mailr16097 - /branches/uf_redesign/gui/wizard_elements.py


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

Header


Content

Posted by edward on May 08, 2012 - 15:25:
Author: bugman
Date: Tue May  8 15:25:33 2012
New Revision: 16097

URL: http://svn.gna.org/viewcvs/relax?rev=16097&view=rev
Log:
Fixes for the SpinCtrl version of the Value wizard page GUI element.

The GetValue(), SetValue(), and other methods were not doing anything for the 
element_type of
'spin'.


Modified:
    branches/uf_redesign/gui/wizard_elements.py

Modified: branches/uf_redesign/gui/wizard_elements.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/wizard_elements.py?rev=16097&r1=16096&r2=16097&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard_elements.py (original)
+++ branches/uf_redesign/gui/wizard_elements.py Tue May  8 15:25:33 2012
@@ -178,6 +178,7 @@
             # Set the default value.
             if self.default != None:
                 self._field.SetValue(self.convert_to_gui(self.default))
+
         # Initialise the combo list input field.
         elif self.element_type == 'combo_list':
             # Translate the read_only flag if None.
@@ -1183,13 +1184,9 @@
             self.convert_to_gui =   float_to_gui
             self.type_string = 'float'
         elif value_type == 'int':
+            self.convert_from_gui = gui_to_int
+            self.convert_to_gui =   int_to_gui
             self.type_string = 'integer'
-            if element_type == 'spin':
-                self.convert_from_gui = nothing
-                self.convert_to_gui =   nothing
-            else:
-                self.convert_from_gui = gui_to_int
-                self.convert_to_gui =   int_to_gui
         elif value_type == 'str':
             self.convert_from_gui = gui_to_str
             self.convert_to_gui =   str_to_gui
@@ -1247,7 +1244,7 @@
 
             # Set the default value.
             if self.default != None:
-                self._field.SetValue(self.convert_to_gui(self.default))
+                self._field.SetValue(self.default)
 
         # Initialise the combo box input field.
         elif self.element_type == 'combo':
@@ -1319,6 +1316,11 @@
                 return None
 
             return value
+
+        # Return the integer value from a SpinCtrl.
+        if self.element_type == 'spin':
+            # The value.
+            return self._field.GetValue()
 
         # Convert and return the value from a ComboBox.
         if self.element_type == 'combo':
@@ -1342,6 +1344,10 @@
         if self.element_type == 'text':
             raise RelaxError("Cannot reset the list of ComboBox choices as 
this is a TextCtrl!")
 
+        # A SpinCtrl?!
+        if self.element_type == 'spin':
+            raise RelaxError("Cannot reset the list of ComboBox choices as 
this is a SpinCtrl!")
+
         # Reset the choices for a ComboBox.
         if self.element_type == 'combo':
             # First clear all data.
@@ -1375,8 +1381,12 @@
         if self.element_type == 'text':
             self._field.SetValue(self.convert_to_gui(value))
 
+        # Set the value for a SpinCtrl.
+        elif self.element_type == 'spin':
+            self._field.SetValue(value)
+
         # Convert and set the value for a ComboBox.
-        if self.element_type == 'combo':
+        elif self.element_type == 'combo':
             # Loop until the proper client data is found.
             for i in range(self._field.GetCount()):
                 if self._field.GetClientData(i) == value:




Related Messages


Powered by MHonArc, Updated Tue May 08 15:40:02 2012