Skip to content

Commit 959e000

Browse files
committed
Update gnome comments ui
1 parent 9c423df commit 959e000

File tree

1 file changed

+52
-27
lines changed

1 file changed

+52
-27
lines changed

src/MainWindow.py

+52-27
Original file line numberDiff line numberDiff line change
@@ -3623,39 +3623,64 @@ def setGnomeComments(self, comments, appname="", lang=""):
36233623
else:
36243624
self.gcMoreButtonEN.set_visible(False)
36253625
for comment in comments:
3626-
if "rating" and "user_display" and "date_created" and "summary" and "description" in comment:
3626+
if "rating" and "user_display" and "date_created" and "summary" and "description" and "distro" and "version" in comment:
36273627
if self.isCommentClean(comment["summary"]) and self.isCommentClean(
36283628
comment["description"]) and self.isCommentClean(comment["user_display"]):
36293629
self.setGnomeCommentStar(comment["rating"] / 20)
3630-
label1 = Gtk.Label.new()
3631-
label1.set_markup("<b>" + str(comment["user_display"]) + "</b>")
3632-
labeldate = Gtk.Label.new()
3633-
labeldate.set_text(str(datetime.fromtimestamp(comment["date_created"])))
3634-
box1 = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 3)
3635-
box1.pack_start(self.gcs1, False, True, 0)
3636-
box1.pack_start(self.gcs2, False, True, 0)
3637-
box1.pack_start(self.gcs3, False, True, 0)
3638-
box1.pack_start(self.gcs4, False, True, 0)
3639-
box1.pack_start(self.gcs5, False, True, 0)
3640-
box1.pack_start(label1, False, True, 10)
3641-
box1.pack_end(labeldate, False, True, 0)
3642-
label2 = Gtk.Label.new()
3643-
label2.set_text(str(comment["summary"]) + "\n" + str(comment["description"]))
3644-
label2.set_selectable(True)
3645-
label2.set_line_wrap(True)
3646-
label2.set_line_wrap_mode(2) # WORD_CHAR
3647-
box2 = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 3)
3648-
box2.pack_start(label2, False, True, 0)
3649-
hsep = Gtk.HSeparator.new()
3650-
box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 3)
3651-
box.pack_start(box1, False, True, 5)
3652-
box.pack_start(box2, False, True, 5)
3653-
box.pack_start(hsep, False, True, 0)
3630+
3631+
label_author = Gtk.Label.new()
3632+
label_author.set_markup("<b>{}</b>".format(comment["user_display"]))
3633+
label_author.set_selectable(True)
3634+
3635+
label_date = Gtk.Label.new()
3636+
label_date.set_markup("{}".format(datetime.fromtimestamp(comment["date_created"])))
3637+
label_date.set_selectable(True)
3638+
3639+
label_distro = Gtk.Label.new()
3640+
label_distro.set_markup("<small>{}: {}</small>".format(_("Distro"), comment["distro"]))
3641+
label_distro.set_selectable(True)
3642+
label_distro.props.halign = Gtk.Align.START
3643+
3644+
label_appversion = Gtk.Label.new()
3645+
label_appversion.set_markup(
3646+
"<small>{}: {}</small>".format(_("App Version"), comment["version"]))
3647+
label_appversion.set_selectable(True)
3648+
label_appversion.props.halign = Gtk.Align.START
3649+
3650+
hbox_top = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
3651+
hbox_top.set_margin_top(8)
3652+
hbox_top.pack_start(self.gcs1, False, False, 0)
3653+
hbox_top.pack_start(self.gcs2, False, False, 0)
3654+
hbox_top.pack_start(self.gcs3, False, False, 0)
3655+
hbox_top.pack_start(self.gcs4, False, False, 0)
3656+
hbox_top.pack_start(self.gcs5, False, False, 0)
3657+
hbox_top.pack_start(label_author, False, False, 8)
3658+
hbox_top.pack_end(label_date, False, False, 0)
3659+
3660+
label_comment = Gtk.Label.new()
3661+
label_comment.set_text("{}\n{}".format(comment["summary"], comment["description"]))
3662+
label_comment.set_selectable(True)
3663+
label_comment.set_line_wrap(True)
3664+
label_comment.set_line_wrap_mode(2) # WORD_CHAR
3665+
label_comment.props.halign = Gtk.Align.START
3666+
3667+
sep = Gtk.VSeparator.new()
3668+
sep.set_margin_top(8)
3669+
3670+
main_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 8)
3671+
main_vbox.pack_start(hbox_top, False, False, 0)
3672+
main_vbox.pack_start(label_distro, False, False, 0)
3673+
main_vbox.pack_start(label_appversion, False, False, 0)
3674+
main_vbox.pack_start(label_comment, False, False, 0)
3675+
main_vbox.pack_start(sep, False, False, 0)
3676+
3677+
row = Gtk.ListBoxRow()
3678+
row.add(main_vbox)
36543679

36553680
if lang == "tr":
3656-
self.GnomeCommentListBoxTR.add(box)
3681+
self.GnomeCommentListBoxTR.add(row)
36573682
elif lang == "en":
3658-
self.GnomeCommentListBoxEN.add(box)
3683+
self.GnomeCommentListBoxEN.add(row)
36593684
else:
36603685
try:
36613686
self.Logger.info("Comment is not clean, app_id: {}, review_id : {}".format(

0 commit comments

Comments
 (0)