mailr14775 - /1.3/gui/interpreter.py


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

Header


Content

Posted by edward on October 04, 2011 - 16:02:
Author: bugman
Date: Tue Oct  4 16:02:39 2011
New Revision: 14775

URL: http://svn.gna.org/viewcvs/relax?rev=14775&view=rev
Log:
Modified the GUI interpreter apply() method to catch RelaxErrors.

Now gui_raise() is used to raise the error and show a dialog, and the method 
returns the execution status.


Modified:
    1.3/gui/interpreter.py

Modified: 1.3/gui/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/interpreter.py?rev=14775&r1=14774&r2=14775&view=diff
==============================================================================
--- 1.3/gui/interpreter.py (original)
+++ 1.3/gui/interpreter.py Tue Oct  4 16:02:39 2011
@@ -106,6 +106,8 @@
         @type args:     any arguments
         @param kwds:    The user function keyword arguments.
         @type kwds:     any keyword arguments
+        @return:        Whether the user function was successfully applied 
or not.
+        @rtype:         bool
         """
 
         # Debugging.
@@ -116,10 +118,22 @@
         fn = self._get_uf(uf)
 
         # Execute the user function.
-        apply(fn, args, kwds)
+        try:
+            apply(fn, args, kwds)
+
+        # Catch all RelaxErrors.
+        except AllRelaxErrors, instance:
+            # Display a dialog with the error.
+            gui_raise(instance, raise_flag=False)
+
+            # Return as a failure.
+            return False
 
         # Notify all observers that a user function has completed.
         status.observers.gui_uf.notify()
+
+        # Return success.
+        return True
 
 
     def empty(self):




Related Messages


Powered by MHonArc, Updated Tue Oct 04 16:20:01 2011