def __init__(self, transient, settings, appender): handlers = { "on_import": self.on_import, "on_receive": self.on_receive, "on_yt_url_entry_changed": self.on_url_entry_changed, "on_yt_info_bar_close": self.on_info_bar_close, "on_popup_menu": on_popup_menu, "on_selected_toggled": self.on_selected_toggled, "on_select_all": self.on_select_all, "on_unselect_all": self.on_unselect_all, "on_key_press": self.on_key_press, "on_close": self.on_close } self.appender = appender self._s_type = settings.setting_type self._download_task = False self._yt_list_id = None self._yt_list_title = None self._settings = settings self._yt = None builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) builder.add_objects_from_string( get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION), ("yt_import_dialog_window", "yt_liststore", "yt_quality_liststore", "yt_popup_menu", "remove_selection_image")) builder.connect_signals(handlers) self._dialog = builder.get_object("yt_import_dialog_window") self._dialog.set_transient_for(transient) self._list_view_scrolled_window = builder.get_object( "yt_list_view_scrolled_window") self._model = builder.get_object("yt_liststore") self._progress_bar = builder.get_object("yt_progress_bar") self._info_bar_box = builder.get_object("yt_info_bar_box") self._message_label = builder.get_object("yt_info_bar_message_label") self._info_bar = builder.get_object("yt_info_bar") self._yt_count_label = builder.get_object("yt_count_label") self._url_entry = builder.get_object("yt_url_entry") self._receive_button = builder.get_object("yt_receive_button") self._import_button = builder.get_object("yt_import_button") self._quality_box = builder.get_object("yt_quality_combobox") self._quality_model = builder.get_object("yt_quality_liststore") self._import_button.bind_property("visible", self._quality_box, "visible") self._import_button.bind_property("sensitive", self._quality_box, "sensitive") self._receive_button.bind_property("sensitive", self._import_button, "sensitive") # style self._style_provider = Gtk.CssProvider() self._style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") self._url_entry.get_style_context().add_provider_for_screen( Gdk.Screen.get_default(), self._style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
def __init__(self, transient, s_type, m3_path, app): super().__init__(transient, s_type) self._app = app self._picons = app.picons self._pic_path = app._settings.profile_picons_path self._services = None self._url_count = 0 self._errors_count = 0 self._max_count = 0 self._is_download = False self._cancellable = Gio.Cancellable() self._dialog.set_title(get_message("Playlist import")) self._dialog.connect("delete-event", self.on_close) self._apply_button.set_label(get_message("Import")) # Progress self._progress_bar = Gtk.ProgressBar(visible=False, valign="center") self._spinner = Gtk.Spinner(active=False) self._info_label = Gtk.Label(visible=True, ellipsize="end", max_width_chars=30) load_label = Gtk.Label(label=get_message("Loading data...")) self._spinner.bind_property("active", self._spinner, "visible") self._spinner.bind_property("visible", load_label, "visible") self._spinner.bind_property("active", self._start_values_grid, "sensitive", 4) progress_box = Gtk.HBox(visible=True, spacing=2) progress_box.add(self._progress_bar) progress_box.pack_end(self._spinner, False, False, 0) progress_box.pack_start(load_label, False, False, 0) # Picons self._picons_switch = Gtk.Switch(visible=True) self._picon_box = Gtk.HBox(visible=True, sensitive=False, spacing=2) self._picon_box.pack_end(self._picons_switch, False, False, 0) self._picon_box.pack_end( Gtk.Label(visible=True, label=get_message("Download picons")), False, False, 0) # Extra box extra_box = Gtk.HBox(visible=True, spacing=2, margin_bottom=5, margin_top=5) extra_box.set_center_widget(progress_box) extra_box.pack_start(self._info_label, False, False, 5) extra_box.pack_end(self._picon_box, True, True, 5) frame = Gtk.Frame(visible=True, margin_bottom=5) frame.add(extra_box) self._data_box.add(frame) self.get_m3u(m3_path, s_type)
def show_playback_window(self): width, height = 480, 240 size = self._app.app_settings.get("playback_window_size") if size: width, height = size if self._playback_window: self._playback_window.show() self._playback_window.set_title(self.get_playback_title()) else: self._playback_window = Gtk.Window( title=self.get_playback_title(), window_position=Gtk.WindowPosition.CENTER, icon_name="demon-editor") self._playback_window.connect("delete-event", self.on_close) self._playback_window.connect("key-press-event", self.on_key_press) self._playback_window.bind_property("visible", self._event_box, "visible") if not IS_DARWIN: self._prev_button.set_visible(False) self._next_button.set_visible(False) self.reparent(self._playback_window) self._playback_window.set_application(self._app) self.show() self._playback_window.resize(width, height) self._playback_window.show()
def __init__(self, transient, model, fav_bouquet, iptv_rows, s_type): handlers = {"on_response": self.on_response} builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) builder.add_objects_from_file(UI_RESOURCES_PATH + "iptv.glade", ("search_unavailable_streams_dialog", )) builder.connect_signals(handlers) self._dialog = builder.get_object("search_unavailable_streams_dialog") self._dialog.set_transient_for(transient) self._model = model self._counter_label = builder.get_object("streams_rows_counter_label") self._level_bar = builder.get_object("unavailable_streams_level_bar") self._bouquet = fav_bouquet self._s_type = s_type self._iptv_rows = iptv_rows self._counter = -1 self._max_rows = len(self._iptv_rows) self._level_bar.set_max_value(self._max_rows) self._download_task = True self._to_delete = [] self.update_counter() self.do_search()
def __init__(self, app, *args, **kwargs): super().__init__(*args, **kwargs) self._app = app self._app.connect("profile-changed", self.on_profile_changed) self._tn = None self._app_mode = False self._commands = deque(maxlen=10) self._handlers = { "on_clear": self.on_clear, "on_text_view_realize": self.on_text_view_realize, "on_view_key_press": self.on_view_key_press, "on_connect": self.on_connect, "on_disconnect": self.on_disconnect } builder = Gtk.Builder() builder.add_from_file(UI_RESOURCES_PATH + "telnet.glade") builder.connect_signals(self._handlers) self._text_view = builder.get_object("text_view") self._buf = builder.get_object("text_buffer") self._end_tag = builder.get_object("end_tag") self._connect_button = builder.get_object("connect_button") self._connect_button.bind_property( "visible", builder.get_object("disconnect_button"), "visible", 4) main_frame = builder.get_object("telnet_frame") provider = Gtk.CssProvider() provider.load_from_path(UI_RESOURCES_PATH + "style.css") main_frame.get_style_context().add_provider( provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.pack_start(main_frame, True, True, 0) self.show()
def __init__(self, app): handlers = { "on_import": self.on_import, "on_receive": self.on_receive, "on_yt_url_entry_changed": self.on_url_entry_changed, "on_yt_info_bar_close": self.on_info_bar_close, "on_popup_menu": on_popup_menu, "on_selected_toggled": self.on_selected_toggled, "on_select_all": self.on_select_all, "on_unselect_all": self.on_unselect_all, "on_key_press": self.on_key_press, "on_close": self.on_close } # self._main_window, self._settings, self.append_imported_services self.appender = app.append_imported_services self._settings = app.app_settings self._s_type = self._settings.setting_type self._download_task = False self._yt_list_id = None self._yt_list_title = None self._yt = None builder = get_builder(_UI_PATH, handlers, use_str=True, objects=("yt_import_dialog_window", "yt_liststore", "yt_quality_liststore", "yt_popup_menu", "remove_selection_image", "yt_receive_image", "yt_import_image")) self._dialog = builder.get_object("yt_import_dialog_window") self._dialog.set_transient_for(app.app_window) self._list_view_scrolled_window = builder.get_object( "yt_list_view_scrolled_window") self._model = builder.get_object("yt_liststore") self._progress_bar = builder.get_object("yt_progress_bar") self._info_bar_box = builder.get_object("yt_info_bar_box") self._message_label = builder.get_object("yt_info_bar_message_label") self._info_bar = builder.get_object("yt_info_bar") self._yt_count_label = builder.get_object("yt_count_label") self._url_entry = builder.get_object("yt_url_entry") self._receive_button = builder.get_object("yt_receive_button") self._import_button = builder.get_object("yt_import_button") self._quality_box = builder.get_object("yt_quality_combobox") self._quality_model = builder.get_object("yt_quality_liststore") self._import_button.bind_property("visible", self._quality_box, "visible") self._import_button.bind_property("sensitive", self._quality_box, "sensitive") self._receive_button.bind_property("sensitive", self._import_button, "sensitive") window_size = self._settings.get("yt_import_dialog_size") if window_size: self._dialog.resize(*window_size) # Style style_provider = Gtk.CssProvider() style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") self._url_entry.get_style_context().add_provider_for_screen( Gdk.Screen.get_default(), style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
def __init__(self, app, view, bouquet=None, service=None, action=Action.ADD): handlers = { "on_response": self.on_response, "on_entry_changed": self.on_entry_changed, "on_url_changed": self.on_url_changed, "on_save": self.on_save, "on_stream_type_changed": self.on_stream_type_changed, "on_yt_quality_changed": self.on_yt_quality_changed, "on_info_bar_close": self.on_info_bar_close } self._app = app self._action = action self._settings = app.app_settings self._s_type = self._settings.setting_type self._bouquet = bouquet self._yt_links = None self._yt_dl = None builder = get_builder(_UI_PATH, handlers, use_str=True, objects=("iptv_dialog", "stream_type_liststore", "yt_quality_liststore")) self._dialog = builder.get_object("iptv_dialog") self._dialog.set_transient_for(app.app_window) self._name_entry = builder.get_object("name_entry") self._description_entry = builder.get_object("description_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._srv_id_entry = builder.get_object("srv_id_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._stream_type_combobox = builder.get_object("stream_type_combobox") self._info_bar = builder.get_object("info_bar") self._message_label = builder.get_object("info_bar_message_label") self._yt_quality_box = builder.get_object("yt_iptv_quality_combobox") self._model, self._paths = view.get_selection().get_selected_rows() # style self._style_provider = Gtk.CssProvider() self._style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") self._digit_elems = (self._srv_id_entry, self._srv_type_entry, self._sid_entry, self._tr_id_entry, self._net_id_entry, self._namespace_entry) for el in self._digit_elems: el.get_style_context().add_provider_for_screen( Gdk.Screen.get_default(), self._style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) if self._s_type is SettingsType.NEUTRINO_MP: builder.get_object("iptv_dialog_ts_data_frame").set_visible(False) builder.get_object("iptv_type_label").set_visible(False) builder.get_object("reference_entry").set_visible(False) builder.get_object("iptv_reference_label").set_visible(False) self._stream_type_combobox.set_visible(False) else: self._description_entry.set_visible(False) builder.get_object("iptv_description_label").set_visible(False) if self._action is Action.ADD: self._save_button.set_visible(False) self._add_button.set_visible(True) if self._s_type is SettingsType.ENIGMA_2: self.update_reference_entry() self._stream_type_combobox.set_active(1) elif self._action is Action.EDIT: self._current_srv = service self.init_data(self._current_srv)
def __init__(self, transient, s_type): handlers = { "on_apply": self.on_apply, "on_response": self.on_response, "on_stream_type_default_togged": self.on_stream_type_default_togged, "on_stream_type_changed": self.on_stream_type_changed, "on_default_id_toggled": self.on_default_id_toggled, "on_default_type_toggled": self.on_default_type_toggled, "on_auto_sid_toggled": self.on_auto_sid_toggled, "on_default_tid_toggled": self.on_default_tid_toggled, "on_default_nid_toggled": self.on_default_nid_toggled, "on_default_namespace_toggled": self.on_default_namespace_toggled, "on_reset_to_default": self.on_reset_to_default, "on_entry_changed": self.on_entry_changed, "on_info_bar_close": self.on_info_bar_close } self._s_type = s_type builder = get_builder(_UI_PATH, handlers, use_str=True, objects=("iptv_list_configuration_dialog", "stream_type_liststore")) self._dialog = builder.get_object("iptv_list_configuration_dialog") self._dialog.set_transient_for(transient) self._data_box = builder.get_object("iptv_list_data_box") self._start_values_grid = builder.get_object("start_values_grid") self._info_bar = builder.get_object("list_configuration_info_bar") self._reference_label = builder.get_object("reference_label") self._stream_type_check_button = builder.get_object( "stream_type_default_check_button") self._id_default_check_button = builder.get_object( "id_default_check_button") self._type_check_button = builder.get_object( "type_default_check_button") self._sid_auto_check_button = builder.get_object( "sid_auto_check_button") self._tid_check_button = builder.get_object("tid_default_check_button") self._nid_check_button = builder.get_object("nid_default_check_button") self._namespace_check_button = builder.get_object( "namespace_default_check_button") self._stream_type_combobox = builder.get_object( "stream_type_list_combobox") self._list_srv_id_entry = builder.get_object("list_srv_id_entry") self._list_srv_type_entry = builder.get_object("list_srv_type_entry") self._list_sid_entry = builder.get_object("list_sid_entry") self._list_tid_entry = builder.get_object("list_tid_entry") self._list_nid_entry = builder.get_object("list_nid_entry") self._list_namespace_entry = builder.get_object("list_namespace_entry") self._apply_button = builder.get_object( "list_configuration_apply_button") self._cancel_button = builder.get_object("cancel_config_list_button") self._ok_button = builder.get_object("list_configuration_ok_button") self._ok_button.bind_property("visible", self._apply_button, "visible", 4) self._ok_button.bind_property("visible", self._cancel_button, "visible", 4) # Style style_provider = Gtk.CssProvider() style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") self._default_elems = (self._stream_type_check_button, self._id_default_check_button, self._type_check_button, self._sid_auto_check_button, self._tid_check_button, self._nid_check_button, self._namespace_check_button) self._digit_elems = (self._list_srv_id_entry, self._list_srv_type_entry, self._list_sid_entry, self._list_tid_entry, self._list_nid_entry, self._list_namespace_entry) for el in self._digit_elems: el.get_style_context().add_provider_for_screen( Gdk.Screen.get_default(), style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
def __init__(self, transient, view, services, bouquet, settings, action=Action.ADD): handlers = { "on_response": self.on_response, "on_entry_changed": self.on_entry_changed, "on_url_changed": self.on_url_changed, "on_save": self.on_save, "on_stream_type_changed": self.on_stream_type_changed, "on_yt_quality_changed": self.on_yt_quality_changed, "on_info_bar_close": self.on_info_bar_close } self._action = action self._s_type = settings.setting_type self._settings = settings self._bouquet = bouquet self._services = services self._yt_links = None self._yt_dl = None builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) builder.add_objects_from_string( get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION), ("iptv_dialog", "stream_type_liststore", "yt_quality_liststore")) builder.connect_signals(handlers) self._dialog = builder.get_object("iptv_dialog") self._dialog.set_transient_for(transient) self._name_entry = builder.get_object("name_entry") self._description_entry = builder.get_object("description_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._stream_type_combobox = builder.get_object("stream_type_combobox") self._info_bar = builder.get_object("info_bar") self._message_label = builder.get_object("info_bar_message_label") self._yt_quality_box = builder.get_object("yt_iptv_quality_combobox") self._model, self._paths = view.get_selection().get_selected_rows() # style self._style_provider = Gtk.CssProvider() self._style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") self._digit_elems = (self._srv_type_entry, self._sid_entry, self._tr_id_entry, self._net_id_entry, self._namespace_entry) for el in self._digit_elems: el.get_style_context().add_provider_for_screen( Gdk.Screen.get_default(), self._style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) if self._s_type is SettingsType.NEUTRINO_MP: builder.get_object("iptv_dialog_ts_data_frame").set_visible(False) builder.get_object("iptv_type_label").set_visible(False) builder.get_object("reference_entry").set_visible(False) builder.get_object("iptv_reference_label").set_visible(False) self._stream_type_combobox.set_visible(False) else: self._description_entry.set_visible(False) builder.get_object("iptv_description_label").set_visible(False) if self._action is Action.ADD: self._save_button.set_visible(False) self._add_button.set_visible(True) if self._s_type is SettingsType.ENIGMA_2: self.update_reference_entry() self._stream_type_combobox.set_active(1) elif self._action is Action.EDIT: self._current_srv = get_base_model(self._model)[self._paths][:] self.init_data(self._current_srv)
def __init__(self, transient, s_type): handlers = { "on_apply": self.on_apply, "on_response": self.on_response, "on_stream_type_default_togged": self.on_stream_type_default_togged, "on_stream_type_changed": self.on_stream_type_changed, "on_default_type_toggled": self.on_default_type_toggled, "on_auto_sid_toggled": self.on_auto_sid_toggled, "on_default_tid_toggled": self.on_default_tid_toggled, "on_default_nid_toggled": self.on_default_nid_toggled, "on_default_namespace_toggled": self.on_default_namespace_toggled, "on_reset_to_default": self.on_reset_to_default, "on_entry_changed": self.on_entry_changed, "on_info_bar_close": self.on_info_bar_close } self._s_type = s_type builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) builder.add_objects_from_string( get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION), ("iptv_list_configuration_dialog", "stream_type_liststore")) builder.connect_signals(handlers) self._dialog = builder.get_object("iptv_list_configuration_dialog") self._dialog.set_transient_for(transient) self._data_box = builder.get_object("iptv_list_data_box") self._start_values_grid = builder.get_object("start_values_grid") self._info_bar = builder.get_object("list_configuration_info_bar") self._reference_label = builder.get_object("reference_label") self._stream_type_check_button = builder.get_object( "stream_type_default_check_button") self._type_check_button = builder.get_object( "type_default_check_button") self._sid_auto_check_button = builder.get_object( "sid_auto_check_button") self._tid_check_button = builder.get_object("tid_default_check_button") self._nid_check_button = builder.get_object("nid_default_check_button") self._namespace_check_button = builder.get_object( "namespace_default_check_button") self._stream_type_combobox = builder.get_object( "stream_type_list_combobox") self._list_srv_type_entry = builder.get_object("list_srv_type_entry") self._list_sid_entry = builder.get_object("list_sid_entry") self._list_tid_entry = builder.get_object("list_tid_entry") self._list_nid_entry = builder.get_object("list_nid_entry") self._list_namespace_entry = builder.get_object("list_namespace_entry") self._apply_button = builder.get_object( "list_configuration_apply_button") # Style style_provider = Gtk.CssProvider() style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") self._default_elems = (self._stream_type_check_button, self._type_check_button, self._sid_auto_check_button, self._tid_check_button, self._nid_check_button, self._namespace_check_button) self._digit_elems = (self._list_srv_type_entry, self._list_sid_entry, self._list_tid_entry, self._list_nid_entry, self._list_namespace_entry) for el in self._digit_elems: el.get_style_context().add_provider_for_screen( Gdk.Screen.get_default(), style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)