From e405f00856bd01228a789d147daa82e73717c142 Mon Sep 17 00:00:00 2001 From: Peter Eisenmann Date: Mon, 17 Oct 2022 02:05:02 +0200 Subject: [PATCH] progress row: improve performance with ListBoxRow Adw.ActionRow is rather complex and does not perform well with ListBox models. Use simpler ListBoxRow as base to increase performance. --- data/resources/ui/widgets/progress_row.blp | 23 ++++++++++++++++++---- src/ui/widgets.py | 10 ++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/data/resources/ui/widgets/progress_row.blp b/data/resources/ui/widgets/progress_row.blp index a0fa1da..35f030f 100644 --- a/data/resources/ui/widgets/progress_row.blp +++ b/data/resources/ui/widgets/progress_row.blp @@ -1,11 +1,26 @@ using Gtk 4.0; using Adw 1; -template ProgressRow : Adw.ActionRow { +template ProgressRow : ListBoxRow { activatable: true; focusable: true; + child: Box { + hexpand: true; + margin-start: 12; + margin-end: 12; + margin-top: 12; + margin-bottom: 12; + spacing: 6; - Image { - icon-name: "go-next-symbolic"; - } + Label title { + ellipsize: end; + hexpand: true; + xalign: 0; + } + + Image { + halign: end; + icon-name: "go-next-symbolic"; + } + }; } diff --git a/src/ui/widgets.py b/src/ui/widgets.py index 55eff53..22a43be 100644 --- a/src/ui/widgets.py +++ b/src/ui/widgets.py @@ -49,18 +49,20 @@ class PageWrapper(Gtk.Box): return self.content.get_child() @Gtk.Template(resource_path='/com/github/p3732/os-installer/ui/widgets/progress_row.ui') -class ProgressRow(Adw.ActionRow): +class ProgressRow(Gtk.ListBoxRow): __gtype_name__ = 'ProgressRow' - def __init__(self, label, additional_info, **kwargs): + title = Gtk.Template.Child() + + def __init__(self, label, additional_info = None, **kwargs): super().__init__(**kwargs) - self.set_title(label) + self.title.set_label(label) self.info = additional_info def get_label(self): - return self.get_title() + return self.title.get_label() @Gtk.Template(resource_path='/com/github/p3732/os-installer/ui/widgets/selection_row.ui')