Skip to content
Snippets Groups Projects
Commit afdbc53b authored by Julien Malik's avatar Julien Malik
Browse files

ENH: handle groups

parent 3570d6a2
Branches
Tags
No related merge requests found
......@@ -309,7 +309,6 @@ class QParameterGroup(QParameterBase):
def DoCreateWidget(self):
form = QtGui.QFormLayout()
defaultWidget = QParameterInt
paramTypeToWidget = {
......@@ -332,14 +331,32 @@ class QParameterGroup(QParameterBase):
app = self.GetModel().GetApplication()
if self._paramKey:
keys = [key for key in app.GetParametersKeys(True) if key and key.startswith(self._paramKey)]
keys = [key for key in app.GetParametersKeys(True) if key and key.startswith(self._paramKey + '.')]
else:
keys = app.GetParametersKeys(False)
print 'keys ' + str(keys)
form = QtGui.QFormLayout()
for key in keys:
widgetClass = paramTypeToWidget[app.GetParameterType(key)]
w = widgetClass(self._model, key)
w.CreateWidget()
form.addRow( app.GetParameterName(key), w )
self.setLayout(form)
if widgetClass is not QParameterGroup:
print " form.addRow(w"
form.addRow( app.GetParameterName(key), w )
else:
print " form.addWidget(w"
form.addRow(w)
if self._paramKey:
# not the root group
group = QtGui.QGroupBox()
group.setTitle( app.GetParameterName(self._paramKey) )
group.setLayout(form)
layout = QtGui.QHBoxLayout()
layout.addWidget(group)
self.setLayout(layout)
else:
self.setLayout(form)
......@@ -57,12 +57,7 @@ private:
AddParameter(ParameterType_String, "string", "String");
AddParameter(ParameterType_Filename, "filename", "File name");
AddParameter(ParameterType_Directory, "directory", "Directory name");
AddParameter(ParameterType_InputImage, "inputimage", "Input Image");
AddParameter(ParameterType_InputComplexImage, "inputcompleximage", "Input Complex Image");
AddParameter(ParameterType_InputVectorData, "inputvectordata", "Input Vector Data");
AddParameter(ParameterType_OutputImage, "outputimage", "Output Image");
AddParameter(ParameterType_OutputVectorData, "outputvectordata", "Output Vector Data");
AddParameter(ParameterType_Radius, "radius", "Radius");
AddParameter(ParameterType_Choice, "choice", "Choice");
AddChoice("choice.choice1", "Choice 1");
......@@ -70,12 +65,24 @@ private:
AddChoice("choice.choice3", "Choice 3");
AddParameter(ParameterType_Float, "choice.choice1.floatchoice1", "Float of choice1");
SetParameterFloat("choice.choice1.floatchoice1", 0.125);
// Test a choice without associated parameter
// AddParameter(ParameterType_Float, "choice.choice2.floatchoice2", "Float of choice2");
// SetParameterFloat("choice.choice2.floatchoice2", 1.0);
AddParameter(ParameterType_Float, "choice.choice3.floatchoice3", "Float of choice3");
SetParameterFloat("choice.choice3.floatchoice3", 5.0);
//AddParameter(ParameterType_Group, "group", "Group");
AddParameter(ParameterType_Group, "ingroup", "Input Group");
AddParameter(ParameterType_Int, "ingroup.integer", "Integer of Group");
AddParameter(ParameterType_InputImage, "ingroup.inputimage", "Input Image");
AddParameter(ParameterType_InputComplexImage, "ingroup.inputcompleximage", "Input Complex Image");
AddParameter(ParameterType_InputVectorData, "ingroup.inputvectordata", "Input Vector Data");
AddParameter(ParameterType_Group, "outgroup", "Output Group");
AddParameter(ParameterType_OutputImage, "outgroup.outputimage", "Output Image");
AddParameter(ParameterType_OutputVectorData, "outgroup.outputvectordata", "Output Vector Data");
AddParameter(ParameterType_Radius, "radius", "Radius");
}
void DoUpdateParameters()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment