diff options
author | Erik Rose <erik@mozilla.com> | 2011-12-19 15:33:20 -0800 |
---|---|---|
committer | Erik Rose <erik@mozilla.com> | 2011-12-19 15:33:20 -0800 |
commit | 4ab628f086ad697243159d4700a5e661297d748d (patch) | |
tree | d85ac3cfffba6d6997167a3a3f34d9fa1042a37a /blessings | |
parent | 58a9726a0bb23e684255bcc3009ab05fcc10a5f5 (diff) | |
download | blessings-4ab628f086ad697243159d4700a5e661297d748d.tar.gz |
Sugar cursor-visibility and single-space-movement capabilities. Closes #15.
Diffstat (limited to 'blessings')
-rw-r--r-- | blessings/__init__.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/blessings/__init__.py b/blessings/__init__.py index 081288b..080fe26 100644 --- a/blessings/__init__.py +++ b/blessings/__init__.py @@ -7,7 +7,6 @@ try: except ImportError: class IOUnsupportedOperation(Exception): """A dummy exception to take the place of Python 3's ``io.UnsupportedOperation`` in Python 2""" - pass import os from os import isatty, environ from platform import python_version_tuple @@ -16,15 +15,15 @@ import sys from termios import TIOCGWINSZ +__all__ = ['Terminal'] + + if ('3', '0', '0') <= python_version_tuple() < ('3', '2', '2+'): # Good till 3.2.10 # Python 3.x < 3.2.3 has a bug in which tparm() erroneously takes a string. raise ImportError('Blessings needs Python 3.2.3 or greater for Python 3 ' 'support due to http://bugs.python.org/issue10570.') -__all__ = ['Terminal'] - - class Terminal(object): """An abstraction around terminal capabilities @@ -111,10 +110,18 @@ class Terminal(object): clear_eol='el', clear_bol='el1', clear_eos='ed', + # 'clear' clears the whole screen. position='cup', # deprecated move='cup', move_x='hpa', move_y='vpa', + move_left='cub1', + move_right='cuf1', + move_up='cuu1', + move_down='cud1', + + hide_cursor='civis', + normal_cursor='cnorm', reset_colors='op', # oc doesn't work on my OS X terminal. |