frat: added screen timers_screen, added new buttons: back, delete_timer, new_timer and the functionality is connected to them, udated fuc list_timers() for work with timers_screens for data;
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
<TimerConstructorScreen>:
|
||||
FloatLayout:
|
||||
# поле вовода "название"
|
||||
TextInput:
|
||||
id: title
|
||||
size_hint: None, None
|
||||
@@ -19,7 +18,6 @@
|
||||
height: 20
|
||||
pos_hint: {"center_x": 0.5, "center_y": 0.8}
|
||||
|
||||
# числовой счётчик "время помидора"
|
||||
Label:
|
||||
text: "помидор"
|
||||
size_hint: None, None
|
||||
@@ -46,7 +44,6 @@
|
||||
pos_hint: {"center_x": 0.7, "center_y": 0.7}
|
||||
on_press: time_tomato_input.increment()
|
||||
|
||||
# числовой счётчик "время прерыва"
|
||||
Label:
|
||||
text: "перерыв"
|
||||
size_hint: None, None
|
||||
@@ -73,7 +70,6 @@
|
||||
pos_hint: {"center_x": 0.7, "center_y": 0.6}
|
||||
on_press: time_break_input.increment()
|
||||
|
||||
# числовой счётчик "время длительного перерыва"
|
||||
Label:
|
||||
text: "перерывище"
|
||||
size_hint: None, None
|
||||
@@ -99,8 +95,7 @@
|
||||
size: 40, 40
|
||||
pos_hint: {"center_x": 0.7, "center_y": 0.5}
|
||||
on_press: time_long_break_input.increment()
|
||||
|
||||
# числовой счётчик "колличество помидоров"
|
||||
|
||||
Label:
|
||||
text: "помидоров"
|
||||
size_hint: None, None
|
||||
@@ -127,20 +122,18 @@
|
||||
pos_hint: {"center_x": 0.7, "center_y": 0.4}
|
||||
on_press: count_tomatos_input.increment()
|
||||
|
||||
# Кнопка "Создать"
|
||||
Button:
|
||||
text: 'Создать'
|
||||
text: "Создать"
|
||||
size_hint: None, None
|
||||
height: 40
|
||||
width: 100
|
||||
pos_hint: {'center_x': 0.7, 'center_y': 0.1}
|
||||
pos_hint: {"center_x": 0.7, "center_y": 0.1}
|
||||
on_press: root.create_timer(self)
|
||||
|
||||
# Кнопка "Назад"
|
||||
Button:
|
||||
text: 'Назад'
|
||||
text: "Назад"
|
||||
size_hint: None, None
|
||||
height: 40
|
||||
width: 100
|
||||
pos_hint: {'center_x': 0.3, 'center_y': 0.1}
|
||||
pos_hint: {"center_x": 0.3, "center_y": 0.1}
|
||||
on_press: root.back(self)
|
||||
@@ -2,51 +2,71 @@
|
||||
|
||||
<TimerScreen>:
|
||||
FloatLayout:
|
||||
# Label для названия таймера
|
||||
Label:
|
||||
id: title_label
|
||||
size_hint: None, None
|
||||
pos_hint: {'center_x': 0.3, 'center_y': 0.7}
|
||||
pos_hint: {"center_x": 0.3, "center_y": 0.7}
|
||||
|
||||
# Label для типа таймера
|
||||
Label:
|
||||
id: type_timer_label
|
||||
text: 'Помидор'
|
||||
text: "Помидор"
|
||||
size_hint: None, None
|
||||
pos_hint: {'center_x': 0.7, 'center_y': 0.7}
|
||||
pos_hint: {"center_x": 0.7, "center_y": 0.7}
|
||||
|
||||
# Кнопка "Старт"
|
||||
Button:
|
||||
text: 'Старт'
|
||||
text: "Старт"
|
||||
size_hint: None, None
|
||||
height: 40
|
||||
width: 100
|
||||
pos_hint: {'center_x': 0.3, 'center_y': 0.5}
|
||||
pos_hint: {"center_x": 0.3, "center_y": 0.5}
|
||||
on_release: root.start_timer(self)
|
||||
|
||||
# Кнопка "Пауза"
|
||||
Button:
|
||||
text: 'Пауза'
|
||||
text: "Пауза"
|
||||
size_hint: None, None
|
||||
height: 40
|
||||
width: 100
|
||||
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
|
||||
pos_hint: {"center_x": 0.5, "center_y": 0.5}
|
||||
on_release: root.pause_timer(self)
|
||||
|
||||
# Кнопка "Стоп"
|
||||
Button:
|
||||
id: stop_button
|
||||
text: 'Стоп'
|
||||
text: "Стоп"
|
||||
opacity: 0
|
||||
disabled: True
|
||||
size_hint: None, None
|
||||
height: 40
|
||||
width: 100
|
||||
pos_hint: {'center_x': 0.7, 'center_y': 0.5}
|
||||
pos_hint: {"center_x": 0.7, "center_y": 0.5}
|
||||
on_release: root.stop_timer(self)
|
||||
|
||||
# Label для отображения времени
|
||||
Label:
|
||||
id: time_label
|
||||
size_hint: None, None
|
||||
pos_hint: {'center_x': 0.5, 'center_y': 0.6}
|
||||
pos_hint: {"center_x": 0.5, "center_y": 0.6}
|
||||
|
||||
Label:
|
||||
id: title_warning
|
||||
text: ""
|
||||
color: (1, 0.3, 0.3, 1)
|
||||
font_size: 14
|
||||
size_hint_y: None
|
||||
height: 20
|
||||
pos_hint: {"center_x": 0.5, "center_y": 0.4}
|
||||
|
||||
Button:
|
||||
text: "Назад"
|
||||
size_hint: None, None
|
||||
height: 40
|
||||
width: 100
|
||||
pos_hint: {"center_x": 0.3, "center_y": 0.1}
|
||||
on_press: root.back(self)
|
||||
|
||||
Button:
|
||||
id: del_timer
|
||||
text: "Удалить"
|
||||
size_hint: None, None
|
||||
height: 40
|
||||
width: 120
|
||||
pos_hint: {"center_x": 0.7, "center_y": 0.1}
|
||||
on_press: root.delete_timer(self)
|
||||
49
kv/timers_screen.kv
Normal file
49
kv/timers_screen.kv
Normal file
@@ -0,0 +1,49 @@
|
||||
#:kivy 2.3.1
|
||||
|
||||
<TimersScreen>:
|
||||
FloatLayout:
|
||||
RecycleView:
|
||||
id: timers_view
|
||||
size_hint: 1, 1
|
||||
pos_hint: {"x": 0, "y": 0}
|
||||
|
||||
viewclass: "TimerButton"
|
||||
|
||||
RecycleBoxLayout:
|
||||
default_size: None, dp(50)
|
||||
default_size_hint: 1, None
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
orientation: "vertical"
|
||||
spacing: dp(5)
|
||||
|
||||
Button:
|
||||
id: new_timer
|
||||
text: 'Новый таймер'
|
||||
size_hint: None, None
|
||||
height: 40
|
||||
width: 120
|
||||
pos_hint: {"center_x": 0.3, "center_y": 0.1}
|
||||
on_release: root.switch_new_timer(self)
|
||||
|
||||
<TimerButton@Button>:
|
||||
timer_id: None
|
||||
text: ""
|
||||
on_release: app.root.get_screen("timers_screen").switch_timer(self)
|
||||
size_hint: None, None
|
||||
height: dp(50)
|
||||
background_normal: "" # отключаем стандартный фон
|
||||
background_color: 0, 0, 0, 0 # прозрачный
|
||||
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: 1, 1, 1, 1 # белый контур
|
||||
Line:
|
||||
width: 1.5
|
||||
rectangle: (self.x, self.y, self.width, self.height)
|
||||
|
||||
Color:
|
||||
rgba: (0, 0.5, 1, 0.5) if self.state == "down" else (0, 0, 0, 0)
|
||||
Rectangle:
|
||||
pos: self.pos
|
||||
size: self.size
|
||||
Reference in New Issue
Block a user