~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to userinteractor.py

  • Committer: Aaron Bentley
  • Date: 2012-01-20 02:07:15 UTC
  • Revision ID: aaron@aaronbentley.com-20120120020715-ar6jbqnrjcuebggz
Tags: release-2.5
Update for 2.5 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import sys
2
 
 
3
 
if sys.platform == "win32":
4
 
    import msvcrt
5
 
    def getchar():
6
 
        return msvcrt.getch()
7
 
else:
8
 
    import tty
9
 
    import termios
10
 
    def getchar():
11
 
        fd = sys.stdin.fileno()
12
 
        settings = termios.tcgetattr(fd)
13
 
        try:
14
 
            tty.setraw(fd)
15
 
            ch = sys.stdin.read(1)
16
 
        finally:
17
 
            termios.tcsetattr(fd, termios.TCSADRAIN, settings)
18
 
        return ch
 
2
from bzrlib.osutils import getchar
19
3
 
20
4
 
21
5
class UserOption: