Author: bugman Date: Tue Apr 17 16:33:03 2012 New Revision: 15756 URL: http://svn.gna.org/viewcvs/relax?rev=15756&view=rev Log: Added a flag to the status singleton object to signal if text output can be coloured. This is only activated when sys.stdout has not been changed. Unix redirection and pipes will need to be handled later (http://mail.python.org/pipermail/python-list/2012-April/1291044.html). Modified: 1.3/relax.py 1.3/status.py Modified: 1.3/relax.py URL: http://svn.gna.org/viewcvs/relax/1.3/relax.py?rev=15756&r1=15755&r2=15756&view=diff ============================================================================== --- 1.3/relax.py (original) +++ 1.3/relax.py Tue Apr 17 16:33:03 2012 @@ -186,6 +186,10 @@ # Run the interpreter for the prompt or script modes. if self.mode == 'prompt' or self.mode == 'script': + # Turn on text colouring. + if sys.stdout == sys.__stdout__: + status.text_colouring = True + # Run the interpreter. self.interpreter = interpreter.Interpreter() self.interpreter.run(self.script_file) Modified: 1.3/status.py URL: http://svn.gna.org/viewcvs/relax/1.3/status.py?rev=15756&r1=15755&r2=15756&view=diff ============================================================================== --- 1.3/status.py (original) +++ 1.3/status.py Tue Apr 17 16:33:03 2012 @@ -97,6 +97,9 @@ else: self.text_width = 100 + # Text output colouring. + self.text_colouring = False + def _setup_observers(self): """Set up all the observer objects."""