mailr13918 - /branches/gui_testing/gui/user_functions/value.py


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

Header


Content

Posted by edward on July 27, 2011 - 09:24:
Author: bugman
Date: Wed Jul 27 09:24:31 2011
New Revision: 13918

URL: http://svn.gna.org/viewcvs/relax?rev=13918&view=rev
Log:
The value.set GUI user function now sets the value to the default when 
parameters are selected.


Modified:
    branches/gui_testing/gui/user_functions/value.py

Modified: branches/gui_testing/gui/user_functions/value.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/user_functions/value.py?rev=13918&r1=13917&r2=13918&view=diff
==============================================================================
--- branches/gui_testing/gui/user_functions/value.py (original)
+++ branches/gui_testing/gui/user_functions/value.py Wed Jul 27 09:24:31 2011
@@ -74,7 +74,7 @@
         """
 
         # The parameter.
-        self.param = self.combo_box(sizer, "The parameter:", 
tooltip=self.uf._doc_args_dict['param'])
+        self.param = self.combo_box(sizer, "The parameter:", 
tooltip=self.uf._doc_args_dict['param'], evt_fn=self.set_default_value)
 
         # The value.
         self.val = self.input_field(sizer, "The value:", 
tooltip=self.uf._doc_args_dict['val'])
@@ -146,3 +146,29 @@
 
         # Set the value.
         self.gui.interpreter.value.set(val=val, param=param, spin_id=spin_id)
+
+
+    def set_default_value(self, event=None):
+        """Set the value to the default once a parameter is selected.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # The parameter.
+        param = self.param.GetClientData(self.param.GetSelection())
+
+        # Clear the previous data.
+        self.val.Clear()
+
+        # Nothing to do.
+        if param == '':
+            return
+
+        # Get the default value.
+        default_value = specific_fns.setup.get_specific_fn('default_value', 
cdp.pipe_type, raise_error=False)
+        value = default_value(param)
+
+        # Set the default value.
+        if value != None:
+            self.val.SetValue(str_to_gui(str(value)))




Related Messages


Powered by MHonArc, Updated Wed Jul 27 09:40:02 2011