Author: bugman Date: Mon Aug 15 09:55:56 2011 New Revision: 14380 URL: http://svn.gna.org/viewcvs/relax?rev=14380&view=rev Log: All calls to user functions in self.gui.interpreter now pass through the queue() method. Modified: branches/gui_testing/gui/analyses/auto_model_free.py branches/gui_testing/gui/analyses/auto_noe.py branches/gui_testing/gui/analyses/auto_rx_base.py branches/gui_testing/gui/relax_gui.py branches/gui_testing/gui/results_viewer.py Modified: branches/gui_testing/gui/analyses/auto_model_free.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_model_free.py?rev=14380&r1=14379&r2=14380&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/auto_model_free.py (original) +++ branches/gui_testing/gui/analyses/auto_model_free.py Mon Aug 15 09:55:56 2011 @@ -169,7 +169,7 @@ # New data container. if data_index == None: # First create the data pipe if not already in existence (if this fails, then no data is set up). - if not has_pipe(pipe_name) and not protected_exec(self.gui.interpreter.pipe.create, pipe_name, 'mf'): + if not has_pipe(pipe_name) and not protected_exec(self.gui.interpreter.queue, 'pipe.create', pipe_name, 'mf'): self.init_flag = False return Modified: branches/gui_testing/gui/analyses/auto_noe.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_noe.py?rev=14380&r1=14379&r2=14380&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/auto_noe.py (original) +++ branches/gui_testing/gui/analyses/auto_noe.py Mon Aug 15 09:55:56 2011 @@ -96,7 +96,7 @@ # New data container. if data_index == None: # First create the data pipe if not already in existence (if this fails, then no data is set up). - if not has_pipe(pipe_name) and not protected_exec(self.gui.interpreter.pipe.create, pipe_name, 'noe'): + if not has_pipe(pipe_name) and not protected_exec(self.gui.interpreter.queue, 'pipe.create', pipe_name, 'noe'): self.init_flag = False return Modified: branches/gui_testing/gui/analyses/auto_rx_base.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_rx_base.py?rev=14380&r1=14379&r2=14380&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/auto_rx_base.py (original) +++ branches/gui_testing/gui/analyses/auto_rx_base.py Mon Aug 15 09:55:56 2011 @@ -95,7 +95,7 @@ # New data container. if data_index == None: # First create the data pipe if not already in existence (if this fails, then no data is set up). - if not has_pipe(pipe_name) and not protected_exec(self.gui.interpreter.pipe.create, pipe_name, 'relax_fit'): + if not has_pipe(pipe_name) and not protected_exec(self.gui.interpreter.queue, 'pipe.create', pipe_name, 'relax_fit'): self.init_flag = False return Modified: branches/gui_testing/gui/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/relax_gui.py?rev=14380&r1=14379&r2=14380&view=diff ============================================================================== --- branches/gui_testing/gui/relax_gui.py (original) +++ branches/gui_testing/gui/relax_gui.py Mon Aug 15 09:55:56 2011 @@ -30,6 +30,7 @@ import platform import sys from textwrap import wrap +from time import sleep import webbrowser import wx from wx.lib import buttons @@ -597,3 +598,18 @@ # Set the status. wx.CallAfter(self.bar.SetStatusText, pipe, 2) + + + def wait_for_interpreter(self, wait_period=0.1): + """Return only once the interpreter thread has cleared all its queued calls. + @keyword wait_period: The time in seconds to wait for the. + """ + + # Loop until finished. + while 1: + # Check that the queue has been cleared and that the global execution lock has been released. + if self.interpreter._queue.empty() and not status.exec_lock.locked(): + break + + # Otherwise sleep a little. + sleep(wait_period) Modified: branches/gui_testing/gui/results_viewer.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/results_viewer.py?rev=14380&r1=14379&r2=14380&view=diff ============================================================================== --- branches/gui_testing/gui/results_viewer.py (original) +++ branches/gui_testing/gui/results_viewer.py Mon Aug 15 09:55:56 2011 @@ -246,9 +246,9 @@ # Diffusion tensor PDB. elif type == 'diff_tensor_pdb': - self.gui.interpreter.pymol.view() - self.gui.interpreter.pymol.cartoon() - self.gui.interpreter.pymol.tensor_pdb(file=file) + self.gui.interpreter.queue('pymol.view') + self.gui.interpreter.queue('pymol.cartoon') + self.gui.interpreter.queue('pymol.tensor_pdb', file=file) # A special table. elif type == 'Table_of_Results': @@ -323,7 +323,8 @@ return # Switch data pipes. - self.gui.interpreter.pipe.switch(pipe) + self.gui.interpreter.queue('pipe.switch', pipe) + self.gui.wait_for_interpreter(0.01) # Update the window. self.refresh()