From 55bb7b2f45fa6749e77e83670e105614ae783c47 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Thu, 14 Oct 2021 17:37:53 +0300 Subject: [PATCH] picons auto filtering on channel selection (#49) --- app/ui/picons.glade | 117 ++++++++++++++++++++------------------------ app/ui/picons.py | 14 ++++-- 2 files changed, 62 insertions(+), 69 deletions(-) diff --git a/app/ui/picons.glade b/app/ui/picons.glade index e96ce7a2..c336c5e4 100644 --- a/app/ui/picons.glade +++ b/app/ui/picons.glade @@ -529,9 +529,11 @@ Author: Dmitriy Yefremov vertical 5 - + False - + 5 + 5 + True True @@ -540,12 +542,43 @@ Author: Dmitriy Yefremov False + + False + True + 2 + + + + + True + True + Automatically set the name selected in the favorites list. + + + False + True + end + 0 + + + + + True + False + Auto + + + False + True + end + 1 + False True - 0 + 1 @@ -570,41 +603,18 @@ Author: Dmitriy Yefremov True False - + + Filer False - 5 - 5 - - - True - False - Filter - - - 0 - 0 - - - - - True - False - False - False - center - True - - - - 1 - 0 - - + False + False + center + True + False True - end 0 @@ -718,43 +728,20 @@ Author: Dmitriy Yefremov True False - + + Filter False - 5 - 5 - - - True - False - False - False - center - right - True - True - - - - 1 - 0 - - - - - True - False - Filter - - - 0 - 0 - - + False + False + center + right + True + True + False True - end 0 diff --git a/app/ui/picons.py b/app/ui/picons.py index 9d28d171..d4e376c7 100644 --- a/app/ui/picons.py +++ b/app/ui/picons.py @@ -58,6 +58,7 @@ class PiconManager(Gtk.Box): self._app = app self._app.connect("page-changed", self.update_picons_dest) self._app.connect("filter-toggled", self.on_app_filter_toggled) + self._app.fav_view.connect("row-activated", self.on_fav_changed) self._picon_ids = picon_ids self._sat_positions = sat_positions self._BASE_URL = "www.lyngsat.com/packages/" @@ -164,10 +165,11 @@ class PiconManager(Gtk.Box): self._download_source_button.bind_property("visible", self._receive_button, "visible") # Filter. self._filter_bar = builder.get_object("filter_bar") + self._auto_filer_switch = builder.get_object("auto_filer_switch") self._filter_button = builder.get_object("filter_button") - self._filter_bar.bind_property("search-mode-enabled", self._filter_bar, "visible") - self._filter_button.bind_property("active", builder.get_object("src_title_grid"), "visible") - self._filter_button.bind_property("active", builder.get_object("dst_title_grid"), "visible") + self._filter_button.bind_property("active", self._filter_bar, "visible") + self._filter_button.bind_property("active", self._src_filter_button, "visible") + self._filter_button.bind_property("active", self._dst_filter_button, "visible") self._filter_button.bind_property("visible", self._info_check_button, "visible") self._filter_button.bind_property("visible", self._send_button, "visible") self._filter_button.bind_property("visible", self._download_button, "visible") @@ -835,9 +837,13 @@ class PiconManager(Gtk.Box): if app.page is Page.PICONS: self._filter_button.set_active(not self._filter_button.get_active()) + def on_fav_changed(self, view, path, column): + if self._app.page is Page.PICONS and self._auto_filer_switch.get_active(): + model = view.get_model() + self._picons_filter_entry.set_text(model.get_value(model.get_iter(path), Column.FAV_SERVICE)) + def on_filter_toggled(self, button): active = self._filter_button.get_active() - self._filter_bar.set_search_mode(active) if not active: self._picons_filter_entry.set_text("")