-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
48 lines (35 loc) · 998 Bytes
/
main.py
File metadata and controls
48 lines (35 loc) · 998 Bytes
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
45
46
47
48
from flask import config
from ui.settingsWindow import SettingsWindow
from ui.overlay import ClipboardOverlay
from core.hotKeys import HotkeyManager
from utils.configManager import load_config, save_config
from core.state import state
from utils.config import config as myConfig
hotkeys = None
overlay = None
first_time = True
def open_settings():
global first_time
if first_time:
load_config(state, myConfig)
first_time = False
settings = SettingsWindow(on_start_callback=start_app)
settings.run()
def start_app():
global hotkeys, overlay
overlay = ClipboardOverlay(
on_open_settings=open_settings,
on_stop_listener=stop_hotkeys
)
hotkeys = HotkeyManager(
on_show_overlay_callback=overlay.show_thread_safe
)
hotkeys.start()
overlay.root.mainloop()
def stop_hotkeys():
global hotkeys
if hotkeys:
hotkeys.stop()
hotkeys = None
if __name__ == "__main__":
open_settings()