mailr16406 - /branches/uf_redesign/gui/input_elements/combo_list.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 22, 2012 - 19:08:
Author: bugman
Date: Tue May 22 19:08:27 2012
New Revision: 16406

URL: http://svn.gna.org/viewcvs/relax?rev=16406&view=rev
Log:
The Combo_list GUI input element can now handle values typed out by the user.

This affects both the GetValue() and SetValue() methods.


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=16406&r1=16405&r2=16406&view=diff
==============================================================================
--- branches/uf_redesign/gui/input_elements/combo_list.py (original)
+++ branches/uf_redesign/gui/input_elements/combo_list.py Tue May 22 19:08:27 
2012
@@ -265,6 +265,9 @@
             # Get the value.
             val = 
self.convert_from_gui(self._combo_boxes[i].GetClientData(self._combo_boxes[i].GetSelection()))
 
+            # Manually added value by the user.
+            if val == None:
+                val = self.convert_from_gui(self._combo_boxes[i].GetValue())
             # Nothing, so skip.
             if val == None:
                 continue
@@ -303,10 +306,22 @@
                     self._add(None)
 
             # Loop until the proper client data is found.
+            found = False
             for j in range(self._combo_boxes[index].GetCount()):
                 if self._combo_boxes[index].GetClientData(j) == value:
                     self._combo_boxes[index].SetSelection(j)
+                    found = True
                     break
+
+            # No value found.
+            if not found:
+                # Invalid value.
+                if self._read_only:
+                    raise RelaxError("The Value element is read only, cannot 
set the value '%s'." % value)
+
+                # Set the unknown value.
+                else:
+                    self._combo_boxes[index].SetValue(value)
 
         # A list of values.
         else:




Related Messages


Powered by MHonArc, Updated Wed May 23 09:00:03 2012