Skip to content
This repository was archived by the owner on Apr 26, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .editorconfig
100644 → 100755
Empty file.
Empty file modified .flake8
100644 → 100755
Empty file.
Empty file modified .github/workflows/codeql-analysis.yml
100644 → 100755
Empty file.
69 changes: 52 additions & 17 deletions .github/workflows/lint-and-build.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ on:
- '**.ui'
jobs:
Pyright:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
os: [windows-latest, ubuntu-latest]
include:
- os: windows-latest
requirements: requirements-dev-win
- os: ubuntu-latest
requirements: requirements-dev
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -37,22 +43,29 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'scripts/requirements-dev.txt'
cache-dependency-path: 'scripts/requirements*.txt'
- run: pip install wheel --upgrade
- name: Install dependencies
run: |
pip install -r "scripts/requirements-dev.txt"
pip install -r "scripts/${{ matrix.requirements }}.txt"
npm install -g pyright
npm list -g pyright
- run: scripts/compile_resources.ps1
shell: pwsh
- name: Analysing the code with Pyright
run: pyright --warnings
Pylint:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
os: [windows-latest, ubuntu-latest]
include:
- os: windows-latest
requirements: requirements-dev-win
- os: ubuntu-latest
requirements: requirements-dev
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -61,19 +74,26 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'scripts/requirements-dev.txt'
cache-dependency-path: 'scripts/requirements*.txt'
- run: pip install wheel --upgrade
- name: Install dependencies
run: pip install -r "scripts/requirements-dev.txt"
run: pip install -r "scripts/${{ matrix.requirements }}.txt"
- run: scripts/compile_resources.ps1
shell: pwsh
- name: Analysing the code with Pylint
run: pylint --reports=y --output-format=colorized src/
Flake8:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
os: [windows-latest, ubuntu-latest]
include:
- os: windows-latest
requirements: requirements-dev-win
- os: ubuntu-latest
requirements: requirements-dev
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -82,19 +102,26 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'scripts/requirements-dev.txt'
cache-dependency-path: 'scripts/requirements*.txt'
- run: pip install wheel --upgrade
- name: Install dependencies
run: pip install -r "scripts/requirements-dev.txt"
run: pip install -r "scripts/${{ matrix.requirements }}.txt"
- run: scripts/compile_resources.ps1
shell: pwsh
- name: Analysing the code with Flake8
run: flake8
Bandit:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
os: [windows-latest, ubuntu-latest]
include:
- os: windows-latest
requirements: requirements-dev-win
- os: ubuntu-latest
requirements: requirements-dev
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -103,19 +130,26 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'scripts/requirements-dev.txt'
cache-dependency-path: 'scripts/requirements*.txt'
- run: pip install wheel --upgrade
- name: Install dependencies
run: pip install -r "scripts/requirements-dev.txt"
run: pip install -r "scripts/${{ matrix.requirements }}.txt"
- run: scripts/compile_resources.ps1
shell: pwsh
- name: Analysing the code with Bandit
run: bandit -n 1 --severity-level medium --recursive src
Build:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
python-version: ["3.10"]
os: [windows-latest, ubuntu-latest]
include:
- os: windows-latest
requirements: requirements-win
- os: ubuntu-latest
requirements: requirements
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand All @@ -126,10 +160,11 @@ jobs:
cache: 'pip'
- run: pip install wheel --upgrade
- name: Install dependencies
run: pip install -r "scripts/requirements.txt"
run: pip install -r "scripts/${{ matrix.requirements }}.txt"
- run: scripts/build.ps1
shell: pwsh
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: AutoSplit (Python ${{ matrix.python-version }})
path: dist/AutoSplit.exe
name: AutoSplit for ${{ matrix.os }} (Python ${{ matrix.python-version }})
path: dist/AutoSplit.*
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .markdownlint.json
100644 → 100755
Empty file.
Empty file modified .vscode/extensions.json
100644 → 100755
Empty file.
Empty file modified .vscode/launch.json
100644 → 100755
Empty file.
Empty file modified .vscode/settings.json
100644 → 100755
Empty file.
Empty file modified .vscode/tasks.json
100644 → 100755
Empty file.
Empty file modified PyInstaller/hooks/hook-cv2.py
100644 → 100755
Empty file.
Empty file modified PyInstaller/hooks/hook-requests.py
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ The AutoSplit LiveSplit Component will directly connect AutoSplit with LiveSplit
- Place the .dll file into your `[...]\LiveSplit\Components` folder.
- Open LiveSplit -> Right Click -> Edit Layout -> Plus Button -> Control -> AutoSplit Integration.
- Click Layout Settings -> AutoSplit Integration
- Click the Browse buttons to locate your AutoSplit Path (path to AutoSplit.exe) and Profile Path (path to your AutoSplit `.toml` profile file) respectively.
- Click the Browse buttons to locate your AutoSplit Path (path to AutoSplit executable) and Profile Path (path to your AutoSplit `.toml` profile file) respectively.
- If you have not yet set saved a profile, you can do so using AutoSplit, and then go back and set your Settings Path.
- Once set, click OK, and then OK again to close the Layout Editor. Right click LiveSplit -> Save Layout to save your layout. AutoSplit and your selected profile will now open automatically when opening that LiveSplit Layout `.lsl` file.

Expand Down
Empty file modified SECURITY.md
100644 → 100755
Empty file.
12 changes: 6 additions & 6 deletions pyproject.toml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ aggressive = 3

# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file
[tool.pyright]
pythonPlatform = "Windows"
typeCheckingMode = "strict"
# Extra strict
reportImplicitStringConcatenation="error"
Expand Down Expand Up @@ -113,16 +112,17 @@ disable = [
# No need to mention the fixmes
"fixme",
"missing-docstring",
# We group imports
"wrong-import-position",
# Already taken care of and grayed out. Also conflicts with Pylance reportIncompatibleMethodOverride
"unused-argument",
# Already taken care of by Flake8
# Already taken care of by Flake8 and isort
"ungrouped-imports",
"unused-import",
# Similar lines in 2 files, doesn't really work
"R0801",
"wrong-import-order",
"wrong-import-position",
# Doesn't work with local imports
"import-error",
# Similar lines in 2 files, doesn't really work
"R0801",
# False positives with PyQt .connect
"no-value-for-parameter",
# Not as long as we support Python 3.9
Expand Down
Empty file modified res/about.ui
100644 → 100755
Empty file.
Empty file modified res/btn_donateCC_LG.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions res/design.ui
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@
<rect>
<x>449</x>
<y>344</y>
<width>101</width>
<width>102</width>
<height>16</height>
</rect>
</property>
Expand All @@ -821,7 +821,7 @@
<widget class="QLabel" name="start_image_status_value_label">
<property name="geometry">
<rect>
<x>560</x>
<x>554</x>
<y>344</y>
<width>98</width>
<height>16</height>
Expand Down
Empty file modified res/example1.6.0.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/icon.ico
100644 → 100755
Empty file.
Empty file modified res/mask_example_image.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/resources.qrc
100644 → 100755
Empty file.
Empty file modified res/settings.ui
100644 → 100755
Empty file.
Empty file modified res/splash.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified res/update_checker.ui
100644 → 100755
Empty file.
7 changes: 6 additions & 1 deletion scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ If ($IsLinux) {
}

python -m pip install wheel --upgrade
python -m pip install -r "$PSScriptRoot/requirements-dev.txt"
If ($IsWindows) {
python -m pip install -r "$PSScriptRoot/requirements-dev-win.txt"
}
Else {
python -m pip install -r "$PSScriptRoot/requirements-dev.txt"
}
& "$PSScriptRoot/compile_resources.ps1"
npm install -g pyright@latest
npm list -g pyright
11 changes: 11 additions & 0 deletions scripts/requirements-dev-win.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Usage: .\scripts\install.bat
#
# If you're having issues with the libraries, you might want to first run:
# pip uninstall -y -r .\scripts\requirements-dev-win.txt
#
# Dependencies
-r requirements-dev.txt
-r requirements-win.txt
#
# Windows-only type-stubs
git+https://github.com/Avasam/pywin32-stubs.git#egg=pywin32-stubs # https://github.com/kaluluosi/pywin32-stubs/pull/8
6 changes: 5 additions & 1 deletion scripts/requirements-dev.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Usage: .\scripts\install.bat
#
# If you're having issues with the libraries, you might want to first run:
# pip uninstall -y -r .\scripts\requirements-dev.txt
#
# Dependencies
-r requirements.txt
#
Expand All @@ -9,7 +14,6 @@ flake8-pyi
flake8-quotes
flake8-isort
pylint>=2.13.9
git+https://github.com/Avasam/pywin32-stubs.git#egg=pywin32-stubs # https://github.com/kaluluosi/pywin32-stubs/pull/8
types-requests
#
# You can comment this out if you don't want to run `designer.bat` to quickly open the bundled PyQt Designer.
Expand Down
11 changes: 11 additions & 0 deletions scripts/requirements-win.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Usage: .\scripts\install.bat
#
# If you're having issues with the libraries, you might want to first run:
# pip uninstall -y -r .\scripts\requirements-dev-win.txt
#
# Dependencies
-r requirements.txt
# Windows-only dependencies:
pygrabber
winsdk>=v1.0.0b4
git+https://github.com/ranchen421/D3DShot.git#egg=D3DShot # https://github.com/SerpentAI/D3DShot/issues/44
14 changes: 6 additions & 8 deletions scripts/requirements.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
# If you're having issues with the libraries, you might want to first run:
# pip uninstall -y -r ./scripts/requirements-dev.txt
#
# Creating AutoSplit.exe with PyInstaller: ./scripts/build.ps1
# Creating AutoSplit executable with PyInstaller: ./scripts/build.ps1
#
# Dependencies:
numpy>=1.22.0rc1,<1.23 # Type issue
opencv-python-headless>=4.5.4,<4.6 # https://github.com/pyinstaller/pyinstaller/issues/6889
PyQt6>=6.2.1
PySide6
ImageHash
keyboard
packaging
Expand All @@ -23,12 +22,11 @@ requests
certifi
toml
psutil
pygrabber
typing-extensions
# Windows-only
pywin32>=301
winsdk>=v1.0.0b4
git+https://github.com/ranchen421/D3DShot.git#egg=D3DShot # https://github.com/SerpentAI/D3DShot/issues/44
# Linux-only dependencies
PyWinCtl
xlib
#
# Build
# Build and compile resources
PyInstaller
PySide6
Empty file modified src/AutoControlledWorker.py
100644 → 100755
Empty file.
20 changes: 16 additions & 4 deletions src/AutoSplit.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from split_parser import BELOW_FLAG, DUMMY_FLAG, PAUSE_FLAG, parse_and_validate_images
from user_profile import DEFAULT_PROFILE
from utils import (AUTOSPLIT_VERSION, FIRST_WIN_11_BUILD, FROZEN, START_AUTO_SPLITTER_TEXT, WINDOWS_BUILD_NUMBER,
auto_split_directory, decimal, is_valid_image)
auto_split_directory, decimal, is_valid_image, open_file)

CHECK_FPS_ITERATIONS = 10

Expand All @@ -41,7 +41,8 @@

class AutoSplit(QMainWindow, design.Ui_MainWindow):
myappid = f"Toufool.AutoSplit.v{AUTOSPLIT_VERSION}"
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
if sys.platform == "win32":
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

# Parse command line args
is_auto_controlled = "--auto-controlled" in sys.argv
Expand Down Expand Up @@ -123,6 +124,16 @@ def __init__(self, parent: Optional[QWidget] = None): # pylint: disable=too-man
self.y_spinbox.setFrame(False)
self.width_spinbox.setFrame(False)
self.height_spinbox.setFrame(False)
# HACK: Spinboxes are too small on Linux and only fit 3 numbers
# We should make the spinboxes larger instead to accomodate all platforms
# But we're currently lacking the space
if sys.platform == "linux":
font = self.x_spinbox.font()
font.setPointSize(7)
self.x_spinbox.setFont(font)
self.y_spinbox.setFont(font)
self.width_spinbox.setFont(font)
self.height_spinbox.setFont(font)

# Get default values defined in SettingsDialog
self.settings_dict = get_default_settings_from_ui(self)
Expand Down Expand Up @@ -379,9 +390,9 @@ def __take_screenshot(self):
error_messages.region()
return

# save and open image
# Save and open image
cv2.imwrite(screenshot_path, capture)
os.startfile(screenshot_path) # nosec
open_file(screenshot_path)

def __check_fps(self):
self.fps_value_label.setText("...")
Expand Down Expand Up @@ -824,6 +835,7 @@ def closeEvent(self, a0: Optional[QtGui.QCloseEvent] = None):
def exit_program():
if self.update_auto_control:
self.update_auto_control.terminate()
self.capture_method.close(self)
if a0 is not None:
a0.accept()
if self.is_auto_controlled:
Expand Down
3 changes: 1 addition & 2 deletions src/AutoSplitImage.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

import cv2
import numpy as np
from win32con import MAXBYTE

import error_messages
from compare import check_if_image_has_transparency, compare_histograms, compare_l2_norm, compare_phash
from utils import is_valid_image
from utils import MAXBYTE, is_valid_image

if TYPE_CHECKING:
from AutoSplit import AutoSplit
Expand Down
Loading