diff --git a/src/AutoSplit.py b/src/AutoSplit.py index a1d45ec8..a2f5f0e8 100644 --- a/src/AutoSplit.py +++ b/src/AutoSplit.py @@ -33,6 +33,7 @@ import cv2 from cv2.typing import MatLike +from gen import about, design, settings, update_checker from psutil import process_iter from PySide6 import QtCore, QtGui from PySide6.QtTest import QTest @@ -44,7 +45,6 @@ from AutoControlledThread import AutoControlledThread from AutoSplitImage import START_KEYWORD, AutoSplitImage, ImageType from capture_method import CaptureMethodBase, CaptureMethodEnum -from gen import about, design, settings, update_checker from hotkeys import ( HOTKEYS, KEYBOARD_GROUPS_ISSUE, diff --git a/src/hotkeys.py b/src/hotkeys.py index 4625bfa2..cac121e6 100644 --- a/src/hotkeys.py +++ b/src/hotkeys.py @@ -30,8 +30,10 @@ PRESS_A_KEY_TEXT = "Press a key..." Commands = Literal["split", "start", "pause", "reset", "skip", "undo"] -Hotkey = Literal["split", "reset", "skip_split", "undo_split", - "pause", "screenshot", "toggle_auto_reset_image"] +Hotkey = Literal[ + "split", "reset", "skip_split", "undo_split", + "pause", "screenshot", "toggle_auto_reset_image", +] HOTKEYS = ( "split", "reset", @@ -39,7 +41,8 @@ "undo_split", "pause", "screenshot", - "toggle_auto_reset_image") + "toggle_auto_reset_image", +) HOTKEYS_WHEN_AUTOCONTROLLED = {"screenshot", "toggle_auto_reset_image"} @@ -165,15 +168,18 @@ def __validate_keypad(expected_key: str, keyboard_event: keyboard.KeyboardEvent) return not is_digit(expected_key[-1]) -def _hotkey_action(keyboard_event: keyboard.KeyboardEvent, - key_name: str, action: Callable[[], None]): +def _hotkey_action( + keyboard_event: keyboard.KeyboardEvent, + key_name: str, action: Callable[[], None], +): """ We're doing the check here instead of saving the key code because the non-keypad shared keys are localized while the keypad ones aren't. They also share scan codes on Windows. """ if keyboard_event.event_type == keyboard.KEY_DOWN and __validate_keypad( - key_name, keyboard_event): + key_name, keyboard_event, + ): action() @@ -305,7 +311,8 @@ def read_and_set_hotkey(): if hotkey_name == "esc": _unhook(getattr(autosplit, f"{hotkey}_hotkey")) autosplit.settings_dict[f"{hotkey}_hotkey"] = ( # pyright: ignore[reportGeneralTypeIssues] - "") + "" + ) if autosplit.SettingsWidget: getattr(autosplit.SettingsWidget, f"{hotkey}_input").setText("") return @@ -346,7 +353,8 @@ def read_and_set_hotkey(): if autosplit.SettingsWidget: getattr(autosplit.SettingsWidget, f"{hotkey}_input").setText(hotkey_name) autosplit.settings_dict[f"{hotkey}_hotkey"] = ( # pyright: ignore[reportGeneralTypeIssues] - hotkey_name) + hotkey_name + ) except Exception as exception: # noqa: BLE001 # We really want to catch everything here error = exception autosplit.show_error_signal.emit(lambda: error_messages.exception_traceback(error)) diff --git a/src/menu_bar.py b/src/menu_bar.py index 9c29f9ba..f31eb1e1 100644 --- a/src/menu_bar.py +++ b/src/menu_bar.py @@ -6,6 +6,7 @@ from urllib.error import URLError from urllib.request import urlopen +from gen import about, design, settings as settings_ui, update_checker from packaging.version import parse as version_parse from PySide6 import QtCore, QtWidgets from PySide6.QtCore import Qt @@ -22,7 +23,6 @@ change_capture_method, get_all_video_capture_devices, ) -from gen import about, design, settings as settings_ui, update_checker from hotkeys import HOTKEYS, HOTKEYS_WHEN_AUTOCONTROLLED, set_hotkey from utils import AUTOSPLIT_VERSION, GITHUB_REPOSITORY, ONE_SECOND, decimal, fire_and_forget diff --git a/src/user_profile.py b/src/user_profile.py index 62d070d9..8b5dfeb1 100644 --- a/src/user_profile.py +++ b/src/user_profile.py @@ -3,12 +3,12 @@ from typing import TYPE_CHECKING, TypedDict, cast import toml +from gen import design from PySide6 import QtCore, QtWidgets from typing_extensions import deprecated, override import error_messages from capture_method import CAPTURE_METHODS, CaptureMethodEnum, Region, change_capture_method -from gen import design from hotkeys import HOTKEYS, Hotkey, remove_all_hotkeys, set_hotkey from menu_bar import open_settings from utils import auto_split_directory diff --git a/src/utils.py b/src/utils.py index 2308996c..de7d0c34 100644 --- a/src/utils.py +++ b/src/utils.py @@ -14,7 +14,6 @@ import cv2 import numpy as np from cv2.typing import MatLike - from gen.build_vars import AUTOSPLIT_BUILD_NUMBER, AUTOSPLIT_GITHUB_REPOSITORY if sys.platform == "win32":