diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index e94b69cd..05610d7d 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -1529,7 +1529,7 @@ class MainAppWindow: data = r[9].split("_") ids["{}:{}:{}".format(data[3], data[5], data[6])] = r[9] - dialog = PiconsDialog(self._main_window, self._options, ids, Profile(self._profile)) + dialog = PiconsDialog(self._main_window, self._options, ids, self._sat_positions, Profile(self._profile)) dialog.show() self.update_picons() diff --git a/app/ui/picons_dialog.glade b/app/ui/picons_dialog.glade index ddbd0885..95f819b3 100644 --- a/app/ui/picons_dialog.glade +++ b/app/ui/picons_dialog.glade @@ -73,18 +73,43 @@ Author: Dmitriy Yefremov - - - - - + + True + False + edit-undo - + + True + False + + + gtk-select-all + True + False + True + True + + + + + + Remove selection + True + False + remove_selection_image + False + + + + + + + @@ -328,7 +353,7 @@ Author: Dmitriy Yefremov True True - satellites_liststore + satellites_list_store False 0 True @@ -351,9 +376,25 @@ Author: Dmitriy Yefremov + False Url + + 1 + + + + + + + False + Pos + + + + 2 + @@ -423,6 +464,8 @@ Author: Dmitriy Yefremov True True providers_list_store + + @@ -476,6 +519,7 @@ Author: Dmitriy Yefremov + False ONID @@ -487,6 +531,7 @@ Author: Dmitriy Yefremov + False SSID diff --git a/app/ui/picons_downloader.py b/app/ui/picons_downloader.py index ae5035fd..af2cab63 100644 --- a/app/ui/picons_downloader.py +++ b/app/ui/picons_downloader.py @@ -14,12 +14,13 @@ from app.properties import Profile from app.tools.satellites import SatellitesParser, SatelliteSource from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, TEXT_DOMAIN, TV_ICON from .dialogs import show_dialog, DialogType, get_message -from .main_helper import update_entry_data, append_text_to_tview, scroll_to +from .main_helper import update_entry_data, append_text_to_tview, scroll_to, on_popup_menu class PiconsDialog: - def __init__(self, transient, options, picon_ids, profile=Profile.ENIGMA_2): + def __init__(self, transient, options, picon_ids, sat_positions, profile=Profile.ENIGMA_2): self._picon_ids = picon_ids + self._sat_positions = sat_positions self._TMP_DIR = tempfile.gettempdir() + "/" self._BASE_URL = "www.lyngsat.com/packages/" self._PATTERN = re.compile("^https://www\.lyngsat\.com/[\w-]+\.html$") @@ -40,7 +41,10 @@ class PiconsDialog: "on_notebook_switch_page": self.on_notebook_switch_page, "on_convert": self.on_convert, "on_satellites_view_realize": self.on_satellites_view_realize, - "on_satellite_selection": self.on_satellite_selection} + "on_satellite_selection": self.on_satellite_selection, + "on_select_all": self.on_select_all, + "on_unselect_all": self.on_unselect_all, + "on_popup_menu": on_popup_menu} builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) @@ -106,9 +110,12 @@ class PiconsDialog: def append_satellites(self, model, sats): for sat in sats: - s = "{} ({})".format(sat[0], sat[1]) + pos = sat[1] + name = "{} ({})".format(sat[0], pos) + pos = "{}{}".format("-" if pos[-1] == "W" else "", pos[:-1]) if not self._terminate and model: - model.append((s, sat[3])) + if pos in self._sat_positions: + model.append((name, sat[3], pos)) yield True def on_satellite_selection(self, view, path, column): @@ -262,6 +269,15 @@ class PiconsDialog: model.set_value(model.get_iter(path), 7, not toggle.get_active()) self.update_receive_button_state() + def on_select_all(self, view): + self.update_selection(view, True) + + def on_unselect_all(self, view): + self.update_selection(view, False) + + def update_selection(self, view, select): + view.get_model().foreach(lambda mod, path, itr: mod.set_value(itr, 7, select)) + def on_url_changed(self, entry): suit = self._PATTERN.search(entry.get_text()) entry.set_name("GtkEntry" if suit else "digit-entry")