Skip to content

Commit a4cd263

Browse files
committed
Allow screenshot hotkeys when autocontrolled
1 parent e61be26 commit a4cd263

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
Easy to use image comparison based auto splitter for speedrunning on console or PC.
1111

12-
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.
12+
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.
1313

1414
![Example](/docs/2.0.0_gif.gif)
1515

@@ -98,9 +98,9 @@ Not a developer? You can still help through the following methods:
9898
- <https://github.com/pypa/pip/issues/9948>
9999
- <https://github.com/pypa/pip/pull/10837>
100100
- <https://github.com/opencv/opencv/issues?q=is%3Aissue+is%3Aopen+involves%3AAvasam+sort%3Areactions-%2B1-asc+>
101+
- <https://github.com/opencv/opencv/issues/18305>
101102
- <https://github.com/opencv/opencv/issues/23906>
102103
- <https://github.com/pywinrt/python-winsdk/issues/11>
103-
- <https://github.com/astral-sh/ruff/issues?q=is%3Aissue+is%3Aopen+involves%3AAvasam+sort%3Areactions-%2B1-asc+>
104104
- <https://github.com/microsoft/vscode/issues/40239>
105105
- <https://github.com/microsoft/vscode/issues/168411>
106106
- <https://github.com/python/mypy/issues/6700>
@@ -112,6 +112,7 @@ Not a developer? You can still help through the following methods:
112112
- <https://github.com/boppreh/keyboard/issues/216>
113113
- <https://github.com/boppreh/keyboard/issues/161>
114114
- <https://github.com/asweigart/pyautogui/issues/663>
115+
- <https://github.com/astral-sh/ruff/issues?q=is%3Aissue+is%3Aopen+involves%3AAvasam+sort%3Areactions-%2B1-asc+>
115116

116117
## Credits
117118

src/hotkeys.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
Commands = Literal["split", "start", "pause", "reset", "skip", "undo"]
3333
Hotkey = Literal["split", "reset", "skip_split", "undo_split", "pause", "screenshot", "toggle_auto_reset_image"]
3434
HOTKEYS = ("split", "reset", "skip_split", "undo_split", "pause", "screenshot", "toggle_auto_reset_image")
35+
HOTKEYS_WHEN_AUTOCONTROLLED = {"screenshot", "toggle_auto_reset_image"}
3536

3637

3738
def remove_all_hotkeys():

src/menu_bar.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
get_all_video_capture_devices,
2424
)
2525
from gen import about, design, settings as settings_ui, update_checker
26-
from hotkeys import HOTKEYS, set_hotkey
26+
from hotkeys import HOTKEYS, HOTKEYS_WHEN_AUTOCONTROLLED, set_hotkey
2727
from utils import AUTOSPLIT_VERSION, GITHUB_REPOSITORY, ONE_SECOND, decimal, fire_and_forget
2828

2929
if TYPE_CHECKING:
@@ -292,11 +292,12 @@ def __setup_bindings(self):
292292
set_hotkey_hotkey_button: QtWidgets.QPushButton = getattr(self, f"set_{hotkey}_hotkey_button")
293293
hotkey_input.setText(self._autosplit_ref.settings_dict.get(f"{hotkey}_hotkey", ""))
294294

295-
set_hotkey_hotkey_button.clicked.connect(partial(set_hotkey, self._autosplit_ref, hotkey=hotkey))
296295
# Make it very clear that hotkeys are not used when auto-controlled
297-
if self._autosplit_ref.is_auto_controlled and hotkey != "toggle_auto_reset_image":
296+
if self._autosplit_ref.is_auto_controlled and hotkey not in HOTKEYS_WHEN_AUTOCONTROLLED:
298297
set_hotkey_hotkey_button.setEnabled(False)
299298
hotkey_input.setEnabled(False)
299+
else:
300+
set_hotkey_hotkey_button.clicked.connect(partial(set_hotkey, self._autosplit_ref, hotkey=hotkey))
300301

301302
# region Set initial values
302303
# Capture Settings

0 commit comments

Comments
 (0)