How to use the pympress.config.Config function in pympress

To help you get started, we’ve selected a few pympress examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Cimbali / pympress / pympress / config.py View on Github external
def __init__(config):
        super(Config, config).__init__()

        # populate values first from the default config file, then from the proper one
        config.read(util.get_default_config())
        config.load_window_layouts()

        all_commands = dict(config.items('shortcuts')).keys()

        config.read(config.path_to_config(True))
        config.upgrade()
        config.load_window_layouts()

        for command in all_commands:
            parsed = {Gtk.accelerator_parse(l) for l in config.get('shortcuts', command).split()}

            if (0, 0) in parsed:
                logger.warning('Failed parsing 1 or more shortcuts for ' + command)
github Cimbali / pympress / pympress / config.py View on Github external
def using_portable_config():
        """ Checks which configuration file location is in use.

        Returns:
            `bool`: `True` iff we are using the portable (i.e. in install dir) location
        """
        return util.get_portable_config() == Config.path_to_config()
github Cimbali / pympress / pympress / extras.py View on Github external
def _setup_backends(cls, conf = None):
        """ Load the backends for video overlays
        """
        if cls._backends_setup:
            return

        cls._backends_setup = True
        if conf is None:
            conf = config.Config()

        try:
            from pympress.media_overlays.gif_backend import GifOverlay

            version = GifOverlay.setup_backend()

            cls._backends['image/gif'] = GifOverlay
            cls._backends['image/svg+xml'] = GifOverlay
            cls._backend_versions.append(version)

        except: logger.exception(_('Video support using {} is disabled.').format('Overlay'))


        try:
            if conf.getboolean('gst', 'enabled'):
                from pympress.media_overlays.gst_backend import GstOverlay
github Cimbali / pympress / pympress / config.py View on Github external
def toggle_portable_config(*args):
        """ Create or remove a configuration file for portable installs.

        The portable install file will be used by default, and deleting it causes the config
        to fall back to the user profile location.

        No need to populate the new config file, this will be done on pympress exit.
        """
        if Config.using_portable_config():
            os.remove(util.get_portable_config())
        else:
            with open(util.get_portable_config(), 'w'):
                pass