def createArgument(self, arg): warg = QWidget() vlayout = QVBoxLayout() vlayout.setSpacing(5) vlayout.setMargin(0) winfo = QWidget() infolayout = QFormLayout() infolayout.setMargin(0) requirement = arg.requirementType() # Generate argument's widget warguments = self.getWidgetFromType(arg) if arg.requirementType() in (Argument.Optional, Argument.Empty): checkBox = checkBoxWidget(self, winfo, warguments, self.labActivate.text()) vlayout.addWidget(checkBox, 0) infolayout.addRow(self.labType.text(), QLabel(str(typeId.Get().typeToName(arg.type())))) tedit = QTextEdit(str(arg.description())) tedit.setReadOnly(True) infolayout.addRow(tedit) winfo.setLayout(infolayout) vlayout.addWidget(winfo, 1) if warguments: vlayout.addWidget(warguments, 2) self.valueArgs[arg.name()] = warguments else: self.valueArgs[arg.name()] = winfo warg.setLayout(vlayout) self.stackedargs.addWidget(warg) argitem = QListWidgetItem(str(arg.name()), self.listargs)
def LoadInfoModules(self): modules = self.loader.modules for mod in modules: try: itemModule = self.itemModuleDic[mod] except KeyError: itemModule = QTreeWidgetItem(self) self.itemModuleDic[mod] = itemModule itemModule.setText(0, str(mod)) itemConfig = QTreeWidgetItem(itemModule) itemConfig.setText(0, "Config") conf = modules[mod].conf args = conf.arguments() for arg in args: itemConfKey = QTreeWidgetItem(itemConfig) itemConfKey.setText(0, "var") itemConfKey.setText(1, arg.name()) itemConfKey.setText(4, typeId.Get().typeToName(arg.type())) if len(arg.description()): itemConfKey.setText(3, arg.description()) parameters = arg.parameters() if len(parameters): itemConfKey.setText(2, str(parameters))
def show_config(self, modname): conf = self.cm.configByName(modname) res = "\n\tConfig:" arguments = conf.arguments() for argument in arguments: res += "\n\t\tname: " + str(argument.name()) res += "\n\t\tdescription: " + str(argument.description()) if argument.inputType() == Argument.Empty: res += "\n\t\tno input parameters" else: res += "\n\t\ttype: " + str(typeId.Get().typeToName( argument.type())) res += "\n\t\trequirement: " if argument.requirementType() == Argument.Optional: res += "optional" else: res += "mandatory" res += "\n\t\tinput parameters: " if argument.parametersType() == Parameter.NotEditable: res += "not editable " else: res += "editable " if argument.inputType() == Argument.List: res += "list" else: res += "single" pcount = argument.parametersCount() if pcount != 0: parameters = argument.parameters() res += "\n\t\tpredefined parameters: " for parameter in parameters: if argument.type() == typeId.Node: res += str(parameter.value().absolute()) else: res += parameter.toString() pcount -= 1 if pcount != 0: res += ", " res += "\n" constants = conf.constants() if len(constants) > 0: res += "\n\tConstant: \t" for constant in constants: res += "\n\t\tname: " + str(constant.name()) res += "\n\t\tdescription: " + str(constant.description()) res += "\n\t\ttype: " + str(typeId.Get().typeToName( constant.type())) cvalues = constant.values() cvallen = len(cvalues) if cvallen > 0: res += "\n\t\tvalues: " for cvalue in cvalues: if cvalue.type() == typeId.Node: res += str(cvalue.value().absolute()) else: res += cvalue.toString() cvallen -= 1 if cvallen != 0: res += ", " res += "\n" return res
def __init__(self): Script.__init__(self, "show_db") self.cm = ConfigManager.Get() self.processusManager = ProcessusManager() self.ti = typeId.Get() self.vtreeprinter = VariantTreePrinter()