-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.py
More file actions
41 lines (32 loc) · 1.17 KB
/
Copy pathcontroller.py
File metadata and controls
41 lines (32 loc) · 1.17 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
from gui import Gui
from countdown import Countdown
import settings
class Controller():
def __init__(self):
self.gui = Gui(self)
def on_save_settings(self):
countdown_time = self.gui.get_countdown_time()
posx = self.gui.get_posx()
posy = self.gui.get_posy()
font_size = self.gui.get_font_size()
settings.set_setting("countdown_time_min", countdown_time)
settings.set_setting("posx", posx)
settings.set_setting("posy", posy)
settings.set_setting("font_size", font_size)
settings.write_settings()
def on_reset_settings(self):
settings.reset_settings()
self.gui.set_countdown_time(settings.get_setting("countdown_time_min"))
self.gui.set_posx(settings.get_setting("posx"))
self.gui.set_posy(settings.get_setting("posy"))
self.gui.set_font_size(settings.get_setting("font_size"))
def on_start_countdown(self, e=None):
if hasattr(self, 'countdown'):
self.countdown.stop()
self.countdown = Countdown()
countdown_time = settings.get_setting("countdown_time_min")
self.countdown.start(self.gui, countdown_time)
def on_stop_countdown(self):
self.countdown.stop()
def run(self):
self.gui.mainloop()