Author: bugman Date: Tue May 22 16:45:36 2012 New Revision: 16395 URL: http://svn.gna.org/viewcvs/relax?rev=16395&view=rev Log: The Value GUI input element UpdateChoices() method now restores the current selection. This matches the Combo_list GUI element changes. Modified: branches/uf_redesign/gui/input_elements/value.py Modified: branches/uf_redesign/gui/input_elements/value.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/input_elements/value.py?rev=16395&r1=16394&r2=16395&view=diff ============================================================================== --- branches/uf_redesign/gui/input_elements/value.py (original) +++ branches/uf_redesign/gui/input_elements/value.py Tue May 22 16:45:36 2012 @@ -341,6 +341,9 @@ # Update the choices for a ComboBox. if self.element_type == 'combo': + # Store the current selection's client data to restore at the end. + sel = self._field.GetClientData(self._field.GetSelection()) + # First clear all data. self.Clear() @@ -358,7 +361,7 @@ self._field.Insert(self.convert_to_gui(combo_choices[i]), i, combo_data[i]) # Set the default selection. - if combo_default != None: + if sel == None and combo_default != None: # Translate if needed. if combo_default in combo_choices: string = combo_default @@ -369,3 +372,9 @@ # Set the selection. self._field.SetStringSelection(string) + + # Restore the selection. + else: + for j in range(self._field.GetCount()): + if self._field.GetClientData(j) == sel: + self._field.SetSelection(j)