From: Renaud Barate Date: Thu, 29 Nov 2012 10:03:56 +0000 (+0100) Subject: Fix display problems when removing / adding variables X-Git-Tag: V6_6_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2d96c271bb4981e1709a39f3902f45d8d6a5f496;p=modules%2Fparametric.git Fix display problems when removing / adding variables --- diff --git a/src/salome/parametric/gui/definevalues.py b/src/salome/parametric/gui/definevalues.py index 43c1c72..5bd7bf1 100644 --- a/src/salome/parametric/gui/definevalues.py +++ b/src/salome/parametric/gui/definevalues.py @@ -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)