Author: bugman Date: Fri May 18 16:47:04 2012 New Revision: 16345 URL: http://svn.gna.org/viewcvs/relax?rev=16345&view=rev Log: The Combo_list GUI input element SetValue() method now handles single values and lists. This is required for the GUI tests. Modified: branches/uf_redesign/gui/input_elements/combo_list.py Modified: branches/uf_redesign/gui/input_elements/combo_list.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/input_elements/combo_list.py?rev=16345&r1=16344&r2=16345&view=diff ============================================================================== --- branches/uf_redesign/gui/input_elements/combo_list.py (original) +++ branches/uf_redesign/gui/input_elements/combo_list.py Fri May 18 16:47:04 2012 @@ -345,18 +345,37 @@ """Special method for setting the value of the GUI element. @keyword value: The value to set. - @type value: anything + @type value: value or list of values @keyword index: The index of the value to set. @type index: int """ - # Add elements as needed. - if len(self._combo_boxes) <= index: - for i in range(len(self._combo_boxes) - index + 1): - self._add(None) - - # Loop until the proper client data is found. - for j in range(self._combo_boxes[index].GetCount()): - if self._combo_boxes[index].GetClientData(j) == value: - self._combo_boxes[index].SetSelection(j) - break + # Single element. + if index != None: + # Add elements as needed. + if len(self._combo_boxes) <= index: + for i in range(len(self._combo_boxes) - index + 1): + self._add(None) + + # Loop until the proper client data is found. + for j in range(self._combo_boxes[index].GetCount()): + if self._combo_boxes[index].GetClientData(j) == value: + self._combo_boxes[index].SetSelection(j) + break + + # A list of values. + else: + # Add elements as needed. + if len(self._combo_boxes) <= len(value): + for i in range(len(value) - len(self._combo_boxes)): + self._add(None) + + # Loop over the list. + for i in range(len(value)): + # Loop until the proper client data is found. + for j in range(self._combo_boxes[i].GetCount()): + if self._combo_boxes[i].GetClientData(j) == value: + self._combo_boxes[i].SetSelection(j) + break + +