Make format configurable, fix bug, progess output
This commit is contained in:
parent
a1c66f33b5
commit
45c94bd5cd
@ -27,6 +27,7 @@ class Pomodoro(IntervalModule):
|
||||
('break_duration', 'Short break duration in secods'),
|
||||
('long_break_duration', 'Long break duration in secods'),
|
||||
('short_break_count', 'Short break count before first long break'),
|
||||
format
|
||||
)
|
||||
|
||||
color_stopped = '#2ECCFA'
|
||||
@ -34,6 +35,7 @@ class Pomodoro(IntervalModule):
|
||||
color_break = '#37FF00'
|
||||
interval = 1
|
||||
short_break_count = 3
|
||||
format = '☯ {current_pomodoro}/{total_pomodoro} {time}'
|
||||
|
||||
pomodoro_duration = 25 * 60
|
||||
break_duration = 5 * 60
|
||||
@ -56,8 +58,8 @@ class Pomodoro(IntervalModule):
|
||||
else:
|
||||
self.time = datetime.now() + \
|
||||
timedelta(seconds=self.break_duration)
|
||||
self.breaks += 1
|
||||
text = 'Go for a break!'
|
||||
self.breaks += 1
|
||||
else:
|
||||
self.state = 'running'
|
||||
self.time = datetime.now() + \
|
||||
@ -70,11 +72,20 @@ class Pomodoro(IntervalModule):
|
||||
text = '{:02}:{:02}'.format(int(min), int(sec))
|
||||
color = self.color_running if self.state == 'running' else self.color_break
|
||||
else:
|
||||
text = 'Stopped'
|
||||
color = self.color_stopped
|
||||
self.output = {
|
||||
'full_text': 'Stopped',
|
||||
'color': self.color_stopped
|
||||
}
|
||||
return
|
||||
|
||||
sdict = {
|
||||
'time': text,
|
||||
'current_pomodoro': self.breaks,
|
||||
'total_pomodoro': self.short_break_count + 1,
|
||||
}
|
||||
|
||||
self.output = {
|
||||
'full_text': text,
|
||||
'full_text': self.format.format(**sdict),
|
||||
'color': color
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user