mailr14520 - /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 August 30, 2011 - 13:30:
Author: bugman
Date: Tue Aug 30 13:30:32 2011
New Revision: 14520

URL: http://svn.gna.org/viewcvs/relax?rev=14520&view=rev
Log:
Created the GUI interpreter object apply() for synchronous calls to the user 
functions.


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=14520&r1=14519&r2=14520&view=diff
==============================================================================
--- 1.3/gui/interpreter.py (original)
+++ 1.3/gui/interpreter.py Tue Aug 30 13:30:32 2011
@@ -86,47 +86,8 @@
         return fn
 
 
-    def empty(self):
-        """Determine if the interpreter thread queue is empty.
-
-        This is a wrapper method for the thread method.
-        """
-
-        # Return the queue empty state.
-        return self._interpreter_thread.empty()
-
-
-    def exit(self):
-        """Cause the thread to exit once all currently queued user functions 
are processed.
-
-        This is a wrapper method for the thread method.
-        """
-
-        # Call the thread's method.
-        return self._interpreter_thread.exit()
-
-
-    def flush(self):
-        """Return only once the queue is empty.
-
-        This is a wrapper method for the interpreter thread.
-        """
-
-        # Call the thread's method.
-        self._interpreter_thread.flush()
-
-
-    def join(self):
-        """Wrapper method for the Queue.join() method."""
-
-        # Call the thread's method.
-        self._interpreter_thread.join()
-
-
-    def queue(self, uf, *args, **kwds):
-        """Queue up a user function.
-
-        This is a wrapper method for the interpreter thread.
+    def apply(self, uf, *args, **kwds):
+        """Apply a user function for synchronous execution.
 
         @param uf:      The user function as a string.
         @type uf:       str
@@ -139,6 +100,63 @@
         # Get the user function.
         fn = self._get_uf(uf)
 
+        # Execute the user function.
+        apply(fn, args, kwds)
+
+
+    def empty(self):
+        """Determine if the interpreter thread queue is empty.
+
+        This is a wrapper method for the thread method.
+        """
+
+        # Return the queue empty state.
+        return self._interpreter_thread.empty()
+
+
+    def exit(self):
+        """Cause the thread to exit once all currently queued user functions 
are processed.
+
+        This is a wrapper method for the thread method.
+        """
+
+        # Call the thread's method.
+        return self._interpreter_thread.exit()
+
+
+    def flush(self):
+        """Return only once the queue is empty.
+
+        This is a wrapper method for the interpreter thread.
+        """
+
+        # Call the thread's method.
+        self._interpreter_thread.flush()
+
+
+    def join(self):
+        """Wrapper method for the Queue.join() method."""
+
+        # Call the thread's method.
+        self._interpreter_thread.join()
+
+
+    def queue(self, uf, *args, **kwds):
+        """Queue up a user function.
+
+        This is a wrapper method for the interpreter thread.
+
+        @param uf:      The user function as a string.
+        @type uf:       str
+        @param args:    The user function arguments.
+        @type args:     any arguments
+        @param kwds:    The user function keyword arguments.
+        @type kwds:     any keyword arguments
+        """
+
+        # Get the user function.
+        fn = self._get_uf(uf)
+
         # Call the thread's method.
         self._interpreter_thread.queue(fn, *args, **kwds)
 
@@ -196,7 +214,15 @@
 
 
     def queue(self, fn, *args, **kwds):
-        """Queue up a user function."""
+        """Queue up a user function for asynchronous execution.
+
+        @param uf:      The user function as a string.
+        @type uf:       str
+        @param args:    The user function arguments.
+        @type args:     any arguments
+        @param kwds:    The user function keyword arguments.
+        @type kwds:     any keyword arguments
+        """
 
         # Place the user function and its args onto the queue.
         self._queue.put([fn, args, kwds])




Related Messages


Powered by MHonArc, Updated Tue Aug 30 13:40:02 2011