From 2aaa986c3a93746a46e680c6f556684d88bf7664 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Thu, 4 Mar 2021 10:38:29 -0800 Subject: [PATCH] moved datetime label and fixed layout --- src/widgets.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/widgets.py b/src/widgets.py index 9bc8b0c..3b408d0 100644 --- a/src/widgets.py +++ b/src/widgets.py @@ -417,9 +417,9 @@ class PostItem(Gtk.ListBoxRow): # datetime now = datetime.datetime.now(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(xalign=1) datetime_label.set_markup('' + timeago.format(post_date_local, now) + '') + #datetime_label.set_markup('' + post_date_local.strftime("%Y-%m-%d %H:%M") + '') # post menu self.menu_button = Gtk.Button.new_from_icon_name('view-more-symbolic', 1) @@ -441,10 +441,17 @@ class PostItem(Gtk.ListBoxRow): self.name_box.pack_start(self.name, True, True, 0) self.name_box.pack_start(self.username, True, True, 0) + # right side container + self.r_box = Gtk.Box(orientation='vertical') + self.rc_box = Gtk.Box(orientation='horizontal') + self.r_box.pack_start(datetime_label, False, False, 0) + self.r_box.pack_start(self.rc_box, False, False, 10) + # header container self.h_box = Gtk.Box(orientation='horizontal') 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_end(self.r_box, False, False, 10) #self.h_box.pack_end(source_label, False, False, 10) #self.h_box.pack_end(datetime_label, False, False, 10) @@ -492,28 +499,28 @@ class PostItem(Gtk.ListBoxRow): self.f_box.pack_end(repost_button, False, False, 5) self.f_box.pack_end(bookmark_button, False, False, 5) self.f_box.pack_end(reply_button, False, False, 5) - self.f_box.pack_start(datetime_label, False, False, 5) - self.f_box.pack_start(source_label, False, False, 0) + #self.f_box.pack_start(datetime_label, False, False, 5) + self.f_box.pack_start(source_label, False, False, 10) # counters - pad = Gtk.Label(label="") - self.h_box.pack_end(pad, False, False, 5) + #pad = Gtk.Label(label="") + #self.rc_box.pack_end(pad, False, False, 5) if post.id != int(post.thread_id): thread_icon = Gtk.Image.new_from_icon_name("user-available-symbolic", Gtk.IconSize.SMALL_TOOLBAR) - self.h_box.pack_end(thread_icon, False, False, 5) + self.rc_box.pack_end(thread_icon, False, False, 5) if post.counts.bookmarks > 0: if post.you_bookmarked: star_icon = Gtk.Image.new_from_icon_name("starred-symbolic", Gtk.IconSize.SMALL_TOOLBAR) else: star_icon = Gtk.Image.new_from_icon_name("non-starred-symbolic", Gtk.IconSize.SMALL_TOOLBAR) star_count = Gtk.Label(label=post.counts.bookmarks) - self.h_box.pack_end(star_icon, False, False, 5) - self.h_box.pack_end(star_count, False, False, 0) + self.rc_box.pack_end(star_count, False, False, 0) + self.rc_box.pack_end(star_icon, False, False, 5) if post.counts.reposts > 0: repost_icon = Gtk.Image.new_from_icon_name("media-playlist-repeat-symbolic", Gtk.IconSize.SMALL_TOOLBAR) repost_count = Gtk.Label(label=post.counts.reposts) - self.h_box.pack_end(repost_icon, False, False, 5) - self.h_box.pack_end(repost_count, False, False, 0) + self.rc_box.pack_end(repost_count, False, False, 0) + self.rc_box.pack_end(repost_icon, False, False, 5) #postid = Gtk.Label(label=post.id) #self.f_box.pack_start(postid, False, False, 5)