Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Commit

Permalink
Toggle autoreset image (Toufool#162)
Browse files Browse the repository at this point in the history
* Fix #52 Comparisons with empty masks

* Save 'Check For Updates On Open' immediatly

* showErrorSignal to show error message box from another thread

* Fixes Toufool#86 Stop uncaught exceptions from silently crashing the app

* Fixes Toufool#86 Stop uncaught exceptions from silently crashing the app

* Fix Toufool#114, try to load Start Image on browse & load settings, don't allow a start image to load if hotkeys are not set.

* First linting pass
Configured VSCode and Markdownlint settings
Added and configured the following linters as strict as I could: pylint, flake8, mypy, bandit, pyright
Partially filled in some type stubs: cv2, imagehash, keyboard, pyautogui, pythonwin, win32helper
[Breaking change] Using interpolation=cv2.INTER_NEAREST everywhere as it is the fastest interlpolation method
Hide generated/compiled files
SelectRegionWidget width and height as functions
Added validate_images_before_parsing() to validate images both before maxFPS and starting autosplitter

* Moved most settings to pyproject.toml and ran autopep8

* Removed mypy and Fixed import-outside-toplevel

* Double quotes and pylint complete linting

* Configured linting workflow

* Async check for updates

* Fix crash on LiveSplit open and missing link in error message

* Merge

* Fixed certificate error and random crash on open when compiled

* Using python/typeshed/pull/6492

* PEP8 naming convention

* Added build artifact

* AutoSplitImage Class and simplified code
Simplified and reduced image conversions
Reduced duplicated code, especially in settings
Build Artifact

* Average FPS over all images with all actions

* Added badges

* Fixed "Select Window" not working for windows with negative coordinates
Split screen_region in smaller functions
WIP towards Toufool#94:
No pop-up on loading settings with no capture window
 Don't stop/reset AutoSplit upon loosing capture window
 No pop-up on loosing capture window
 Don't allow selecting desktop.

* Ability to recover window

Fixed regressions:
Fix crash on clising window mid-run
Forgot to migrate split_delay to image.delay
Removed dead load_pyqt_settings code
Fixed dummy groups
Pause time from filename not set correctly
Setting hotkeys on load

* Differentiate "undo/skip split" from "previous/next image"
Skip/udo will now actually call command
This makes grouping option obsolete as user now has finer control anyway
UI is a bit cramped, but that should be resolved with UI revamp
Updated README

* Make Save Settings more intuitive
Don't close if user has cancelled "saving sattings as"
Removed more attributes from AutoSplit class
Don't update last_successfully_loaded_settings_file_path if load was not successful
"Save Settings As" defaults to the last_successfully_loaded_settings_file_path THEN the .exe
When closing app, ue save_settings instead of save_settings_as

* Initial UI update for 2.0.0. Add settings window.

* Hooked new settings window to actual values (Toufool#151)

* Initial UI update for 2.0.0. Add settings window.

* hooked new settings window to actual values

* Better "seconds remaining" text

* Undo split goes to the end of the group

Co-authored-by: Austin <[email protected]>

* Image comparison method and default delay time (Toufool#135)

* hooked new settings window to actual values

* Implemented image specific comparison method and default delay time.
Closes #26

* Initial UI update for 2.0.0. Add settings window.

* hooked new settings window to actual values

* Better "seconds remaining" text

* Undo split goes to the end of the group

* Fixed images comparison method defaulting to 0 rather than none

Co-authored-by: Austin <[email protected]>

* Support hotkeys with modifiers (Toufool#136)

* hooked new settings window to actual values

* Better "seconds remaining" text

* Support modifiers the same way LiveSplit does. Closes #34

* Initial UI update for 2.0.0. Add settings window.

* hooked new settings window to actual values

* Better "seconds remaining" text

* Undo split goes to the end of the group

Co-authored-by: Austin <[email protected]>

* Linted pyi files (Toufool#137)

* hooked new settings window to actual values

* Linted pyi files

* Initial UI update for 2.0.0. Add settings window.

* hooked new settings window to actual values

* Better "seconds remaining" text

* Undo split goes to the end of the group

* Turn off pyright(reportFunctionMemberAccess) in favor of pylint(no-member)

* Massively sped up Flake tests
Removed 400+kb of type stubs

* Centralized qWait typing fix

* Autosort imports

* Resynced settings

Co-authored-by: Austin <[email protected]>

* Toml profiles + Python 3.10 (Toufool#140)

* Typings update

* Full setup and configuration update

* User Profile, Revamped settings, Start image fixes & __auto_splitter method refactor

* Added new Capture Method system for more capture options + utils (Toufool#141)

* Add D3DShot types
from python/typeshed#8652

* New Capture Method system

* Warning if AutoSplit is already open + Build number + Splash Screen + Doc update + Fixes (Toufool#161)

* Doc + Setup update

* typings update

* Warning if AutoSplit is already open + Build number + Splash Screen

* Target the right repository/fork

* Fix Toufool#155

* Actions shortcut and prevent double open window
Closes Toufool#154

* ImageHash hotfix

* Toggle autoreset image + ui adjustments

Co-authored-by: Austin <[email protected]>
  • Loading branch information
Avasam and Toufool authored Sep 4, 2022
1 parent f8e72cc commit 9e48c51
Show file tree
Hide file tree
Showing 95 changed files with 10,513 additions and 6,236 deletions.
31 changes: 31 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[flake8]
color=always
max-line-length=120
; Auto generated
exclude=src/gen/, typings/cv2-stubs/__init__.pyi
ignore=
W503, ; Linebreak before binary operator
E402, ; Allow imports at the bottom of file
Y026, ; Not using typing_extensions
SIM105, ; contextlib.suppress is roughly 3x slower than try/except
CCE001, ; False positives for attribute docstrings
per-file-ignores=
; Docstrings in type stubs
; Function bodys contain other than just ... (eg: raise)
; Single quote docstrings
typings/cv2-stubs/__init__.pyi: Q000,E704,E501,N8,A002,A003,CCE002,F401, Y021,Y010,Q002
; Quotes
; Allow ... on same line as def
; Line too long
; Naming conventions can't be controlled for external libraries
; Argument names can't be controlled for external libraries
; attribute names can't be controlled for external libraries
; False positive Class level expression with elipsis
; Type re-exports
*.pyi: Q000,E704,E501,N8,A002,A003,CCE002,F401
; PyQt methods
ignore-names=closeEvent,paintEvent,keyPressEvent,mousePressEvent,mouseMoveEvent,mouseReleaseEvent
; McCabe max-complexity is also taken care of by Pylint and doesn't fail the build there
; So this is the hard limit
max-complexity=32
inline-quotes=double
67 changes: 67 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [main, master, develop, dev, 2.0.0]
pull_request:
# The branches below must be a subset of the branches above
branches: [develop, dev, 2.0.0]
schedule:
- cron: "26 13 * * 6"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: ["python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# 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

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
134 changes: 134 additions & 0 deletions .github/workflows/lint-and-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
name: Lint and build
on:
workflow_dispatch: # Allows manual builds
push:
branches:
- main
- master
paths:
- "**.py"
- "**.pyi"
- "**.ui"
pull_request:
branches:
- main
- master
- dev*
- 2.0.0
paths:
- "**.py"
- "**.pyi"
- "**.ui"

env:
GITHUB_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}

jobs:
Pyright:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- run: scripts/install.ps1
shell: pwsh
- name: Analysing the code with Pyright
run: pyright --warnings
Pylint:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- run: scripts/install.ps1
shell: pwsh
- name: Analysing the code with Pylint
run: pylint --reports=y --output-format=colorized src/
Flake8:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- run: scripts/install.ps1
shell: pwsh
- name: Analysing the code with Flake8
run: flake8
Bandit:
runs-on: windows-latest
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- run: scripts/install.ps1
shell: pwsh
- name: Analysing the code with Bandit
run: bandit -n 1 --severity-level medium --recursive src
Build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- run: scripts/install.ps1
shell: pwsh
- 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*
if-no-files-found: error
- name: Upload Build logs
uses: actions/upload-artifact@v3
with:
name: Build logs (Python ${{ matrix.python-version }})
path: |
build/AutoSplit/*.toc
build/AutoSplit/*.txt
build/AutoSplit/*.html
if-no-files-found: error
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# Caches
.cache/

# Byte-compiled / optimized / DLL files
__pycache__/

# Distribution / packaging
env/
build/
dist/
*.prof
# Generated
**/gen/*.py
!**/gen/*.pyi

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -16,3 +23,4 @@ dist/

# Dev settings
*.pkl
settings.toml
6 changes: 6 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"default": true,
"MD001": false,
"MD013": false,
"MD025": false
}
36 changes: 31 additions & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
// Keep in alphabetical order
{
"recommendations": [
"ms-python.vscode-pylance",
"ms-python.python",
"sonarsource.sonarlint-vscode",
"bungcip.better-toml",
"davidanson.vscode-markdownlint",
"eamodio.gitlens",
"ms-python.flake8",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.powershell",
"pkief.material-icon-theme",
"redhat.vscode-yaml",
"shardulm94.trailing-spaces",
"eamodio.gitlens"
"sonarsource.sonarlint-vscode"
],
"unwantedRecommendations": [
// Must disable in this workspace //
//
// VSCode has implemented an optimized version
"coenraads.bracket-pair-colorizer",
"coenraads.bracket-pair-colorizer-2",
// Lots of conflicts
"esbenp.prettier-vscode",
// Replaced by ESLint
"eg2.tslint",
"ms-vscode.vscode-typescript-tslint-plugin",
// Obsoleted by Pylance
"ms-pyright.pyright",
"esbenp.prettier-vscode"
// Not configurable per workspace, tends to conflict with other linters
// Use eslint-plugin-sonarjs for JS/TS projects
"sonarsource.sonarlint-vscode",
//
// Don't recommend to autoinstall //
//
// This is a Git project
"johnstoncode.svn-scm",
// Prefer using VSCode itself as a text editor
"vscodevim.vim",
]
}
29 changes: 29 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: AutoSplit",
"type": "python",
"request": "launch",
"preLaunchTask": "Compile resources",
"program": "src/AutoSplit.py",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Python: AutoSplit --auto-controlled",
"type": "python",
"request": "launch",
"preLaunchTask": "Compile resources",
"program": "src/AutoSplit.py",
"args": [
"--auto-controlled"
],
"console": "integratedTerminal",
"justMyCode": true
}
]
}
Loading

0 comments on commit 9e48c51

Please sign in to comment.