Skip to content

Commit

Permalink
Fix DPI warnings and update upstream issues list
Browse files Browse the repository at this point in the history
asweigart/pyautogui#663

Better patch for pyautogui DPI
  • Loading branch information
Avasam committed Jun 23, 2023
1 parent 22fc606 commit 4624164
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# Workaround for https://github.com/adamchainz/pre-commit-dprint/issues/4
- id: pretty-format-json
exclude: ".vscode/.*|dprint.json" # Exclude jsonc
exclude: ".vscode/.*" # Exclude jsonc
args: [--autofix, --no-sort-keys]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,18 @@ Not a developer? You can still help through the following methods:
- [Upvoting feature requests](../../issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3Aenhancement) you are interested in
- Sharing AutoSplit with other speedrunners
- Upvoting the following upstream issues in libraries and tools we use:
- <https://github.com/opencv/opencv/issues/23539>
- <https://github.com/opencv/opencv/issues/14590>
- <https://github.com/opencv/opencv/pull/20370>
- <https://github.com/opencv/opencv/issues/23537>
- <https://github.com/opencv/opencv/issues/23158>
- <https://bugreports.qt.io/browse/QTBUG-114436>
- <https://github.com/astral-sh/ruff/issues?q=is%3Aopen+involves%3AAvasam>
- <https://github.com/opencv/opencv/issues/created_by/Avasam>
- <https://github.com/opencv/opencv/issues?q=is%3Aopen+involves%3AAvasam>
- <https://github.com/pywinrt/python-winsdk/issues/11>
- <https://github.com/adamchainz/pre-commit-dprint/issues/4>
- <https://github.com/microsoft/vscode/issues/40239>
- <https://github.com/microsoft/vscode/issues/168411>
- <https://github.com/boppreh/keyboard/issues/171>
- <https://github.com/boppreh/keyboard/issues/516>
- <https://github.com/boppreh/keyboard/issues/216>
- <https://github.com/boppreh/keyboard/issues/161>
- <https://github.com/asweigart/pyautogui/issues/663>

## Credits

Expand Down
11 changes: 11 additions & 0 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ $dev = If ($Env:GITHUB_JOB -eq 'Build') { '' } Else { '-dev' }
python -m pip install wheel pip setuptools --upgrade
pip install -r "$PSScriptRoot/requirements$dev.txt" --upgrade

# Patch libraries so we don't have to install from git

# Prevent pyautogui from setting Process DPI Awareness, which Qt tries to do then throws warnings about it.
# The unittest workaround significantly increases build time, boot time and build size with PyInstaller.
# https://github.com/asweigart/pyautogui/issues/663#issuecomment-1296719464
$pyautoguiPath = python -c 'import pyautogui as _; print(_.__path__[0])'
(Get-Content "$pyautoguiPath/_pyautogui_win.py").replace('ctypes.windll.user32.SetProcessDPIAware()', 'pass') |
Set-Content "$pyautoguiPath/_pyautogui_win.py"
python -m pip uninstall pyscreeze mouseinfo pyperclip -y


# Don't compile resources on the Build CI job as it'll do so in build script
If ($dev) {
& "$PSScriptRoot/compile_resources.ps1"
Expand Down
2 changes: 0 additions & 2 deletions src/AutoSplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
os.environ["REQUESTS_CA_BUNDLE"] = certifi.where()
myappid = f"Toufool.AutoSplit.v{AUTOSPLIT_VERSION}"
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
# qt.qpa.window: SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) failed: COM error 0x5: Access is denied. # noqa: E501
# ctypes.windll.user32.SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)


class AutoSplit(QMainWindow, design.Ui_MainWindow):
Expand Down

0 comments on commit 4624164

Please sign in to comment.