minor corrections for EPG dialog

This commit is contained in:
DYefremov
2022-01-24 19:17:11 +03:00
parent a6904360f9
commit ed3aea42f5
2 changed files with 55 additions and 38 deletions

View File

@@ -812,44 +812,61 @@ Author: Dmitriy Yefremov
</packing>
</child>
<child>
<object class="GtkSearchBar" id="filter_bar">
<object class="GtkBox" id="filter_bar">
<property name="can_focus">False</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="filter_box">
<object class="GtkSwitch" id="filter_auto_switch">
<property name="name">filter_switch</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Automatically set the name selected in the bouquet list.</property>
<property name="valign">center</property>
<property name="margin_right">15</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="filter_auto_label">
<property name="name">filter_auto_label</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkSearchEntry" id="filter_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-replace-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<signal name="search-changed" handler="on_filter_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="filter_auto_button">
<property name="label" translatable="yes">Auto</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Automatically set the name selected in the bouquet list.</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<property name="valign">center</property>
<property name="label" translatable="yes">Auto</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="center">
<object class="GtkSearchEntry" id="filter_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="primary_icon_name">edit-find-replace-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<signal name="search-changed" handler="on_filter_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>

View File

@@ -37,7 +37,7 @@ from urllib.error import HTTPError, URLError
from gi.repository import GLib
from app.commons import run_idle, run_task
from app.commons import run_idle, run_task, run_with_delay
from app.connections import download_data, DownloadType
from app.eparser.ecommons import BouquetService, BqServiceType
from app.settings import SEP
@@ -112,9 +112,8 @@ class EpgDialog:
self._xml_download_progress_bar = builder.get_object("xml_download_progress_bar")
# Filter
self._filter_bar = builder.get_object("filter_bar")
self._filter_bar.bind_property("search-mode-enabled", self._filter_bar, "visible")
self._filter_entry = builder.get_object("filter_entry")
self._filter_auto_button = builder.get_object("filter_auto_button")
self._filter_auto_switch = builder.get_object("filter_auto_switch")
self._services_filter_model = builder.get_object("services_filter_model")
self._services_filter_model.set_visible_func(self.services_filter_function)
# Info
@@ -337,7 +336,7 @@ class EpgDialog:
self.on_assign_ref()
def on_bq_cursor_changed(self, view):
if self._filter_bar.get_visible() and self._filter_auto_button.get_active():
if self._filter_bar.get_visible() and self._filter_auto_switch.get_active():
path, column = view.get_cursor()
model = view.get_model()
if path:
@@ -428,10 +427,11 @@ class EpgDialog:
row[Column.FAV_TOOLTIP] = f"{get_message('Service reference')}: {':'.join(fav_id_data[:10])}\n{src}"
def on_filter_toggled(self, button):
self._filter_bar.set_search_mode(button.get_active())
self._filter_bar.set_visible(button.get_active())
if not button.get_active():
self._filter_entry.set_text("")
@run_with_delay(1)
def on_filter_changed(self, entry):
self._services_filter_model.refilter()