Changeset 116

Show
Ignore:
Timestamp:
05/12/05 10:46:58 (4 years ago)
Author:
athomas
Message:
  • Proper checking for colour terminal in utils.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fwc/trunk/util.py

    r114 r116  
    749749__cprint_re = re.compile(r'[^^]+|\^([N0-7BU])') 
    750750__cprint_strip = re.compile('\^([N0-7BU])') 
    751 if sys.stdout.isatty(): 
     751__colour_terminal = 0 
     752try: 
     753        import curses 
     754        curses.setupterm() 
     755        if curses.tigetnum('colors') >= 0: 
     756                __colour_terminal = 1 
     757except ImportError: 
     758        pass 
     759 
     760if sys.stdout.isatty() and __colour_terminal: 
    752761        def cprint(*args): 
    753762                """ Print using colour escape codes similar to the Quake engine. That is,