diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 5e0a6e8b..bb2f1003 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -2612,6 +2612,10 @@ class Application(Gtk.Application): def bouquets_view(self): return self._bouquets_view + @property + def filter_entry(self): + return self._filter_entry + @property def current_services(self): return self._services diff --git a/app/ui/picons_manager.glade b/app/ui/picons_manager.glade index f52c99dd..a570ab29 100644 --- a/app/ui/picons_manager.glade +++ b/app/ui/picons_manager.glade @@ -352,6 +352,64 @@ Author: Dmitriy Yefremov 5 vertical 5 + + + True + False + select-folder + + + + + + False + True + 0 + + + + + False + Filter services in the main list. + end + end + 5 + + + True + False + end + center + Filter services + + + True + True + 1 + + + + + True + False + end + center + + + + False + True + end + 2 + + + + + False + False + 1 + + False @@ -370,7 +428,7 @@ Author: Dmitriy Yefremov False True - 0 + 2 @@ -392,22 +450,7 @@ Author: Dmitriy Yefremov False True - 1 - - - - - True - False - select-folder - - - - - - False - True - 2 + 3 @@ -452,7 +495,7 @@ Author: Dmitriy Yefremov True True - 3 + 4 diff --git a/app/ui/picons_manager.py b/app/ui/picons_manager.py index ce79e24d..ec121db7 100644 --- a/app/ui/picons_manager.py +++ b/app/ui/picons_manager.py @@ -5,7 +5,7 @@ import subprocess import tempfile from pathlib import Path -from gi.repository import GLib, GdkPixbuf +from gi.repository import GLib, GdkPixbuf, GObject from app.commons import run_idle, run_task, run_with_delay from app.connections import upload_data, DownloadType, download_data, remove_picons @@ -28,6 +28,7 @@ class PiconsDialog: self._POS_PATTERN = re.compile(r"^\d+\.\d+[EW]?$") self._current_process = None self._terminate = False + self._filter_binding = None handlers = {"on_receive": self.on_receive, "on_load_providers": self.on_load_providers, @@ -54,6 +55,7 @@ class PiconsDialog: "on_select_all": self.on_select_all, "on_unselect_all": self.on_unselect_all, "on_filter_toggled": self.on_filter_toggled, + "on_filter_services_switch": self.on_filter_services_switch, "on_popup_menu": on_popup_menu} builder = Gtk.Builder() @@ -103,6 +105,7 @@ class PiconsDialog: self._load_providers_button.bind_property("visible", builder.get_object("download_box_separator"), "visible") self._filter_bar.bind_property("search-mode-enabled", self._filter_bar, "visible") self._explorer_path_button.bind_property("sensitive", builder.get_object("picons_view_sw"), "sensitive") + self._filter_button.bind_property("active", builder.get_object("filter_service_box"), "visible") # Init drag-and-drop self.init_drag_and_drop() # Style @@ -509,6 +512,15 @@ class PiconsDialog: if not active: self._picons_filter_entry.set_text("") + def on_filter_services_switch(self, button, state): + if state: + self._filter_binding = self._picons_filter_entry.bind_property("text", self._app.filter_entry, "text") + self._app.filter_entry.set_text(self._picons_filter_entry.get_text()) + else: + if self._filter_binding: + self._filter_binding.unbind() + self._app.filter_entry.set_text("") + def on_url_changed(self, entry): suit = self._PATTERN.search(entry.get_text()) entry.set_name("GtkEntry" if suit else "digit-entry")