def _display_settings(self):
        """ Retrieve in-memory settings and put them in dialog fields. """

        self.general_clear_cache_on_exit_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "clear-cache-on-exit"))
        )
        self.general_compact_toolbar_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "compact-tool-bar"))
        )
        self.general_compact_treeview_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "compact-tree-view"))
        )
        self.general_disable_presets_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "disable-presets"))
        )
        self.general_disable_proxy_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "disable-proxy"))
        )
        self.general_refresh_cache_on_startup_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "refresh-cache-on-startup"))
        )
        self.general_show_buttonmenu_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "show-button-menu"))
        )
        self.general_show_menubar_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "show-menu-bar"))
        )
        self.general_show_tooltip_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "show-tooltip"))
        )
        self.general_start_maximized_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION, "start-maximized"))
        )

        value = settings.get_config().get(config.NOSECTION, "terminal-emulator")
        if not value:
            # Get default value (as an example value) if stored value is empty
            settings.revert_config_option(config.NOSECTION, "terminal-emulator")
        self.general_terminal_emulator_entry.set_text(settings.get_config().get(config.NOSECTION, "terminal-emulator"))

        #

        self.radio_channels_entry.set_text(settings.get_config().get("radio", "channels"))
        download_path = settings.get_config().get("radio", "download-path")
        self.radio_download_path_entry.set_text(download_path)
        if download_path:
            if not os.path.exists(download_path):
                os.makedirs(download_path)
            self.radio_download_file_chooser_button.set_filename(download_path)
        else:
            # Set to root path
            self.radio_download_file_chooser_button.set_filename(os.sep)
        self.radio_preset_file_entry.set_text(settings.get_config().get("radio", "preset-file"))
        self.radio_recording_modes_entry.set_text(settings.get_config().get("radio", "recording-modes"))
        self.radio_run_in_terminal_check_button.set_active(
            string.str2bool(settings.get_config().get("radio", "run-in-terminal"))
        )

        #

        self.tv_channels_entry.set_text(settings.get_config().get("tv", "channels"))
        download_path = settings.get_config().get("tv", "download-path")
        self.tv_download_path_entry.set_text(download_path)
        if download_path:
            if not os.path.exists(download_path):
                os.makedirs(download_path)
            self.tv_download_file_chooser_button.set_filename(download_path)
        else:
            # Set to root path
            self.tv_download_file_chooser_button.set_filename(os.sep)
        self.tv_preset_file_entry.set_text(settings.get_config().get("tv", "preset-file"))
        self.tv_recording_modes_entry.set_text(settings.get_config().get("tv", "recording-modes"))
        self.tv_run_in_terminal_check_button.set_active(
            string.str2bool(settings.get_config().get("tv", "run-in-terminal"))
        )
Beispiel #2
0
    def _display_settings(self):
        """ Retrieve in-memory settings and put them in dialog fields. """

        self.general_clear_cache_on_exit_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION,
                                                      "clear-cache-on-exit")))
        self.general_compact_toolbar_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION,
                                                      "compact-tool-bar")))
        self.general_compact_treeview_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION,
                                                      "compact-tree-view")))
        self.general_disable_presets_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION,
                                                      "disable-presets")))
        self.general_disable_proxy_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION,
                                                      "disable-proxy")))
        self.general_refresh_cache_on_startup_check_button.set_active(
            string.str2bool(settings.get_config().get(
                config.NOSECTION, "refresh-cache-on-startup")))
        self.general_show_buttonmenu_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION,
                                                      "show-button-menu")))
        self.general_show_menubar_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION,
                                                      "show-menu-bar")))
        self.general_show_tooltip_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION,
                                                      "show-tooltip")))
        self.general_start_maximized_check_button.set_active(
            string.str2bool(settings.get_config().get(config.NOSECTION,
                                                      "start-maximized")))

        value = settings.get_config().get(config.NOSECTION,
                                          "terminal-emulator")
        if not value:
            # Get default value (as an example value) if stored value is empty
            settings.revert_config_option(config.NOSECTION,
                                          "terminal-emulator")
        self.general_terminal_emulator_entry.set_text(
            settings.get_config().get(config.NOSECTION, "terminal-emulator"))

        #

        self.radio_channels_entry.set_text(settings.get_config().get(
            "radio", "channels"))
        download_path = settings.get_config().get("radio", "download-path")
        self.radio_download_path_entry.set_text(download_path)
        if download_path:
            if not os.path.exists(download_path):
                os.makedirs(download_path)
            self.radio_download_file_chooser_button.set_filename(download_path)
        else:
            # Set to root path
            self.radio_download_file_chooser_button.set_filename(os.sep)
        self.radio_preset_file_entry.set_text(settings.get_config().get(
            "radio", "preset-file"))
        self.radio_recording_modes_entry.set_text(settings.get_config().get(
            "radio", "recording-modes"))
        self.radio_run_in_terminal_check_button.set_active(
            string.str2bool(settings.get_config().get("radio",
                                                      "run-in-terminal")))

        #

        self.tv_channels_entry.set_text(settings.get_config().get(
            "tv", "channels"))
        download_path = settings.get_config().get("tv", "download-path")
        self.tv_download_path_entry.set_text(download_path)
        if download_path:
            if not os.path.exists(download_path):
                os.makedirs(download_path)
            self.tv_download_file_chooser_button.set_filename(download_path)
        else:
            # Set to root path
            self.tv_download_file_chooser_button.set_filename(os.sep)
        self.tv_preset_file_entry.set_text(settings.get_config().get(
            "tv", "preset-file"))
        self.tv_recording_modes_entry.set_text(settings.get_config().get(
            "tv", "recording-modes"))
        self.tv_run_in_terminal_check_button.set_active(
            string.str2bool(settings.get_config().get("tv",
                                                      "run-in-terminal")))
    def _on_prefs_revert_clicked(self, user_data):
        """ Only reset settings visible on the preferences dialog window. """

        # Factory-reset all options
        # settings.revert()

        settings.revert_config_option(config.NOSECTION, "clear-cache-on-exit")
        settings.revert_config_option(config.NOSECTION, "compact-toolbar")
        settings.revert_config_option(config.NOSECTION, "compact-treeview")
        settings.revert_config_option(config.NOSECTION, "disable-presets")
        settings.revert_config_option(config.NOSECTION, "disable-proxy")
        settings.revert_config_option(config.NOSECTION, "refresh-cache-on-startup")
        settings.revert_config_option(config.NOSECTION, "show-menubar")
        settings.revert_config_option(config.NOSECTION, "show-tooltip")
        settings.revert_config_option(config.NOSECTION, "start-maximized")
        settings.revert_config_option(config.NOSECTION, "terminal-emulator")

        settings.revert_config_option("radio", "channels")
        settings.revert_config_option("radio", "download-path")
        settings.revert_config_option("radio", "preset-file")
        settings.revert_config_option("radio", "recording-modes")
        settings.revert_config_option("radio", "run-in-terminal")

        settings.revert_config_option("tv", "channels")
        settings.revert_config_option("tv", "download-path")
        settings.revert_config_option("tv", "preset-file")
        settings.revert_config_option("tv", "recording-modes")
        settings.revert_config_option("tv", "run-in-terminal")

        self._display_settings()
Beispiel #4
0
    def _on_prefs_revert_clicked(self, user_data):
        """ Only reset settings visible on the preferences dialog window. """

        # Factory-reset all options
        #settings.revert()

        settings.revert_config_option(config.NOSECTION, "clear-cache-on-exit")
        settings.revert_config_option(config.NOSECTION, "compact-toolbar")
        settings.revert_config_option(config.NOSECTION, "compact-treeview")
        settings.revert_config_option(config.NOSECTION, "disable-presets")
        settings.revert_config_option(config.NOSECTION, "disable-proxy")
        settings.revert_config_option(config.NOSECTION,
                                      "refresh-cache-on-startup")
        settings.revert_config_option(config.NOSECTION, "show-menubar")
        settings.revert_config_option(config.NOSECTION, "show-tooltip")
        settings.revert_config_option(config.NOSECTION, "start-maximized")
        settings.revert_config_option(config.NOSECTION, "terminal-emulator")

        settings.revert_config_option("radio", "channels")
        settings.revert_config_option("radio", "download-path")
        settings.revert_config_option("radio", "preset-file")
        settings.revert_config_option("radio", "recording-modes")
        settings.revert_config_option("radio", "run-in-terminal")

        settings.revert_config_option("tv", "channels")
        settings.revert_config_option("tv", "download-path")
        settings.revert_config_option("tv", "preset-file")
        settings.revert_config_option("tv", "recording-modes")
        settings.revert_config_option("tv", "run-in-terminal")

        self._display_settings()