class SittingScreen(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) instr = ScrollLabel(ltext=txt_sitting) self.ltimer = Seconds(45) self.ltimer.bind(done=self.timer_end) self.btn = Button(text="Далее") self.btn.background_color = (0, 0.5, 0.5, 1) self.btn.on_press = self.next linemain = BoxLayout(orientation="vertical", padding=8, spacing=8) linemain.add_widget(instr) linemain.add_widget(self.ltimer) linemain.add_widget(self.btn) self.add_widget(linemain) def on_enter(self): self.ltimer.start() def timer_end(self, *args): self.btn.set_disabled(False) def next(self): self.manager.current = "test_result"
class PulseScr(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) self.next_screen = False instr = ScrollLabel(txt_test1, textcolor = '#000000') lbl1 = ScrollLabel('Считайте пульс', textcolor = '#000000') self.lbl_sec = Seconds(15, textcolor = '#000000') self.lbl_sec.bind(done=self.sec_finished) line1 = BoxLayout() vlay = BoxLayout(orientation='horizontal') vlay.add_widget(lbl1) vlay.add_widget(self.lbl_sec) line1.add_widget(instr) line1.add_widget(vlay) line2 = BoxLayout(size_hint=(0.8, None), height='30sp') lbl_result = Label(text='Напишите свой результат в этом поле:', halign='right') self.in_result = TextInput(text='0', multiline=False) self.in_result.set_disabled(True) line2.add_widget(lbl_result) line2.add_widget(self.in_result) self.btn = Button(text='Приступить', size_hint=(0.3, 0.2), pos_hint={'center_x': 0.5}) self.btn.background_color = btn_color self.btn.on_press = self.next outer = BoxLayout(orientation='vertical', padding=8, spacing=8) outer.add_widget(line1) outer.add_widget(line2) outer.add_widget(self.btn) self.add_widget(outer) def sec_finished(self, *args): self.in_result.set_disabled(False) self.btn.set_disabled(False) self.btn.text = 'Продолжить' self.next_screen = True def next(self): if not self.next_screen: self.btn.set_disabled(True) self.lbl_sec.start() else: global p1 p1 = check_int(self.in_result.text) if p1 == False or p1 <= 0: p1 = 0 self.in_result.text = str(p1) else: self.manager.current = 'sits'
class TestScreen(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) instr = ScrollLabel(ltext=txt_test1) self.ltimer = Seconds(15) self.ltimer.bind(done=self.timer_end) self.start_button = Button(text='Начать') self.start_button.on_press = self.start_timer self.start_button.background_color = (0,0,1,1) l1 = Label(text='Запишите релузьтат') self.test1_input = TextInput() self.test1_input.set_disabled(True) line1 = BoxLayout(orientation='vertical', size_hint=(1, None), height='60sp') line1.add_widget(l1) line1.add_widget(self.test1_input) self.button = Button(text='Далее') self.button.background_color = (1, 0, 0, 1) self.button.set_disabled(True) self.button.on_press = self.next main_line = BoxLayout(orientation='vertical', padding=8, spacing=8) main_line.add_widget(instr) main_line.add_widget(self.ltimer) main_line.add_widget(self.start_button) main_line.add_widget(line1) main_line.add_widget(self.button) self.add_widget(main_line) def start_timer(self): self.ltimer.start() self.start_button.set_disabled(True) def timer_end(self, *args): self.test1_input.set_disabled(False) self.button.set_disabled(False) def next(self): global p1 p1 = int(self.test1_input.text) self.manager.current = 'sitting'
class TestScreen(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) instr = ScrollLabel(ltext=txt_test1) self.ltimer = Seconds(15) self.ltimer.bind(done=self.timer_end) l1 = Label(text="Запишите результат") self.test1_input = TextInput(text="0") self.test1_input.set_disabled(True) line1 = BoxLayout(orientation="vertical", size_hint=(1, None), height='60sp') line1.add_widget(l1) line1.add_widget(self.test1_input) self.btn = Button(text="Нажми, если ты живой.") self.btn.background_color = (0, 0.5, 0.5, 1) self.btn.on_press = self.next self.btn.set_disabled(True) linemain = BoxLayout(orientation="vertical", padding=8, spacing=8) linemain.add_widget(instr) linemain.add_widget(self.ltimer) linemain.add_widget(line1) linemain.add_widget(self.btn) self.add_widget(linemain) def on_enter(self): self.ltimer.start() def timer_end(self, *args): self.test1_input.set_disabled(False) self.btn.set_disabled(False) def next(self): global p1 p1 = check_int(self.test1_input.text) if p1 != False and p1 > 0: self.manager.current = "sitting"
class Test2Screen(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) instr = ScrollLabel(ltext=txt_test2) l1 = Label(text=" Результат после приседания") self.test2_input = TextInput() l2 = Label(text="") self.test3_input = TextInput() self.t1 = Seconds(15) self.t2 = Seconds(45) self.t3 = Seconds(15) self.btn = Button(text="Показать результат") self.btn.background_color = (0, 0.5, 0.5, 1) self.btn.on_press = self.next line1 = BoxLayout(orientation="vertical", size_hint=(1, None), height='60sp') line1.add_widget(l1) line1.add_widget(self.test2_input) line2 = BoxLayout(orientation="vertical", size_hint=(1, None), height='60sp') line2.add_widget(l2) line2.add_widget(self.test3_input) linemain = BoxLayout(orientation="vertical", padding=8, spacing=8) linemain.add_widget(instr) linemain.add_widget(line1) linemain.add_widget(line2) linemain.add_widget(self.btn) self.add_widget(linemain) def on_enter(self): self.t1.start() self.t2.start() def t1_end(self, *args): self.test2_input.set_disabled(False) def t2_end(self, *args): self.t3.start() def t3_end(self, *args): self.test3_input.set_disabled(False) self.btn.set_disabled(False) def next(self): global p2, p3 p2 = int(self.test2_input.text) p3 = int(self.test3_input.text) self.manager.current = "result"
class PulseScr(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) self.next_screen = False instr = ScrollLabel(txt_test1, textcolor='#FFFFFF') lbl1 = ScrollLabel('Считайте пульс', textcolor='#FFFFFF') self.lbl_sec = Seconds(15, textcolor='#FFFFFF') self.lbl_sec.bind(done=self.sec_finished) line1 = ColoredLayout(lcolor=(0, 0.5, 0.01, 1)) vlay = ColoredLayout(orientation='vertical', lcolor=(0.44, 0.44, 0.44, 1)) vlay.add_widget(lbl1) vlay.add_widget(self.lbl_sec) line1.add_widget(instr) line1.add_widget(vlay) line2 = BoxLayout(size_hint=(0.8, None), height='30sp') lbl_result = Label(text='Введите результат:', halign='right') self.in_result = TextInput(text='0', multiline=False) self.in_result.set_disabled(True) line2.add_widget(lbl_result) line2.add_widget(self.in_result) self.btn = Button(text='Начать', pos_hint={'center_x': 0.5}) self.btn.background_color = btn_color self.btn.on_press = self.next self.line3 = BoxLayout(size_hint=(0.8, None), height='80sp', pos_hint={'center_x': 0.5}) self.line3.add_widget(self.btn) outer = BoxLayout(orientation='vertical', padding=8, spacing=8) outer.add_widget(line1) outer.add_widget(line2) outer.add_widget(self.line3) self.add_widget(outer) def sec_finished(self, *args): self.in_result.set_disabled(False) self.btn.set_disabled(False) self.btn.text = 'Продолжить' self.next_screen = True self.line3.remove_widget(self.btn) self.btn_back = Button(text='Назад') self.btn_back.background_color = btn_color self.line3.add_widget(self.btn_back) self.line3.add_widget(self.btn) self.btn_back.on_press = self.back def next(self): if not self.next_screen: self.btn.set_disabled(True) self.lbl_sec.start() else: global p1 p1 = check_int(self.in_result.text) if p1 == False or p1 <= 0: p1 = 0 self.in_result.text = str(p1) else: self.in_result.text = '0' self.manager.current = 'sits' def back(self): self.manager.current = self.manager.previous()
class PulseScr2(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) self.next_screen = False self.stage = 0 instr = ScrollLabel(txt_test3, textcolor='#FFFFFF') self.lbl1 = ScrollLabel('Считайте пульс', textcolor='#FFFFFF') self.lbl_sec = Seconds(15, textcolor='#FFFFFF') self.lbl_sec.bind(done=self.sec_finished) line0 = ColoredLayout(lcolor=(0, 0.5, 0.01, 1)) vlay = ColoredLayout(orientation='vertical', lcolor=(0.44, 0.44, 0.44, 1)) vlay.add_widget(self.lbl1) vlay.add_widget(self.lbl_sec) line0.add_widget(instr) line0.add_widget(vlay) line1 = BoxLayout(size_hint=(0.8, None), height='30sp') lbl_result1 = Label(text='Результат:', halign='right') self.in_result1 = TextInput(text='0', multiline=False) self.in_result1.set_disabled(True) line1.add_widget(lbl_result1) line1.add_widget(self.in_result1) line2 = BoxLayout(size_hint=(0.8, None), height='30sp') lbl_result2 = Label(text='Результат после отдыха:', halign='right') self.in_result2 = TextInput(text='0', multiline=False) self.in_result2.set_disabled(True) line2.add_widget(lbl_result2) line2.add_widget(self.in_result2) self.btn = Button(text='Начать', size_hint=(0.3, 0.2), pos_hint={'center_x': 0.5}) self.btn.background_color = btn_color self.btn.on_press = self.next outer = BoxLayout(orientation='vertical', padding=8, spacing=8) outer.add_widget(line0) outer.add_widget(line1) outer.add_widget(line2) outer.add_widget(self.btn) self.add_widget(outer) def sec_finished(self, instance, value): if value: if self.stage == 0: self.stage = 1 self.lbl1.set_text('Отдыхайте') self.lbl_sec.restart(30) self.in_result1.set_disabled(False) elif self.stage == 1: self.stage = 2 self.lbl1.set_text('Считайте пульс') self.lbl_sec.restart(15) elif self.stage == 2: self.in_result2.set_disabled(False) self.btn.set_disabled(False) self.btn.text = 'Завершить' self.next_screen = True def next(self): if not self.next_screen: self.btn.set_disabled(True) self.lbl_sec.start() else: global p2, p3 p2 = check_int(self.in_result1.text) p3 = check_int(self.in_result2.text) if p2 == False and p3 == False: p2 = 0 self.in_result1.text = str(p2) p3 = 0 self.in_result2.text = str(p3) elif p2 == False: p2 = 0 self.in_result1.text = str(p2) elif p3 == False: p3 = 0 self.in_result2.text = str(p3) else: self.in_result1.text = '0' self.in_result2.text = '0' self.manager.current = 'result'