timer start, py3.8 support

This commit is contained in:
Sander Land committed 2020-05-18 19:25:22 +02:00
1 parent 51dfcee774
commit 78bab1c6d8
11 files changed
+101 -16

No files matched your search

+24
View File
@@ -320,3 +320,27 @@ class ConfigTeacherPopup(QuickConfigGui):
return
self.katrain.update_state()
self.popup.dismiss()
class ConfigTimerPopup(QuickConfigGui):
def __init__(self, katrain, popup, **kwargs):
self.settings = katrain.config("timer")
super().__init__(katrain, popup, self.settings, **kwargs)
Clock.schedule_once(self.build, 0)
self.spacing = 2
def build(self, _dt):
thrbox = GridLayout(spacing=1, padding=2, cols=2, rows=2,size_hint=(1,2))
thrbox.add_widget(ScaledLightLabel(text="Byo-yomi\nperiod length (s)", bold=True,size_hint=(2,1),num_lines=2))
thrbox.add_widget(LabelledIntInput(text='30', input_property="byo_length"))
thrbox.add_widget(ScaledLightLabel(text="Byo-yomi\nnumber of periods", bold=True,size_hint=(2,1),num_lines=2))
thrbox.add_widget(LabelledIntInput(text='5', input_property="byo_num"))
self.add_widget(thrbox)
self.add_widget(StyledButton(text=f"Apply and Save", on_press=lambda _: self.update_config(True)))
def update_config(self, save_to_file=False):
self.katrain.controls.timer_settings = self.collect_properties(self)
self.katrain.update_state()
self.popup.dismiss()