Author: bugman Date: Fri Sep 17 10:15:30 2010 New Revision: 11596 URL: http://svn.gna.org/viewcvs/relax?rev=11596&view=rev Log: The NOE auto-analysis in the GUI can now be debugged. Giving the --debug option will now disable the relax controller and threading. Error messages will be then shown in the terminal where relax was launched from, rather than saying "Unhandled exception in thread started by". Modified: branches/bieri_gui/gui_bieri/analyses/auto_noe.py Modified: branches/bieri_gui/gui_bieri/analyses/auto_noe.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/analyses/auto_noe.py?rev=11596&r1=11595&r2=11596&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/analyses/auto_noe.py (original) +++ branches/bieri_gui/gui_bieri/analyses/auto_noe.py Fri Sep 17 10:15:30 2010 @@ -25,6 +25,7 @@ """Module containing the base class for the automatic NOE analysis frames.""" # Python module imports. +import __main__ from os import sep from string import replace import sys @@ -487,11 +488,15 @@ # Synchronise the frame data to the relax data store. self.sync_ds(upload=True) - # Display the relax controller. - self.gui.controller.Show() - - # Start the thread. - id = thread.start_new_thread(self.execute_thread, ()) + # Display the relax controller (if not debugging). + if not __main__.debug: + self.gui.controller.Show() + + # Start the thread (if not debugging). + if __main__.debug: + self.execute_thread() + else: + id = thread.start_new_thread(self.execute_thread, ()) # Terminate the event. event.Skip() @@ -500,18 +505,20 @@ def execute_thread(self): """Execute the calculation in a thread.""" - # Redirect relax output and errors to the controller. - redir = Redirect_text(self.gui.controller) - sys.stdout = redir - sys.stderr = redir - - # Print a header in the controller. - header = 'Starting NOE calculation' - underline = '-' * len(header) - wx.CallAfter(self.gui.controller.log_panel.AppendText, (header+'\n\n')) - time.sleep(0.5) - - # Assemble all the data needed for the Relax_fit class. + # Controller. + if not __main__.debug: + # Redirect relax output and errors to the controller. + redir = Redirect_text(self.gui.controller) + sys.stdout = redir + sys.stderr = redir + + # Print a header in the controller. + header = 'Starting NOE calculation' + underline = '-' * len(header) + wx.CallAfter(self.gui.controller.log_panel.AppendText, (header+'\n\n')) + time.sleep(0.5) + + # Assemble all the data needed for the auto-analysis. data = self.assemble_data() # Execute.