From e38c6a0d558a781e1266a7c0db1fa725b8b36ba5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 19 Jul 2019 11:19:20 +1000 Subject: [PATCH] gui: drop the timestamp label for each drawing Now that we group by month anyway, this isn't that useful anymore --- tuhigui/data/ui/Drawing.ui | 19 ++----------------- tuhigui/drawing.py | 19 ------------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/tuhigui/data/ui/Drawing.ui b/tuhigui/data/ui/Drawing.ui index 35bc13c..4d538e6 100644 --- a/tuhigui/data/ui/Drawing.ui +++ b/tuhigui/data/ui/Drawing.ui @@ -32,27 +32,12 @@ True False + center + 10 10 10 10 True - - - True - False - 20 - 20 - Wed 09:55 07/07/2019 - - - - - - True - True - 0 - - True diff --git a/tuhigui/drawing.py b/tuhigui/drawing.py index 9deece4..12fa77a 100644 --- a/tuhigui/drawing.py +++ b/tuhigui/drawing.py @@ -23,27 +23,11 @@ import gi gi.require_version("Gtk", "3.0") -def relative_date(timestamp): - t = datetime.date.fromtimestamp(timestamp) - today = datetime.date.today() - diff = t - today - - if diff.days == 0: - return _('Today') - if diff.days == -1: - return _('Yesterday') - if diff.days > -4: # last 4 days we convert to weekdays - return t.strftime('%A') - - return t.strftime('%x') - - @Gtk.Template(resource_path='/org/freedesktop/Tuhi/ui/Drawing.ui') class Drawing(Gtk.Box): __gtype_name__ = "Drawing" box_toolbar = Gtk.Template.Child() - label_timestamp = Gtk.Template.Child() image_svg = Gtk.Template.Child() btn_rotate_left = Gtk.Template.Child() btn_rotate_right = Gtk.Template.Child() @@ -56,9 +40,6 @@ class Drawing(Gtk.Box): self.json_data = json_data self.refresh() # sets self.svg - day = relative_date(self.svg.timestamp) - hour = time.strftime('%H:%M', time.localtime(self.svg.timestamp)) - self.label_timestamp.set_text(f'{day} {hour}') self.timestamp = self.svg.timestamp def _on_orientation_changed(self, config, pspec):