From 592ee2d558605ef8bd2ebe21ca88a6378420c094 Mon Sep 17 00:00:00 2001 From: Manan Khattar Date: Mon, 3 Jan 2022 01:04:48 -0800 Subject: [PATCH] fix bug with predetermined time intervals --- timebox.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/timebox.py b/timebox.py index 8550ffe..3a8f21d 100644 --- a/timebox.py +++ b/timebox.py @@ -94,8 +94,11 @@ def __init__(self, timer_interval=1): title = str(i) + " Minutes" def callback(_, j=i): self.set_mins(_, j) + for btn in [*self.things_buttons.values(), *self.buttons.values()]: + btn.set_callback(None) self.timer.count = 0 - self.timer.end = j + self.timer.end = self.interval + self.start_pause_button.title = "Pause Timer" self.timer.start() self.buttons["btn_" + str(i)] = rumps.MenuItem( title=title, callback=callback @@ -184,6 +187,7 @@ def set_mins(self, sender, interval): for btn in [*self.things_buttons.values(), *self.buttons.values()]: if sender.title == btn.title: self.interval = interval * SEC_TO_MIN + print(f"here: {self.interval}") cleaned_title = " ".join(sender.title.split()[2:]) self.menu_title = ( " ".join(cleaned_title.split()[:4])