diff --git a/.editorconfig b/.editorconfig index a1317354..2f3832b6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,5 +15,8 @@ indent_size = 4 [*.md] trim_trailing_whitespace = false +[*.blp] +indent_size = 2 + [*.yml] indent_size = 2 diff --git a/data/ui/builtin_preset_row.blp b/data/ui/builtin_preset_row.blp index beb4602e..96a2a96a 100644 --- a/data/ui/builtin_preset_row.blp +++ b/data/ui/builtin_preset_row.blp @@ -2,12 +2,16 @@ using Gtk 4.0; using Adw 1; template GradienceBuiltinPresetRow : Adw.ActionRow { - subtitle: _("Made by @GradienceTeam"); + subtitle: _("Made by @GradienceTeam"); + [suffix] Button apply_button { - valign: center; - icon-name: "checkmark-large-symbolic"; - tooltip-text: _("Apply Preset"); - clicked => on_apply_button_clicked(); + valign: center; + icon-name: "checkmark-large-symbolic"; + tooltip-text: _("Apply Preset"); + clicked => on_apply_button_clicked(); + styles [ + "flat", + ] } } diff --git a/data/ui/error.blp b/data/ui/error.blp index e87e5418..004339e4 100644 --- a/data/ui/error.blp +++ b/data/ui/error.blp @@ -8,20 +8,24 @@ template GradienceError : ListBoxRow { margin-bottom: 6; margin-start: 12; margin-end: 12; + Box { orientation: horizontal; spacing: 6; + Label error-label { + halign: start; + justify: left; styles ["heading", "error"] - halign: start; - justify: left; } + Label element-label { - styles ["dim-label", "error"] halign: start; justify: left; + styles ["dim-label", "error"] } } + Label line-label { halign: start; wrap: true; diff --git a/data/ui/explore_preset_row.blp b/data/ui/explore_preset_row.blp index 3cc0239b..e4fe0c6a 100644 --- a/data/ui/explore_preset_row.blp +++ b/data/ui/explore_preset_row.blp @@ -2,41 +2,39 @@ using Gtk 4.0; using Adw 1; template GradienceExplorePresetRow : Adw.ActionRow { + Box { + spacing: 6; - Box { - spacing: 6; + //Label badge { + // valign: center; + // label: _("Unknown"); - //Label badge { - // valign: center; - // label: _("Unknown"); + // styles [ + // "tag", + // "caption", + // ] + //} - // styles [ - // "tag", - // "caption", - // ] - //} + Button apply_button { + valign: center; + icon-name: "checkmark-large-symbolic"; + tooltip-text: _("Download and Apply"); + clicked => on_apply_button_clicked(); - Button apply_button { - valign: center; - icon-name: "checkmark-large-symbolic"; - tooltip-text: _("Download and Apply"); - clicked => on_apply_button_clicked(); - - styles [ - "flat", - ] - } - Button download_button { - valign: center; - icon-name: "download-symbolic"; - tooltip-text: _("Download Only"); - clicked => on_download_button_clicked(); - - styles [ - "flat", - ] - } + styles [ + "flat", + ] } + Button download_button { + valign: center; + icon-name: "download-symbolic"; + tooltip-text: _("Download Only"); + clicked => on_download_button_clicked(); + styles [ + "flat", + ] + } + } } diff --git a/data/ui/no_plugin_pref.blp b/data/ui/no_plugin_pref.blp index dd3e51bd..6b082c5c 100644 --- a/data/ui/no_plugin_pref.blp +++ b/data/ui/no_plugin_pref.blp @@ -2,34 +2,30 @@ using Gtk 4.0; using Adw 1; template GradienceNoPluginPrefWindow: Adw.Window { - title: _("Plugin Preferences"); - modal: true; - default-width: 400; - default-height: 400; - resizable: true; - deletable: true; + title: _("Plugin Preferences"); + modal: true; + default-width: 400; + default-height: 400; + resizable: true; + deletable: true; - Adw.Leaflet leaflet { - can-unfold: false; + Adw.Leaflet leaflet { + can-unfold: false; - Gtk.Box main_view { - orientation: vertical; + Gtk.Box main_view { + orientation: vertical; - Adw.HeaderBar titlebar { - styles ["flat"] - } - - - Adw.StatusPage { - name: "empty"; - title: _("No Preferences"); - icon-name: "action-unavailable-symbolic"; - - description: _("This plugin doesn't have any preferences."); - } - - } - } + Adw.HeaderBar titlebar { + styles ["flat"] + } + Adw.StatusPage { + name: "empty"; + icon-name: "action-unavailable-symbolic"; + title: _("No Preferences"); + description: _("This plugin doesn't have any preferences."); + } + } } +} diff --git a/data/ui/plugin_row.blp b/data/ui/plugin_row.blp index f8bccdb6..57bb500c 100644 --- a/data/ui/plugin_row.blp +++ b/data/ui/plugin_row.blp @@ -24,6 +24,4 @@ template GradiencePluginRow : Adw.ActionRow { tooltip-text: _("Remove Plugin"); clicked => on_remove_plugin_clicked(); } - - } diff --git a/data/ui/preferences.blp b/data/ui/preferences.blp index e9b0759a..ab7dd363 100644 --- a/data/ui/preferences.blp +++ b/data/ui/preferences.blp @@ -2,72 +2,80 @@ using Gtk 4.0; using Adw 1; template GradiencePreferencesWindow : Adw.PreferencesWindow { - title: _("Preferences"); - default-height: 400; - default-width: 600; - modal: true; + title: _("Preferences"); + default-height: 400; + default-width: 600; + modal: true; - Adw.PreferencesPage { - Adw.PreferencesGroup flatpak_group { - title: _("GTK4 Flatpak Applications"); - Adw.ActionRow { - title: _("Allow GTK4 Flatpak Applications Theming"); - subtitle: _("Override Flatpak permissions for current user to allow GTK4 Flatpak applications to access custom themes."); - activatable-widget: allow_gtk4_flatpak_theming_user; - Gtk.Switch allow_gtk4_flatpak_theming_user { - valign: center; - } - } - Adw.ActionRow { - visible: false; - title: _("Allow GTK4 Flatpak Applications Theming (System)"); - subtitle: _("Override Flatpak permissions for all users to allow GTK4 Flatpak applications to access custom themes. (Requires root access)"); - activatable-widget: allow_gtk4_flatpak_theming_global; - Gtk.Switch allow_gtk4_flatpak_theming_global { - valign: center; - } - } - } - Adw.PreferencesGroup gtk3_flatpak_group { - title: _("GTK3 Flatpak Applications"); - description: _("Remember to install adw-gtk3 theme (as a Flatpak package) in order to get custom presets working in GTK3 Flatpak applications."); - Adw.ActionRow { - title: _("Allow GTK3 Flatpak theming"); - subtitle: _("Override Flatpak permissions for current user to allow GTK3 Flatpak applications to access adw-gtk3 theme."); - activatable-widget: allow_gtk3_flatpak_theming_user; - Gtk.Switch allow_gtk3_flatpak_theming_user { - valign: center; - } - } - Adw.ActionRow { - visible: false; - title: _("GTK3 Flatpak Applications (System)"); - subtitle: _("Override Flatpak permissions for all users to allow GTK3 Flatpak applications to access adw-gtk3 theme. (Requires root access)"); - activatable-widget: allow_gtk3_flatpak_theming_global; - Gtk.Switch allow_gtk3_flatpak_theming_global { - valign: center; - } - } - } - Adw.PreferencesGroup custom_repository_group { - visible: false; - title: _("Custom Preset Repositories"); - Adw.ActionRow { - title: _("Custom repository URL address"); - Gtk.Box { - styles ["linked"] - orientation: horizontal; + Adw.PreferencesPage { + Adw.PreferencesGroup flatpak_group { + title: _("GTK4 Flatpak Applications"); - Gtk.Entry custom_repository_entry { - valign: center; - } - - Gtk.Button custom_repository_apply { - valign: center; - icon-name: "checkmark-large-symbolic"; - } - } - } + Adw.ActionRow { + title: _("Allow GTK4 Flatpak Applications Theming"); + subtitle: _("Override Flatpak permissions for current user to allow GTK4 Flatpak applications to access custom themes."); + activatable-widget: allow_gtk4_flatpak_theming_user; + Gtk.Switch allow_gtk4_flatpak_theming_user { + valign: center; } + } + + Adw.ActionRow { + visible: false; + title: _("Allow GTK4 Flatpak Applications Theming (System)"); + subtitle: _("Override Flatpak permissions for all users to allow GTK4 Flatpak applications to access custom themes. (Requires root access)"); + activatable-widget: allow_gtk4_flatpak_theming_global; + Gtk.Switch allow_gtk4_flatpak_theming_global { + valign: center; + } + } } + + Adw.PreferencesGroup gtk3_flatpak_group { + title: _("GTK3 Flatpak Applications"); + description: _("Remember to install adw-gtk3 theme (as a Flatpak package) in order to get custom presets working in GTK3 Flatpak applications."); + + Adw.ActionRow { + title: _("Allow GTK3 Flatpak theming"); + subtitle: _("Override Flatpak permissions for current user to allow GTK3 Flatpak applications to access adw-gtk3 theme."); + activatable-widget: allow_gtk3_flatpak_theming_user; + Gtk.Switch allow_gtk3_flatpak_theming_user { + valign: center; + } + } + + Adw.ActionRow { + visible: false; + title: _("GTK3 Flatpak Applications (System)"); + subtitle: _("Override Flatpak permissions for all users to allow GTK3 Flatpak applications to access adw-gtk3 theme. (Requires root access)"); + activatable-widget: allow_gtk3_flatpak_theming_global; + Gtk.Switch allow_gtk3_flatpak_theming_global { + valign: center; + } + } + } + + Adw.PreferencesGroup custom_repository_group { + visible: false; + title: _("Custom Preset Repositories"); + + Adw.ActionRow { + title: _("Custom repository URL address"); + + Gtk.Box { + styles ["linked"] + orientation: horizontal; + + Gtk.Entry custom_repository_entry { + valign: center; + } + + Gtk.Button custom_repository_apply { + valign: center; + icon-name: "checkmark-large-symbolic"; + } + } + } + } + } } diff --git a/data/ui/preset_row.blp b/data/ui/preset_row.blp index ce6ac4ec..8947b734 100644 --- a/data/ui/preset_row.blp +++ b/data/ui/preset_row.blp @@ -14,10 +14,10 @@ Popover pop_actions { margin-end: 6; Button btn_share { - valign: center; - label: _("Share preset"); - tooltip-text: _("Share Preset"); - styles ["flat"] + valign: center; + label: _("Share preset"); + tooltip-text: _("Share Preset"); + styles ["flat"] } Separator { @@ -30,98 +30,90 @@ Popover pop_actions { } template GradiencePresetRow : Adw.ExpanderRow { - [action] - Button star_button { + [action] + Button star_button { + valign: center; + styles [ + "flat", + ] + } + + [action] + Stack value_stack { + valign: center; + hhomogeneous: false; + interpolate-size: true; + transition-type: crossfade; + + Button apply_button { valign: center; - tooltip-text: _("Add as a Favourite"); + icon-name: "checkmark-large-symbolic"; + tooltip-text: _("Apply Preset"); + clicked => on_apply_button_clicked(); styles [ "flat", ] } + Entry name_entry { + text: "Name"; + changed => on_name_entry_changed(); + } + } - [action] - Stack value_stack { + [action] + ToggleButton name_entry_toggle { + valign: center; + icon-name: "document-edit-symbolic"; + tooltip-text: _("Rename Preset"); + toggled => on_name_entry_toggled(); + styles [ + "flat", + ] + } + + [action] + MenuButton { + valign: center; + popover: pop_actions; + icon-name: "view-more-symbolic"; + tooltip-text: _("More Options"); + styles [ + "flat", + ] + } + + Adw.ActionRow description { + title: _("Description"); + subtitle: _("Sorry, but this preset don't have a description."); + } + + Adw.ActionRow { + [prefix] + Gtk.Box badge_list { + spacing: 6; + margin-start: 6; + margin-end: 6; + + Label no_badges { valign: center; - hhomogeneous: false; - interpolate-size: true; - transition-type: crossfade; - - Button apply_button { - valign: center; - icon-name: "checkmark-large-symbolic"; - tooltip-text: _("Apply Preset"); - clicked => on_apply_button_clicked(); - styles [ - "flat", - ] - } - Entry name_entry { - text: "Name"; - changed => on_name_entry_changed(); - } + label: _("No Badges"); + styles [ + "tag", + "caption", + ] + } } - [action] - ToggleButton name_entry_toggle { - valign: center; - icon-name: "document-edit-symbolic"; - tooltip-text: _("Rename Preset"); - - toggled => on_name_entry_toggled(); - - styles [ - "flat", - ] - } - - [action] - MenuButton { + [suffix] + Button remove_button { valign: center; - popover: pop_actions; - icon-name: "view-more-symbolic"; - tooltip-text: _("More Options"); - styles [ - "flat", - ] + label: _("Remove preset"); + tooltip-text: _("Remove Preset"); + clicked => on_remove_button_clicked(); + styles ["destructive-action"] } - - - Adw.ActionRow description { - title: _("Description"); - subtitle: _("Sorry, but this preset don't have a description."); - } - - Adw.ActionRow { - - [prefix] - Gtk.Box badge_list { - spacing: 6; - margin-start: 6; - margin-end: 6; - - Label no_badges { - valign: center; - label: _("No Badges"); - styles [ - "tag", - "caption", - ] - } - } - - [suffix] - Button remove_button { - valign: center; - label: _("Remove preset"); - tooltip-text: _("Remove Preset"); - clicked => on_remove_button_clicked(); - styles ["destructive-action"] - } - - } - - + } //Gtk.ListBoxRow { // activatable: false; @@ -210,8 +202,4 @@ template GradiencePresetRow : Adw.ExpanderRow { // // } //} - - - - } diff --git a/data/ui/presets_manager_window.blp b/data/ui/presets_manager_window.blp index 9f59c4ef..b2ffb110 100644 --- a/data/ui/presets_manager_window.blp +++ b/data/ui/presets_manager_window.blp @@ -81,20 +81,19 @@ template GradiencePresetWindow : Adw.Window { orientation: vertical; Gtk.Box { - styles ["linked"] + styles ["linked"] - Gtk.SearchEntry search_entry { - hexpand: true; - placeholder-text: _("e.g. \"Pretty Purple\""); - } - - Gtk.DropDown search_dropdown { - model: StringList search_string_list { - strings [_("All")] - }; - } - } + Gtk.SearchEntry search_entry { + hexpand: true; + placeholder-text: _("e.g. \"Pretty Purple\""); + } + Gtk.DropDown search_dropdown { + model: StringList search_string_list { + strings [_("All")] + }; + } + } Gtk.Stack search_stack { Gtk.StackPage { @@ -118,16 +117,16 @@ template GradiencePresetWindow : Adw.Window { Gtk.StackPage { name: "page_empty"; child: Adw.StatusPage { - icon-name: "system-search-symbolic"; - title: _("No Results Found"); + icon-name: "system-search-symbolic"; + title: _("No Results Found"); }; } Gtk.StackPage { name: "page_offline"; child: Adw.StatusPage { - icon-name: "network-wireless-offline-symbolic"; - title: _("Offline"); + icon-name: "network-wireless-offline-symbolic"; + title: _("Offline"); }; } } diff --git a/data/ui/repo_row.blp b/data/ui/repo_row.blp index db1b1f0c..3fb007e1 100644 --- a/data/ui/repo_row.blp +++ b/data/ui/repo_row.blp @@ -9,5 +9,4 @@ template GradienceRepoRow : Adw.ActionRow { tooltip-text: _("Remove Preset"); clicked => on_remove_button_clicked(); } - } diff --git a/data/ui/window.blp b/data/ui/window.blp index b42532a8..3ed76a2f 100644 --- a/data/ui/window.blp +++ b/data/ui/window.blp @@ -189,6 +189,7 @@ menu presets-menu { Popover errors-popover { ListBox errors-list { selection-mode: none; + [placeholder] Label { margin-top: 6; diff --git a/gradience/preset_row.py b/gradience/preset_row.py index 294758e7..2419f816 100644 --- a/gradience/preset_row.py +++ b/gradience/preset_row.py @@ -84,8 +84,10 @@ class GradiencePresetRow(Adw.ExpanderRow): if name in self.win.app.favourite: self.star_button.set_icon_name("starred-symbolic") + self.star_button.set_tooltip_text(_("Remove from Favourites")) else: self.star_button.set_icon_name("non-starred-symbolic") + self.star_button.set_tooltip_text(_("Add to Favourites")) def on_share_btn_clicked(self, *_args): buglog("share") @@ -97,9 +99,11 @@ class GradiencePresetRow(Adw.ExpanderRow): if self.name in self.win.app.favourite: self.win.app.favourite.remove(self.name) self.star_button.set_icon_name("non-starred-symbolic") + self.star_button.set_tooltip_text(_("Add to Favourites")) else: self.win.app.favourite.add(self.name) self.star_button.set_icon_name("starred-symbolic") + self.star_button.set_tooltip_text(_("Remove from Favourites")) self.win.app.save_favourite() self.win.reload_pref_group() diff --git a/gradience/presets_manager_window.py b/gradience/presets_manager_window.py index 57b2c692..3634ca06 100644 --- a/gradience/presets_manager_window.py +++ b/gradience/presets_manager_window.py @@ -236,14 +236,9 @@ class GradiencePresetWindow(Adw.Window): self.search_stack.set_visible_child_name("page_results") for widget in self.search_results_list: widget.props.visible = False - if not ( - self.search_dropdown.props.selected_item.get_string().lower() - in "all" - ): - if ( - self.search_dropdown.props.selected_item.get_string().lower() - in widget.prefix.lower() - ): + selected_item_name = self.search_dropdown.props.selected_item.get_string().lower() + if not selected_item_name in "all": + if selected_item_name in widget.prefix.lower(): if search_text.lower() in widget.props.title.lower(): widget.props.visible = True items_count += 1