From c4ba2195b311b4a540048386fdc2c256ced843cd Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Sun, 29 Sep 2019 13:57:46 -0700 Subject: [PATCH] Changed Pomodoro icons, made the work/break periods variables --- bumblebee/modules/pomodoro.py | 18 +++++++++++------- themes/icons/awesome-fonts.json | 5 +++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bumblebee/modules/pomodoro.py b/bumblebee/modules/pomodoro.py index 0eacc63..68909d9 100644 --- a/bumblebee/modules/pomodoro.py +++ b/bumblebee/modules/pomodoro.py @@ -16,10 +16,12 @@ import bumblebee.engine class Module(bumblebee.engine.Module): def __init__(self, engine, config): widgets = bumblebee.output.Widget(full_text=self.text) - self._work_period = 25 - self._play_period = 5 - self.remaining_time = datetime.timedelta(minutes=self._work_period) + self.work_period = 25 + self.break_period = 5 + self.remaining_time = datetime.timedelta(minutes=self.work_period) self.remaining_time_str = "{}m ".format(ceil((self.remaining_time.seconds / 60))) + # self.remaining_time_str = "{}min{}s ".format(int((self.remaining_time.seconds / 60)), + # round((self.remaining_time.seconds/60) % 1*60)) self.time = None self.pomodoro = { "state":"OFF", "type": ""} self._text = self.remaining_time_str + self.pomodoro["type"] @@ -42,18 +44,20 @@ class Module(bumblebee.engine.Module): if self.remaining_time.seconds <= 0: if self.pomodoro["type"] == "Work": self.pomodoro["type"] = "Break" - self.remaining_time = datetime.timedelta(minutes=self._work_period) + self.remaining_time = datetime.timedelta(minutes=self.break_period) elif self.pomodoro["type"] == "Break": self.pomodoro["type"] = "Work" - self.remaining_time = datetime.timedelta(minutes=self._play_period) + self.remaining_time = datetime.timedelta(minutes=self.work_period) self.remaining_time_str = "{}m ".format(ceil((self.remaining_time.seconds / 60))) + # self.remaining_time_str = "{}min{}s ".format(int((self.remaining_time.seconds / 60)), + # round((self.remaining_time.seconds / 60) % 1 * 60)) self._text = self.remaining_time_str + self.pomodoro["type"] def timer_play_pause(self, widget): if self.pomodoro["state"] == "OFF": self.pomodoro = {"state": "ON", "type": "Work"} - self.remaining_time = datetime.timedelta(minutes=self._work_period) + self.remaining_time = datetime.timedelta(minutes=self.work_period) self.time = datetime.datetime.now() elif self.pomodoro["state"] == "ON": self.pomodoro["state"] = "PAUSED" @@ -66,7 +70,7 @@ class Module(bumblebee.engine.Module): def timer_reset(self, widget): if self.pomodoro["state"] == "ON" or self.pomodoro["state"] == "PAUSED": self.pomodoro = {"state":"OFF", "type": "" } - self.remaining_time = datetime.timedelta(minutes=self._work_period) + self.remaining_time = datetime.timedelta(minutes=self.work_period) def state(self, widget): state = []; diff --git a/themes/icons/awesome-fonts.json b/themes/icons/awesome-fonts.json index c2c6c11..d5e947f 100644 --- a/themes/icons/awesome-fonts.json +++ b/themes/icons/awesome-fonts.json @@ -224,8 +224,9 @@ "prefix": "" }, "pomodoro": { - "off": { "prefix": "🍅" }, + "off": { "prefix": "" }, "paused": { "prefix": "" }, - "on": { "prefix": "" } + "work": { "prefix": "" }, + "break": { "prefix": "" } } }