diff --git a/app/ui/dialogs.glade b/app/ui/dialogs.glade index 1bcb62e1..7d42d62e 100644 --- a/app/ui/dialogs.glade +++ b/app/ui/dialogs.glade @@ -664,7 +664,6 @@ dmitry.v.yefremov@gmail.com gtk-add - True True True True @@ -676,6 +675,21 @@ dmitry.v.yefremov@gmail.com 1 + + + gtk-save + True + True + True + True + True + + + True + True + 2 + + False @@ -725,7 +739,7 @@ dmitry.v.yefremov@gmail.com - + True True gtk-edit @@ -778,7 +792,7 @@ dmitry.v.yefremov@gmail.com - + True True @@ -795,7 +809,7 @@ dmitry.v.yefremov@gmail.com - + True False @@ -923,7 +937,7 @@ dmitry.v.yefremov@gmail.com - + True True 10 @@ -935,7 +949,7 @@ dmitry.v.yefremov@gmail.com - + True True 10 @@ -947,7 +961,7 @@ dmitry.v.yefremov@gmail.com - + True True 10 @@ -959,7 +973,7 @@ dmitry.v.yefremov@gmail.com - + True True 10 @@ -971,7 +985,7 @@ dmitry.v.yefremov@gmail.com - + True True 10 @@ -1010,6 +1024,11 @@ dmitry.v.yefremov@gmail.com + + iptv_dialog_cancel_button + iptv_dialog_add_button + iptv_dialog_save_button + 1 diff --git a/app/ui/dialogs.py b/app/ui/dialogs.py index 99383f2f..83420983 100644 --- a/app/ui/dialogs.py +++ b/app/ui/dialogs.py @@ -6,6 +6,11 @@ from app.commons import run_idle from . import Gtk, UI_RESOURCES_PATH, TEXT_DOMAIN +class Action(Enum): + EDIT = 0 + ADD = 1 + + class DialogType(Enum): INPUT = "input_dialog" CHOOSER = "path_chooser_dialog" @@ -13,6 +18,7 @@ class DialogType(Enum): QUESTION = "question_dialog" ABOUT = "about_dialog" WAIT = "wait_dialog" + IPTV = "iptv_dialog" class WaitDialog: diff --git a/app/ui/iptv.py b/app/ui/iptv.py new file mode 100644 index 00000000..d4c83317 --- /dev/null +++ b/app/ui/iptv.py @@ -0,0 +1,46 @@ +from .main_helper import get_base_model +from . import Gtk + +from app.properties import Profile +from .dialogs import get_dialog_from_xml, DialogType, Action + + +class IptvDialog: + def __init__(self, transient, view=None, services=None, bouquets=None, profile=Profile.ENIGMA_2, action=Action.ADD): + builder, dialog = get_dialog_from_xml(DialogType.IPTV, transient) + self._dialog = dialog + self._dialog.set_transient_for(transient) + self._name_entry = builder.get_object("name_entry") + self._url_entry = builder.get_object("url_entry") + self._reference_entry = builder.get_object("reference_entry") + self._srv_type_entry = builder.get_object("srv_type_entry") + self._sid_entry = builder.get_object("sid_entry") + self._tr_id_entry = builder.get_object("tr_id_entry") + self._net_id_entry = builder.get_object("net_id_entry") + self._namespace_entry = builder.get_object("namespace_entry") + self._stream_type_combobox = builder.get_object("stream_type_combobox") + self._add_button = builder.get_object("iptv_dialog_add_button") + self._save_button = builder.get_object("iptv_dialog_save_button") + self._action = action + + if self._action is Action.ADD: + self._save_button.set_visible(False) + self._add_button.set_visible(True) + elif self._action is Action.EDIT: + model, paths = view.get_selection().get_selected_rows() + model = get_base_model(model) + row = model[paths][:] + self._name_entry.set_text(row[2]) + + def show(self): + response = self._dialog.run() + if response == Gtk.ResponseType.OK: + self.save() + self._dialog.destroy() + + def save(self): + print(self._action) + + +if __name__ == "__main__": + pass diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 5d607d72..8538bf2c 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -11,6 +11,7 @@ from app.eparser.ecommons import CAS, Flag from app.eparser.enigma.bouquets import BqServiceType from app.eparser.neutrino.bouquets import BqType from app.properties import get_config, write_config, Profile +from .iptv import IptvDialog from .search import SearchProvider from . import Gtk, Gdk, UI_RESOURCES_PATH, LOCKED_ICON, HIDE_ICON, IPTV_ICON from .dialogs import show_dialog, DialogType, get_chooser_dialog, WaitDialog, get_message @@ -114,7 +115,8 @@ class MainAppWindow: "on_search_up": self.on_search_up, "on_search": self.on_search, "on_service_edit": self.on_service_edit, - "on_services_add_new": self.on_services_add_new} + "on_services_add_new": self.on_services_add_new, + "on_iptv": self.on_iptv} self.__options = get_config() self.__profile = self.__options.get("profile") @@ -861,6 +863,9 @@ class MainAppWindow: bq_services.append(ch.fav_id) self.update_bouquet_channels(self.__fav_model, None, bq_selected) + def on_iptv(self, item): + IptvDialog(self.__main_window).show() + def on_insert_marker(self, view): """ Inserts marker into bouquet services list. """ insert_marker(view, self.__bouquets, self.is_bouquet_selected(), self.__services, self.__main_window) @@ -924,9 +929,15 @@ class MainAppWindow: model_name = get_base_model(model).get_name() if model_name == self._FAV_LIST_NAME: srv_type = model.get_value(model.get_iter(paths), 5) - if srv_type == BqServiceType.IPTV.name or srv_type == BqServiceType.MARKER.name: - self.on_rename(view) - return + if srv_type == BqServiceType.MARKER.name: + return self.on_rename(view) + elif srv_type == BqServiceType.IPTV.name: + return IptvDialog(self.__main_window, + self.__fav_view, + self.__services, + self.__bouquets, + Profile(self.__profile), + Action.EDIT).show() self.on_locate_in_services(view) dialog = ServiceDetailsDialog(self.__main_window, diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index 1a1c2195..cbf16cec 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -251,6 +251,7 @@ False image17 False + diff --git a/app/ui/service_details_dialog.py b/app/ui/service_details_dialog.py index 387c5649..f864c373 100644 --- a/app/ui/service_details_dialog.py +++ b/app/ui/service_details_dialog.py @@ -1,5 +1,4 @@ import re -from enum import Enum from functools import lru_cache from app.commons import run_idle @@ -7,16 +6,11 @@ from app.eparser import Service, get_satellites from app.eparser.ecommons import MODULATION, Inversion, ROLL_OFF, Pilot, Flag, Pids, POLARIZATION, \ get_key_by_value, get_value_by_name, FEC_DEFAULT, PLS_MODE from app.properties import Profile -from app.ui.dialogs import show_dialog, DialogType -from app.ui.main_helper import get_base_model +from .dialogs import show_dialog, DialogType, Action +from .main_helper import get_base_model from . import Gtk, Gdk, UI_RESOURCES_PATH, HIDE_ICON, TEXT_DOMAIN -class Action(Enum): - EDIT = 0 - ADD = 1 - - class ServiceDetailsDialog: _DATA_ID = "{:04x}:{:08x}:{:04x}:{:04x}:{}:{}"