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])
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])
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)
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])
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
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
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
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
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
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)
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
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