add footer to post item

This commit is contained in:
Morgan McMillian 2020-12-16 21:30:04 -08:00
parent 0347fa45eb
commit e78dbc9838

View file

@ -22,6 +22,8 @@ import pnutpy
import logging
import requests
from dateutil.tz import tzlocal
gi.require_version('GdkPixbuf', '2.0')
gi.require_version('Gdk', '3.0')
gi.require_version('Gtk', '3.0')
@ -259,8 +261,17 @@ class PostItem(Gtk.ListBoxRow):
photo = Gtk.Image.new_from_pixbuf(self.get_oembed_thumb(oembed))
self.c_box.pack_end(photo, False, False, 18)
# footer container
self.f_box = Gtk.Box(orientation='horizontal')
post_date_local = post.created_at.astimezone(tzlocal())
datetime_label = Gtk.Label(label=post_date_local.strftime("%Y-%m-%d %H:%M"), xalign=0)
self.source = Gtk.Label(label=post.source.name, xalign=1)
self.f_box.pack_start(datetime_label, False, False, 18)
self.f_box.pack_end(self.source, False, False, 18)
self.box.pack_start(self.h_box, True, True, 10)
self.box.pack_start(self.c_box, True, True, 10)
self.box.pack_start(self.f_box, True, True, 10)
def get_avatar(self, size, url):
# TODO: needs a cache