-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (35 loc) · 1.38 KB
/
main.py
File metadata and controls
44 lines (35 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import signal
import sys
from PySide6.QtWidgets import QApplication
from core.overlay import RainingKeysOverlay
from core.input_mon import InputMonitor
from core.settings_manager import SettingsManager
from core.gui import SettingsWindow
def main():
# Allow Ctrl+C to terminate the application immediately
signal.signal(signal.SIGINT, signal.SIG_DFL)
app = QApplication(sys.argv)
# Initialize Settings
settings_mgr = SettingsManager()
# Initialize Settings Window (Control Panel)
settings_win = SettingsWindow(settings_mgr)
settings_win.show() # Show GUI
# Create the overlay window
overlay = RainingKeysOverlay(settings_mgr)
overlay.show()
# Create and start the input monitor thread
# Dependency Injection: Pass the configuration object
input_mon = InputMonitor(settings_mgr.app_config)
input_mon.key_pressed.connect(overlay.handle_input)
input_mon.key_released.connect(overlay.handle_release)
# Connect raw key signal to Settings Window for recording
input_mon.raw_key_pressed.connect(settings_win.handle_raw_key)
input_mon.start()
print(f"RainingKeys v{settings_mgr.app_config.VERSION} started.")
print(" - Overlay active.")
print(" - Settings window open.")
print("Press Ctrl+C in terminal to stop.")
# Execute app
sys.exit(app.exec())
if __name__ == "__main__":
main()