gui: drop the timestamp label for each drawing

Now that we group by month anyway, this isn't that useful anymore
pull/145/head
Peter Hutterer 2019-07-19 11:19:20 +10:00
parent c00580655e
commit e38c6a0d55
2 changed files with 2 additions and 36 deletions

View File

@ -32,27 +32,12 @@
<object class="GtkBox" id="box_toolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="margin_left">10</property>
<property name="margin_right">10</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="hexpand">True</property>
<child>
<object class="GtkLabel" id="label_timestamp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">20</property>
<property name="margin_right">20</property>
<property name="label" translatable="yes">Wed 09:55 07/07/2019</property>
<attributes>
<attribute name="weight" value="semibold"/>
</attributes>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_rotate_left">
<property name="visible">True</property>

View File

@ -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):