mailr16681 - /branches/uf_redesign/gui/uf_objects.py


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

Header


Content

Posted by edward on June 06, 2012 - 10:19:
Author: bugman
Date: Wed Jun  6 10:19:31 2012
New Revision: 16681

URL: http://svn.gna.org/viewcvs/relax?rev=16681&view=rev
Log:
Added support for the user function arg type 'force flag' to the GUI user 
functions.

This arg type will, in the GUI, always return True.  This is because a user 
clicking on 'Ok' or
'Apply' is essentially saying that this operation should be performed.  The 
special Force_true class
was created for these arguments which simply ignores SetValue() calls and 
always returns True from
GetValue() calls.


Modified:
    branches/uf_redesign/gui/uf_objects.py

Modified: branches/uf_redesign/gui/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/uf_objects.py?rev=16681&r1=16680&r2=16681&view=diff
==============================================================================
--- branches/uf_redesign/gui/uf_objects.py (original)
+++ branches/uf_redesign/gui/uf_objects.py Wed Jun  6 10:19:31 2012
@@ -151,6 +151,20 @@
 
 
 
+class Force_true(object):
+    """A special user function arg element which always returns True."""
+
+    def GetValue(self):
+        """Simple method for returning True."""
+
+        return True
+
+
+    def SetValue(self, value):
+        """Dummy method."""
+
+
+
 class Uf_object(object):
     """The object for auto-generating the GUI user functions."""
 
@@ -681,6 +695,10 @@
             elif arg['arg_type'] in ['func', 'func args']:
                 pass
 
+            # Special arg type:  force flags.
+            elif arg['arg_type'] in ['force flag']:
+                self.uf_args[arg['name']] = Force_true()
+
             # Special arg type:  spin IDs.
             elif arg['arg_type'] in ['spin ID']:
                 self.uf_args[arg['name']] = Spin_id(name=arg['name'], 
parent=self, default=arg['default'], element_type=arg['wiz_element_type'], 
sizer=sizer, desc=desc, combo_choices=arg['wiz_combo_choices'], 
combo_data=arg['wiz_combo_data'], tooltip=arg['desc'], 
divider=self._div_left, height_element=self.height_element, 
can_be_none=arg['can_be_none'])




Related Messages


Powered by MHonArc, Updated Wed Jun 06 10:40:01 2012