Author: bugman Date: Tue Apr 17 18:18:35 2012 New Revision: 15765 URL: http://svn.gna.org/viewcvs/relax?rev=15765&view=rev Log: Added isatty() methods to all of the dummy file objects within relax. This fixes a number of errors caused by the recent introduction of coloured text. Modified: 1.3/gui/controller.py 1.3/multi/processor_io.py 1.3/relax_io.py Modified: 1.3/gui/controller.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/controller.py?rev=15765&r1=15764&r2=15765&view=diff ============================================================================== --- 1.3/gui/controller.py (original) +++ 1.3/gui/controller.py Tue Apr 17 18:18:35 2012 @@ -1056,6 +1056,16 @@ wx.CallAfter(self.control.write) + def isatty(self): + """Answer that this is not a TTY. + + @return: False, as this is not a TTY. + @rtype: bool + """ + + return False + + def write(self, string): """Simulate the file object write method. Modified: 1.3/multi/processor_io.py URL: http://svn.gna.org/viewcvs/relax/1.3/multi/processor_io.py?rev=15765&r1=15764&r2=15765&view=diff ============================================================================== --- 1.3/multi/processor_io.py (original) +++ 1.3/multi/processor_io.py Tue Apr 17 18:18:35 2012 @@ -49,6 +49,16 @@ """Dummy flush method.""" + def isatty(self): + """Answer that this is not a TTY. + + @return: False, as this is not a TTY. + @rtype: bool + """ + + return False + + def write(self, string): """Replacement write() method. Modified: 1.3/relax_io.py URL: http://svn.gna.org/viewcvs/relax/1.3/relax_io.py?rev=15765&r1=15764&r2=15765&view=diff ============================================================================== --- 1.3/relax_io.py (original) +++ 1.3/relax_io.py Tue Apr 17 18:18:35 2012 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003-2011 Edward d'Auvergne # +# Copyright (C) 2003-2012 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -1012,6 +1012,17 @@ self.stream2.flush() + def isatty(self): + """Check that both streams are TTYs. + + @return: True, only if both streams are TTYs. + @rtype: bool + """ + + # Check both streams. + return self.stream1.isatty() & self.stream2.isatty() + + def split(self, stream1, stream2): """Function for setting the streams."""