modified timer so it counts to -10s

This commit is contained in:
Angoosh Leviocki 2024-11-27 16:18:09 +01:00
parent da3215ec5e
commit c267155b25
Signed by: angoosh
GPG Key ID: 2DAE446D291BD8D3

View File

@ -6,7 +6,7 @@ gi.require_version('Gtk', '4.0')
from gi.repository import Gtk, Gio, Gdk from gi.repository import Gtk, Gio, Gdk
index = 2 index = 2
TIME = 10*60 TIME = 10
class GridRow(): class GridRow():
def __init__(self, parent, runner, index): def __init__(self, parent, runner, index):
@ -41,9 +41,13 @@ class GridRow():
def updateTime(self): def updateTime(self):
t = TIME t = TIME
while t: while t >= -10:
mins, secs = divmod(t, 60) if t < 0:
timer = '{:02d}:{:02d}'.format(mins, secs) mins, secs = divmod((t * -1), 60)
timer = '-{:02d}:{:02d}'.format(mins, secs)
else:
mins, secs = divmod(t, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
self.runb.set_label(timer) self.runb.set_label(timer)
time.sleep(1) time.sleep(1)
t -= 1 t -= 1