adjust padding in post item

This commit is contained in:
Morgan McMillian 2020-12-21 09:38:48 -08:00
parent 0fc7895020
commit df9e836886

View file

@ -240,9 +240,9 @@ class PostItem(Gtk.ListBoxRow):
self.avatar.set_image_load_func(self.get_avatar, post.user.content.avatar_image.link) self.avatar.set_image_load_func(self.get_avatar, post.user.content.avatar_image.link)
#self.avatar = Gtk.Image.new_from_pixbuf(self.get_avatar(48, post.user.content.avatar_image.link)) #self.avatar = Gtk.Image.new_from_pixbuf(self.get_avatar(48, post.user.content.avatar_image.link))
self.source = Gtk.Label(label=post.source.name, xalign=1, yalign=0) self.source = Gtk.Label(label=post.source.name, xalign=1, yalign=0)
self.h_box.pack_start(self.avatar, False, False, 18) self.h_box.pack_start(self.avatar, False, False, 10)
self.h_box.pack_start(self.name_box, False, False, 0) self.h_box.pack_start(self.name_box, False, False, 0)
self.h_box.pack_end(self.source, False, False, 18) self.h_box.pack_end(self.source, False, False, 10)
# content container # content container
self.c_box = Gtk.Box(orientation='vertical') self.c_box = Gtk.Box(orientation='vertical')
@ -251,8 +251,8 @@ class PostItem(Gtk.ListBoxRow):
# TODO: parse content links # TODO: parse content links
if 'content' in post: if 'content' in post:
self.content.set_markup(post.content.text) self.content.set_markup(post.content.text)
self.t_box.pack_start(self.content, False, False, 18) self.t_box.pack_start(self.content, False, False, 10)
self.c_box.pack_start(self.t_box, False, False, 18) self.c_box.pack_start(self.t_box, False, False, 10)
if 'raw' in post: if 'raw' in post:
for raw in post.raw: for raw in post.raw:
@ -261,31 +261,31 @@ class PostItem(Gtk.ListBoxRow):
oembed = raw.value oembed = raw.value
if oembed.type == "photo": if oembed.type == "photo":
photo = Gtk.Image.new_from_pixbuf(self.get_oembed_thumb(oembed)) photo = Gtk.Image.new_from_pixbuf(self.get_oembed_thumb(oembed))
self.c_box.pack_end(photo, False, False, 18) self.c_box.pack_end(photo, False, False, 10)
# footer container # footer container
self.f_box = Gtk.Box(orientation='horizontal') self.f_box = Gtk.Box(orientation='horizontal')
post_date_local = post.created_at.astimezone(tzlocal()) post_date_local = post.created_at.astimezone(tzlocal())
datetime_label = Gtk.Label(label=post_date_local.strftime("%Y-%m-%d %H:%M"), xalign=1) datetime_label = Gtk.Label(label=post_date_local.strftime("%Y-%m-%d %H:%M"), xalign=1)
self.f_box.pack_end(datetime_label, False, False, 18) self.f_box.pack_end(datetime_label, False, False, 10)
pad = Gtk.Label(label="") pad = Gtk.Label(label="")
self.f_box.pack_start(pad, False, False, 9) self.f_box.pack_start(pad, False, False, 10)
if post.id != int(post.thread_id): if post.id != int(post.thread_id):
thread_icon = Gtk.Image.new_from_icon_name("user-available-symbolic", Gtk.IconSize.SMALL_TOOLBAR) thread_icon = Gtk.Image.new_from_icon_name("user-available-symbolic", Gtk.IconSize.SMALL_TOOLBAR)
self.f_box.pack_start(thread_icon, False, False, 9) self.f_box.pack_start(thread_icon, False, False, 5)
if post.counts.bookmarks > 0: if post.counts.bookmarks > 0:
if post.you_bookmarked: if post.you_bookmarked:
star_icon = Gtk.Image.new_from_icon_name("starred-symbolic", Gtk.IconSize.SMALL_TOOLBAR) star_icon = Gtk.Image.new_from_icon_name("starred-symbolic", Gtk.IconSize.SMALL_TOOLBAR)
else: else:
star_icon = Gtk.Image.new_from_icon_name("non-starred-symbolic", Gtk.IconSize.SMALL_TOOLBAR) star_icon = Gtk.Image.new_from_icon_name("non-starred-symbolic", Gtk.IconSize.SMALL_TOOLBAR)
star_count = Gtk.Label(label=post.counts.bookmarks) star_count = Gtk.Label(label=post.counts.bookmarks)
self.f_box.pack_start(star_icon, False, False, 9) self.f_box.pack_start(star_icon, False, False, 5)
self.f_box.pack_start(star_count, False, False, 0) self.f_box.pack_start(star_count, False, False, 0)
if post.counts.reposts > 0: if post.counts.reposts > 0:
repost_icon = Gtk.Image.new_from_icon_name("media-playlist-repeat-symbolic", Gtk.IconSize.SMALL_TOOLBAR) repost_icon = Gtk.Image.new_from_icon_name("media-playlist-repeat-symbolic", Gtk.IconSize.SMALL_TOOLBAR)
repost_count = Gtk.Label(label=post.counts.reposts) repost_count = Gtk.Label(label=post.counts.reposts)
self.f_box.pack_start(repost_icon, False, False, 9) self.f_box.pack_start(repost_icon, False, False, 5)
self.f_box.pack_start(repost_count, False, False, 0) self.f_box.pack_start(repost_count, False, False, 0)
self.box.pack_start(self.h_box, True, True, 10) self.box.pack_start(self.h_box, True, True, 10)