mailr15843 - /1.3/gui/controller.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on April 30, 2012 - 18:39:
Author: bugman
Date: Fri Apr 27 11:46:34 2012
New Revision: 15843

URL: http://svn.gna.org/viewcvs/relax?rev=15843&view=rev
Log:
The GUI and logging/teeing modes are now compatible with each other.

The relax controller now uses the relax_io.SplitIO class to allow the STDOUT 
and STDERR messages to
be both directed to the log file and the controller.  The controller will 
capture both streams,
rather than splitting the IO, if no IO redirection has been set up.


Modified:
    1.3/gui/controller.py

Modified: 1.3/gui/controller.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/controller.py?rev=15843&r1=15842&r2=15843&view=diff
==============================================================================
--- 1.3/gui/controller.py (original)
+++ 1.3/gui/controller.py Fri Apr 27 11:46:34 2012
@@ -32,6 +32,7 @@
 
 # relax module imports.
 from generic_fns.pipes import cdp_name
+from relax_io import SplitIO
 from status import Status; status = Status()
 
 # relax GUI module imports.
@@ -96,9 +97,23 @@
         self.log_panel = LogCtrl(self.main_panel, self, 
log_queue=self.log_queue, id=-1)
         sizer.Add(self.log_panel, 1, wx.EXPAND|wx.ALL, 0)
 
-        # IO redirection.
-        sys.stdout = Redirect_text(self.log_panel, self.log_queue, 
orig_io=sys.stdout, stream=0)
-        sys.stderr = Redirect_text(self.log_panel, self.log_queue, 
orig_io=sys.stderr, stream=1)
+        # IO redirection for STDOUT (with splitting if logging or teeing 
modes are set).
+        out = Redirect_text(self.log_panel, self.log_queue, 
orig_io=sys.stdout, stream=0)
+        if sys.stdout == sys.__stdout__:
+            sys.stdout = out
+        else:
+            split_stdout = SplitIO()
+            split_stdout.split(sys.stdout, out)
+            sys.stdout = split_stdout
+
+        # IO redirection for STDERR (with splitting if logging or teeing 
modes are set).
+        err = Redirect_text(self.log_panel, self.log_queue, 
orig_io=sys.stderr, stream=1)
+        if sys.stderr == sys.__stderr__:
+            sys.stderr = err
+        else:
+            split_stderr = SplitIO()
+            split_stderr.split(sys.stderr, err)
+            sys.stderr = split_stderr
 
         # Initial update of the controller.
         self.update_controller()




Related Messages


Powered by MHonArc, Updated Mon Apr 30 19:40:03 2012