Skip to content

Commit

Permalink
Allow screenshot hotkeys when autocontrolled
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Aug 2, 2024
1 parent e61be26 commit a4cd263
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

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

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.
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.

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

Expand Down Expand Up @@ -98,9 +98,9 @@ Not a developer? You can still help through the following methods:
- <https://github.com/pypa/pip/issues/9948>
- <https://github.com/pypa/pip/pull/10837>
- <https://github.com/opencv/opencv/issues?q=is%3Aissue+is%3Aopen+involves%3AAvasam+sort%3Areactions-%2B1-asc+>
- <https://github.com/opencv/opencv/issues/18305>
- <https://github.com/opencv/opencv/issues/23906>
- <https://github.com/pywinrt/python-winsdk/issues/11>
- <https://github.com/astral-sh/ruff/issues?q=is%3Aissue+is%3Aopen+involves%3AAvasam+sort%3Areactions-%2B1-asc+>
- <https://github.com/microsoft/vscode/issues/40239>
- <https://github.com/microsoft/vscode/issues/168411>
- <https://github.com/python/mypy/issues/6700>
Expand All @@ -112,6 +112,7 @@ Not a developer? You can still help through the following methods:
- <https://github.com/boppreh/keyboard/issues/216>
- <https://github.com/boppreh/keyboard/issues/161>
- <https://github.com/asweigart/pyautogui/issues/663>
- <https://github.com/astral-sh/ruff/issues?q=is%3Aissue+is%3Aopen+involves%3AAvasam+sort%3Areactions-%2B1-asc+>
## Credits
Expand Down
1 change: 1 addition & 0 deletions src/hotkeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
Commands = Literal["split", "start", "pause", "reset", "skip", "undo"]
Hotkey = Literal["split", "reset", "skip_split", "undo_split", "pause", "screenshot", "toggle_auto_reset_image"]
HOTKEYS = ("split", "reset", "skip_split", "undo_split", "pause", "screenshot", "toggle_auto_reset_image")
HOTKEYS_WHEN_AUTOCONTROLLED = {"screenshot", "toggle_auto_reset_image"}


def remove_all_hotkeys():
Expand Down
7 changes: 4 additions & 3 deletions src/menu_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
get_all_video_capture_devices,
)
from gen import about, design, settings as settings_ui, update_checker
from hotkeys import HOTKEYS, set_hotkey
from hotkeys import HOTKEYS, HOTKEYS_WHEN_AUTOCONTROLLED, set_hotkey
from utils import AUTOSPLIT_VERSION, GITHUB_REPOSITORY, ONE_SECOND, decimal, fire_and_forget

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

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

# region Set initial values
# Capture Settings
Expand Down

0 comments on commit a4cd263

Please sign in to comment.