diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py
index d5a7e19a..edbabf47 100644
--- a/app/ui/main_app_window.py
+++ b/app/ui/main_app_window.py
@@ -29,7 +29,7 @@ from .main_helper import (insert_marker, move_items, rename, ViewTarget, set_fla
scroll_to, get_base_model, update_picons_data, copy_picon_reference, assign_picon,
remove_picon, is_only_one_item_selected, gen_bouquets, BqGenType, get_iptv_url, append_picons,
get_selection, get_model_data, remove_all_unused_picons, get_picon_pixbuf)
-from .picons_downloader import PiconsDialog
+from .picons_manager import PiconsDialog
from .satellites_dialog import show_satellites_dialog
from .search import SearchProvider
from .service_details_dialog import ServiceDetailsDialog, Action
@@ -120,7 +120,7 @@ class Application(Gtk.Application):
"on_insert_marker": self.on_insert_marker,
"on_fav_press": self.on_fav_press,
"on_locate_in_services": self.on_locate_in_services,
- "on_picons_loader_show": self.on_picons_loader_show,
+ "on_picons_manager_show": self.on_picons_manager_show,
"on_filter_changed": self.on_filter_changed,
"on_assign_picon": self.on_assign_picon,
"on_remove_picon": self.on_remove_picon,
@@ -842,7 +842,8 @@ class Application(Gtk.Application):
def on_services_view_drag_drop(self, view, drag_context, x, y, time):
view.stop_emission_by_name("drag_drop")
# https://stackoverflow.com/q/7661016 [Some data was dropped, get the data!]
- view.drag_get_data(drag_context, drag_context.list_targets()[-1], time)
+ targets = drag_context.list_targets()
+ view.drag_get_data(drag_context, targets[-1] if targets else Gdk.atom_intern("text/plain", False), time)
def on_services_view_drag_data_received(self, view, drag_context, x, y, data, info, time):
# Needs for the GtkTreeView when using models [filter, sort]
@@ -2419,7 +2420,7 @@ class Application(Gtk.Application):
# ***************** Picons *********************#
- def on_picons_loader_show(self, action, value=None):
+ def on_picons_manager_show(self, action, value=None):
ids = {}
if self._s_type is SettingsType.ENIGMA_2:
for r in self._services_model:
diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade
index cfb67b37..df23b334 100644
--- a/app/ui/main_window.glade
+++ b/app/ui/main_window.glade
@@ -1257,8 +1257,8 @@ Author: Dmitriy Yefremov
True
False
True
- Picons downloader
-
+ Picons manager
+
end
@@ -316,66 +319,25 @@ Author: Dmitriy Yefremov
False
vertical
-
-
-
- True
- False
- Explorer
-
-
- False
-
-
-
-
- True
- False
- 5
- 5
- 5
- 5
- vertical
- 2
-
+
True
False
- 5
- 5
+ vertical
+ 2
-
+
True
False
- 0.10000000149011612
+ 0.5
in
-
- 200
+
True
True
5
5
+ 5
5
- in
+ True
-
+
+ 200
True
- True
- satellites_list_store
- False
- 0
- True
-
-
-
-
+ False
+ 2
+ vertical
+ 2
+
+
+ True
+ False
+ 5
+ 2
+
+
+ False
+ Satellite
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ False
+ Loading data...
+
+
+ False
+ True
+ 1
+
+
+
+
+ True
+ False
+ True
+
+
+ False
+ True
+ 2
+
+
+
+
+ False
+ True
+ 0
+
-
- Satellite
+
+ True
+ True
+ in
+
+
+ True
+ True
+ satellites_list_store
+ False
+ 0
+ True
+
+
+
+
+
+
+
+ Satellite
+ True
+
+
+
+ 0
+
+
+
+
+
+
+ False
+ Url
+
+
+
+ 1
+
+
+
+
+
+
+ False
+ Pos
+
+
+
+ 2
+
+
+
+
+
+
+
+
True
-
-
-
- 0
-
-
-
-
-
-
- False
- Url
-
-
-
- 1
-
-
-
-
-
-
- False
- Pos
-
-
-
- 2
-
-
-
-
-
-
-
-
-
-
- True
- False
- 2
-
-
- False
- Satellite
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- Loading data...
-
-
- False
- True
- 1
-
-
-
-
- True
- False
- True
-
-
- False
- True
- 2
-
-
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- 0.05000000074505806
- in
-
-
- True
- False
- 5
- 5
- 5
- vertical
- 2
-
-
- True
- True
- 2
- network-workgroup-symbolic
- False
- https://www.lyngsat.com/*satellite*.html
- url
-
-
-
- False
- True
- 0
-
-
-
-
- 150
- True
- True
- 2
- out
-
-
- True
- True
- providers_list_store
- 1
-
-
-
-
-
-
-
- 15
- Providers
- True
- 0.5
-
-
-
- 0
-
-
-
-
-
- 1
-
-
-
-
-
-
- autosize
- Position
-
-
- 0.50999999046325684
- True
-
-
-
- 2
-
-
-
-
-
-
- False
- Url
-
-
-
- 3
-
-
-
-
-
-
- False
- ONID
-
-
-
- 4
-
-
-
-
-
-
- False
- SSID
-
-
-
- 5
-
-
-
-
-
-
- False
- Single
-
-
-
- 6
-
-
-
-
-
-
- Selected
-
-
-
-
-
- 7
-
-
-
-
-
-
-
-
- True
- True
- 1
-
-
-
-
- True
- False
- 2
- 2
- 2
- True
-
-
- True
- True
- network-transmit-receive-symbolic
-
-
- 0
- 1
+ True
+ 1
+
+
+ False
+ True
+
+
+
+
+ 280
+ True
+ False
+ 2
+ vertical
+ 2
-
- True
- True
-
-
- 1
- 1
-
-
-
-
+
True
False
- Receiver IP:
- 0.05000000074505806
+ Satellite url:
- 0
- 0
+ False
+ True
+ 0
-
+
True
- False
- Receiver picons path:
- 0.05000000074505806
+ True
+ network-workgroup-symbolic
+ False
+ https://www.lyngsat.com/*satellite*.html
+ url
+
- 1
- 0
+ False
+ True
+ 1
+
+
+
+
+ 150
+ True
+ True
+ 2
+ out
+
+
+ True
+ True
+ providers_list_store
+ 1
+
+
+
+
+
+
+
+ 15
+ Providers
+ True
+ 0.5
+
+
+
+ 0
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ autosize
+ Position
+
+
+ 0.50999999046325684
+ True
+
+
+
+ 2
+
+
+
+
+
+
+ False
+ Url
+
+
+
+ 3
+
+
+
+
+
+
+ False
+ ONID
+
+
+
+ 4
+
+
+
+
+
+
+ False
+ SSID
+
+
+
+ 5
+
+
+
+
+
+
+ False
+ Single
+
+
+
+ 6
+
+
+
+
+
+
+ Selected
+
+
+
+
+
+ 7
+
+
+
+
+
+
+
+
+ True
+ True
+ 2
+
+
+
+
+ True
+ False
+ 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
+ 3
+
+
+
+
+ True
+ False
+ Current picons path:
+ 0.019999999552965164
+
+
+ False
+ True
+ 4
+
+
+
+
+ True
+ True
+ folder-open
+ False
+
+
+
+ False
+ True
+ 5
- False
- True
- 2
-
-
-
-
- True
- False
- Current picons path:
- 0.019999999552965164
-
-
- False
- True
- 3
-
-
-
-
- True
- True
- folder-open
- False
-
-
-
- False
- True
- 4
+ True
+ True
-
+
True
False
- Satellite url:
+ Picons download tool
True
True
- 1
-
-
-
-
- True
- True
- 0
-
-
-
-
- True
- False
- 2
- 2
- True
-
-
- True
- False
- 0.05000000074505806
- in
-
-
- True
- False
- vertical
-
-
- True
- False
- center
-
-
- Enigma2 (default)
- True
- True
- False
- True
- neutrino_mp_radio_button
-
-
- False
- True
- 0
-
-
-
-
- Neutrino-MP
- True
- True
- False
- True
- enigma2_radio_button
-
-
- False
- True
- 1
-
-
-
-
- False
- True
- 1
-
-
-
-
-
-
- True
- False
- Picons name format:
-
-
-
-
- 0
- 0
+ 0
-
+
True
False
- 0.05000000074505806
- in
-
-
- True
- False
- vertical
-
-
- True
- False
- center
-
-
- No(default)
- True
- True
- False
- True
- resize_100_60_radio_button
-
-
- False
- True
- 0
-
-
-
-
- 220x132
- True
- True
- False
- True
- resize_100_60_radio_button
-
-
- False
- True
- 1
-
-
-
-
- 100x60
- True
- True
- False
- True
- resize_no_radio_button
-
-
- False
- True
- 2
-
-
-
-
- False
- True
- 1
-
-
-
-
-
-
- True
- False
- Resize:
-
-
-
-
- 1
- 0
-
-
-
-
- False
- True
- 4
-
-
-
-
- 1
-
-
-
-
- True
- False
- Downloader
-
-
- 1
- False
-
-
-
-
- True
- False
- 5
- 5
- 5
- 5
- 0.5
- in
-
-
- True
- False
- 5
- 5
- 5
- 5
- vertical
- 2
-
-
- True
- False
- 5
+ 2
2
True
-
+
True
False
- select-folder
-
-
- 0
- 1
-
-
-
-
- True
- False
- Path to Enigma2 picons:
+ 0.05000000074505806
+ in
+
+
+ True
+ False
+ vertical
+
+
+ True
+ False
+ center
+
+
+ Enigma2 (default)
+ True
+ True
+ False
+ True
+ neutrino_mp_radio_button
+
+
+ False
+ True
+ 0
+
+
+
+
+ Neutrino-MP
+ True
+ True
+ False
+ True
+ enigma2_radio_button
+
+
+ False
+ True
+ 1
+
+
+
+
+ False
+ True
+ 1
+
+
+
+
+
+
+ True
+ False
+ Picons name format:
+
+
0
@@ -1105,86 +958,227 @@ Author: Dmitriy Yefremov
-
+
True
False
- Path to save:
+ 0.05000000074505806
+ in
+
+
+ True
+ False
+ vertical
+
+
+ True
+ False
+ center
+
+
+ No(default)
+ True
+ True
+ False
+ True
+ resize_100_60_radio_button
+
+
+ False
+ True
+ 0
+
+
+
+
+ 220x132
+ True
+ True
+ False
+ True
+ resize_100_60_radio_button
+
+
+ False
+ True
+ 1
+
+
+
+
+ 100x60
+ True
+ True
+ False
+ True
+ resize_no_radio_button
+
+
+ False
+ True
+ 2
+
+
+
+
+ False
+ True
+ 1
+
+
+
+
+
+
+ True
+ False
+ Resize:
+
+
- 0
- 2
+ 1
+ 0
+
+
+
+
+ False
+ True
+ 4
+
+
+
+
+ downloader
+ Downloader
+ 1
+
+
+
+
+ True
+ False
+ 0.5
+ in
+
+
+ True
+ False
+ 5
+ 5
+ 5
+ 5
+ vertical
+ 2
+
+
+ True
+ False
+ 5
+ 2
+ True
+
+
+ True
+ False
+ select-folder
+
+
+ 0
+ 1
+
+
+
+
+ True
+ False
+ Path to Enigma2 picons:
+
+
+ 0
+ 0
+
+
+
+
+ True
+ False
+ Path to save:
+
+
+ 0
+ 2
+
+
+
+
+ True
+ False
+ select-folder
+
+
+ 0
+ 3
+
+
+
+
+ False
+ True
+ 0
-
+
True
False
- select-folder
+ Enigma2 -> Neutrino-MP
- 0
- 3
+ False
+ True
+ end
+ 1
+
+
+
+
+ True
+ False
+ gtk-convert
+ 3
+
+
+ False
+ True
+ end
+ 2
-
- False
- True
- 0
-
-
-
+
+
True
False
- Enigma2 -> Neutrino-MP
+ Converter between name formats
-
- False
- True
- end
- 1
-
-
-
-
- True
- False
- gtk-convert
- 3
-
-
- False
- True
- end
- 2
-
-
-
-
- True
- False
- Converter between name formats
-
+
+ converter
+ Converter
+ 2
+
-
- 2
-
-
-
+
+
True
False
- Converter between name formats
- Converter
+ stack
-
- 2
- False
-
diff --git a/app/ui/picons_downloader.py b/app/ui/picons_manager.py
similarity index 91%
rename from app/ui/picons_downloader.py
rename to app/ui/picons_manager.py
index cb686303..f0351d62 100644
--- a/app/ui/picons_downloader.py
+++ b/app/ui/picons_manager.py
@@ -8,7 +8,7 @@ from gi.repository import GLib, GdkPixbuf
from app.commons import run_idle, run_task, run_with_delay
from app.connections import upload_data, DownloadType, download_data, remove_picons
-from app.settings import SettingsType
+from app.settings import SettingsType, Settings
from app.tools.picons import PiconsParser, parse_providers, Provider, convert_to
from app.tools.satellites import SatellitesParser, SatelliteSource
from .dialogs import show_dialog, DialogType, get_message
@@ -41,7 +41,7 @@ class PiconsDialog:
"on_url_changed": self.on_url_changed,
"on_picons_filter_changed": self.on_picons_filter_changed,
"on_position_edited": self.on_position_edited,
- "on_notebook_switch_page": self.on_notebook_switch_page,
+ "on_visible_page": self.on_visible_page,
"on_convert": self.on_convert,
"on_picons_folder_changed": self.on_picons_folder_changed,
"on_picons_view_drag_drop": self.on_picons_view_drag_drop,
@@ -56,7 +56,7 @@ class PiconsDialog:
"on_popup_menu": on_popup_menu}
builder = Gtk.Builder()
- builder.add_from_file(UI_RESOURCES_PATH + "picons_dialog.glade")
+ builder.add_from_file(UI_RESOURCES_PATH + "picons_manager.glade")
builder.connect_signals(handlers)
self._dialog = builder.get_object("picons_dialog")
@@ -101,6 +101,7 @@ class PiconsDialog:
self._load_providers_button.bind_property("visible", self._receive_button, "visible")
self._load_providers_button.bind_property("visible", builder.get_object("download_box_separator"), "visible")
self._filter_bar.bind_property("search-mode-enabled", self._filter_bar, "visible")
+ self._explorer_path_button.bind_property("sensitive", builder.get_object("picons_view_sw"), "sensitive")
# Init drag-and-drop
self.init_drag_and_drop()
# Style
@@ -112,8 +113,7 @@ class PiconsDialog:
self._s_type = settings.setting_type
self._ip_entry.set_text(self._settings.host)
self._picons_entry.set_text(self._settings.picons_path)
- self._picons_path = self._settings.picons_local_path
- self._picons_dir_entry.set_text(self._picons_path)
+ self._picons_dir_entry.set_text(self._settings.picons_local_path)
window_size = self._settings.get("picons_downloader_window_size")
if window_size:
@@ -129,7 +129,7 @@ class PiconsDialog:
self._dialog.show()
def on_picons_view_realize(self, view):
- self._explorer_path_button.set_current_folder(self._picons_path)
+ self._explorer_path_button.set_current_folder(self._settings.picons_local_path)
def on_picons_folder_changed(self, button):
path = button.get_filename()
@@ -142,10 +142,13 @@ class PiconsDialog:
def update_picons(self, path):
p_model = self._picons_view.get_model()
- self._picons_view.set_model(None)
model = get_base_model(p_model)
- model.clear()
- self._picons_view.set_model(p_model)
+ self._picons_view.set_model(None)
+
+ for index, itr in enumerate([row.iter for row in model]):
+ model.remove(itr)
+ if index % 50 == 0:
+ yield True
for file in os.listdir(path):
if self._terminate:
@@ -158,6 +161,7 @@ class PiconsDialog:
else:
yield model.append((p, file))
+ self._picons_view.set_model(p_model)
self._explorer_path_button.set_sensitive(True)
yield True
@@ -171,7 +175,8 @@ class PiconsDialog:
def on_picons_view_drag_drop(self, view, drag_context, x, y, time):
view.stop_emission_by_name("drag_drop")
- view.drag_get_data(drag_context, drag_context.list_targets()[-1], time)
+ targets = drag_context.list_targets()
+ view.drag_get_data(drag_context, targets[-1] if targets else Gdk.atom_intern("text/plain", False), time)
def on_picons_view_drag_data_received(self, view, drag_context, x, y, data, info, time):
view.stop_emission_by_name("drag_data_received")
@@ -317,7 +322,7 @@ class PiconsDialog:
self.process_provider(Provider(*prv))
if self._resize_no_radio_button.get_active():
- self.resize(self._picons_path)
+ self.resize(self._picons_dir_entry.get_text())
self.show_info_message(get_message("Done!"), Gtk.MessageType.INFO)
finally:
@@ -334,7 +339,8 @@ class PiconsDialog:
GLib.io_add_watch(self._current_process.stderr, GLib.IO_IN, self.write_to_buffer)
self._current_process.wait()
path = self._TMP_DIR + (url[url.find("//") + 2:] if prv.single else self._BASE_URL + url[url.rfind("/") + 1:])
- PiconsParser.parse(path, self._picons_path, self._TMP_DIR, prv, self._picon_ids, self.get_picons_format())
+ PiconsParser.parse(path, self._picons_dir_entry.get_text(),
+ self._TMP_DIR, prv, self._picon_ids, self.get_picons_format())
def write_to_buffer(self, fd, condition):
if condition == GLib.IO_IN:
@@ -382,10 +388,9 @@ class PiconsDialog:
GLib.idle_add(self._dialog.destroy)
def save_window_size(self, window):
- t, _ = self._text_view.get_allocated_size()
- b, _ = self._info_bar.get_allocated_size()
size = window.get_size()
- self._settings.add("picons_downloader_window_size", (size.width, size.height - t.height - b.height))
+ height = size.height - self._text_view.get_allocated_height() - self._info_bar.get_allocated_height()
+ self._settings.add("picons_downloader_window_size", (size.width, height))
@run_task
def clean_data(self):
@@ -397,8 +402,10 @@ class PiconsDialog:
if show_dialog(DialogType.QUESTION, self._dialog) == Gtk.ResponseType.CANCEL:
return
+ settings = Settings(self._settings.settings)
+ settings.picons_local_path = self._explorer_path_button.get_filename() + "/"
self.show_info_message(get_message("Please, wait..."), Gtk.MessageType.INFO)
- self.run_func(lambda: upload_data(settings=self._settings,
+ self.run_func(lambda: upload_data(settings=settings,
download_type=DownloadType.PICONS,
callback=self.append_output,
done_callback=lambda: self.show_info_message(get_message("Done!"),
@@ -408,9 +415,11 @@ class PiconsDialog:
if show_dialog(DialogType.QUESTION, self._dialog) == Gtk.ResponseType.CANCEL:
return
- self.run_func(lambda: download_data(settings=self._settings,
+ settings = Settings(self._settings.settings)
+ settings.picons_local_path = self._explorer_path_button.get_filename() + "/"
+ self.run_func(lambda: download_data(settings=settings,
download_type=DownloadType.PICONS,
- callback=self.append_output))
+ callback=self.append_output), True)
def on_remove(self, item):
if show_dialog(DialogType.QUESTION, self._dialog) == Gtk.ResponseType.CANCEL:
@@ -422,14 +431,17 @@ class PiconsDialog:
Gtk.MessageType.INFO)))
@run_task
- def run_func(self, func):
+ def run_func(self, func, update=False):
try:
GLib.idle_add(self._expander.set_expanded, True)
GLib.idle_add(self._header_download_box.set_sensitive, False)
func()
except OSError as e:
self.show_info_message(str(e), Gtk.MessageType.ERROR)
- GLib.idle_add(self._header_download_box.set_sensitive, True)
+ finally:
+ GLib.idle_add(self._header_download_box.set_sensitive, True)
+ if update:
+ self.on_picons_folder_changed(self._explorer_path_button)
def on_info_bar_close(self, bar=None, resp=None):
self._info_bar.set_visible(False)
@@ -486,10 +498,11 @@ class PiconsDialog:
model.set_value(model.get_iter(path), 2, value)
@run_idle
- def on_notebook_switch_page(self, nb, box, tab_num):
- self._convert_button.set_visible(tab_num > 1)
- self._load_providers_button.set_visible(tab_num == 1)
- is_explorer = tab_num == 0
+ def on_visible_page(self, stack: Gtk.Stack, param):
+ name = stack.get_visible_child_name()
+ self._convert_button.set_visible(name == "converter")
+ self._load_providers_button.set_visible(name == "downloader")
+ is_explorer = name == "explorer"
self._filter_button.set_visible(is_explorer)
if is_explorer:
self.on_picons_folder_changed(self._explorer_path_button)