Skip to content

Commit 9e48c51

Browse files
AvasamToufool
andauthored
Toggle autoreset image (#162)
* Fix #52 Comparisons with empty masks * Save 'Check For Updates On Open' immediatly * showErrorSignal to show error message box from another thread * Fixes #86 Stop uncaught exceptions from silently crashing the app * Fixes #86 Stop uncaught exceptions from silently crashing the app * Fix #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 #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 (#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 (#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 (#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 (#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 (#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 (#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 (#161) * Doc + Setup update * typings update * Warning if AutoSplit is already open + Build number + Splash Screen * Target the right repository/fork * Fix #155 * Actions shortcut and prevent double open window Closes #154 * ImageHash hotfix * Toggle autoreset image + ui adjustments Co-authored-by: Austin <[email protected]>
1 parent f8e72cc commit 9e48c51

File tree

95 files changed

+10513
-6236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+10513
-6236
lines changed

.flake8

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[flake8]
2+
color=always
3+
max-line-length=120
4+
; Auto generated
5+
exclude=src/gen/, typings/cv2-stubs/__init__.pyi
6+
ignore=
7+
W503, ; Linebreak before binary operator
8+
E402, ; Allow imports at the bottom of file
9+
Y026, ; Not using typing_extensions
10+
SIM105, ; contextlib.suppress is roughly 3x slower than try/except
11+
CCE001, ; False positives for attribute docstrings
12+
per-file-ignores=
13+
; Docstrings in type stubs
14+
; Function bodys contain other than just ... (eg: raise)
15+
; Single quote docstrings
16+
typings/cv2-stubs/__init__.pyi: Q000,E704,E501,N8,A002,A003,CCE002,F401, Y021,Y010,Q002
17+
; Quotes
18+
; Allow ... on same line as def
19+
; Line too long
20+
; Naming conventions can't be controlled for external libraries
21+
; Argument names can't be controlled for external libraries
22+
; attribute names can't be controlled for external libraries
23+
; False positive Class level expression with elipsis
24+
; Type re-exports
25+
*.pyi: Q000,E704,E501,N8,A002,A003,CCE002,F401
26+
; PyQt methods
27+
ignore-names=closeEvent,paintEvent,keyPressEvent,mousePressEvent,mouseMoveEvent,mouseReleaseEvent
28+
; McCabe max-complexity is also taken care of by Pylint and doesn't fail the build there
29+
; So this is the hard limit
30+
max-complexity=32
31+
inline-quotes=double

.github/workflows/codeql-analysis.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [main, master, develop, dev, 2.0.0]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [develop, dev, 2.0.0]
20+
schedule:
21+
- cron: "26 13 * * 6"
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
language: ["python"]
32+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
33+
# Learn more:
34+
# 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
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
39+
40+
# Initializes the CodeQL tools for scanning.
41+
- name: Initialize CodeQL
42+
uses: github/codeql-action/init@v2
43+
with:
44+
languages: ${{ matrix.language }}
45+
# If you wish to specify custom queries, you can do so here or in a config file.
46+
# By default, queries listed here will override any specified in a config file.
47+
# Prefix the list here with "+" to use these queries and those in the config file.
48+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
49+
50+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51+
# If this step fails, then you should remove it and run the build manually (see below)
52+
- name: Autobuild
53+
uses: github/codeql-action/autobuild@v2
54+
55+
# ℹ️ Command-line programs to run using the OS shell.
56+
# 📚 https://git.io/JvXDl
57+
58+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
59+
# and modify them (or add more) to build your code if your project
60+
# uses a compiled language
61+
62+
#- run: |
63+
# make bootstrap
64+
# make release
65+
66+
- name: Perform CodeQL Analysis
67+
uses: github/codeql-action/analyze@v2

.github/workflows/lint-and-build.yml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
2+
name: Lint and build
3+
on:
4+
workflow_dispatch: # Allows manual builds
5+
push:
6+
branches:
7+
- main
8+
- master
9+
paths:
10+
- "**.py"
11+
- "**.pyi"
12+
- "**.ui"
13+
pull_request:
14+
branches:
15+
- main
16+
- master
17+
- dev*
18+
- 2.0.0
19+
paths:
20+
- "**.py"
21+
- "**.pyi"
22+
- "**.ui"
23+
24+
env:
25+
GITHUB_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
26+
27+
jobs:
28+
Pyright:
29+
runs-on: windows-latest
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
python-version: ["3.9", "3.10"]
34+
steps:
35+
- name: Checkout ${{ github.repository }}/${{ github.ref }}
36+
uses: actions/checkout@v3
37+
- name: Set up Node
38+
uses: actions/setup-node@v3
39+
- name: Set up Python ${{ matrix.python-version }}
40+
uses: actions/setup-python@v4
41+
with:
42+
python-version: ${{ matrix.python-version }}
43+
cache: "pip"
44+
cache-dependency-path: "scripts/requirements*.txt"
45+
- run: scripts/install.ps1
46+
shell: pwsh
47+
- name: Analysing the code with Pyright
48+
run: pyright --warnings
49+
Pylint:
50+
runs-on: windows-latest
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
python-version: ["3.9", "3.10"]
55+
steps:
56+
- name: Checkout ${{ github.repository }}/${{ github.ref }}
57+
uses: actions/checkout@v3
58+
- name: Set up Python ${{ matrix.python-version }}
59+
uses: actions/setup-python@v4
60+
with:
61+
python-version: ${{ matrix.python-version }}
62+
cache: "pip"
63+
cache-dependency-path: "scripts/requirements*.txt"
64+
- run: scripts/install.ps1
65+
shell: pwsh
66+
- name: Analysing the code with Pylint
67+
run: pylint --reports=y --output-format=colorized src/
68+
Flake8:
69+
runs-on: windows-latest
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
python-version: ["3.9", "3.10"]
74+
steps:
75+
- name: Checkout ${{ github.repository }}/${{ github.ref }}
76+
uses: actions/checkout@v3
77+
- name: Set up Python ${{ matrix.python-version }}
78+
uses: actions/setup-python@v4
79+
with:
80+
python-version: ${{ matrix.python-version }}
81+
cache: "pip"
82+
cache-dependency-path: "scripts/requirements*.txt"
83+
- run: scripts/install.ps1
84+
shell: pwsh
85+
- name: Analysing the code with Flake8
86+
run: flake8
87+
Bandit:
88+
runs-on: windows-latest
89+
steps:
90+
- name: Checkout ${{ github.repository }}/${{ github.ref }}
91+
uses: actions/checkout@v3
92+
- name: Set up Python 3.10
93+
uses: actions/setup-python@v4
94+
with:
95+
python-version: "3.10"
96+
cache: "pip"
97+
cache-dependency-path: "scripts/requirements*.txt"
98+
- run: scripts/install.ps1
99+
shell: pwsh
100+
- name: Analysing the code with Bandit
101+
run: bandit -n 1 --severity-level medium --recursive src
102+
Build:
103+
runs-on: windows-latest
104+
strategy:
105+
fail-fast: false
106+
matrix:
107+
python-version: ["3.10"]
108+
steps:
109+
- name: Checkout ${{ github.repository }}/${{ github.ref }}
110+
uses: actions/checkout@v3
111+
- name: Set up Python ${{ matrix.python-version }}
112+
uses: actions/setup-python@v4
113+
with:
114+
python-version: ${{ matrix.python-version }}
115+
cache: "pip"
116+
- run: scripts/install.ps1
117+
shell: pwsh
118+
- run: scripts/build.ps1
119+
shell: pwsh
120+
- name: Upload Build Artifact
121+
uses: actions/upload-artifact@v3
122+
with:
123+
name: AutoSplit (Python ${{ matrix.python-version }})
124+
path: dist/AutoSplit*
125+
if-no-files-found: error
126+
- name: Upload Build logs
127+
uses: actions/upload-artifact@v3
128+
with:
129+
name: Build logs (Python ${{ matrix.python-version }})
130+
path: |
131+
build/AutoSplit/*.toc
132+
build/AutoSplit/*.txt
133+
build/AutoSplit/*.html
134+
if-no-files-found: error

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

3+
# Caches
4+
.cache/
5+
36
# Byte-compiled / optimized / DLL files
47
__pycache__/
58

69
# Distribution / packaging
710
env/
811
build/
912
dist/
13+
*.prof
14+
# Generated
15+
**/gen/*.py
16+
!**/gen/*.pyi
1017

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

1724
# Dev settings
1825
*.pkl
26+
settings.toml

.markdownlint.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"default": true,
3+
"MD001": false,
4+
"MD013": false,
5+
"MD025": false
6+
}

.vscode/extensions.json

+31-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
1+
// Keep in alphabetical order
12
{
23
"recommendations": [
3-
"ms-python.vscode-pylance",
4-
"ms-python.python",
5-
"sonarsource.sonarlint-vscode",
4+
"bungcip.better-toml",
65
"davidanson.vscode-markdownlint",
6+
"eamodio.gitlens",
7+
"ms-python.flake8",
8+
"ms-python.python",
9+
"ms-python.vscode-pylance",
10+
"ms-vscode.powershell",
11+
"pkief.material-icon-theme",
12+
"redhat.vscode-yaml",
713
"shardulm94.trailing-spaces",
8-
"eamodio.gitlens"
14+
"sonarsource.sonarlint-vscode"
915
],
1016
"unwantedRecommendations": [
17+
// Must disable in this workspace //
18+
//
19+
// VSCode has implemented an optimized version
20+
"coenraads.bracket-pair-colorizer",
21+
"coenraads.bracket-pair-colorizer-2",
22+
// Lots of conflicts
23+
"esbenp.prettier-vscode",
24+
// Replaced by ESLint
25+
"eg2.tslint",
26+
"ms-vscode.vscode-typescript-tslint-plugin",
27+
// Obsoleted by Pylance
1128
"ms-pyright.pyright",
12-
"esbenp.prettier-vscode"
29+
// Not configurable per workspace, tends to conflict with other linters
30+
// Use eslint-plugin-sonarjs for JS/TS projects
31+
"sonarsource.sonarlint-vscode",
32+
//
33+
// Don't recommend to autoinstall //
34+
//
35+
// This is a Git project
36+
"johnstoncode.svn-scm",
37+
// Prefer using VSCode itself as a text editor
38+
"vscodevim.vim",
1339
]
1440
}

.vscode/launch.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: AutoSplit",
9+
"type": "python",
10+
"request": "launch",
11+
"preLaunchTask": "Compile resources",
12+
"program": "src/AutoSplit.py",
13+
"console": "integratedTerminal",
14+
"justMyCode": true
15+
},
16+
{
17+
"name": "Python: AutoSplit --auto-controlled",
18+
"type": "python",
19+
"request": "launch",
20+
"preLaunchTask": "Compile resources",
21+
"program": "src/AutoSplit.py",
22+
"args": [
23+
"--auto-controlled"
24+
],
25+
"console": "integratedTerminal",
26+
"justMyCode": true
27+
}
28+
]
29+
}

0 commit comments

Comments
 (0)