From d4f209bfe98e86104242da4a0c6c3b6ced6cbd99 Mon Sep 17 00:00:00 2001 From: Sergei Turukin Date: Tue, 17 May 2016 14:07:41 +0300 Subject: [PATCH] Refactor. --- i3pystatus/pomodoro.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/i3pystatus/pomodoro.py b/i3pystatus/pomodoro.py index 907cbf6..ed13860 100644 --- a/i3pystatus/pomodoro.py +++ b/i3pystatus/pomodoro.py @@ -75,22 +75,21 @@ class Pomodoro(IntervalModule): if self.state == RUNNING or self.state == BREAK: min, sec = divmod((self.time - datetime.utcnow()).total_seconds(), 60) text = '{:02}:{:02}'.format(int(min), int(sec)) - color = self.color_running if self.state == RUNNING else self.color_break - else: - self.output = { - 'full_text': 'Start pomodoro', - 'color': self.color_stopped + sdict = { + 'time': text, + 'current_pomodoro': self.breaks + 1, + 'total_pomodoro': self.short_break_count + 1, } - return + + color = self.color_running if self.state == RUNNING else self.color_break + text = self.format.format(**sdict) + else: + text = 'Start pomodoro', + color = self.color_stopped - sdict = { - 'time': text, - 'current_pomodoro': self.breaks + 1, - 'total_pomodoro': self.short_break_count + 1, - } - self.data = sdict + self.output = { - 'full_text': self.format.format(**sdict), + 'full_text': text, 'color': color }