Author: bugman Date: Tue Aug 9 14:12:51 2011 New Revision: 14289 URL: http://svn.gna.org/viewcvs/relax?rev=14289&view=rev Log: The result_file observer object has been created and is being used throughout relax. The results viewer window is now launched in a thread safe way with a wx.CallAfter call. Modified: branches/gui_testing/generic_fns/grace.py branches/gui_testing/generic_fns/structure/geometric.py branches/gui_testing/generic_fns/value.py branches/gui_testing/gui/analyses/auto_noe.py branches/gui_testing/gui/relax_gui.py branches/gui_testing/status.py Modified: branches/gui_testing/generic_fns/grace.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/grace.py?rev=14289&r1=14288&r2=14289&view=diff ============================================================================== --- branches/gui_testing/generic_fns/grace.py (original) +++ branches/gui_testing/generic_fns/grace.py Tue Aug 9 14:12:51 2011 @@ -36,6 +36,7 @@ from relax_io import get_file_path, open_write_file, test_binary from relax_warnings import RelaxWarning import specific_fns +from status import Status; status = Status() def determine_seq_type(spin_id=None): @@ -374,6 +375,7 @@ if not hasattr(cdp, 'result_files'): cdp.result_files = [] cdp.result_files.append(['grace', 'Grace', file_path]) + status.observers.result_file.notify() Modified: branches/gui_testing/generic_fns/structure/geometric.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/structure/geometric.py?rev=14289&r1=14288&r2=14289&view=diff ============================================================================== --- branches/gui_testing/generic_fns/structure/geometric.py (original) +++ branches/gui_testing/generic_fns/structure/geometric.py Tue Aug 9 14:12:51 2011 @@ -36,7 +36,7 @@ from relax_errors import RelaxError, RelaxNoPdbError, RelaxNoSequenceError, RelaxNoTensorError, RelaxNoVectorsError from relax_io import get_file_path, open_write_file from relax_warnings import RelaxWarning - +from status import Status; status = Status() def angles_regular(inc=None): @@ -395,6 +395,7 @@ if not hasattr(cdp, 'result_files'): cdp.result_files = [] cdp.result_files.append(['cone_pdb', 'Cone PDB', pdb_path]) + status.observers.result_file.notify() def create_diff_tensor_pdb(scale=1.8e-6, file=None, dir=None, force=False): @@ -577,6 +578,7 @@ if dir == None: dir = getcwd() cdp.result_files.append(['diff_tensor_pdb', 'Diffusion tensor PDB', get_file_path(file, dir)]) + status.observers.result_file.notify() def create_vector_dist(length=None, symmetry=True, file=None, dir=None, force=False): @@ -720,6 +722,7 @@ if dir == None: dir = getcwd() cdp.result_files.append(['vector_dist_pdb', 'Vector distribution PDB', get_file_path(file, dir)]) + status.observers.result_file.notify() def generate_vector_dist(mol=None, res_name=None, res_num=None, chain_id='', centre=zeros(3, float64), R=eye(3), warp=eye(3), limit_check=None, scale=1.0, inc=20, distribution='uniform', debug=False): Modified: branches/gui_testing/generic_fns/value.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/value.py?rev=14289&r1=14288&r2=14289&view=diff ============================================================================== --- branches/gui_testing/generic_fns/value.py (original) +++ branches/gui_testing/generic_fns/value.py Tue Aug 9 14:12:51 2011 @@ -33,6 +33,7 @@ from relax_errors import RelaxError, RelaxNoSequenceError, RelaxNoSpinError, RelaxParamSetError, RelaxValueError from relax_io import get_file_path, open_write_file, read_spin_data, write_spin_data import specific_fns +from status import Status; status = Status() def copy(pipe_from=None, pipe_to=None, param=None): @@ -413,6 +414,7 @@ if not hasattr(cdp, 'result_files'): cdp.result_files = [] cdp.result_files.append(['text', 'Text', file_path]) + status.observers.result_file.notify() def write_data(param=None, file=None, bc=False, return_value=None): 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=14289&r1=14288&r2=14289&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/auto_noe.py (original) +++ branches/gui_testing/gui/analyses/auto_noe.py Tue Aug 9 14:12:51 2011 @@ -491,3 +491,4 @@ # Add the macro to the results list. cdp.result_files.append(['pymol', 'PyMOL', data.save_dir+sep+'noe.pml']) + status.observers.result_file.notify() Modified: branches/gui_testing/gui/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/relax_gui.py?rev=14289&r1=14288&r2=14289&view=diff ============================================================================== --- branches/gui_testing/gui/relax_gui.py (original) +++ branches/gui_testing/gui/relax_gui.py Tue Aug 9 14:12:51 2011 @@ -148,6 +148,7 @@ # Register functions with the observer objects. status.observers.pipe_alteration.register('status bar', self.update_status_bar) + status.observers.result_file.register('gui', self.show_results_viewer) def about_gui(self, event): @@ -435,17 +436,24 @@ self.relax_prompt.Show() - def show_results_viewer(self, event): + def show_results_viewer(self, event=None): """Display the analysis results. @param event: The wx event. @type event: wx event """ + + # Show the results viewer in a thread safe way. + wx.CallAfter(self.show_results_viewer_safe) + + + def show_results_viewer_safe(self): + """Display the analysis results in a thread safe wx.CallAfter call.""" # Throw a warning if the execution lock is on. if status.exec_lock.locked(): dlg = wx.MessageDialog(self, "Leaving the results viewer window open will slow down the calculations.", caption="Warning", style=wx.OK|wx.ICON_EXCLAMATION|wx.STAY_ON_TOP) - dlg.ShowModal() + wx.CallAfter(dlg.ShowModal) # Create the results viewer window if needed. if not hasattr(self, 'results_viewer'): Modified: branches/gui_testing/status.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/status.py?rev=14289&r1=14288&r2=14289&view=diff ============================================================================== --- branches/gui_testing/status.py (original) +++ branches/gui_testing/status.py Tue Aug 9 14:12:51 2011 @@ -116,6 +116,9 @@ # The observer object for the execution lock. self.observers.exec_lock = Observer() + + # The observer object for the creation of results files. + self.observers.result_file = Observer() def init_auto_analysis(self, name, type):