add edit step + do recipe in main view, added carousel for recipe selection
This commit is contained in:
@@ -6,11 +6,22 @@ import time
|
||||
from .base import View
|
||||
|
||||
class TimerView(View):
|
||||
@property
|
||||
def goal_secs(self):
|
||||
try:
|
||||
return float(self.goal_entry.get())
|
||||
except ValueError:
|
||||
return 0.0
|
||||
|
||||
@goal_secs.setter
|
||||
def goal_secs(self, value):
|
||||
self.goal_entry.delete(0, tk.END)
|
||||
self.goal_entry.insert(0, str(value))
|
||||
|
||||
def __init__(self, parent, size, center, width=3, **kwargs):
|
||||
self.start_time = None
|
||||
self.elapsed_time = 0
|
||||
self.is_running = False
|
||||
self.goal_minutes = 0 # 0 means no goal set
|
||||
self.radius = min(center) - 7
|
||||
self.width = width
|
||||
self.goal_achived = 0
|
||||
@@ -79,9 +90,8 @@ class TimerView(View):
|
||||
|
||||
# Draw progress circle if goal is set
|
||||
try:
|
||||
goal_sec = float(self.goal_entry.get())
|
||||
if goal_sec > 0:
|
||||
progress = current_time / goal_sec
|
||||
if self.goal_secs > 0:
|
||||
progress = current_time / self.goal_secs
|
||||
else:
|
||||
progress = current_time / 60
|
||||
|
||||
@@ -89,7 +99,7 @@ class TimerView(View):
|
||||
inverted = int(progress) % 2 == 1
|
||||
|
||||
# pulse width if goal achieved
|
||||
if int(progress) > 0 and self.is_running:
|
||||
if self.goal_secs > 0 and int(progress) > 0 and self.is_running:
|
||||
self.goal_achived = (self.goal_achived + self.goal_pulse_freq) % 3
|
||||
else:
|
||||
self.goal_achived = 0
|
||||
|
||||
Reference in New Issue
Block a user