]> SALOME platform Git repositories - modules/parametric.git/commitdiff
Salome HOME
Fix display problems when removing / adding variables
authorRenaud Barate <renaud.barate@edf.fr>
Thu, 29 Nov 2012 10:03:56 +0000 (11:03 +0100)
committerRenaud Barate <renaud.barate@edf.fr>
Thu, 29 Nov 2012 10:03:56 +0000 (11:03 +0100)
src/salome/parametric/gui/definevalues.py

index 43c1c726f94e501534d2b2523d450cb1662317e7..5bd7bf14acfb091ca19a739c23162820fb0d31bc 100644 (file)
@@ -35,6 +35,7 @@ class DefineValuesFrame(QtGui.QWidget):
     QtGui.QWidget.__init__(self, parent)
     self.setLayout(QtGui.QVBoxLayout(self))
     self.varwidgets = {}
+    self.layout().addStretch()
 
   def set_variables(self, varlist):
     previous_set = set(self.varwidgets.keys())
@@ -42,14 +43,14 @@ class DefineValuesFrame(QtGui.QWidget):
     var_to_remove = previous_set - new_set
     var_to_add = new_set - previous_set
     for var in var_to_remove:
+      self.layout().removeWidget(self.varwidgets[var])
       self.varwidgets[var].close()
       del self.varwidgets[var]
     for var in var_to_add:
       varrange = VariableRange(self)
       varrange.nameLabel.setText(var)
       self.varwidgets[var] = varrange
-      self.layout().addWidget(varrange)
-    self.layout().addStretch()
+      self.layout().insertWidget(self.layout().count()-1, varrange)
 
   def set_ranges_from_param_study(self, param_study):
     for var in param_study.input_vars:
@@ -59,5 +60,4 @@ class DefineValuesFrame(QtGui.QWidget):
       varrange.toSpinBox.setValue(var.max)
       varrange.stepSpinBox.setValue(var.step)
       self.varwidgets[var.name] = varrange
-      self.layout().addWidget(varrange)
-    self.layout().addStretch()
+      self.layout().insertWidget(self.layout().count()-1, varrange)