diff --git a/app/ui/import_dialog.glade b/app/ui/import_dialog.glade
new file mode 100644
index 00000000..1ec1c9d0
--- /dev/null
+++ b/app/ui/import_dialog.glade
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/ui/import_dialog.py b/app/ui/import_dialog.py
new file mode 100644
index 00000000..ed4d09f7
--- /dev/null
+++ b/app/ui/import_dialog.py
@@ -0,0 +1,46 @@
+from app.commons import run_idle
+from app.eparser import get_bouquets
+from app.ui.dialogs import get_message
+from .uicommons import Gtk, UI_RESOURCES_PATH
+
+
+class ImportDialog:
+ def __init__(self, transient, path, profile):
+ handlers = {}
+
+ builder = Gtk.Builder()
+ builder.set_translation_domain("demon-editor")
+ builder.add_from_file(UI_RESOURCES_PATH + "import_dialog.glade")
+ builder.connect_signals(handlers)
+
+ self._dialog_window = builder.get_object("dialog_window")
+ self._dialog_window.set_transient_for(transient)
+ self._model = builder.get_object("main_list_store")
+ self._main_view = builder.get_object("main_view")
+ self._info_bar = builder.get_object("info_bar")
+ self._message_label = builder.get_object("message_label")
+
+ self.init_data(path, profile)
+
+ def show(self):
+ self._dialog_window.show()
+
+ def init_data(self, path, profile):
+ try:
+ bouquets = get_bouquets(path, profile)
+ for bqs in bouquets:
+ for bq in bqs.bouquets:
+ self._model.append((bq.name, bq.type, True))
+ self.show_info_message(get_message("Not implemented yet!"), Gtk.MessageType.WARNING)
+ except FileNotFoundError as e:
+ self.show_info_message(str(e), Gtk.MessageType.ERROR)
+
+ @run_idle
+ def show_info_message(self, text, message_type):
+ self._info_bar.set_visible(True)
+ self._info_bar.set_message_type(message_type)
+ self._message_label.set_text(text)
+
+
+if __name__ == "__main__":
+ pass
diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py
index a3270517..15d7773d 100644
--- a/app/ui/main_app_window.py
+++ b/app/ui/main_app_window.py
@@ -15,7 +15,8 @@ from app.eparser.enigma.bouquets import BqServiceType
from app.eparser.neutrino.bouquets import BqType
from app.properties import get_config, write_config, Profile
from app.tools.media import Player
-from app.ui.backup import BackupDialog, backup_data, clear_data_path
+from .backup import BackupDialog, backup_data, clear_data_path
+from .import_dialog import ImportDialog
from .download_dialog import DownloadDialog
from .iptv import IptvDialog, SearchUnavailableDialog, IptvListConfigurationDialog
from .search import SearchProvider
@@ -101,6 +102,7 @@ class Application(Gtk.Application):
"on_locked": self.on_locked,
"on_model_changed": self.on_model_changed,
"on_import_m3u": self.on_import_m3u,
+ "on_import_bouquets": self.on_import_bouquets,
"on_backup_tool_show": self.on_backup_tool_show,
"on_insert_marker": self.on_insert_marker,
"on_fav_press": self.on_fav_press,
@@ -1261,6 +1263,8 @@ class Application(Gtk.Application):
if response:
next(self.remove_favs(response, self._fav_model), False)
+ # ***************** Import ********************#
+
def on_import_m3u(self, item):
""" Imports iptv from m3u files. """
response = get_chooser_dialog(self._main_window, self._options.get(self._profile), "*.m3u", "m3u files")
@@ -1281,6 +1285,13 @@ class Application(Gtk.Application):
bq_services.append(ch.fav_id)
next(self.update_bouquet_services(self._fav_model, None, self._bq_selected), False)
+ def on_import_bouquets(self, item):
+ response = show_dialog(DialogType.CHOOSER, self._main_window, options=self._options.get(self._profile))
+ if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT):
+ return
+
+ ImportDialog(self._main_window, response, Profile(self._profile)).show()
+
# ***************** Backup ********************#
def on_backup_tool_show(self, item):
diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade
index c2e26c09..3fc41cd4 100644
--- a/app/ui/main_window.glade
+++ b/app/ui/main_window.glade
@@ -776,6 +776,20 @@ Author: Dmitriy Yefremov
2
+
+
+ True
+ True
+ True
+ Import bouquets and services
+
+
+
+ False
+ True
+ 3
+
+
@@ -798,7 +812,7 @@ Author: Dmitriy Yefremov
False
True
- 4
+ 5
@@ -812,7 +826,7 @@ Author: Dmitriy Yefremov
True
True
- 5
+ 6
@@ -823,7 +837,7 @@ Author: Dmitriy Yefremov
False
True
- 6
+ 7
@@ -837,7 +851,7 @@ Author: Dmitriy Yefremov
True
True
- 7
+ 8