def show(self, form, *params): finalResiduesList = self.getResidues(form) provider = ListTreeProviderString(finalResiduesList) dlg = dialog.ListDialog( form.root, "Chain residues", provider, "Select one residue (residue number, " "residue name)") form.setVar('lastResidueToRemove', dlg.values[0].get())
def show(self, form, *params): attrsList = self.getInputAttributes(form) finalAttrsList = [] for i in attrsList: finalAttrsList.append(pwobj.String(i)) provider = ListTreeProviderString(finalAttrsList) dlg = dialog.ListDialog(form.root, "Filter set", provider, "Select one of the attributes") form.setVar('rankingField', dlg.values[0].get())
def show(self, form, *params): patchValues = [Integer(i) for i in range(32, 130, 8)] # Get a data provider from the patchValues to be used in the tree (dialog) provider = ListTreeProviderString(patchValues) dlg = dialog.ListDialog(form.root, "Paych shape values", provider, "Select one of the size values)") # Set the chosen value back to the form form.setVar(PATCH_SHAPE, dlg.values[0].get())
def show(self, form, *params): protocol = form.protocol label = params[0] experiment = protocol.getAttributeValue('inputExperiment', None) if experiment is None: form.showError("Select input experiment first.") else: experiment.load() dlg = dialog.ListDialog(form.root, "Choose dose name", DoseTreeProvider(experiment), selectmode=self.getSelectMode()) if dlg.resultYes(): self.setFormValues(form, label, dlg.values)
def show(self, form, *params): protocol = form.protocol try: models = self.getModelsChainsStep(protocol) except Exception as e: print "ERROR: ", e.message return self.editionListOfChains(models) finalChainList = [] for i in self.chainList: finalChainList.append(String(i)) provider = ListTreeProviderString(finalChainList) dlg = dialog.ListDialog( form.root, "Model chains", provider, "Select one of the chains (model, chain, " "number of chain residues)") form.setVar('inputStructureChain', dlg.values[0].get())
def chooseTemplate(templates, parentWindow=None): chosenTemplate = None if len(templates) == 1: chosenTemplate = templates[0] else: provider = pwgui.tree.ListTreeProviderTemplate(templates) dlg = dialog.ListDialog(parentWindow, "Workflow templates", provider, "Select one of the templates.", selectOnDoubleClick=True) if dlg.result == dialog.RESULT_YES: chosenTemplate = dlg.values[0] if chosenTemplate is not None: print("Template to use: %s" % chosenTemplate) # Replace environment variables chosenTemplate.replaceEnvVariables() return chosenTemplate
def show(self, form, *params): label = params[0] protocol = form.protocol fnCSV = protocol.getAttributeValue('inputFile', "") if not os.path.exists(fnCSV): form.showError("Select a valid CSV input file first.") else: varNames = getVarNamesFromCSVfile(fnCSV) tp = SimpleListTreeProvider(varNames, name="Variables") dlg = dialog.ListDialog(form.root, "Choose variable(s)", tp, selectmode='extended') if dlg.resultYes(): strToAdd = "" for value in dlg.values: strToAdd += "\n%s ; [Units/none] ; [numeric/text] ; [time/label/measurement] ; [Comment]" % ( value.get()) if strToAdd != "": currentValue = protocol.getAttributeValue(label, "") form.setVar(label, currentValue + strToAdd)
def show(self, form, *params): protocol = form.protocol label = params[0] fullParams = self._getAllParams(protocol) experiment = None if len(fullParams) > 1: experiment = protocol.getAttributeValue(fullParams[1], None) else: experiment = protocol.getAttributeValue('inputExperiment', None) if experiment is None: form.showError("Select input experiment first.") else: experiment.load() filterFunc = getattr(protocol, 'filterVarForWizard', None) tp = FilterVariablesTreeProvider(experiment, filter=filterFunc) dlg = dialog.ListDialog(form.root, self.getTitle(), tp, selectmode=self.getSelectMode()) if dlg.resultYes(): self.setFormValues(form, label, dlg.values)
def getTemplate(root): # Check if there is any .json.template in the template folder # get the template folder templateFolder = pw.getTemplatePath() # Get all ".json.template" there templates = [] for file in glob.glob1(templateFolder, "*.json.template"): templates.append(String(file)) if len(templates): if len(templates) == 1: chosen = templates[0].get() else: provider = ListTreeProviderString(templates) dlg = dialog.ListDialog(root, "Workflow templates", provider, "Select one of the templates.") chosen = dlg.values[0].get() chosen = os.path.join(templateFolder, chosen) print("Template to use: %s" % chosen) with open(chosen, 'r') as myfile: template = myfile.read() # Replace environment variables template = template % os.environ return template else: raise Exception("There isn't any *.json.template at %s" % templates)
def show(self, form, *params): # This are the greetings: greetings = [ String("Hello world"), String("Hola mundo"), String("Bonjour le monde"), String("Hallo Welt"), String("Kon'nichiwa sekai"), String("Nǐ hǎo, shìjiè"), String("Ciao mondo"), String("Hallo Wereld"), String("Privet, mir") ] # Get a data provider from the greetings to be used in the tree (dialog) provider = ListTreeProviderString(greetings) # Show the dialog dlg = dialog.ListDialog(form.root, "Greetings from the world", provider, "Select one of the greetings)") # Set the chosen value back to the form form.setVar('message', dlg.values[0].get())