From 2d96c271bb4981e1709a39f3902f45d8d6a5f496 Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Thu, 29 Nov 2012 11:03:56 +0100 Subject: [PATCH] Fix display problems when removing / adding variables --- src/salome/parametric/gui/definevalues.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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) -- 2.39.2