From e2ec3593276c7b9a24e03d71cacaafe6e47af583 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Wed, 17 Oct 2018 00:12:31 +0300 Subject: [PATCH] added satellites loading in the picons dialog --- app/ui/picons_dialog.glade | 532 +++++++++++++++++++++--------------- app/ui/picons_downloader.py | 23 +- 2 files changed, 330 insertions(+), 225 deletions(-) diff --git a/app/ui/picons_dialog.glade b/app/ui/picons_dialog.glade index f9a60015..f14aaeb3 100644 --- a/app/ui/picons_dialog.glade +++ b/app/ui/picons_dialog.glade @@ -69,6 +69,20 @@ Author: Dmitriy Yefremov + + + + + + + + + + + + + + False True @@ -287,246 +301,322 @@ Author: Dmitriy Yefremov vertical 2 - + True False - 5 - 0.039999999105930328 - in + 5 - + True False - 2 - 2 - 2 - vertical - 2 + 0.10000000149011612 + in - - True - True - 5 - 5 - 2 - network-workgroup-symbolic - False - https://www.lyngsat.com/*satellite*.html - url - - - - False - True - 0 - - - - - 150 - True - True - 5 - 5 - 2 - 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 - 1 - - - - - True - False - 5 - 5 - 2 - 2 - 2 - True - - - True - True - network-transmit-receive-symbolic - - - 0 - 1 - - - - - True - True - - - 1 - 1 - - - - - True - False - Receiver IP: - 0.05000000074505806 - - - 0 - 0 - - - - - True - False - Receiver picons path: - 0.05000000074505806 - - - 1 - 0 - - - - - False - True - 2 - - - - - True - False - Current picons path: - 0.019999999552965164 - - - False - True - 3 - - - - + + 200 True True 5 5 5 - folder-open-symbolic - False - + in + + + True + True + satellites_liststore + False + 0 + True + + + + + + + + Satellite + True + + + + 0 + + + + + + + Url + + + + + + + + + + + + True + False + Satellite - - False - True - 4 - + + False + True + 0 + - - + + True False - Satellite url (www.lyngsat.com): + 0.05000000074505806 + in + + + True + False + 5 + 5 + vertical + 2 + + + True + True + 5 + 5 + 2 + network-workgroup-symbolic + False + https://www.lyngsat.com/*satellite*.html + url + + + + False + True + 0 + + + + + 150 + True + True + 5 + 5 + 2 + 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 + 1 + + + + + True + False + 5 + 5 + 2 + 2 + 2 + True + + + True + True + network-transmit-receive-symbolic + + + 0 + 1 + + + + + True + True + + + 1 + 1 + + + + + True + False + Receiver IP: + 0.05000000074505806 + + + 0 + 0 + + + + + True + False + Receiver picons path: + 0.05000000074505806 + + + 1 + 0 + + + + + False + True + 2 + + + + + True + False + Current picons path: + 0.019999999552965164 + + + False + True + 3 + + + + + True + True + 5 + 5 + 5 + folder-open-symbolic + False + + + + False + True + 4 + + + + + + + True + False + Satellite url: + + + + True + True + 1 + - True + False True - 1 + 0 @@ -923,10 +1013,4 @@ Author: Dmitriy Yefremov - - - - - - diff --git a/app/ui/picons_downloader.py b/app/ui/picons_downloader.py index 67b54513..cbde983c 100644 --- a/app/ui/picons_downloader.py +++ b/app/ui/picons_downloader.py @@ -9,6 +9,7 @@ from app.commons import run_idle, run_task from app.ftp import upload_data, DownloadType from app.tools.picons import PiconsParser, parse_providers, Provider, convert_to 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 @@ -34,7 +35,9 @@ class PiconsDialog: "on_url_changed": self.on_url_changed, "on_position_edited": self.on_position_edited, "on_notebook_switch_page": self.on_notebook_switch_page, - "on_convert": self.on_convert} + "on_convert": self.on_convert, + "on_satellites_view_realize": self.on_satellites_view_realize, + "on_satellite_selection": self.on_satellite_selection} builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) @@ -44,6 +47,7 @@ class PiconsDialog: self._dialog = builder.get_object("picons_dialog") self._dialog.set_transient_for(transient) self._providers_tree_view = builder.get_object("providers_tree_view") + self._satellites_tree_view = builder.get_object("satellites_tree_view") self._expander = builder.get_object("expander") self._text_view = builder.get_object("text_view") self._info_bar = builder.get_object("info_bar") @@ -88,6 +92,23 @@ class PiconsDialog: self._dialog.run() self._dialog.destroy() + def on_satellites_view_realize(self, view): + gen = self.append_satellites(view) + GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) + + def append_satellites(self, view): + model = view.get_model() + yield True + sats = SatellitesParser().get_satellites_list(SatelliteSource.LYNGSAT) + for sat in sats: + s = "{} ({})".format(sat[0], sat[1]) + model.append((s, sat[3])) + yield True + + def on_satellite_selection(self, view, path, column): + model = view.get_model() + self._url_entry.set_text(model.get(model.get_iter(path), 1)[0]) + @run_idle def on_load_providers(self, item): self._expander.set_expanded(True)