~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to terminal.py

  • Committer: Aaron Bentley
  • Date: 2006-07-17 19:05:46 UTC
  • Revision ID: abentley@panoramicfeedback.com-20060717190546-11b67e418c7c3241
Allow completion on executables, fix broken prompt code

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2004 Aaron Bentley
2
 
# <aaron@aaronbentley.com>
 
2
# <aaron.bentley@utoronto.ca>
3
3
#
4
4
#    This program is free software; you can redistribute it and/or modify
5
5
#    it under the terms of the GNU General Public License as published by
16
16
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
18
import os
19
 
import sys
20
19
 
21
20
__docformat__ = "restructuredtext"
22
21
__doc__ = "Terminal control functionality"
25
24
    # XXX The whole color handling should be rewritten to use terminfo
26
25
    # XXX before we get there, checking for setaf capability should do.
27
26
    # XXX See terminfo(5) for all the gory details.
28
 
    if sys.platform == "win32":
29
 
        return False
30
 
    if not sys.stdout.isatty():
31
 
        return False
32
27
    import curses
33
 
    try:
34
 
        curses.setupterm()
35
 
    except curses.error:
36
 
        return False
 
28
    curses.setupterm()
37
29
    return bool(curses.tigetstr('setaf'))
38
30
 
39
31
colors = {