From 870327816c0574be252d0c694211effb8dc4c1c2 Mon Sep 17 00:00:00 2001 From: heliguy4599 Date: Sat, 7 Oct 2023 20:22:27 -0400 Subject: [PATCH] Add pills and margins Make installed type text and EOL text be inside of pills to look better and more readable Increase margins at the top and bottom of the main list --- src/meson.build | 1 + src/orphans_window.py | 3 ++- src/remotes.py | 4 ++-- src/style.css | 21 +++++++++++++++++++++ src/warehouse.gresource.xml | 1 + src/window.blp | 4 ++-- src/window.py | 21 ++++++++------------- 7 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 src/style.css diff --git a/src/meson.build b/src/meson.build index 1ae65df..061b46b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -51,6 +51,7 @@ warehouse_sources = [ 'filter_window.py', 'filter.blp', 'popular_remotes_window.py', + 'style.css', ] install_data(warehouse_sources, install_dir: moduledir) diff --git a/src/orphans_window.py b/src/orphans_window.py index 40967f7..6a8be3d 100644 --- a/src/orphans_window.py +++ b/src/orphans_window.py @@ -117,8 +117,9 @@ class OrphansWindow(Adw.Window): for i in range(len(self.host_remotes)): remote_row = Adw.ActionRow(title=self.host_remotes[i][1]) - label = Gtk.Label(label=_("{} wide").format(self.host_remotes[i][7])) + label = Gtk.Label(label=_("{} wide").format(self.host_remotes[i][7]), valign=Gtk.Align.CENTER) remote_select = Gtk.CheckButton() + label.add_css_class("installType") remote_select_buttons.append(remote_select) remote_select.connect("toggled", remote_select_handler) remote_row.set_activatable_widget(remote_select) diff --git a/src/remotes.py b/src/remotes.py index 09fb477..5ae7f75 100644 --- a/src/remotes.py +++ b/src/remotes.py @@ -77,8 +77,8 @@ class RemotesWindow(Adw.Window): if title == "-": remote_row.set_title(name) self.remotes_list.append(remote_row) - label = Gtk.Label(label=("{} wide").format(install_type)) - label.add_css_class("subtitle") + label = Gtk.Label(label=("{} wide").format(install_type), valign=Gtk.Align.CENTER) + label.add_css_class("installType") remote_row.add_suffix(label) copy_button = Gtk.Button(icon_name="edit-copy-symbolic", valign=Gtk.Align.CENTER, tooltip_text=_("Copy remote name")) copy_button.add_css_class("flat") diff --git a/src/style.css b/src/style.css new file mode 100644 index 0000000..9e4c064 --- /dev/null +++ b/src/style.css @@ -0,0 +1,21 @@ +.eolText { + background-color: #ff0000b7; + color: #fafafa; + border-radius: 1000px; + padding-left: 10px; + padding-right: 10px; + padding-top: 5px; + padding-bottom: 5px; + font-weight: bold; +} + +.installType { + background-color: #0077ffd0; + color: #fafafa; + border-radius: 1000px; + padding-left: 10px; + padding-right: 10px; + padding-top: 5px; + padding-bottom: 5px; + font-weight: bold; + } \ No newline at end of file diff --git a/src/warehouse.gresource.xml b/src/warehouse.gresource.xml index 5427eaf..f8f455b 100644 --- a/src/warehouse.gresource.xml +++ b/src/warehouse.gresource.xml @@ -5,6 +5,7 @@ orphans.ui filter.ui popular_remotes.ui + style.css gtk/help-overlay.ui diff --git a/src/window.blp b/src/window.blp index c0571e5..7f57ad2 100644 --- a/src/window.blp +++ b/src/window.blp @@ -59,8 +59,8 @@ template WarehouseWindow : Adw.ApplicationWindow { vexpand: true; Adw.Clamp{ ListBox flatpaks_list_box { - margin-top: 6; - margin-bottom: 24; + margin-top: 18; + margin-bottom: 18; margin-start: 12; margin-end: 12; hexpand: true; diff --git a/src/window.py b/src/window.py index 77c729c..a834cfa 100644 --- a/src/window.py +++ b/src/window.py @@ -120,7 +120,7 @@ class WarehouseWindow(Adw.ApplicationWindow): type_arr.append(app_type) self.removeRow(self.flatpak_rows[i]) task = Gio.Task.new(None, None, self.uninstallFlatpakCallback) - task.run_in_thread(lambda _task, _obj, _data, _cancellable, ref_arr=ref_arr, id_arr=id_arr, type_arr=type_arr ,should_trash=should_trash: self.uninstallFlatpakThread(ref_arr, id_arr, type_arr, should_trash)) + task.run_in_thread(lambda _task, _obj, _data, _cancellable, ref_arr=ref_arr, id_arr=id_arr, type_arr=type_arr, should_trash=should_trash: self.uninstallFlatpakThread(ref_arr, id_arr, type_arr, should_trash)) def batchUninstallButtonHandler(self, _widget): self.should_pulse = True @@ -287,16 +287,14 @@ class WarehouseWindow(Adw.ApplicationWindow): flatpak_row.set_subtitle(app_id) if "eol" in self.host_flatpaks[index][12]: - eol_runtime_label = Gtk.Label(label=_("Flatpak EOL"), tooltip_text=_("This Flatpak has reached its End of Life and will not receive any security updates")) - eol_runtime_label.add_css_class("subtitle") - eol_runtime_label.add_css_class("error") - flatpak_row.add_suffix(eol_runtime_label) + eol_app_label = Gtk.Label(label=_("Flatpak EOL"), valign=Gtk.Align.CENTER, tooltip_text=_("This Flatpak has reached its End of Life and will not receive any security updates")) + eol_app_label.add_css_class("eolText") + flatpak_row.add_suffix(eol_app_label) if self.host_flatpaks[index][13] in self.eol_list: - eol_app_label = Gtk.Label(label=_("Runtime EOL"), tooltip_text=_("The runtime used by this app has reached its End of Life and will not receive any security updates")) - eol_app_label.add_css_class("subtitle") - eol_app_label.add_css_class("error") - flatpak_row.add_suffix(eol_app_label) + eol_runtime_label = Gtk.Label(label=_("Runtime EOL"), valign=Gtk.Align.CENTER, tooltip_text=_("The runtime used by this app has reached its End of Life and will not receive any security updates")) + eol_runtime_label.add_css_class("eolText") + flatpak_row.add_suffix(eol_runtime_label) properties_button = Gtk.Button(icon_name="info-symbolic", valign=Gtk.Align.CENTER, tooltip_text=_("View Properties")) properties_button.add_css_class("flat") @@ -352,10 +350,7 @@ class WarehouseWindow(Adw.ApplicationWindow): self.in_batch_mode = widget.get_active() self.batch_mode_bar.set_revealed(widget.get_active()) - if widget.get_active(): - self.flatpaks_list_box.set_margin_bottom(6) - else: - self.flatpaks_list_box.set_margin_bottom(24) + if not widget.get_active(): self.batch_select_all_button.set_active(False) def batchActionsEnable(self, should_enable):