diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 66f0c27c..3cff918a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [main, master, develop, dev] + branches: [main, dev*] pull_request: # The branches below must be a subset of the branches above - branches: [develop, dev] + branches: [dev*] schedule: - cron: "26 13 * * 6" @@ -39,7 +39,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -50,7 +50,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # â„šī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -64,4 +64,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/lint-and-build.yml b/.github/workflows/lint-and-build.yml index e4776b7b..91d6cbd9 100644 --- a/.github/workflows/lint-and-build.yml +++ b/.github/workflows/lint-and-build.yml @@ -11,7 +11,6 @@ on: push: branches: - main - - master - dev* paths: - "**.py" @@ -21,7 +20,6 @@ on: pull_request: branches: - main - - master - dev* paths: - "**.py" @@ -51,9 +49,10 @@ jobs: echo $Env:RUFF_VERSION echo "RUFF_VERSION=$Env:RUFF_VERSION" >> $Env:GITHUB_OUTPUT shell: pwsh - - uses: astral-sh/ruff-action@v2 + - uses: astral-sh/ruff-action@v3 with: version: ${{ steps.ruff_version.outputs.RUFF_VERSION }} + - run: ruff format --check Pyright: runs-on: ${{ matrix.os }} strategy: diff --git a/.github/workflows/printenv.yml b/.github/workflows/printenv.yml index 14aeb4f3..1b032639 100644 --- a/.github/workflows/printenv.yml +++ b/.github/workflows/printenv.yml @@ -10,7 +10,7 @@ on: type: boolean push: branches: - - master + - main - dev env: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 89aa2a84..db39db1e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: pretty-format-ini args: [--autofix] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.0 # Must match requirements-dev.txt + rev: v0.8.5 # Must match requirements-dev.txt hooks: - id: ruff args: [--fix] diff --git a/README.md b/README.md index 5e8960c5..d5e85359 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Easy to use image comparison based auto splitter for speedrunning on console or This program can be used to automatically start, split, and reset your preferred speedrun timer by comparing images to a capture region. This allows you to focus more on your speedrun and less on managing your timer. It also improves the accuracy of your splits. It can be used in tandem with any speedrun timer that accepts hotkeys (LiveSplit, WSplit, etc.), and can be integrated with LiveSplit.

- Example + ![Example](/docs/2.2.2.gif)

## Tutorial diff --git a/scripts/compile_resources.ps1 b/scripts/compile_resources.ps1 index e2abdb9a..57483dd0 100644 --- a/scripts/compile_resources.ps1 +++ b/scripts/compile_resources.ps1 @@ -19,7 +19,7 @@ Write-Host 'Generated code from .ui files' $build_vars_path = "$PSScriptRoot/../src/gen/build_vars.py" If ($Env:GITHUB_EXCLUDE_BUILD_NUMBER -eq $true -or ( - $Env:GITHUB_EVENT_NAME -eq 'push' -and $Env:GITHUB_REF_NAME -eq 'master') + $Env:GITHUB_EVENT_NAME -eq 'push' -and $Env:GITHUB_REF_NAME -eq 'main') ) { $BUILD_NUMBER = '' } diff --git a/scripts/lint.ps1 b/scripts/lint.ps1 index e5dc4a9c..2049ef13 100644 --- a/scripts/lint.ps1 +++ b/scripts/lint.ps1 @@ -2,9 +2,6 @@ $originalDirectory = $pwd Set-Location "$PSScriptRoot/.." $exitCodes = 0 -Write-Host "`nRunning formatting..." -ruff format - Write-Host "`nRunning Ruff ..." ruff check --fix $exitCodes += $LastExitCode @@ -15,6 +12,9 @@ else { Write-Host "`Ruff passed" -ForegroundColor Green } +Write-Host "`nRunning formatting..." +ruff format + $pyrightVersion = 'latest' # Change this if latest has issues Write-Host "`nRunning Pyright $pyrightVersion ..." $Env:PYRIGHT_PYTHON_FORCE_VERSION = $pyrightVersion diff --git a/scripts/requirements-dev.txt b/scripts/requirements-dev.txt index 1bdb9648..51cec95d 100644 --- a/scripts/requirements-dev.txt +++ b/scripts/requirements-dev.txt @@ -12,7 +12,7 @@ -r requirements.txt # # Linters & Formatters -ruff>=0.8.0 +ruff>=0.8.5 # # Types scipy-stubs>=1.14.1.1 diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 64b1ab52..fc0d1726 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -12,7 +12,7 @@ psutil>=6.0.0 # Python 3.13 support # PyAutoGUI # See install.ps1 PyWinCtl>=0.0.42 # py.typed # When needed, dev builds can be found at https://download.qt.io/snapshots/ci/pyside/dev?C=M;O=D -PySide6-Essentials<6.8.1 # Has typing issue with QMessageBox.warning https://bugreports.qt.io/browse/PYSIDE-2939 +PySide6-Essentials>=6.8.2 # Fixed typing issue with QMessageBox.warning scipy>=1.14.1 # Python 3.13 support tomli-w>=1.1.0 # Typing fixes typing-extensions>=4.4.0 # @override decorator support diff --git a/src/AutoSplit.py b/src/AutoSplit.py index 3e315ac3..e87fd4ee 100644 --- a/src/AutoSplit.py +++ b/src/AutoSplit.py @@ -658,7 +658,7 @@ def __auto_splitter(self): # noqa: C901,PLR0912,PLR0915 while self.split_image_number < number_of_split_images: # Check if we are not waiting for the split delay to send the key press if self.waiting_for_split_delay: - time_millis = int(round(time() * ONE_SECOND)) + time_millis = round(time() * ONE_SECOND) if time_millis < split_time: QApplication.processEvents() continue diff --git a/src/d3d11.py b/src/d3d11.py index e9e4c5bb..b27b5295 100644 --- a/src/d3d11.py +++ b/src/d3d11.py @@ -44,8 +44,8 @@ def query_interface(self, iid: uuid.UUID | str) -> "IUnknown": iid = uuid.UUID(iid) ppv = wintypes.LPVOID() - _iid = GUID.from_buffer_copy(iid.bytes_le) - ret = self.QueryInterface(self, ctypes.byref(_iid), ctypes.byref(ppv)) + riid = GUID.from_buffer_copy(iid.bytes_le) + ret = self.QueryInterface(self, ctypes.byref(riid), ctypes.byref(ppv)) if ret: raise ctypes.WinError(ret) diff --git a/src/hotkeys.py b/src/hotkeys.py index 8280a57c..5f17f32b 100644 --- a/src/hotkeys.py +++ b/src/hotkeys.py @@ -104,7 +104,7 @@ def send_command(autosplit: "AutoSplit", command: CommandStr): _send_hotkey(autosplit.settings_dict["skip_split_hotkey"]) case "undo": _send_hotkey(autosplit.settings_dict["undo_split_hotkey"]) - case _: # pyright: ignore[reportUnnecessaryComparison] + case _: raise KeyError(f"{command!r} is not a valid command") diff --git a/src/menu_bar.py b/src/menu_bar.py index 0b9246f3..27d0d7fb 100644 --- a/src/menu_bar.py +++ b/src/menu_bar.py @@ -116,7 +116,7 @@ def open_update_checker(autosplit: "AutoSplit", latest_version: str, *, check_on def view_help(): - webbrowser.open(f"https://github.com/{GITHUB_REPOSITORY}/blob/master/docs/tutorial.md") + webbrowser.open(f"https://github.com/{GITHUB_REPOSITORY}/blob/main/docs/tutorial.md") class __CheckForUpdatesThread(QtCore.QThread): # noqa: N801 # Private class @@ -354,17 +354,17 @@ def __setup_bindings(self): ) # Debug screenshot selection checkboxes initial values and bindings - _screenshot_on_setting = self._autosplit_ref.settings_dict["screenshot_on"] + screenshot_on_setting = self._autosplit_ref.settings_dict["screenshot_on"] for command in _DEBUG_SCREENSHOT_COMMANDS: checkbox: QtWidgets.QCheckBox = getattr(self, f"screenshot_on_{command}_checkbox") - checkbox.setChecked(command in _screenshot_on_setting) + checkbox.setChecked(command in screenshot_on_setting) def add_or_del(checked: Literal[0, 2], command: CommandStr = command): if checked: - _screenshot_on_setting.append(command) + screenshot_on_setting.append(command) else: - _screenshot_on_setting.remove(command) + screenshot_on_setting.remove(command) checkbox.stateChanged.connect(add_or_del) diff --git a/src/utils.py b/src/utils.py index 38a66921..3fd57e47 100644 --- a/src/utils.py +++ b/src/utils.py @@ -314,5 +314,5 @@ def run_tesseract(png: bytes): # Shared strings # Check `excludeBuildNumber` during workflow dispatch build generate a clean version number -AUTOSPLIT_VERSION = "2.2.2" + (f"-{AUTOSPLIT_BUILD_NUMBER}" if AUTOSPLIT_BUILD_NUMBER else "") +AUTOSPLIT_VERSION = "2.3" + (f"-{AUTOSPLIT_BUILD_NUMBER}" if AUTOSPLIT_BUILD_NUMBER else "") GITHUB_REPOSITORY = AUTOSPLIT_GITHUB_REPOSITORY