コード例 #1
0
ファイル: transmitter.py プロジェクト: vpont/DemonEditor
    def __init__(self, http_api, app_window, settings):
        handlers = {
            "on_popup_menu": self.on_popup_menu,
            "on_status_icon_activate": self.on_status_icon_activate,
            "on_url_changed": self.on_url_changed,
            "on_url_activate": self.on_url_activate,
            "on_drag_data_received": self.on_drag_data_received,
            "on_previous": self.on_previous,
            "on_next": self.on_next,
            "on_stop": self.on_stop,
            "on_clear": self.on_clear,
            "on_play": self.on_play
        }

        self._http_api = http_api
        self._app_window = app_window
        self._is_status_icon = True

        builder = get_builder(UI_RESOURCES_PATH + "transmitter.glade",
                              handlers)

        self._main_window = builder.get_object("main_window")
        self._url_entry = builder.get_object("url_entry")
        self._tool_bar = builder.get_object("tool_bar")
        self._popup_menu = builder.get_object("staus_popup_menu")
        self._restore_menu_item = builder.get_object("restore_menu_item")
        self._status_active = None
        self._status_passive = None
        self._yt = YouTube.get_instance(settings)

        try:
            gi.require_version("AppIndicator3", "0.1")
            from gi.repository import AppIndicator3
        except (ImportError, ValueError) as e:
            log("{}: Load library error: {}".format(__class__.__name__, e))
            self._tray = builder.get_object("status_icon")
        else:
            self._is_status_icon = False
            self._status_active = AppIndicator3.IndicatorStatus.ACTIVE
            self._status_passive = AppIndicator3.IndicatorStatus.PASSIVE

            category = AppIndicator3.IndicatorCategory.APPLICATION_STATUS
            path = Path(UI_RESOURCES_PATH +
                        "/icons/hicolor/scalable/apps/demon-editor.svg")
            path = str(path.resolve()) if path.is_file() else "demon-editor"
            self._tray = AppIndicator3.Indicator.new("DemonEditor", path,
                                                     category)
            self._tray.set_status(self._status_active)
            self._tray.set_secondary_activate_target(
                builder.get_object("show_menu_item"))
            self._tray.set_menu(self._popup_menu)

        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)
コード例 #2
0
ファイル: backup.py プロジェクト: vpont/DemonEditor
    def __init__(self, transient, settings, callback):
        handlers = {
            "on_restore_bouquets": self.on_restore_bouquets,
            "on_restore_all": self.on_restore_all,
            "on_remove": self.on_remove,
            "on_view_popup_menu": self.on_view_popup_menu,
            "on_info_button_toggled": self.on_info_button_toggled,
            "on_info_bar_close": self.on_info_bar_close,
            "on_cursor_changed": self.on_cursor_changed,
            "on_resize": self.on_resize,
            "on_key_release": self.on_key_release
        }

        builder = get_builder(UI_RESOURCES_PATH + "backup_dialog.glade",
                              handlers)

        self._settings = settings
        self._s_type = settings.setting_type
        self._data_path = self._settings.profile_data_path
        self._backup_path = self._settings.profile_backup_path or "{}backup{}".format(
            self._data_path, os.sep)
        self._open_data_callback = callback
        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._text_view = builder.get_object("text_view")
        self._text_view_scrolled_window = builder.get_object(
            "text_view_scrolled_window")
        self._info_check_button = builder.get_object("info_check_button")
        self._info_bar = builder.get_object("info_bar")
        self._message_label = builder.get_object("message_label")

        if IS_GNOME_SESSION:
            header_bar = Gtk.HeaderBar(visible=True, show_close_button=True)
            self._dialog_window.set_titlebar(header_bar)

            button_box = builder.get_object("main_button_box")
            button_box.set_margin_top(0)
            button_box.set_margin_bottom(0)
            button_box.set_margin_left(0)
            button_box.reparent(header_bar)

            ch_button = builder.get_object("info_check_button")
            ch_button.set_margin_right(0)
            h_bar = builder.get_object("header_bar")
            h_bar.remove(ch_button)
            h_bar.set_visible(False)
            header_bar.pack_end(ch_button)

        # Setting the last size of the dialog window if it was saved
        window_size = self._settings.get("backup_tool_window_size")
        if window_size:
            self._dialog_window.resize(*window_size)

        self.init_data()
コード例 #3
0
    def __init__(self, app, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._app = app

        handlers = {"on_clear": self.on_clear}
        builder = get_builder(UI_RESOURCES_PATH + "logs.glade", handlers)

        self._log_view = builder.get_object("log_view")
        self.pack_start(builder.get_object("log_frame"), True, True, 0)

        logger = logging.getLogger(LOGGER_NAME)
        logger.addHandler(LogsClient.LogHandler(self._log_view))

        self.show()
コード例 #4
0
ファイル: playback.py プロジェクト: vpont/DemonEditor
    def init_playback_elements(self):
        self._player.connect("error", self.on_error)
        self._player.connect("played", self.on_played)
        self._player.connect("audio-track", self.on_audio_track_changed)
        self._player.connect("subtitle-track", self.on_subtitle_track_changed)
        self._app.app_window.connect("key-press-event", self.on_key_press)

        builder = get_builder(UI_RESOURCES_PATH + "app_menu.ui")
        self._audio_track_menu = builder.get_object("audio_track_menu")
        self._subtitle_track_menu = builder.get_object("subtitle_track_menu")
        audio_menu = builder.get_object("audio_menu")
        video_menu = builder.get_object("video_menu")
        subtitle_menu = builder.get_object("subtitle_menu")

        if not IS_GNOME_SESSION:
            menu_bar = self._app.get_menubar()
            menu_bar.insert_section(1, None, audio_menu)
            menu_bar.insert_section(2, None, video_menu)
            menu_bar.insert_section(3, None, subtitle_menu)

        if not IS_DARWIN:
            self._player.connect("position", self.on_time_changed)
            self._audio_menu_button.set_menu_model(self._audio_track_menu)
            self._video_menu_button.set_menu_model(
                builder.get_object("aspect_ratio_menu"))
            self._subtitle_menu_button.set_menu_model(
                self._subtitle_track_menu)
        # Actions.
        self._app.set_action("on_play", self.on_play)
        self._app.set_action("on_stop", self.on_stop)
        audio_track_action = Gio.SimpleAction.new_stateful(
            "on_set_audio_track", GLib.VariantType.new("i"),
            GLib.Variant("i", 0))
        audio_track_action.connect("activate", self.on_set_audio_track)
        self._app.add_action(audio_track_action)
        aspect_action = Gio.SimpleAction.new_stateful(
            "on_set_aspect_ratio", GLib.VariantType.new("s"),
            GLib.Variant("s", ""))
        aspect_action.connect("activate", self.on_set_aspect_ratio)
        self._app.add_action(aspect_action)
        subtitle_track_action = Gio.SimpleAction.new_stateful(
            "on_set_subtitle_track", GLib.VariantType.new("i"),
            GLib.Variant("i", -1))
        subtitle_track_action.connect("activate", self.on_set_subtitle_track)
        self._app.add_action(subtitle_track_action)
コード例 #5
0
ファイル: imports.py プロジェクト: vpont/DemonEditor
    def __init__(self,
                 transient,
                 path,
                 settings,
                 service_ids,
                 appender,
                 bouquets=None):
        handlers = {
            "on_import": self.on_import,
            "on_cursor_changed": self.on_cursor_changed,
            "on_selected_toggled": self.on_selected_toggled,
            "on_info_bar_close": self.on_info_bar_close,
            "on_select_all": self.on_select_all,
            "on_unselect_all": self.on_unselect_all,
            "on_popup_menu": on_popup_menu,
            "on_resize": self.on_resize,
            "on_key_press": self.on_key_press
        }

        builder = get_builder(UI_RESOURCES_PATH + "imports.glade", handlers)

        self._bq_services = {}
        self._services = {}
        self._service_ids = service_ids
        self._append = appender
        self._profile = settings.setting_type
        self._settings = settings
        self._bouquets = bouquets

        self._dialog_window = builder.get_object("dialog_window")
        self._dialog_window.set_transient_for(transient)
        self._main_model = builder.get_object("main_list_store")
        self._main_view = builder.get_object("main_view")
        self._services_view = builder.get_object("services_view")
        self._services_model = builder.get_object("services_list_store")
        self._info_check_button = builder.get_object("info_check_button")
        self._info_check_button.bind_property(
            "active", builder.get_object("services_box_frame"), "visible")
        self._info_bar = builder.get_object("info_bar")
        self._message_label = builder.get_object("message_label")
        window_size = self._settings.get("import_dialog_window_size")
        if window_size:
            self._dialog_window.resize(*window_size)

        self.init_data(path)
コード例 #6
0
    def __init__(self, transient, model, fav_bouquet, iptv_rows, s_type):
        handlers = {"on_response": self.on_response}

        builder = get_builder(UI_RESOURCES_PATH + "iptv.glade",
                              handlers,
                              objects=("search_unavailable_streams_dialog", ))

        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()
コード例 #7
0
ファイル: playback.py プロジェクト: vpont/DemonEditor
    def __init__(self, app, *args, **kwargs):
        super().__init__(*args, **kwargs)
        # Signals.
        GObject.signal_new("playback-full-screen", self,
                           GObject.SIGNAL_RUN_LAST, GObject.TYPE_PYOBJECT,
                           (GObject.TYPE_PYOBJECT, ))
        GObject.signal_new("playback-close", self, GObject.SIGNAL_RUN_LAST,
                           GObject.TYPE_PYOBJECT, (GObject.TYPE_PYOBJECT, ))
        GObject.signal_new("play", self, GObject.SIGNAL_RUN_LAST,
                           GObject.TYPE_PYOBJECT, (GObject.TYPE_PYOBJECT, ))
        GObject.signal_new("stop", self, GObject.SIGNAL_RUN_LAST,
                           GObject.TYPE_PYOBJECT, (GObject.TYPE_PYOBJECT, ))

        self._app = app
        self._app.connect("fav-clicked", self.on_fav_clicked)
        self._app.connect("page-changed", self.on_page_changed)
        self._app.connect("play-current", self.on_play_current)
        self._app.connect("play-recording", self.on_play_recording)
        self._fav_view = app.fav_view
        self._player = None
        self._current_mrl = None
        self._full_screen = False
        self._playback_window = None
        self._audio_track_menu = None
        self._subtitle_track_menu = None
        self._play_mode = self._app.app_settings.play_streams_mode

        handlers = {
            "on_realize": self.on_realize,
            "on_press": self.on_press,
            "on_next": self.on_next,
            "on_previous": self.on_previous,
            "on_rewind": self.on_rewind,
            "on_full_screen": self.on_full_screen,
            "on_close": self.on_close
        }

        builder = get_builder(UI_RESOURCES_PATH + "playback.glade", handlers)
        self.set_spacing(5)
        self.set_orientation(Gtk.Orientation.VERTICAL)
        self._event_box = builder.get_object("event_box")
        self.pack_start(self._event_box, True, True, 0)
        if not IS_DARWIN:
            self.pack_end(builder.get_object("tool_bar"), False, True, 0)
            self._scale = builder.get_object("scale")
            self._full_time_label = builder.get_object("full_time_label")
            self._current_time_label = builder.get_object("current_time_label")
            self._rewind_box = builder.get_object("rewind_box")
            self._tool_bar = builder.get_object("tool_bar")
            self._prev_button = builder.get_object("prev_button")
            self._next_button = builder.get_object("next_button")
            self._audio_menu_button = builder.get_object("audio_menu_button")
            self._video_menu_button = builder.get_object("video_menu_button")
            self._subtitle_menu_button = builder.get_object(
                "subtitle_menu_button")
            self._fav_view.bind_property("sensitive", self._prev_button,
                                         "sensitive")
            self._fav_view.bind_property("sensitive", self._next_button,
                                         "sensitive")

        self.connect("delete-event", self.on_delete)
        self.connect("show", self.set_player_area_size)
コード例 #8
0
ファイル: epg.py プロジェクト: audi06/DemonEditor
    def __init__(self, app, bouquet, bouquet_name):

        handlers = {
            "on_close_dialog": self.on_close_dialog,
            "on_apply": self.on_apply,
            "on_update": self.on_update,
            "on_save_to_xml": self.on_save_to_xml,
            "on_auto_configuration": self.on_auto_configuration,
            "on_filter_toggled": self.on_filter_toggled,
            "on_filter_changed": self.on_filter_changed,
            "on_info_bar_close": self.on_info_bar_close,
            "on_popup_menu": on_popup_menu,
            "on_bouquet_popup_menu": self.on_bouquet_popup_menu,
            "on_copy_ref": self.on_copy_ref,
            "on_assign_ref": self.on_assign_ref,
            "on_reset": self.on_reset,
            "on_list_reset": self.on_list_reset,
            "on_drag_begin": self.on_drag_begin,
            "on_drag_data_get": self.on_drag_data_get,
            "on_drag_data_received": self.on_drag_data_received,
            "on_resize": self.on_resize,
            "on_names_source_changed": self.on_names_source_changed,
            "on_options_save": self.on_options_save,
            "on_use_web_source_switch": self.on_use_web_source_switch,
            "on_enable_filtering_switch": self.on_enable_filtering_switch,
            "on_update_on_start_switch": self.on_update_on_start_switch,
            "on_field_icon_press": self.on_field_icon_press,
            "on_key_press": self.on_key_press,
            "on_bq_cursor_changed": self.on_bq_cursor_changed
        }

        self._app = app
        self._services = {}
        self._ex_services = self._app.current_services
        self._ex_fav_model = self._app.fav_view.get_model()
        self._settings = self._app.app_settings
        self._bouquet = bouquet
        self._bouquet_name = bouquet_name
        self._current_ref = []
        self._enable_dat_filter = False
        self._use_web_source = False
        self._update_epg_data_on_start = False
        self._refs_source = RefsSource.SERVICES
        self._download_xml_is_active = False

        builder = get_builder(UI_RESOURCES_PATH + "epg.glade", handlers)

        self._dialog = builder.get_object("epg_dialog_window")
        self._dialog.set_transient_for(self._app.app_window)
        self._source_view = builder.get_object("source_view")
        self._bouquet_view = builder.get_object("bouquet_view")
        self._bouquet_model = builder.get_object("bouquet_list_store")
        self._services_model = builder.get_object("services_list_store")
        self._info_bar = builder.get_object("info_bar")
        self._message_label = builder.get_object("info_bar_message_label")
        self._assign_ref_popup_item = builder.get_object(
            "bouquet_assign_ref_popup_item")
        self._left_action_box = builder.get_object("left_action_box")
        self._xml_download_progress_bar = builder.get_object(
            "xml_download_progress_bar")
        # Filter
        self._filter_bar = builder.get_object("filter_bar")
        self._filter_entry = builder.get_object("filter_entry")
        self._filter_auto_switch = builder.get_object("filter_auto_switch")
        self._services_filter_model = builder.get_object(
            "services_filter_model")
        self._services_filter_model.set_visible_func(
            self.services_filter_function)
        # Info
        self._source_count_label = builder.get_object("source_count_label")
        self._source_info_label = builder.get_object("source_info_label")
        self._bouquet_count_label = builder.get_object("bouquet_count_label")
        self._bouquet_epg_count_label = builder.get_object(
            "bouquet_epg_count_label")
        # Options
        self._xml_radiobutton = builder.get_object("xml_radiobutton")
        self._xml_chooser_button = builder.get_object("xml_chooser_button")
        self._names_source_box = builder.get_object("names_source_box")
        self._web_source_box = builder.get_object("web_source_box")
        self._use_web_source_switch = builder.get_object(
            "use_web_source_switch")
        self._url_to_xml_entry = builder.get_object("url_to_xml_entry")
        self._enable_filtering_switch = builder.get_object(
            "enable_filtering_switch")
        self._epg_dat_path_entry = builder.get_object("epg_dat_path_entry")
        self._epg_dat_stb_path_entry = builder.get_object(
            "epg_dat_stb_path_entry")
        self._update_on_start_switch = builder.get_object(
            "update_on_start_switch")
        self._epg_dat_source_box = builder.get_object("epg_dat_source_box")

        if IS_GNOME_SESSION:
            header_bar = Gtk.HeaderBar(
                visible=True,
                show_close_button=True,
                title="EPG",
                subtitle=get_message("List configuration"))
            self._dialog.set_titlebar(header_bar)
            builder.get_object("left_action_box").reparent(header_bar)
            right_box = builder.get_object("right_action_box")
            builder.get_object("main_actions_box").remove(right_box)
            header_bar.pack_end(right_box)
            builder.get_object("toolbar_box").set_visible(False)

        self._app.connect("epg-dat-downloaded", self.on_epg_dat_downloaded)

        # Setting the last size of the dialog window
        window_size = self._settings.get("epg_tool_window_size")
        if window_size:
            self._dialog.resize(*window_size)

        self.init_drag_and_drop()
        self.on_update()
コード例 #9
0
ファイル: settings_dialog.py プロジェクト: audi06/DemonEditor
    def __init__(self, transient, settings: Settings):
        handlers = {
            "on_field_icon_press": self.on_field_icon_press,
            "on_settings_type_changed": self.on_settings_type_changed,
            "on_reset": self.on_reset,
            "on_response": self.on_response,
            "on_connection_test": self.on_connection_test,
            "on_info_bar_close": self.on_info_bar_close,
            "on_set_color_switch": self.on_set_color_switch,
            "on_force_bq_name": self.on_force_bq_name,
            "on_http_mode_switch": self.on_http_mode_switch,
            "on_experimental_switch": self.on_experimental_switch,
            "on_yt_dl_switch": self.on_yt_dl_switch,
            "on_default_path_mode_switch": self.on_default_path_mode_switch,
            "on_profile_add": self.on_profile_add,
            "on_profile_edit": self.on_profile_edit,
            "on_profile_remove": self.on_profile_remove,
            "on_profile_deleted": self.on_profile_deleted,
            "on_profile_inserted": self.on_profile_inserted,
            "on_profile_edited": self.on_profile_edited,
            "on_profile_selected": self.on_profile_selected,
            "on_profile_set_default": self.on_profile_set_default,
            "on_add_picon_path": self.on_add_picon_path,
            "on_remove_picon_path": self.on_remove_picon_path,
            "on_lang_changed": self.on_lang_changed,
            "on_main_settings_visible": self.on_main_settings_visible,
            "on_http_use_ssl_toggled": self.on_http_use_ssl_toggled,
            "on_click_mode_togged": self.on_click_mode_togged,
            "on_play_mode_changed": self.on_play_mode_changed,
            "on_transcoding_preset_changed":
            self.on_transcoding_preset_changed,
            "on_apply_presets": self.on_apply_presets,
            "on_digit_entry_changed": self.on_digit_entry_changed,
            "on_view_popup_menu": self.on_view_popup_menu,
            "on_list_font_reset": self.on_list_font_reset,
            "on_theme_changed": self.on_theme_changed,
            "on_theme_add": self.on_theme_add,
            "on_theme_remove": self.on_theme_remove,
            "on_appearance_changed": self.on_appearance_changed,
            "on_icon_theme_add": self.on_icon_theme_add,
            "on_icon_theme_remove": self.on_icon_theme_remove
        }

        # Settings.
        self._ext_settings = settings
        self._settings = Settings(settings.settings)
        self._profiles = self._settings.profiles
        self._s_type = self._settings.setting_type
        self._updated = False

        builder = get_builder(UI_RESOURCES_PATH + "settings_dialog.glade",
                              handlers)

        self._dialog = builder.get_object("settings_dialog")
        self._dialog.set_transient_for(transient)
        self._dialog.set_border_width(0)
        self._dialog.set_margin_left(0)
        self._main_stack = builder.get_object("main_stack")
        # Network.
        self._host_field = builder.get_object("host_field")
        self._port_field = builder.get_object("port_field")
        self._login_field = builder.get_object("login_field")
        self._password_field = builder.get_object("password_field")
        self._http_port_field = builder.get_object("http_port_field")
        self._http_use_ssl_check_button = builder.get_object(
            "http_use_ssl_check_button")
        self._telnet_port_field = builder.get_object("telnet_port_field")
        self._telnet_timeout_spin_button = builder.get_object(
            "telnet_timeout_spin_button")
        self._reset_button = builder.get_object("reset_button")
        # Test.
        self._ftp_radio_button = builder.get_object("ftp_radio_button")
        self._http_radio_button = builder.get_object("http_radio_button")
        # Network paths.
        self._services_field = builder.get_object("services_field")
        self._user_bouquet_field = builder.get_object("user_bouquet_field")
        self._satellites_xml_field = builder.get_object("satellites_xml_field")
        self._picons_paths_box = builder.get_object("picons_paths_box")
        self._remove_picon_path_button = builder.get_object(
            "remove_picon_path_button")
        # Paths.
        self._picons_path_field = builder.get_object("picons_path_field")
        self._data_path_field = builder.get_object("data_path_field")
        self._backup_path_field = builder.get_object("backup_path_field")
        self._record_data_path_field = builder.get_object(
            "record_data_path_field")
        self._default_data_paths_switch = builder.get_object(
            "default_data_paths_switch")
        self._default_data_paths_switch.bind_property("active",
                                                      self._backup_path_field,
                                                      "sensitive", 4)
        self._default_data_paths_switch.bind_property("active",
                                                      self._picons_path_field,
                                                      "sensitive", 4)
        # Info bar.
        self._info_bar = builder.get_object("info_bar")
        self._message_label = builder.get_object("info_bar_message_label")
        self._test_spinner = builder.get_object("test_spinner")
        # Settings type.
        self._enigma_radio_button = builder.get_object("enigma_radio_button")
        self._neutrino_radio_button = builder.get_object(
            "neutrino_radio_button")
        self._support_ver5_switch = builder.get_object("support_ver5_switch")
        self._force_bq_name_switch = builder.get_object("force_bq_name_switch")
        # Streaming.
        self._apply_presets_button = builder.get_object("apply_presets_button")
        self._transcoding_switch = builder.get_object("transcoding_switch")
        self._edit_preset_switch = builder.get_object("edit_preset_switch")
        self._presets_combo_box = builder.get_object("presets_combo_box")
        self._video_bitrate_field = builder.get_object("video_bitrate_field")
        self._video_width_field = builder.get_object("video_width_field")
        self._video_height_field = builder.get_object("video_height_field")
        self._audio_bitrate_field = builder.get_object("audio_bitrate_field")
        self._audio_channels_combo_box = builder.get_object(
            "audio_channels_combo_box")
        self._audio_sample_rate_combo_box = builder.get_object(
            "audio_sample_rate_combo_box")
        self._audio_codec_combo_box = builder.get_object(
            "audio_codec_combo_box")
        self._transcoding_switch.bind_property(
            "active", builder.get_object("record_box"), "sensitive")
        self._edit_preset_switch.bind_property("active",
                                               self._apply_presets_button,
                                               "sensitive")
        self._edit_preset_switch.bind_property(
            "active", builder.get_object("video_options_grid"), "sensitive")
        self._edit_preset_switch.bind_property(
            "active", builder.get_object("audio_options_grid"), "sensitive")
        self._play_streams_combo_box = builder.get_object(
            "play_streams_combo_box")
        self._stream_lib_combo_box = builder.get_object("stream_lib_combo_box")
        self._double_click_combo_box = builder.get_object(
            "double_click_combo_box")
        self._allow_main_list_playback_switch = builder.get_object(
            "allow_main_list_playback_switch")
        # Program.
        self._before_save_switch = builder.get_object("before_save_switch")
        self._before_downloading_switch = builder.get_object(
            "before_downloading_switch")
        self._load_on_startup_switch = builder.get_object(
            "load_on_startup_switch")
        self._bouquet_hints_switch = builder.get_object("bouquet_hints_switch")
        self._services_hints_switch = builder.get_object(
            "services_hints_switch")
        self._lang_combo_box = builder.get_object("lang_combo_box")
        # Appearance.
        self._list_font_button = builder.get_object("list_font_button")
        self._picons_size_button = builder.get_object("picons_size_button")
        self._tooltip_logo_size_button = builder.get_object(
            "tooltip_logo_size_button")
        self._colors_grid = builder.get_object("colors_grid")
        self._set_color_switch = builder.get_object("set_color_switch")
        self._new_color_button = builder.get_object("new_color_button")
        self._extra_color_button = builder.get_object("extra_color_button")
        # Extra.
        self._support_http_api_switch = builder.get_object(
            "support_http_api_switch")
        self._enable_yt_dl_switch = builder.get_object("enable_yt_dl_switch")
        self._enable_update_yt_dl_switch = builder.get_object(
            "enable_update_yt_dl_switch")
        self._enable_send_to_switch = builder.get_object(
            "enable_send_to_switch")
        # EXPERIMENTAL.
        self._enable_exp_switch = builder.get_object(
            "enable_experimental_switch")
        self._enable_exp_switch.bind_property("active",
                                              builder.get_object("yt_dl_box"),
                                              "sensitive")
        self._enable_yt_dl_switch.bind_property(
            "active", builder.get_object("yt_dl_update_box"), "sensitive")
        self._enable_exp_switch.bind_property(
            "active", builder.get_object("v5_support_box"), "sensitive")
        self._enable_exp_switch.bind_property(
            "active", builder.get_object("enable_direct_playback_box"),
            "sensitive")
        # Enigma2 only.
        self._enigma_radio_button.bind_property(
            "active", builder.get_object("bq_naming_grid"), "sensitive")
        self._enigma_radio_button.bind_property(
            "active", builder.get_object("program_frame"), "sensitive")
        self._enigma_radio_button.bind_property(
            "active", builder.get_object("experimental_box"), "sensitive")
        self._enigma_radio_button.bind_property(
            "active", builder.get_object("allow_double_click_box"),
            "sensitive")
        # Profiles.
        self._profile_view = builder.get_object("profile_tree_view")
        self._profile_add_button = builder.get_object("profile_add_button")
        self._profile_remove_button = builder.get_object(
            "profile_remove_button")
        # Network.
        # Separated due to a bug with response (presumably in the builder) in ubuntu 18.04 and derivatives.
        builder.get_object("network_settings_frame").add(
            builder.get_object("network_box"))
        # Style.
        self._style_provider = Gtk.CssProvider()
        self._style_provider.load_from_path(UI_RESOURCES_PATH + "style.css")
        self._digit_elems = (self._port_field, self._http_port_field,
                             self._telnet_port_field, self._video_width_field,
                             self._video_bitrate_field,
                             self._video_height_field,
                             self._audio_bitrate_field)
        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 IS_GNOME_SESSION:
            switcher = builder.get_object("main_stack_switcher")
            switcher.set_margin_top(0)
            switcher.set_margin_bottom(0)
            builder.get_object("main_box").remove(switcher)
            header_bar = Gtk.HeaderBar(visible=True, show_close_button=True)
            header_bar.set_custom_title(switcher)
            self._dialog.set_titlebar(header_bar)

        self.init_ui_elements()
        self.init_profiles()

        if not IS_LINUX:
            # Themes.
            builder.get_object("style_frame").set_visible(IS_WIN)
            builder.get_object("themes_support_frame").set_visible(True)
            self._layout_switch = builder.get_object("layout_switch")
            self._layout_switch.set_active(self._ext_settings.alternate_layout)
            self._force_ext_themes_switch = builder.get_object(
                "force_ext_themes_switch")
            self._force_ext_themes_switch.set_active(
                self._settings.force_external_themes)
            self._theme_frame = builder.get_object("theme_frame")
            self._theme_frame.set_visible(True)
            self._theme_thumbnail_image = builder.get_object(
                "theme_thumbnail_image")
            self._theme_combo_box = builder.get_object("theme_combo_box")
            self._icon_theme_combo_box = builder.get_object(
                "icon_theme_combo_box")
            self._dark_mode_switch = builder.get_object("dark_mode_switch")
            self._dark_mode_switch.set_active(self._ext_settings.dark_mode)
            self._themes_support_switch = builder.get_object(
                "themes_support_switch")
            self._themes_support_switch.bind_property("active",
                                                      self._theme_frame,
                                                      "sensitive")
            self.init_themes()
コード例 #10
0
ファイル: ftp.py プロジェクト: vpont/DemonEditor
    def __init__(self, app, settings, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.set_spacing(2)
        self.set_orientation(Gtk.Orientation.VERTICAL)

        self._app = app
        self._settings = settings
        self._ftp = None
        self._select_enabled = True

        handlers = {
            "on_connect": self.on_connect,
            "on_disconnect": self.on_disconnect,
            "on_ftp_row_activated": self.on_ftp_row_activated,
            "on_file_row_activated": self.on_file_row_activated,
            "on_bookmark_activated": self.on_bookmark_activated,
            "on_ftp_edit": self.on_ftp_edit,
            "on_ftp_rename": self.on_ftp_rename,
            "on_ftp_renamed": self.on_ftp_renamed,
            "on_ftp_copy": self.on_ftp_copy,
            "on_file_rename": self.on_file_rename,
            "on_file_renamed": self.on_file_renamed,
            "on_file_copy": self.on_file_copy,
            "on_file_remove": self.on_file_remove,
            "on_ftp_remove": self.on_ftp_file_remove,
            "on_bookmark_remove": self.on_bookmark_remove,
            "on_file_create_folder": self.on_file_create_folder,
            "on_ftp_create_folder": self.on_ftp_create_folder,
            "on_view_drag_begin": self.on_view_drag_begin,
            "on_ftp_drag_data_get": self.on_ftp_drag_data_get,
            "on_ftp_drag_data_received": self.on_ftp_drag_data_received,
            "on_file_drag_data_get": self.on_file_drag_data_get,
            "on_file_drag_data_received": self.on_file_drag_data_received,
            "on_view_drag_end": self.on_view_drag_end,
            "on_bookmark_add": self.on_bookmark_add,
            "on_view_popup_menu": on_popup_menu,
            "on_view_key_press": self.on_view_key_press,
            "on_view_press": self.on_view_press,
            "on_view_release": self.on_view_release,
            "on_paned_size_allocate": self.on_paned_size_allocate
        }

        builder = get_builder(UI_RESOURCES_PATH + "ftp.glade", handlers)

        self.add(builder.get_object("main_ftp_box"))
        self._ftp_info_label = builder.get_object("ftp_info_label")
        self._ftp_view = builder.get_object("ftp_view")
        self._ftp_model = builder.get_object("ftp_list_store")
        self._ftp_name_renderer = builder.get_object(
            "ftp_name_column_renderer")
        self._file_view = builder.get_object("file_view")
        self._file_model = builder.get_object("file_list_store")
        self._file_name_renderer = builder.get_object(
            "file_name_column_renderer")
        self._bookmark_view = builder.get_object("bookmarks_view")
        self._bookmark_model = builder.get_object("bookmarks_list_store")
        # Buttons
        self._connect_button = builder.get_object("connect_button")
        disconnect_button = builder.get_object("disconnect_button")
        disconnect_button.bind_property("visible",
                                        builder.get_object("ftp_actions_box"),
                                        "sensitive")
        disconnect_button.bind_property(
            "visible", builder.get_object("ftp_create_folder_menu_item"),
            "sensitive")
        disconnect_button.bind_property(
            "visible", builder.get_object("ftp_edit_menu_item"), "sensitive")
        disconnect_button.bind_property(
            "visible", builder.get_object("ftp_rename_menu_item"), "sensitive")
        disconnect_button.bind_property(
            "visible", builder.get_object("ftp_remove_menu_item"), "sensitive")
        disconnect_button.bind_property(
            "visible", builder.get_object("add_ftp_bookmark_button"),
            "sensitive")
        self._connect_button.bind_property(
            "visible", builder.get_object("disconnect_button"), "visible", 4)
        self._bookmarks_button = builder.get_object("bookmarks_button")
        self._bookmarks_button.bind_property(
            "active", builder.get_object("bookmarks_box"), "visible")
        # Force Ctrl
        self._ftp_view.connect("key-press-event", self._app.force_ctrl)
        self._file_view.connect("key-press-event", self._app.force_ctrl)
        # Icons
        theme = Gtk.IconTheme.get_default()
        folder_icon = "folder-symbolic" if settings.is_darwin else "folder"
        self._folder_icon = theme.load_icon(folder_icon, 16,
                                            0) if theme.lookup_icon(
                                                folder_icon, 16, 0) else None
        self._link_icon = theme.load_icon(
            "emblem-symbolic-link", 16, 0) if theme.lookup_icon(
                "emblem-symbolic-link", 16, 0) else None
        # Initialization
        self.init_drag_and_drop()
        self.init_ftp()
        self.init_file_data()
        self.show()
コード例 #11
0
    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)
コード例 #12
0
    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)
コード例 #13
0
    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)