Author: bugman Date: Tue May 22 12:38:54 2012 New Revision: 16375 URL: http://svn.gna.org/viewcvs/relax?rev=16375&view=rev Log: Modified and renamed the self._execute_uf() method so that it will work with the system test scripts. The file and directory arguments are now merged, as required by the GUI user function pages. Modified: branches/uf_redesign/test_suite/gui_tests/base_classes.py Modified: branches/uf_redesign/test_suite/gui_tests/base_classes.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/test_suite/gui_tests/base_classes.py?rev=16375&r1=16374&r2=16375&view=diff ============================================================================== --- branches/uf_redesign/test_suite/gui_tests/base_classes.py (original) +++ branches/uf_redesign/test_suite/gui_tests/base_classes.py Tue May 22 12:38:54 2012 @@ -40,6 +40,7 @@ from generic_fns.reset import reset from relax_io import delete from status import Status; status = Status() +from user_functions.data import Uf_info; uf_info = Uf_info() # relax GUI module imports. from gui.interpreter import Interpreter; interpreter = Interpreter() @@ -69,6 +70,53 @@ self._gui_launch = True + def _execute_uf(self, uf_name=None, **kargs): + """Execute the given user function. + + @keyword uf_name: The name of the user function. + @type uf_name: str + """ + + # Create and store a wizard instance to be used in all user function pages (if needed). + if not hasattr(self, '_wizard'): + self._wizard = Wiz_window(self.app.gui) + + # Get the user function data object. + uf_data = uf_info.get_uf(uf_name) + + # Merge the file and directory args, as needed. + for i in range(len(uf_data.kargs)): + # Alias. + arg = uf_data.kargs[i] + + # File selection and associated directory arg. + if arg['arg_type'] == 'dir' and arg['name'] in kargs: + # Find the associated file selection arg name. + for j in range(len(uf_data.kargs)): + if uf_data.kargs[i]['arg_type'] == 'file sel': + file_sel_name = uf_data.kargs[i]['name'] + + # Prepend the directory to the file, if needed. + if file_sel_name in kargs: + kargs[file_sel_name] = kargs[arg['name']] + sep + kargs[file_sel_name] + + # Create the page. + uf_page = Uf_page(uf_name, parent=self._wizard, sync=True) + + # Update the user function page. + uf_page.on_display() + + # Set all the values. + for key in kargs: + uf_page.SetValue(key=key, value=kargs[key]) + + # Execute the user function. + uf_page.on_execute() + + # Flush the interpreter to force synchronous user functions operation. + interpreter.flush() + + def check_exceptions(self): """Check that no exception has occurred.""" @@ -83,34 +131,6 @@ # No exception. except Queue.Empty: pass - - - def execute_uf(self, uf_name=None, **kargs): - """Execute the given user function. - - @keyword uf_name: The name of the user function. - @type uf_name: str - """ - - # Create and store a wizard instance to be used in all user function pages (if needed). - if not hasattr(self, '_wizard'): - self._wizard = Wiz_window(self.app.gui) - - # Create the page. - uf_page = Uf_page(uf_name, parent=self._wizard, sync=True) - - # Update the user function page. - uf_page.on_display() - - # Set all the values. - for key in kargs: - uf_page.SetValue(key=key, value=kargs[key]) - - # Execute the user function. - uf_page.on_execute() - - # Flush the interpreter to force synchronous user functions operation. - interpreter.flush() def script_exec(self, script):