mailr16446 - in /branches/uf_redesign/gui/input_elements: combo_list.py value.py


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

Header


Content

Posted by edward on May 24, 2012 - 16:41:
Author: bugman
Date: Thu May 24 16:41:08 2012
New Revision: 16446

URL: http://svn.gna.org/viewcvs/relax?rev=16446&view=rev
Log:
Mac OS X bug fixes for the GUI ComboBox input elements.

The ComboBox.GetClientData() method on Mac OS X fails if the 
ComboBox.GetSelection() method returns
-1 (or wx.NOT_FOUND).


Modified:
    branches/uf_redesign/gui/input_elements/combo_list.py
    branches/uf_redesign/gui/input_elements/value.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=16446&r1=16445&r2=16446&view=diff
==============================================================================
--- branches/uf_redesign/gui/input_elements/combo_list.py (original)
+++ branches/uf_redesign/gui/input_elements/combo_list.py Thu May 24 16:41:08 
2012
@@ -263,7 +263,11 @@
         n = 0
         for i in range(len(self._combo_boxes)):
             # Get the value.
-            val = 
self.convert_from_gui(self._combo_boxes[i].GetClientData(self._combo_boxes[i].GetSelection()))
+            sel_index = self._combo_boxes[i].GetSelection()
+            if sel_index == wx.NOT_FOUND:
+                val = None
+            else:
+                val = 
self.convert_from_gui(self._combo_boxes[i].GetClientData(sel_index))
 
             # Manually added value by the user.
             if val == None:
@@ -369,7 +373,11 @@
         # Loop over the combo boxes.
         for i in range(len(self._combo_boxes)):
             # Store the current selection's client data to restore at the 
end.
-            sel = 
self._combo_boxes[i].GetClientData(self._combo_boxes[i].GetSelection())
+            sel_index = self._combo_boxes[i].GetSelection()
+            if sel_index == wx.NOT_FOUND:
+                sel = None
+            else:
+                sel = self._combo_boxes[i].GetClientData(sel_index)
 
             # First clear all data.
             self._combo_boxes[i].Clear()

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=16446&r1=16445&r2=16446&view=diff
==============================================================================
--- branches/uf_redesign/gui/input_elements/value.py (original)
+++ branches/uf_redesign/gui/input_elements/value.py Thu May 24 16:41:08 2012
@@ -268,7 +268,11 @@
         # Convert and return the value from a ComboBox.
         if self.element_type == 'combo':
             # An element selected from the list.
-            value = 
self.convert_from_gui(self._field.GetClientData(self._field.GetSelection()))
+            sel_index = self._field.GetSelection()
+            if sel_index == wx.NOT_FOUND:
+                value = None
+            else:
+                value = 
self.convert_from_gui(self._field.GetClientData(sel_index))
 
             # A non-list value.
             if value == None:
@@ -338,7 +342,11 @@
         # 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())
+            sel_index = self._field.GetSelection()
+            if sel_index == wx.NOT_FOUND:
+                sel = None
+            else:
+                sel = self._field.GetClientData(sel_index)
 
             # First clear all data.
             self.Clear()




Related Messages


Powered by MHonArc, Updated Thu May 24 17:00:02 2012