def argparsedToArgument(argsNamespace): newArguments = ArgumentTree() for key, value in vars(argsNamespace).items(): if value == None: continue newArguments.set(value, *argparsedNameToPathMap[key]) return newArguments
def argparsedToArgument( argsNamespace ): newArguments = ArgumentTree() for key, value in vars( argsNamespace ).items(): if value == None: continue newArguments.set( value, *argparsedNameToPathMap[key] ) return newArguments
def loadUserConfiguration(): config_path = os.path.join(appdirs.user_config_dir('jaminique'), "config.json") if os.path.isfile(config_path): with open(config_path, 'rt') as configfile: return ArgumentTree(configfile) else: return ArgumentTree()
def loadCoreConfiguration(): from sys import argv config_path = os.path.join(os.path.dirname(argv[0]), "config.json") if os.path.isfile(config_path): with open(config_path, 'rt') as configfile: return ArgumentTree(configfile) else: return ArgumentTree()
def buildGUI(arguments=None): if arguments == None: arguments = ArgumentTree() glade_path = os.path.join(glade_prefix, "main_ui.glade") builder = Gtk.Builder.new_from_file(glade_path) handler = GUIHandler(builder, arguments) builder.connect_signals(handler) builder.get_object("main_window").show_all() return handler, builder
def argumentTreeUpdatedOnBase(initialcfgName, cfgMap, recursive=True): if initialcfgName not in cfgMap: return ArgumentTree() currentcfg = cfgMap[initialcfgName].clone() if not currentcfg.contains('base'): currentcfg.set(initialcfgName, '<base-name>') return currentcfg else: newcfg = None if recursive: newcfg = argumentTreeUpdatedOnBase(currentcfg.get('base'), cfgMap) else: newcfg = cfgMap[currentcfg.get('base')].clone() currentcfg.unset('base') newcfg.update(currentcfg) return newcfg
def toSubTree(kv): k, v = kv return (k, ArgumentTree(v))
def loadDefaultArgumentTree(): cfg = ArgumentTree() cfg.update(loadCoreConfiguration()) cfg.update(loadSystemConfiguration()) cfg.update(loadUserConfiguration()) return cfg
def loadDefaultArgumentTree(): cfg = ArgumentTree() cfg.update( loadCoreConfiguration() ) cfg.update( loadSystemConfiguration() ) cfg.update( loadUserConfiguration() ) return cfg