def loadConfig(self, path): self._cur_mod = None self._cur_node = None self._cur_value = None names = self._mman.getModuleNames() self._gui.initModules(names) config = pfile.loadConfigFile(path) self._mman.loadNodes(config=config)
def make(parser, args): parser.usage="usage: %prog make [options]" parser.add_option("-n", "--not-interactive", dest="interactive" , help="Use this flag to disable interactive mode." , default=True, action="store_false") parser.add_option("-l", "--load-config", dest="load" , help="Load a config file before starting build process.") parser.add_option("-c", "--create-c-headers", dest="cheaders" , help="Indicates, that c-header files will be included." , default=False, action="store_true") options, args = parser.parse_args(args) cfg = MainConfig(os.getcwd(), failinpc=True) if options.load is None: path = os.path.join(cfg.config_dir, _PC_CCF) if not os.path.isfile(path): logging.debug("No 'current config' exists yet.") else: path = options.load if not os.path.isfile(path): logging.error("Couldn't find config-file '%s'." % path) if os.path.isfile(path): config = pfile.loadConfigFile(path) else: config = dict() man = pmodules.ModuleManager(cfg.fullSource()) man.initModules(cfg.targets) man.loadNodes(config=config) if options.interactive: while not man.isFullyConfigured(): ctrl = cfgcontrol.ConfigController(Pbgui, man) if not ctrl.mainloop(): # User pressed the 'cancle' button. print("exiting") return if not man.isFullyConfigured(): return if options.cheaders: man.generateOutput(cfg.fullDestination() , cbcfg=cdefines.generateHeader) else: man.generateOutput(cfg.fullDestination())
def configure(parser, args): parser.usage="usage: %prog configure" options, args = parser.parse_args(args) cfg = MainConfig(os.getcwd(), failinpc=True) man = pmodules.ModuleManager(cfg.fullSource()) man.initModules(cfg.targets) path = os.path.join(cfg.config_dir, _PC_CCF) config = dict() if os.path.isfile(path): config = pfile.loadConfigFile(path) else: logging.warning("Default configuration does not exist") man.loadNodes(config=config) ctrl = cfgcontrol.ConfigController(Pbgui, man) save_settings = ctrl.mainloop() if save_settings: print("Is fully configured: " , man.isFullyConfigured(warning=True)) print(man.collectConfig()) pfile.saveConfigFile(path, man.collectConfig())