swap client source and datetime fields
This commit is contained in:
parent
36bef985f4
commit
b0515a5e4a
1 changed files with 24 additions and 16 deletions
|
@ -344,31 +344,41 @@ class PostItem(Gtk.ListBoxRow):
|
||||||
super(Gtk.ListBoxRow, self).__init__()
|
super(Gtk.ListBoxRow, self).__init__()
|
||||||
self.post = post
|
self.post = post
|
||||||
|
|
||||||
self.box = Gtk.Box(orientation='vertical')
|
# Avatar
|
||||||
self.add(self.box)
|
#self.avatar = Handy.Avatar(size=48, text=post.user.username, show_initials=True)
|
||||||
|
#self.avatar.set_image_load_func(self.get_avatar, post.user.content.avatar_image)
|
||||||
|
self.avatar = Gtk.Image.new_from_pixbuf(self.get_avatar(48, post.user.content.avatar_image))
|
||||||
|
|
||||||
|
# Source
|
||||||
|
self.source = Gtk.Label(label=post.source.name, xalign=1)
|
||||||
|
|
||||||
|
self.username = Gtk.Label(label="@" + post.user.username, xalign=0)
|
||||||
|
self.name = Gtk.Label(xalign=0)
|
||||||
|
if 'name' in post.user:
|
||||||
|
self.name.set_markup(f"<b>{post.user.name}</b>")
|
||||||
|
|
||||||
|
# datetime
|
||||||
|
post_date_local = post.created_at.astimezone(tzlocal())
|
||||||
|
datetime_label = Gtk.Label(label=post_date_local.strftime("%Y-%m-%d %H:%M"), xalign=1, yalign=0)
|
||||||
|
|
||||||
# post menu
|
# post menu
|
||||||
self.menu_button = Gtk.Button.new_from_icon_name('view-more-symbolic', 1)
|
self.menu_button = Gtk.Button.new_from_icon_name('view-more-symbolic', 1)
|
||||||
self.menu_button.connect('clicked', self.show_menu)
|
self.menu_button.connect('clicked', self.show_menu)
|
||||||
|
|
||||||
|
self.box = Gtk.Box(orientation='vertical')
|
||||||
|
self.add(self.box)
|
||||||
|
|
||||||
# name container
|
# name container
|
||||||
self.name_box = Gtk.Box(orientation='vertical')
|
self.name_box = Gtk.Box(orientation='vertical')
|
||||||
self.username = Gtk.Label(label="@" + post.user.username, xalign=0)
|
|
||||||
self.name = Gtk.Label(xalign=0)
|
|
||||||
if 'name' in post.user:
|
|
||||||
self.name.set_markup(f"<b>{post.user.name}</b>")
|
|
||||||
self.name_box.pack_start(self.name, True, True, 0)
|
self.name_box.pack_start(self.name, True, True, 0)
|
||||||
self.name_box.pack_start(self.username, True, True, 0)
|
self.name_box.pack_start(self.username, True, True, 0)
|
||||||
|
|
||||||
# header container
|
# header container
|
||||||
self.h_box = Gtk.Box(orientation='horizontal')
|
self.h_box = Gtk.Box(orientation='horizontal')
|
||||||
#self.avatar = Handy.Avatar(size=48, text=post.user.username, show_initials=True)
|
|
||||||
#self.avatar.set_image_load_func(self.get_avatar, post.user.content.avatar_image)
|
|
||||||
self.avatar = Gtk.Image.new_from_pixbuf(self.get_avatar(48, post.user.content.avatar_image))
|
|
||||||
self.source = Gtk.Label(label=post.source.name, xalign=1, yalign=0)
|
|
||||||
self.h_box.pack_start(self.avatar, False, False, 10)
|
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, 10)
|
#self.h_box.pack_end(self.source, False, False, 10)
|
||||||
|
self.h_box.pack_end(datetime_label, False, False, 10)
|
||||||
|
|
||||||
# content container
|
# content container
|
||||||
self.c_box = Gtk.Box(orientation='vertical')
|
self.c_box = Gtk.Box(orientation='vertical')
|
||||||
|
@ -376,7 +386,7 @@ class PostItem(Gtk.ListBoxRow):
|
||||||
self.content = Gtk.Label(wrap=True, xalign=0)
|
self.content = Gtk.Label(wrap=True, xalign=0)
|
||||||
# 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_text(post.content.text)
|
||||||
self.t_box.pack_start(self.content, False, False, 10)
|
self.t_box.pack_start(self.content, False, False, 10)
|
||||||
self.c_box.pack_start(self.t_box, False, False, 10)
|
self.c_box.pack_start(self.t_box, False, False, 10)
|
||||||
|
|
||||||
|
@ -403,11 +413,9 @@ class PostItem(Gtk.ListBoxRow):
|
||||||
# footer container
|
# footer container
|
||||||
self.f_box = Gtk.Box(orientation='horizontal')
|
self.f_box = Gtk.Box(orientation='horizontal')
|
||||||
self.f_box.pack_end(self.menu_button, False, False, 10)
|
self.f_box.pack_end(self.menu_button, False, False, 10)
|
||||||
|
#self.f_box.pack_end(datetime_label, False, False, 10)
|
||||||
|
self.f_box.pack_end(self.source, False, False, 10)
|
||||||
|
|
||||||
# datetime
|
|
||||||
post_date_local = post.created_at.astimezone(tzlocal())
|
|
||||||
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, 10)
|
|
||||||
pad = Gtk.Label(label="")
|
pad = Gtk.Label(label="")
|
||||||
self.f_box.pack_start(pad, False, False, 5)
|
self.f_box.pack_start(pad, False, False, 5)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue