Author: bugman Date: Thu May 24 09:42:07 2012 New Revision: 16427 URL: http://svn.gna.org/viewcvs/relax?rev=16427&view=rev Log: The GUI user functions are now going straight to the back end rather than through the prompt. The GUI user functions were previously passing through the prompt UI user functions for argument checking, which then passed on to the back end. Now the prompt is bypassed, and the back end is being directly called. This should speed up the user functions, and specifically the GUI tests. Modified: branches/uf_redesign/gui/interpreter.py Modified: branches/uf_redesign/gui/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/interpreter.py?rev=16427&r1=16426&r2=16427&view=diff ============================================================================== --- branches/uf_redesign/gui/interpreter.py (original) +++ branches/uf_redesign/gui/interpreter.py Thu May 24 09:42:07 2012 @@ -37,6 +37,7 @@ from prompt import interpreter from relax_errors import AllRelaxErrors from status import Status; status = Status() +from user_functions.data import Uf_info; uf_info = Uf_info() # relax GUI module imports. from gui.errors import gui_raise @@ -72,7 +73,7 @@ return self._instance - def _get_uf(self, uf): + def _get_backend(self, uf): """Return the user function object corresponding to the given string. @param uf: The name of the user function. @@ -81,23 +82,11 @@ @rtype: func """ - # Handle the user function class. - if search('\.', uf): - # Split the user function. - uf_class, uf_fn = split(uf, '.') - - # Get the user function class. - obj = getattr(self._interpreter, uf_class) - - # Get the function. - fn = getattr(obj, uf_fn) - - # Simple user function. - else: - fn = getattr(self._interpreter, uf) - - # Return the user function. - return fn + # Get the user function info object. + info = uf_info.get_uf(uf) + + # Return the backend. + return info.backend def apply(self, uf, *args, **kwds): @@ -117,8 +106,8 @@ if status.debug: sys.stdout.write("debug> GUI interpreter: Applying the %s user function for synchronous execution.\n" % uf) - # Get the user function. - fn = self._get_uf(uf) + # Get the user function backend. + fn = self._get_backend(uf) # Execute the user function. try: @@ -211,7 +200,7 @@ sys.stdout.write("debug> GUI interpreter: Queuing the %s user function for asynchronous execution.\n" % uf) # Get the user function. - fn = self._get_uf(uf) + fn = self._get_backend(uf) # Call the thread's method. self._interpreter_thread.queue(fn, *args, **kwds)