-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keyboard/mouse context mgrs, printable width of sequences, sequence parsers #27
Commits on Apr 11, 2013
-
- add unicode-derived 'Keystroke' class, which is yielded by the generator method _resolve_multibyte, adding additional properties, .is_sequence (bool), .code (int), and .name (str). - detect encoding and initialize incrementaldecoder in __init__, used by _resolve_multibyte. - inherit curses key capability names, values, and create multibyte sequence pattern lookup in __init__ - add _resolve_keycode method, returns key capability name for an integer. - add _resolve_multibyte(text) method, given a string of multibyte input, 'text', returns instances of Keystroke class, which may be checked for .is_sequence, .code, and .name.
Configuration menu - View commit details
-
Copy full SHA for 596602c - Browse repository at this point
Copy the full SHA 596602cView commit details -
Implement sequence-safe word wrapping
Add wrap method to Terminal, with accompanying AnsiWrapper class, a derived version of textwrap.TextWrapper, with a modified version of _wrap_chunks that is sequence-safe. A module-global function, 'ansiwrap' is exposed. Sequences are detected using a range of byte matching and regular expressions. This sequence padding code been tested thoroughly on ANSI Art from the "Dark Domains" DVD by "ACiD Productions". Example usage: >> import blessings >> t = blessings.Terminal() >>> for num, byte in enumerate('Pony Express, Choo! CHooooooOOoooOOo!'): ... seq += t.color(num % 7) + t.bold + byte + t.normal >>> import textwrap >>> print u'\n'.join(textwrap.wrap(seq, 15)) (as you can see, textwrap fails horribly !!) >>> print u'\n'.join(t.wrap(seq, 15)) Pony Express, Choo! CHooooooOOoooOOo! winning !!
Configuration menu - View commit details
-
Copy full SHA for f366cc8 - Browse repository at this point
Copy the full SHA f366cc8View commit details -
Continuing the example from the previous commit, it is now possible: >>> print t.center(seq) Pony Express, Choo! CHooooooOOoooOOo!
Configuration menu - View commit details
-
Copy full SHA for f1a3cf1 - Browse repository at this point
Copy the full SHA f1a3cf1View commit details -
re-shuffle .center, .ljust, and .rjust
Instantate AnsiString from Terminal, so AnsiString contains these padding methods, requires less instantiation.
Configuration menu - View commit details
-
Copy full SHA for 0ef2233 - Browse repository at this point
Copy the full SHA 0ef2233View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d7b4d0 - Browse repository at this point
Copy the full SHA 9d7b4d0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 77ecb9c - Browse repository at this point
Copy the full SHA 77ecb9cView commit details -
static import for fcntl, will use fcntl.fcntl,
also readability from pexpect
Configuration menu - View commit details
-
Copy full SHA for 982192d - Browse repository at this point
Copy the full SHA 982192dView commit details -
Implement 'inkey_enabled' context manager
* add _conanical and _echo terminal state helpers and related functions. * remove another magic bit, '27', by explicitly setting to curses.ascii.ESC * fix for incremental decoder * add warning for failed decodes in _resolve_multibyte * placeholder for inkey() with docstrings of expected behavior
Configuration menu - View commit details
-
Copy full SHA for cd5ae7d - Browse repository at this point
Copy the full SHA cd5ae7dView commit details -
use tty.LFLAGS instead of magic attrs[3] bit. Also rename 'attrs' references to 'mode' to match python standard module naming conv.
Configuration menu - View commit details
-
Copy full SHA for a1d97c8 - Browse repository at this point
Copy the full SHA a1d97c8View commit details -
Configuration menu - View commit details
-
Copy full SHA for e803a44 - Browse repository at this point
Copy the full SHA e803a44View commit details
Commits on Apr 12, 2013
-
implement complete keyboard handling, win32 support ?
in the usual style of mine, fully written but not yet run, this intermittent commit has complete docstrings for the interface in mind. I haven't a win32 platform, but diligent effort was made to support it. This commit also includes a possible fix for windows systems to determine the terminal height and width without calls to fcntl. - remove unused defaultdict import - refactor input stream key capability from __init__ to _init_keystrokes() - remove redundant input key capability definitions - store _state_echo and _state_canonical; necessary for win32 systems - refactor term.stream to term.o_stream to accompany term.i_stream - refactor documented @Property, do_style - refactor _resolve_multibyte to _resolve_msb, consistent reference 'MSB' can be either 'escape sequence' for application keys, or utf-8 bytes as part of a hamsterface emoticon.
Configuration menu - View commit details
-
Copy full SHA for 7d1668c - Browse repository at this point
Copy the full SHA 7d1668cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 619ae9e - Browse repository at this point
Copy the full SHA 619ae9eView commit details -
getch() so far works in non-conanical mode, as unimpressive as it is. various issues with multibyte sequence decoding, currently looks like the loop timing and buffering at issue.
Configuration menu - View commit details
-
Copy full SHA for 50241f0 - Browse repository at this point
Copy the full SHA 50241f0View commit details -
unset canonical or echo on __del__
This is what the curses wrapper is missing; it is very obnoxious when developing curses when your program crashes, you have to type 'reset' after each crash That's fine, we simply check the state and always restore it on __del__. If python throws an exception and kicks you out while the terminal is in cbreak mode, a warning is issued to let you know it was restored after doing so. This will appear after your traceback. So it won't be any suprised as to what happened.
Configuration menu - View commit details
-
Copy full SHA for c234619 - Browse repository at this point
Copy the full SHA c234619View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4697a0f - Browse repository at this point
Copy the full SHA 4697a0fView commit details -
remove MSB decode warning, as we aggressively test
also sprinly various print debugs for MSB, there is a timing issue related to the 2nd byte of a '\x1b[A' sequence failing the kbhit() check. I think i've seen this before, has to do with flushing something correctly at a particular time? will look tomorrow.
Configuration menu - View commit details
-
Copy full SHA for 93810b8 - Browse repository at this point
Copy the full SHA 93810b8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f4d101 - Browse repository at this point
Copy the full SHA 1f4d101View commit details -
remove @property.setter, not python 2.5 compatible. do_styling remains a property, but read-only !
Configuration menu - View commit details
-
Copy full SHA for 6997889 - Browse repository at this point
Copy the full SHA 6997889View commit details -
remove __del__, revert window size to old behavior
That is, for win32 systems, if the new height & width returns 0, then the old behavior of trying to use termios is used..
Configuration menu - View commit details
-
Copy full SHA for 99f1aff - Browse repository at this point
Copy the full SHA 99f1affView commit details -
change o_stream back to stream
so that the tests don't have to be updated also a fix for o_fd/decriptor
Configuration menu - View commit details
-
Copy full SHA for f34d972 - Browse repository at this point
Copy the full SHA f34d972View commit details -
was trying to figure out why this test failed for so long, but I was running it with 'nose 2>&1 | less' -- no wonder, output was not a tty...
Configuration menu - View commit details
-
Copy full SHA for 19005bd - Browse repository at this point
Copy the full SHA 19005bdView commit details -
finished input! Go ahead; kick the tires!
For the longest time, the 2nd byte in a multibyte sequence was blocking on select. I discovered using i_stream.read(1) does not interact with the VMIN and VTIME set for cbreak mode on terminals connected to the stream. a call using os.read(i_stream.fileno(), 1) resolved this. - is_a_tty class attribute changed to property. This brevities the documentation and interface, certainly enforcing the concept that this property is read-only! - the input stream is *always* stdin. - helped comment the whys and whats of __init__, about fd's, curses, etc. - remove list comprehension, fix bug with _keycodes being empty - only detect input encoding if stream is connected to a tty, otherwise it is not necessary to detect encoding of multibyte input, as we can't support interactive keyboard input on non-ttys. - try to cleanup _height_and_width win32 support. - however; removed the windows getch() and kbhit() until it can be tried .. - removed the debug prints since inkey appears to work now - removed the excessive delve into termios, using only tty.setcbreak() and restoring original terminal settings in finally: clause
Configuration menu - View commit details
-
Copy full SHA for 726ce6b - Browse repository at this point
Copy the full SHA 726ce6bView commit details -
Configuration menu - View commit details
-
Copy full SHA for eaa2955 - Browse repository at this point
Copy the full SHA eaa2955View commit details -
Configuration menu - View commit details
-
Copy full SHA for e0730ff - Browse repository at this point
Copy the full SHA e0730ffView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3588ed9 - Browse repository at this point
Copy the full SHA 3588ed9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2482606 - Browse repository at this point
Copy the full SHA 2482606View commit details -
pep8 compliance; 79-col wrapping for better pydoc
also snuck a kbhit() timing fix, woops
Configuration menu - View commit details
-
Copy full SHA for 5db146c - Browse repository at this point
Copy the full SHA 5db146cView commit details -
Configuration menu - View commit details
-
Copy full SHA for b6eff3e - Browse repository at this point
Copy the full SHA b6eff3eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9aa1f39 - Browse repository at this point
Copy the full SHA 9aa1f39View commit details -
Configuration menu - View commit details
-
Copy full SHA for e44f08f - Browse repository at this point
Copy the full SHA e44f08fView commit details -
Configuration menu - View commit details
-
Copy full SHA for db90d03 - Browse repository at this point
Copy the full SHA db90d03View commit details -
Configuration menu - View commit details
-
Copy full SHA for c8c704d - Browse repository at this point
Copy the full SHA c8c704dView commit details -
Configuration menu - View commit details
-
Copy full SHA for ed0b3f5 - Browse repository at this point
Copy the full SHA ed0b3f5View commit details -
add test case for _is_movement
caught \033#8, my favorite 'fill the screen' sequence. not that anyone would have noticed.
Configuration menu - View commit details
-
Copy full SHA for 56dbd5a - Browse repository at this point
Copy the full SHA 56dbd5aView commit details -
Configuration menu - View commit details
-
Copy full SHA for a896f7f - Browse repository at this point
Copy the full SHA a896f7fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8d2ba43 - Browse repository at this point
Copy the full SHA 8d2ba43View commit details -
Configuration menu - View commit details
-
Copy full SHA for 68f16ba - Browse repository at this point
Copy the full SHA 68f16baView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a909ec - Browse repository at this point
Copy the full SHA 3a909ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7dfb756 - Browse repository at this point
Copy the full SHA 7dfb756View commit details -
Configuration menu - View commit details
-
Copy full SHA for e00efb8 - Browse repository at this point
Copy the full SHA e00efb8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 08e535a - Browse repository at this point
Copy the full SHA 08e535aView commit details -
Configuration menu - View commit details
-
Copy full SHA for a2c157c - Browse repository at this point
Copy the full SHA a2c157cView commit details
Commits on Apr 13, 2013
-
Configuration menu - View commit details
-
Copy full SHA for a7aa242 - Browse repository at this point
Copy the full SHA a7aa242View commit details -
Configuration menu - View commit details
-
Copy full SHA for 85868d8 - Browse repository at this point
Copy the full SHA 85868d8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 937f10f - Browse repository at this point
Copy the full SHA 937f10fView commit details -
Configuration menu - View commit details
-
Copy full SHA for e199f4b - Browse repository at this point
Copy the full SHA e199f4bView commit details -
add nother *human* test for animations
this is really just a test of timing performance, revived an old alogorithm i made as a kid and wrapped it into a simple game, called "newton's nightmare".
Configuration menu - View commit details
-
Copy full SHA for 277cb50 - Browse repository at this point
Copy the full SHA 277cb50View commit details -
make newton's nightmare more interesting
add a new planet? every 50 points. really should track the tracers and keep only the 10th last.
Configuration menu - View commit details
-
Copy full SHA for 32b703c - Browse repository at this point
Copy the full SHA 32b703cView commit details -
leave only a limited tail length using a stack of unique screen positions die animation !
Configuration menu - View commit details
-
Copy full SHA for 4b1d7b5 - Browse repository at this point
Copy the full SHA 4b1d7b5View commit details -
Configuration menu - View commit details
-
Copy full SHA for f684e2d - Browse repository at this point
Copy the full SHA f684e2dView commit details -
also add SUP/SDOWN/SLEFT/SRIGHT to game for testing
Configuration menu - View commit details
-
Copy full SHA for 0c51b54 - Browse repository at this point
Copy the full SHA 0c51b54View commit details -
Configuration menu - View commit details
-
Copy full SHA for 22b2cc6 - Browse repository at this point
Copy the full SHA 22b2cc6View commit details -
Configuration menu - View commit details
-
Copy full SHA for a4c62d4 - Browse repository at this point
Copy the full SHA a4c62d4View commit details -
velocity was always in Down-right direction, now can be any. also change the 'your score' to be term.height -3, and use term.clear_eol this game is pretty fun !
Configuration menu - View commit details
-
Copy full SHA for 85ec2f7 - Browse repository at this point
Copy the full SHA 85ec2f7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b6c4c6 - Browse repository at this point
Copy the full SHA 5b6c4c6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 83798cb - Browse repository at this point
Copy the full SHA 83798cbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 59ea95f - Browse repository at this point
Copy the full SHA 59ea95fView commit details -
Configuration menu - View commit details
-
Copy full SHA for f616114 - Browse repository at this point
Copy the full SHA f616114View commit details -
add timing tests of input using pexpect
pexpect gives us a real pty; will travis-ci allows it?
Configuration menu - View commit details
-
Copy full SHA for 5cbb2d8 - Browse repository at this point
Copy the full SHA 5cbb2d8View commit details -
refactor resolve_mbs; improve test cases
make unicode decoding more internal, but externally exposed and documented through the encoding parameter. further improving pexpect test cases.
Configuration menu - View commit details
-
Copy full SHA for 1616da7 - Browse repository at this point
Copy the full SHA 1616da7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1caec63 - Browse repository at this point
Copy the full SHA 1caec63View commit details -
Configuration menu - View commit details
-
Copy full SHA for 54c1fd2 - Browse repository at this point
Copy the full SHA 54c1fd2View commit details -
Configuration menu - View commit details
-
Copy full SHA for f1e4d45 - Browse repository at this point
Copy the full SHA f1e4d45View commit details -
Configuration menu - View commit details
-
Copy full SHA for d88e249 - Browse repository at this point
Copy the full SHA d88e249View commit details -
complete mouse tracking extended modes
the default mode is a comprimise of the most compatible and most capable and documented well.
Configuration menu - View commit details
-
Copy full SHA for 4f76056 - Browse repository at this point
Copy the full SHA 4f76056View commit details -
Configuration menu - View commit details
-
Copy full SHA for f02f818 - Browse repository at this point
Copy the full SHA f02f818View commit details -
Configuration menu - View commit details
-
Copy full SHA for 44fe0c3 - Browse repository at this point
Copy the full SHA 44fe0c3View commit details
Commits on Apr 14, 2013
-
Configuration menu - View commit details
-
Copy full SHA for d72f279 - Browse repository at this point
Copy the full SHA d72f279View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5933088 - Browse repository at this point
Copy the full SHA 5933088View commit details -
broad and comprehensive _is_movement tests
also brought a few changes to WILL_MOVE, WONT_MOVE also assert TypeError for non-ints for things like term.move(1.0)
Configuration menu - View commit details
-
Copy full SHA for 11a309c - Browse repository at this point
Copy the full SHA 11a309cView commit details -
my nose for python 2.5 doesn't seem to work
Configuration menu - View commit details
-
Copy full SHA for 133fd9c - Browse repository at this point
Copy the full SHA 133fd9cView commit details -
minor TypeError friendly msg fix for mised strings
plus a test case, and disable the float exception testing, as it fails on older python where only a DeprecationWarning is emitted
Configuration menu - View commit details
-
Copy full SHA for fe92ffe - Browse repository at this point
Copy the full SHA fe92ffeView commit details -
Configuration menu - View commit details
-
Copy full SHA for e57e8a1 - Browse repository at this point
Copy the full SHA e57e8a1View commit details -
Configuration menu - View commit details
-
Copy full SHA for bd62d89 - Browse repository at this point
Copy the full SHA bd62d89View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7c94c4c - Browse repository at this point
Copy the full SHA 7c94c4cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1ecc3cb - Browse repository at this point
Copy the full SHA 1ecc3cbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8137f93 - Browse repository at this point
Copy the full SHA 8137f93View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a0e316 - Browse repository at this point
Copy the full SHA 2a0e316View commit details