From 0e50cf4927be40d64957bb9203854af7a18a4043 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Mon, 22 Jan 2024 14:19:43 +0300 Subject: [PATCH] add extraction support for EPG tab --- app/ui/epg/epg.py | 30 ++++++++++++++++++++---------- app/ui/main.py | 3 +-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/ui/epg/epg.py b/app/ui/epg/epg.py index 24b61710..fa51e88f 100644 --- a/app/ui/epg/epg.py +++ b/app/ui/epg/epg.py @@ -410,7 +410,7 @@ class EpgTool(Gtk.Box): self._app = app self._app.connect("data-open", self.on_data_open) - self._app.connect("data-send", self.on_data_send) + self._app.connect("data-extract", self.on_data_extract) self._app.connect("fav-changed", self.on_service_changed) self._app.connect("profile-changed", self.on_profile_changed) self._app.connect("bouquet-changed", self.on_bouquet_changed) @@ -462,19 +462,29 @@ class EpgTool(Gtk.Box): if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT): return - if next(self.clear(), False): - self._epg_cache = TabEpgCache(self._app, response) - if not self._src_xmltv_button.get_active(): - self._src_xmltv_button.set_active(True) + self.open_data(response) - def on_data_send(self, app, page): + def on_data_extract(self, app, page): if page is not Page.EPG: return - if self._src_xmltv_button.get_active(): - self._app.show_error_message("Not implemented yet!") - else: - self._app.show_error_message("Not allowed in this context!") + f_filter = Gtk.FileFilter() + f_filter.set_name("*.zip, *.gz, *.xz") + f_filter.add_mime_type("application/zip") + f_filter.add_mime_type("application/gzip") + f_filter.add_mime_type("application/x-xz") + + response = get_chooser_dialog(self._app.app_window, self._app.app_settings, + "*.zip, *.gz, *.xz files", ("*.zip", "*.gz", "*.xz"), "Open archive", f_filter) + if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT): + return + self.open_data(response) + + def open_data(self, path): + if next(self.clear(), False): + self._epg_cache = TabEpgCache(self._app, path) + if not self._src_xmltv_button.get_active(): + self._src_xmltv_button.set_active(True) def on_service_changed(self, app, srv): if app.page is not Page.EPG: diff --git a/app/ui/main.py b/app/ui/main.py index 763782e5..8a4138f7 100644 --- a/app/ui/main.py +++ b/app/ui/main.py @@ -115,7 +115,7 @@ class Application(Gtk.Application): DATA_SAVE_PAGES = {Page.SERVICES, Page.SATELLITE} DATA_OPEN_PAGES = {Page.SERVICES, Page.SATELLITE, Page.PICONS, Page.EPG} - DATA_EXTRACT_PAGES = {Page.SERVICES} + DATA_EXTRACT_PAGES = {Page.SERVICES, Page.EPG} DATA_SEND_PAGES = {Page.SERVICES, Page.SATELLITE, Page.PICONS, Page.FTP} DATA_RECEIVE_PAGES_enabled = {Page.SERVICES, Page.SATELLITE, Page.PICONS, Page.RECORDINGS, Page.FTP} @@ -2191,7 +2191,6 @@ class Application(Gtk.Application): @run_task def upload_data(self, download_type): opts = self._settings - use_http = self._s_type is SettingsType.ENIGMA_2 and opts.use_http multiple = len(self._settings.hosts) > 1 for host in self._settings.hosts: if multiple: