fix: hotkey parsing and initialization order

- Use pynput format <f12>, <shift>+<f12> etc for hotkey parsing
- Initialize screenshot hotkeys AFTER UI setup (fixes log_output error)
- Clean up hotkey display in help text (remove angle brackets)
This commit is contained in:
LemonNexus 2026-02-11 12:37:12 +00:00
parent 299b1e0fa5
commit 21c2508842
2 changed files with 11 additions and 6 deletions

View File

@ -46,10 +46,10 @@ class ScreenshotHotkeyManager(QObject):
# Default hotkeys
DEFAULT_HOTKEYS = {
'screenshot_full': 'f12', # Full screen
'screenshot_region': 'shift+f12', # Region selection
'screenshot_loot': 'ctrl+f12', # Loot window area
'screenshot_hud': 'alt+f12', # HUD area
'screenshot_full': '<f12>', # Full screen
'screenshot_region': '<shift>+<f12>', # Region selection
'screenshot_loot': '<ctrl>+<f12>', # Loot window area
'screenshot_hud': '<alt>+<f12>', # HUD area
}
def __init__(self, screenshot_manager: Optional[AutoScreenshot] = None,
@ -360,7 +360,9 @@ class ScreenshotHotkeyManager(QObject):
for action, combo in self.hotkeys.items():
desc = descriptions.get(action, action)
lines.append(f" {combo.upper():<15} - {desc}")
# Remove angle brackets for display
display_combo = combo.replace('<', '').replace('>', '')
lines.append(f" {display_combo.upper():<15} - {desc}")
return "\n".join(lines)

View File

@ -412,14 +412,17 @@ class MainWindow(QMainWindow):
self._screenshot_capture = ScreenshotCapture(self.db)
# Screenshot hotkey manager (global hotkeys for manual capture)
# Note: Initialized after UI setup because it uses log_output
self._screenshot_hotkeys = None
self._init_screenshot_hotkeys()
# Setup UI
self.setup_ui()
self.apply_dark_theme()
self.create_menu_bar()
self.create_status_bar()
# Initialize screenshot hotkeys AFTER UI is setup
self._init_screenshot_hotkeys()
# Load persistent settings
self._load_settings()