Пример #1
0
def get_settings(module_key, cfg, db_dict, user_cfg):
    key = a2ctrl.get_cfg_value(cfg, user_cfg, 'key', str)
    scope = a2ctrl.get_cfg_value(cfg, user_cfg, 'scope', list)
    scope_mode = a2ctrl.get_cfg_value(cfg, user_cfg, 'scopeMode', int)
    function = cfg.get(['functionCode', 'functionURL',
                        'functionSend'][cfg['functionMode']], '')

    db_dict.setdefault('hotkeys', {})
    db_dict['hotkeys'].setdefault(scope_mode, [])
    # save a global if global scope set or all-but AND scope is empty
    if scope_mode == 0 or scope_mode == 2 and scope == '':
        db_dict['hotkeys'][0].append([key, function])
    else:
        db_dict['hotkeys'][scope_mode].append([scope, key, function])
Пример #2
0
def get_settings(_module_key, cfg, db_dict, user_cfg):
    key = a2ctrl.get_cfg_value(cfg, user_cfg, 'key')
    scope = a2ctrl.get_cfg_value(cfg, user_cfg, Vars.scope, list)
    scope_mode = a2ctrl.get_cfg_value(cfg, user_cfg, Vars.scope_mode, int)
    func = cfg.get([Vars.function_code, Vars.function_url,
                    Vars.function_send][cfg.get(Vars.function_mode, 0)], '')

    db_dict.setdefault('hotkeys', {})
    db_dict['hotkeys'].setdefault(scope_mode, [])
    # save a global if global scope set or all-but AND scope is empty
    if scope_mode == 0 or scope_mode == 2 and scope == '':
        db_dict['hotkeys'][0].append([key, func])
    else:
        db_dict['hotkeys'][scope_mode].append([scope, key, func])
Пример #3
0
 def get_user_value(self, typ, name=None, default=None):
     """
     Get a user value. 'value'
     Name is 'value' by default so you can just get the default value by stating the type. Voila!
     """
     return a2ctrl.get_cfg_value(self.cfg, self.user_cfg, name, typ,
                                 default)
Пример #4
0
def get_settings(_module_key, cfg, db_dict, user_cfg):
    key = a2ctrl.get_cfg_value(cfg, user_cfg, 'key')
    scope = a2ctrl.get_cfg_value(cfg, user_cfg, Vars.scope, list)
    scope_mode = a2ctrl.get_cfg_value(cfg, user_cfg, Vars.scope_mode, int)
    func = cfg.get(
        [Vars.function_code, Vars.function_url, Vars.function_send]
        [cfg.get(Vars.function_mode, 0)],
        '')

    db_dict.setdefault('hotkeys', {})
    db_dict['hotkeys'].setdefault(scope_mode, [])
    # save a global if global scope set or all-but AND scope is empty
    if scope_mode == 0 or scope_mode == 2 and scope == '':
        db_dict['hotkeys'][0].append([key, func])
    else:
        db_dict['hotkeys'][scope_mode].append([scope, key, func])
Пример #5
0
def get_settings(_module_key, cfg, db_dict, user_cfg):
    db_dict.setdefault('variables', {})
    value = a2ctrl.get_cfg_value(cfg, user_cfg, typ=(int, float), default=0.0)
    db_dict['variables'][cfg['name']] = value
Пример #6
0
def get_settings(_module_key, cfg, db_dict, user_cfg):
    db_dict.setdefault('variables', {})
    value = a2ctrl.get_cfg_value(cfg, user_cfg, typ=list, default=[])
    db_dict['variables'][cfg['name']] = value
Пример #7
0
Файл: path.py Проект: lipkau/a2
def get_settings(module_key, cfg, db_dict, user_cfg):
    db_dict.setdefault('variables', {})
    value = a2ctrl.get_cfg_value(cfg, user_cfg, typ=str, default='')
    db_dict['variables'][cfg['name']] = value
Пример #8
0
def get_settings(_module_key, cfg, db_dict, user_cfg):
    value = a2ctrl.get_cfg_value(cfg, user_cfg, typ=bool, default=cfg.get('value', False))
    db_dict.setdefault('variables', {})[cfg['name']] = value
Пример #9
0
def get_settings(_module_key, cfg, db_dict, user_cfg):
    value = a2ctrl.get_cfg_value(cfg, user_cfg, typ=list, default=[0, 0])
    db_dict.setdefault('variables', {})[cfg['name']] = value
Пример #10
0
 def get_user_value(self, typ, name=None, default=None):
     """
     Get a user value. 'value'
     Name is 'value' by default so you can just get the default value by stating the type. Voila!
     """
     return get_cfg_value(self.cfg, self.userCfg, name, typ, default)
Пример #11
0
def get_settings(_module_key, cfg, db_dict, user_cfg):
    db_dict.setdefault('variables', {})
    value = a2ctrl.get_cfg_value(cfg, user_cfg, typ=str, default='')
    # user values might been stuck in the db only save if allowed.
    if cfg.get('user_edit', False) or value in cfg.get('items', []):
        db_dict['variables'][cfg['name']] = value
Пример #12
0
def get_settings(_module_key, cfg, db_dict, user_cfg):
    value = a2ctrl.get_cfg_value(cfg,
                                 user_cfg,
                                 typ=bool,
                                 default=cfg.get('value', False))
    db_dict.setdefault('variables', {})[cfg['name']] = value
Пример #13
0
def get_settings(module_key, cfg, db_dict, user_cfg):
    db_dict.setdefault('variables', {})
    value = a2ctrl.get_cfg_value(cfg, user_cfg, typ=(int, float), default=0.0)
    db_dict['variables'][cfg['name']] = value