From 7b44df9afd78bc3eb985b225a338ce444dd91097 Mon Sep 17 00:00:00 2001 From: Dmitriy Yefremov Date: Sat, 3 Mar 2018 13:38:33 +0300 Subject: [PATCH] added converter tab for picons dialog --- app/ui/main_app_window.py | 4 +- app/ui/main_window.glade | 1 - app/ui/picons_dialog.glade | 1293 ++++++++++++++++++++---------------- app/ui/picons_dialog.py | 37 +- 4 files changed, 745 insertions(+), 590 deletions(-) diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 91978d96..d7333250 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -510,7 +510,6 @@ class MainAppWindow: self.append_services(data_path) self.update_services_counts(len(self.__services_model)) self.update_picons() - self.__picons_download_tool_button.set_sensitive(len(self.__services_model)) except FileNotFoundError as e: show_dialog(DialogType.ERROR, self.__main_window, getattr(e, "message", str(e)) + "\n\nPlease, download files from receiver or setup your path for read data!") @@ -679,7 +678,6 @@ class MainAppWindow: self.__profile = profile self.clear_current_data() self.update_services_counts() - self.__picons_download_tool_button.set_sensitive(len(self.__services_model)) def on_tree_view_key_release(self, view, event): """ Handling keystrokes """ @@ -873,7 +871,7 @@ class MainAppWindow: data = r[9].split("_") ids["{}:{}:{}".format(data[3], data[5], data[6])] = r[9] - dialog = PiconsDialog(self.__main_window, self.__options.get(self.__profile), ids, Profile(self.__profile)) + dialog = PiconsDialog(self.__main_window, self.__options, ids, Profile(self.__profile)) dialog.show() self.update_picons() diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index 29017921..48d3a23a 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -1090,7 +1090,6 @@ True - False False Picons Picons loader diff --git a/app/ui/picons_dialog.glade b/app/ui/picons_dialog.glade index 0deedac7..cc0de7f4 100644 --- a/app/ui/picons_dialog.glade +++ b/app/ui/picons_dialog.glade @@ -20,7 +20,6 @@ - 480 False Picons download tool False @@ -66,617 +65,749 @@ - + True False - vertical - 2 + 2 + True - + True - False - 2 - True - - - True - True - network-transmit-receive-symbolic - - - 0 - 1 - - - - - True - True - - - 1 - 1 - - - - - True - False - Receiver IP: - - - 0 - 0 - - - - - True - False - Receiver picons path: - - - 1 - 0 - - + True + network-transmit-receive-symbolic - False - True - 0 + 0 + 1 - + True - False - Current picons path: - 0.019999999552965164 + True + + + 1 + 1 + + + + + True + False + Receiver IP: + + + 0 + 0 + + + + + True + False + Receiver picons path: + + + 1 + 0 + + + + + False + True + 0 + + + + + True + False + Current picons path: + 0.019999999552965164 + + + False + True + 1 + + + + + True + True + folder-open-symbolic + False + + + + False + True + 2 + + + + + True + False + 2 + + + True + False + vertical + + + True + False + Picons name format: + + + False + True + 0 + + + + + True + False + 5 + + + Enigma2 (default) + True + True + False + 0 + True + True + neutrino_mp_radio_button + + + False + True + 0 + + + + + Neutrino-MP + True + True + False + 0 + True + True + enigma2_radio_button + + + False + True + 1 + + + + + False + True + 1 + + + + + 0 + 0 + + + + + True + False + vertical + + + True + False + Resize: + + + False + True + 0 + + + + + True + False + + + No(default) + True + True + False + 0 + True + True + resize_100_60_radio_button + + + False + True + 0 + + + + + 220x132 + True + True + False + 0 + True + True + resize_100_60_radio_button + + + False + True + 1 + + + + + 100x60 + True + True + False + 0 + True + True + resize_no_radio_button + + + False + True + 2 + + + + + False + True + 1 + + + + + 2 + 0 + + + + + True + False + 5 + 5 + vertical + + + 1 + 0 + + + + + + False + False + 3 + + + + + True + False + + + False + True + 4 + + + + + True + True + + + + True + False + vertical + 1 + + + 24 + True + False + Satellite url (www.lyngsat.com): + 0.019999999552965164 + + + + False + True + 1 + 0 + + + + + True + True + network-workgroup-symbolic + False + https://www.lyngsat.com/*satellite*.html + url + + + + False + True + 1 + + + + + 150 + True + True + out + + + True + True + True + providers_list_store + + + + + + 15 + Providers + True + 0.5 + + + + 0 + + + + + + 1 + + + + + + + autosize + Position + + + 0.50999999046325684 + True + + + + 2 + + + + + + + False + Url + + + + 3 + + + + + + + False + ONID + + + + 4 + + + + + + + Selected + + + + + + 5 + + + + + + + + + True + True + 2 + + + + + + + True + False + Downloader + + + False + + + + + True + False + vertical + 2 + + + 24 + True + False + Converter between name formats + + + + False + True + 0 + + + + + True + False + 5 + 2 + True + + + True + False + select-folder + + + 0 + 1 + + + + + True + False + Enigma2 picons path: + + + 0 + 0 + + + + + True + False + Save to: + + + 0 + 2 + + + + + True + False + select-folder + + + 0 + 3 + + + + + False + True + 2 + + - False - True 1 - - + + True - True - folder-open-symbolic - False - + False + Converter between name formats + Converter - False - True - 2 + 1 + False - + + + + + + + + False + True + 8 + + + + + True + False + + + False + True + 10 + + + + + True + False + False + + True False - 2 + Cancel + True + gtk-cancel + + + + False + True + + + + + True + False + + + False + False + + + + + False + True + Convert + True + gtk-execute + + + + True + True + + + + + True + False + False + Receive picons for providers + True + Receive picons + True + go-bottom + + + + True + True + + + + + True + False + False + Load satellite providers. + True + Load providers + True + network-server-symbolic + + + + True + True + + + + + True + False + + + False + False + + + + + True + False + Transfer to receiver + Send + True + go-top + + + + False + True + + + + + + False + True + 11 + + + + + True + True + True + + + 150 + True + True + in + 240 - + True - False - vertical - - - True - False - Picons name format: - - - False - True - 0 - - - - - True - False - 5 - - - Enigma2 (default) - True - True - False - 0 - True - True - neutrino_mp_radio_button - - - False - True - 0 - - - - - Neutrino-MP - True - True - False - 0 - True - True - enigma2_radio_button - - - False - True - 1 - - - - - False - True - 1 - - + True + False + word-char + True - - 0 - 0 - + + + + + + True + False + Extra: + + + + + False + True + 13 + + + + + True + False + True + + + + False + 6 + end + + - - True - False - vertical - - - True - False - Resize: - - - False - True - 0 - - - - - True - False - - - No(default) - True - True - False - 0 - True - True - resize_100_60_radio_button - - - False - True - 0 - - - - - 220x132 - True - True - False - 0 - True - True - resize_100_60_radio_button - - - False - True - 1 - - - - - 100x60 - True - True - False - 0 - True - True - resize_no_radio_button - - - False - True - 2 - - - - - False - True - 1 - - - - - 2 - 0 - + - - True - False - 5 - 5 - vertical - - - 1 - 0 - + - False False - 3 + 0 - - - True + + False - - - False - True - 4 - - - - - True - False - Satellite url (www.lyngsat.com): - 0.019999999552965164 - - - - False - True - 5 - - - - - True - True - network-workgroup-symbolic - False - https://www.lyngsat.com/*satellite*.html - url - - - - False - True - 6 - - - - - 150 - True - True - out + 16 - - True - True - True - providers_list_store - - - - - - 15 - Providers - True - 0.5 - - - - 0 - - - - - - 1 - - - - - - - autosize - Position - - - 0.50999999046325684 - True - - - - 2 - - - - - - - False - Url - - - - 3 - - - - - - - False - ONID - - - - 4 - - - - - - - Selected - - - - - - 5 - - - - - - - - - True - True - 10 - - - - - True - False - - - False - True - 2 - 11 - - - - - True - False - False - - - True - False - Cancel - True - gtk-cancel - - - - True - True - + - + True False + Info False - False - - - - - True - False - False - Receive picons for providers - True - Receive picons - True - go-bottom - - - - True - True - - - - - True - False - False - Load satellite providers. - True - Load providers - True - network-server-symbolic - - - - False - True - - - - - True - False - - - False - False - - - - - True - False - Transfer to receiver - Send - True - go-top - - - - True - True - - - - - - False - True - 12 - - - - - True - True - True - - - 150 - True - True - in - 240 - - - True - True - False - word-char - True - - - - - - - True - False - Extra: - - - - - False - True - 13 - - - - - True - False - True - - - - False - 6 - end - - - - - - - - - - - - False - False - 0 - - - - - False - 16 - - - - - - True - False - Info - - - False - True - 1 - - - - - - - - False - False - 0 + True + 1 @@ -685,26 +816,30 @@ False - True - 14 + False + 0 - - True - False - - - False - True - 15 - + - True + False True - 1 + 14 + + + + + True + False + + + False + True + 2 + 15 diff --git a/app/ui/picons_dialog.py b/app/ui/picons_dialog.py index 3d2ee606..7f8b1c1d 100644 --- a/app/ui/picons_dialog.py +++ b/app/ui/picons_dialog.py @@ -21,7 +21,6 @@ class PiconsDialog: self._BASE_URL = "www.lyngsat.com/packages/" self._PATTERN = re.compile("^https://www\.lyngsat\.com/[\w-]+\.html$") self._current_process = None - self._picons_path = options.get("picons_dir_path", "") self._terminate = False handlers = {"on_receive": self.on_receive, @@ -33,7 +32,9 @@ class PiconsDialog: "on_picons_dir_open": self.on_picons_dir_open, "on_selected_toggled": self.on_selected_toggled, "on_url_changed": self.on_url_changed, - "on_position_edited": self.on_position_edited} + "on_position_edited": self.on_position_edited, + "on_notebook_switch_page": self.on_notebook_switch_page, + "on_convert": self.on_convert} builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) @@ -55,6 +56,10 @@ class PiconsDialog: self._message_label = builder.get_object("info_bar_message_label") self._load_providers_tool_button = builder.get_object("load_providers_tool_button") self._receive_tool_button = builder.get_object("receive_tool_button") + self._convert_tool_button = builder.get_object("convert_tool_button") + self._enigma2_path_button = builder.get_object("enigma2_path_button") + self._save_to_button = builder.get_object("save_to_button") + self._send_tool_button = builder.get_object("send_tool_button") self._enigma2_radio_button = builder.get_object("enigma2_radio_button") self._neutrino_mp_radio_button = builder.get_object("neutrino_mp_radio_button") self._resize_no_radio_button = builder.get_object("resize_no_radio_button") @@ -65,13 +70,15 @@ class PiconsDialog: self._style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") self._url_entry.get_style_context().add_provider_for_screen(Gdk.Screen.get_default(), self._style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) - - self._properties = options + self._properties = options.get(profile.value) self._profile = profile - self._ip_entry.set_text(options.get("host", "")) - self._picons_entry.set_text(options.get("picons_path", "")) - self._picons_path = options.get("picons_dir_path", "") + self._ip_entry.set_text(self._properties.get("host", "")) + self._picons_entry.set_text(self._properties.get("picons_path", "")) + self._picons_path = self._properties.get("picons_dir_path", "") self._picons_dir_entry.set_text(self._picons_path) + self._enigma2_picons_path = self._picons_path + if profile is Profile.NEUTRINO_MP: + self._enigma2_picons_path = options.get(Profile.ENIGMA_2.value).get("picons_dir_path", "") def show(self): self._dialog.run() @@ -222,6 +229,22 @@ class PiconsDialog: model = self._providers_tree_view.get_model() model.set_value(model.get_iter(path), 2, value) + @run_idle + def on_notebook_switch_page(self, nb, box, tab_num): + self._load_providers_tool_button.set_visible(not tab_num) + self._receive_tool_button.set_visible(not tab_num) + self._convert_tool_button.set_visible(tab_num) + self._send_tool_button.set_sensitive(not tab_num) + + if self._enigma2_path_button.get_filename() is None: + self._enigma2_path_button.set_current_folder(self._enigma2_picons_path) + + def on_convert(self, item): + picons_path = self._enigma2_path_button.get_filename() + save_path = self._save_to_button.get_filename() + if not picons_path or not save_path: + show_dialog(DialogType.ERROR, transient=self._dialog, text="Select paths!") + @run_idle def update_receive_button_state(self): self._receive_tool_button.set_sensitive(len(self.get_selected_providers()) > 0)