shorter/simpler status bar text
This commit is contained in:
parent
6801a8eee5
commit
73d846ab0d
20
Window.py
20
Window.py
@ -390,14 +390,26 @@ class Window:
|
||||
|
||||
def update_status_event(self):
|
||||
if self.mark is not None:
|
||||
td = datetime.now() - self.mark
|
||||
now = datetime.now()
|
||||
td = now - self.mark
|
||||
days = td.days
|
||||
hours = td.seconds / 60 / 60
|
||||
mins = (td.seconds - hours * 60 * 60) / 60
|
||||
secs = (td.seconds - hours * 60 * 60 - mins * 60)
|
||||
# TODO: smarter / shorter status text
|
||||
self.status_label.set_text('Mark: %s; Elapsed: %dd %dh %dm %ds' % \
|
||||
(self.mark.strftime(DT_FORMAT), days, hours, mins, secs))
|
||||
markfmt = str(int(self.mark.strftime("%I"))) + \
|
||||
self.mark.strftime(":%M") + self.mark.strftime("%p")[0].lower()
|
||||
if now.date() != self.mark.date():
|
||||
markfmt = self.mark.strftime("%m/%d ") + markfmt
|
||||
elapsedfmt = ''
|
||||
if days != 0:
|
||||
elapsedfmt += '%dd ' % days
|
||||
if hours != 0:
|
||||
elapsedfmt += '%dh ' % hours
|
||||
if mins != 0:
|
||||
elapsedfmt += '%dm ' % mins
|
||||
elapsedfmt += '%ds' % secs
|
||||
self.status_label.set_text('Mark: %s Elapsed: %s' % \
|
||||
(markfmt, elapsedfmt))
|
||||
else:
|
||||
self.status_label.set_text('No mark set')
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user