Ejemplo n.º 1
0
 def setUpClass(cls):
     if not hasattr(cls, 'cfg'):
         defaults = {
             'main': {
                 'a_default_key': 100,
                 'bool_option': False
             },
         }
         cls.cfg = UserConfig(cls.__name__, cls.__name__, defaults)
Ejemplo n.º 2
0
 def setUpClass(cls):
     if not hasattr(cls, 'cfg'):
         defaults = {'main': {'a-default-key': 100}}
         cls.cfg = UserConfig(cls.__name__, cls.__name__, defaults)
Ejemplo n.º 3
0
    from workbench.config.main import CONF

and use it to access the settings
"""
from __future__ import (absolute_import, unicode_literals)

from workbench.config.user import UserConfig

# -----------------------------------------------------------------------------
# Constants
# -----------------------------------------------------------------------------
ORGANIZATION = 'mantidproject'
APPNAME = 'workbench'

# Iterable containing defaults for each configurable section of the code
# General application settings are in the main section
DEFAULTS = {
    'main': {
        'high_dpi_scaling': True,
        'window/size': (1260, 740),
        'window/position': (10, 10),
        'window/is_maximized': True,
        'window/is_fullscreen': False,
    }
}

# -----------------------------------------------------------------------------
# 'Singleton' instance
# -----------------------------------------------------------------------------
CONF = UserConfig(ORGANIZATION, APPNAME, defaults=DEFAULTS)
Ejemplo n.º 4
0
 def __enter__(self):
     self.cfg = UserConfig(self.name, self.name, self.defaults)
     return self.cfg