mailr19016 - in /trunk: ansi.py gui/relax_gui.py lib/__init__.py lib/ansi.py lib/errors.py lib/warnings.py prompt/interpreter.py


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

Header


Content

Posted by edward on March 22, 2013 - 22:39:
Author: bugman
Date: Fri Mar 22 22:39:49 2013
New Revision: 19016

URL: http://svn.gna.org/viewcvs/relax?rev=19016&view=rev
Log:
Renamed the ansi module to lib.ansi.

This is part of the relax library redesign.


Added:
    trunk/lib/ansi.py
      - copied, changed from r19014, trunk/ansi.py
Removed:
    trunk/ansi.py
Modified:
    trunk/gui/relax_gui.py
    trunk/lib/__init__.py
    trunk/lib/errors.py
    trunk/lib/warnings.py
    trunk/prompt/interpreter.py

Removed: trunk/ansi.py
URL: http://svn.gna.org/viewcvs/relax/trunk/ansi.py?rev=19015&view=auto
==============================================================================
--- trunk/ansi.py (original)
+++ trunk/ansi.py (removed)
@@ -1,81 +1,0 @@
-###############################################################################
-#                                                                            
 #
-# Copyright (C) 2012 Edward d'Auvergne                                       
 #
-#                                                                            
 #
-# This file is part of the program relax (http://www.nmr-relax.com).         
 #
-#                                                                            
 #
-# This program is free software: you can redistribute it and/or modify       
 #
-# it under the terms of the GNU General Public License as published by       
 #
-# the Free Software Foundation, either version 3 of the License, or          
 #
-# (at your option) any later version.                                        
 #
-#                                                                            
 #
-# This program is distributed in the hope that it will be useful,            
 #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
-# GNU General Public License for more details.                               
 #
-#                                                                            
 #
-# You should have received a copy of the GNU General Public License          
 #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
-#                                                                            
 #
-###############################################################################
-
-# Module docstring.
-"""Module containing ANSI escape sequences and helper functions for colour 
terminal output."""
-
-# Dependencies.
-import dep_check
-
-# Python module imports.
-if dep_check.ctypes_module:
-    import ctypes
-else:
-    ctypes = None
-import sys
-
-# The relax prompt.
-relax_prompt = "\033[94m"
-
-# RelaxErrors.
-relax_error = "\033[31m"
-
-# RelaxWarnings.
-relax_warning = "\033[33m"
-
-# Script printout.
-script = "\033[36m"
-
-# The terminating sequence.
-end = "\033[0m"
-
-
-def enable_control_chars(stream=1):
-    """Helper function for determining if control characters should be 
printed to the IO streams.
-
-    This uses both the sys.std*.isatty() methods as well as the operating 
system.  Control characters are only shown on GNU/Linux and Mac OS X (or 
technically they are disabled on MS Windows as both cmd and the PowerShell do 
not support the ANSI characters).
-
-
-    @keyword stream:    The stream to check.  The value of 0 corresponds to 
STDIN, 1 corresponds to STDOUT, and 2 corresponds to STDERR.
-    @type stream:       int
-    @return:            The answer of whether color and other control 
characters should be printed.
-    @rtype:             bool
-    """
-
-    # MS Windows, therefore always return False.
-    if hasattr(ctypes, 'windll'):
-        return False
-
-    # The STDIO streams.
-    if stream == 0:
-        if not hasattr(sys.stdin, 'isatty'):
-            return False
-        return sys.stdin.isatty()
-    elif stream == 1:
-        if not hasattr(sys.stdout, 'isatty'):
-            return False
-        return sys.stdout.isatty()
-    elif stream == 2:
-        if not hasattr(sys.stderr, 'isatty'):
-            return False
-        return sys.stderr.isatty()
-    else:
-        return False

Modified: trunk/gui/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/relax_gui.py?rev=19016&r1=19015&r2=19016&view=diff
==============================================================================
--- trunk/gui/relax_gui.py (original)
+++ trunk/gui/relax_gui.py Fri Mar 22 22:39:49 2013
@@ -34,7 +34,7 @@
 import wx
 
 # relax module imports.
-import ansi
+from lib import ansi
 from data import Relax_data_store; ds = Relax_data_store()
 from data.gui import Gui
 from info import Info_box

Modified: trunk/lib/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/__init__.py?rev=19016&r1=19015&r2=19016&view=diff
==============================================================================
--- trunk/lib/__init__.py (original)
+++ trunk/lib/__init__.py Fri Mar 22 22:39:49 2013
@@ -23,6 +23,7 @@
 """The relax-lib package - a collection of functions, objects, and methods 
for the study of dynamics."""
 
 __all__ = [
+    'ansi',
     'errors',
     'geometry',
     'io',

Copied: trunk/lib/ansi.py (from r19014, trunk/ansi.py)
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/ansi.py?p2=trunk/lib/ansi.py&p1=trunk/ansi.py&r1=19014&r2=19016&rev=19016&view=diff
==============================================================================
--- trunk/ansi.py (original)
+++ trunk/lib/ansi.py Fri Mar 22 22:39:49 2013
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2012 Edward d'Auvergne                                       
 #
+# Copyright (C) 2012-2013 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -22,13 +22,10 @@
 # Module docstring.
 """Module containing ANSI escape sequences and helper functions for colour 
terminal output."""
 
-# Dependencies.
-import dep_check
-
 # Python module imports.
-if dep_check.ctypes_module:
+try:
     import ctypes
-else:
+except ImportError:
     ctypes = None
 import sys
 

Modified: trunk/lib/errors.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/errors.py?rev=19016&r1=19015&r2=19016&view=diff
==============================================================================
--- trunk/lib/errors.py (original)
+++ trunk/lib/errors.py Fri Mar 22 22:39:49 2013
@@ -35,7 +35,7 @@
 
 # relax module imports.
 from compat import pickle
-import ansi
+from lib import ansi
 
 
 # Text variables.

Modified: trunk/lib/warnings.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/warnings.py?rev=19016&r1=19015&r2=19016&view=diff
==============================================================================
--- trunk/lib/warnings.py (original)
+++ trunk/lib/warnings.py Fri Mar 22 22:39:49 2013
@@ -29,7 +29,7 @@
 import warnings
 
 # relax module imports.
-import ansi
+from lib import ansi
 from status import Status; status = Status()
 
 

Modified: trunk/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/prompt/interpreter.py?rev=19016&r1=19015&r2=19016&view=diff
==============================================================================
--- trunk/prompt/interpreter.py (original)
+++ trunk/prompt/interpreter.py Fri Mar 22 22:39:49 2013
@@ -26,8 +26,8 @@
 import dep_check
 
 # Python module imports.
-import ansi
 from code import InteractiveConsole
+from lib import ansi
 from math import pi
 from os import F_OK, access, chdir, getcwd, path
 from pydoc import pager




Related Messages


Powered by MHonArc, Updated Fri Mar 22 23:00:02 2013