Hello community, here is the log from the commit of package python-curtsies for openSUSE:Factory checked in at 2017-09-05 15:15:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-curtsies (Old) and /work/SRC/openSUSE:Factory/.python-curtsies.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-curtsies" Tue Sep 5 15:15:36 2017 rev:2 rq:520045 version:0.2.11 Changes: -------- --- /work/SRC/openSUSE:Factory/python-curtsies/python-curtsies.changes 2016-10-20 23:07:28.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-curtsies.new/python-curtsies.changes 2017-09-05 15:15:40.137452346 +0200 @@ -1,0 +2,16 @@ +Thu Aug 31 22:14:20 UTC 2017 - toddrme2178@gmail.com + +- Update to version 0.2.11 + * Add sequences for home and end (fixes Curtsies #78) + * fix #90 again + * strip ansi escape sequences if parsing fmtstr input fails + * prevent invalid negative cursor positions in CursorAwareWindow (fixes bpython #607) + * '\x1bOA' changed from ctrl-arrow key to arrow key (fixes bpython #621) + * alternate codes for F1-F4 (fixes bpython #626) + +------------------------------------------------------------------- +Thu Aug 24 13:35:27 UTC 2017 - jmatejek@suse.com + +- singlespec auto-conversion + +------------------------------------------------------------------- @@ -4,0 +21 @@ + Old: ---- curtsies-0.2.6.tar.gz New: ---- curtsies-0.2.11.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-curtsies.spec ++++++ --- /var/tmp/diff_new_pack.KmorUb/_old 2017-09-05 15:15:41.217300559 +0200 +++ /var/tmp/diff_new_pack.KmorUb/_new 2017-09-05 15:15:41.221299997 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-curtsies # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,24 +16,28 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-curtsies -Version: 0.2.6 +Version: 0.2.11 Release: 0 Summary: Curses-like terminal wrapper, with colored strings! License: MIT Group: Development/Languages/Python Url: https://github.com/thomasballinger/curtsies Source: https://files.pythonhosted.org/packages/source/c/curtsies/curtsies-%{version}.tar.gz +BuildRequires: %{python_module blessings} +BuildRequires: %{python_module devel} +BuildRequires: %{python_module mock} +BuildRequires: %{python_module nose} +BuildRequires: %{python_module pyte} +BuildRequires: %{python_module setuptools} BuildRequires: fdupes -BuildRequires: python-blessings -BuildRequires: python-devel -BuildRequires: python-mock -BuildRequires: python-pyte -BuildRequires: python-setuptools +BuildRequires: python-rpm-macros Requires: python-blessings -BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch +%python_subpackages + %description Curses-like terminal wrapper with a display based on compositing 2d arrays of text. @@ -42,15 +46,18 @@ %setup -q -n curtsies-%{version} %build -python setup.py build +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} -%fdupes %{buildroot} +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%python_expand nosetests-%{$python_bin_suffix} -%files +%files %{python_files} %defattr(-,root,root,-) -%{python_sitelib}/* %doc readme.md LICENSE +%{python_sitelib}/* %changelog ++++++ curtsies-0.2.6.tar.gz -> curtsies-0.2.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/PKG-INFO new/curtsies-0.2.11/PKG-INFO --- old/curtsies-0.2.6/PKG-INFO 2016-01-11 23:37:59.000000000 +0100 +++ new/curtsies-0.2.11/PKG-INFO 2016-10-23 01:02:52.000000000 +0200 @@ -1,12 +1,122 @@ Metadata-Version: 1.1 Name: curtsies -Version: 0.2.6 +Version: 0.2.11 Summary: Curses-like terminal wrapper, with colored strings! Home-page: https://github.com/thomasballinger/curtsies Author: Thomas Ballinger Author-email: thomasballinger@gmail.com License: MIT -Description: UNKNOWN +Description: |Build Status| |Documentation Status| |Curtsies Logo| + + Curtsies is a library for interacting with the terminal. This is what + using (nearly every feature of) curtsies looks like: + + .. code:: python + + from __future__ import unicode_literals # convenient for Python 2 + import random + + from curtsies import FullscreenWindow, Input, FSArray + from curtsies.fmtfuncs import red, bold, green, on_blue, yellow + + print(yellow('this prints normally, not to the alternate screen')) + with FullscreenWindow() as window: + with Input() as input_generator: + msg = red(on_blue(bold('Press escape to exit'))) + a = FSArray(window.height, window.width) + a[0:1, 0:msg.width] = [msg] + for c in input_generator: + if c == '<ESC>': + break + elif c == '<SPACE>': + a = FSArray(window.height, window.width) + else: + s = repr(c).decode() + row = random.choice(range(window.height)) + column = random.choice(range(window.width-len(s))) + color = random.choice([red, green, on_blue, yellow]) + a[row, column:column+len(s)] = [color(s)] + window.render_to_terminal(a) + + Paste it in a ``something.py`` file and try it out! + + Installation: ``pip install curtsies`` + + `Documentation http://curtsies.readthedocs.org/en/latest/`__ + + Primer + ------ + + `FmtStr http://curtsies.readthedocs.org/en/latest/FmtStr.html`__ + objects are strings formatted with colors and styles displayable in a + terminal with `ANSI escape + sequences http://en.wikipedia.org/wiki/ANSI_escape_code%3E%60_`__. + + (the import statement shown below is outdated) + + .. figure:: http://i.imgur.com/7lFaxsz.png + :alt: + + `FSArray http://curtsies.readthedocs.org/en/latest/FSArray.html`__ + objects contain multiple such strings with each formatted string on its + own row, and FSArray objects can be superimposed on each other to build + complex grids of colored and styled characters through composition. + + (the import statement shown below is outdated) + + .. figure:: http://i.imgur.com/rvTRPv1.png + :alt: + + Such grids of characters can be rendered to the terminal in alternate + screen mode (no history, like ``Vim``, ``top`` etc.) by + `FullscreenWindow http://curtsies.readthedocs.org/en/latest/window.html#curtsies.window.Fullsc...`__ + objects or normal history-preserving screen by + `CursorAwareWindow http://curtsies.readthedocs.org/en/latest/window.html#curtsies.window.Cursor...`__ + objects. User keyboard input events like pressing the up arrow key are + detected by an + `Input http://curtsies.readthedocs.org/en/latest/input.html`__ object. + + Examples + -------- + + - `Tic-Tac-Toe `__ + + .. figure:: http://i.imgur.com/AucB55B.png + :alt: + + - `Avoid the X's game `__ + + .. figure:: http://i.imgur.com/nv1RQd3.png + :alt: + + - `Bpython-curtsies uses + curtsies http://ballingt.com/2013/12/21/bpython-curtsies.html`__ + + |image3| + + - `More examples </examples>`__ + + About + ----- + + - `Curtsies + Documentation http://curtsies.readthedocs.org/en/latest/`__ + - Curtsies was written to for + `bpython-curtsies http://ballingt.com/2013/12/21/bpython-curtsies.html`__ + - ``#bpython`` on irc is a good place to talk about Curtsies, but feel + free to open an issue if you're having a problem! + - Thanks to the many contributors! + - If all you need are colored strings, consider one of these `other + libraries http://curtsies.readthedocs.io/en/latest/FmtStr.html#fmtstr-rationale`__! + + .. |Build Status| image:: https://travis-ci.org/thomasballinger/curtsies.svg?branch=master + :target: https://travis-ci.org/thomasballinger/curtsies + .. |Documentation Status| image:: https://readthedocs.org/projects/curtsies/badge/?version=latest + :target: https://readthedocs.org/projects/curtsies/?badge=latest + .. |Curtsies Logo| image:: http://ballingt.com/assets/curtsiestitle.png + .. |image3| image:: http://i.imgur.com/r7rZiBS.png + :target: http://www.youtube.com/watch?v=lwbpC4IJlyA + Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Environment :: Console diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/curtsies/__init__.py new/curtsies-0.2.11/curtsies/__init__.py --- old/curtsies-0.2.6/curtsies/__init__.py 2016-01-11 23:37:06.000000000 +0100 +++ new/curtsies-0.2.11/curtsies/__init__.py 2016-10-23 01:00:44.000000000 +0200 @@ -1,5 +1,5 @@ """Terminal-formatted strings""" -__version__='0.2.6' +__version__='0.2.11' from .window import FullscreenWindow, CursorAwareWindow from .input import Input diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/curtsies/curtsieskeys.py new/curtsies-0.2.11/curtsies/curtsieskeys.py --- old/curtsies-0.2.6/curtsies/curtsieskeys.py 2016-01-11 23:36:53.000000000 +0100 +++ new/curtsies-0.2.11/curtsies/curtsieskeys.py 2016-10-20 22:18:49.000000000 +0200 @@ -16,10 +16,10 @@ (b'\x1b[B', u'<DOWN>'), (b'\x1b[C', u'<RIGHT>'), (b'\x1b[D', u'<LEFT>'), - (b'\x1bOA', u'<Ctrl-UP>'), - (b'\x1bOB', u'<Ctrl-DOWN>'), - (b'\x1bOC', u'<Ctrl-RIGHT>'), - (b'\x1bOD', u'<Ctrl-LEFT>'), + (b'\x1bOA', u'<UP>'), # in issue 92 its shown these should be normal arrows, + (b'\x1bOB', u'<DOWN>'), # not ctrl-arrows as we previously had them. + (b'\x1bOC', u'<RIGHT>'), + (b'\x1bOD', u'<LEFT>'), (b'\x1b[1;5A', u'<Ctrl-UP>'), (b'\x1b[1;5B', u'<Ctrl-DOWN>'), @@ -45,6 +45,13 @@ (b'\x1bOQ', u'<F2>'), (b'\x1bOR', u'<F3>'), (b'\x1bOS', u'<F4>'), + + # see bpython #626 + (b'\x1b[11~', u'<F1>'), + (b'\x1b[12~', u'<F2>'), + (b'\x1b[13~', u'<F3>'), + (b'\x1b[14~', u'<F4>'), + (b'\x1b[15~', u'<F5>'), (b'\x1b[17~', u'<F6>'), (b'\x1b[18~', u'<F7>'), @@ -74,7 +81,8 @@ (b'\x1b[H', u'<HOME>'), # reported by amorozov in bpython #490 (b'\x1b[F', u'<END>'), # reported by amorozov in bpython #490 - # see curtsies #78 - taken from https://github.com/jquast/blessed/blob/e9ad7b85dfcbbba49010ab8c13e3a5920d81b... + (b'\x1bOH', u'<HOME>'), # reported by mixmastamyk in curtsies #78 + (b'\x1bOF', u'<END>'), # reported by mixmastamyk in curtsies #78 # not fixing for back compat. # (b"\x1b[1~", u'<FIND>'), # find diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/curtsies/escseqparse.py new/curtsies-0.2.11/curtsies/escseqparse.py --- old/curtsies-0.2.6/curtsies/escseqparse.py 2016-01-11 23:36:53.000000000 +0100 +++ new/curtsies-0.2.11/curtsies/escseqparse.py 2016-10-20 22:18:49.000000000 +0200 @@ -9,14 +9,23 @@ True """ +import re + from .termformatconstants import (FG_NUMBER_TO_COLOR, BG_NUMBER_TO_COLOR, NUMBER_TO_STYLE, RESET_ALL, RESET_FG, RESET_BG, STYLES) -import re + + +def remove_ansi(s): + return re.sub(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]', '', s) def parse(s): r""" + Returns a list of strings or format dictionaries to describe the strings. + + May raise a ValueError if it can't be parsed. + >>> parse(">>> []") ['>>> []'] >>> #parse("\x1b[33m[\x1b[39m\x1b[33m]\x1b[39m\x1b[33m[\x1b[39m\x1b[33m]\x1b[39m\x1b[33m[\x1b[39m\x1b[33m]\x1b[39m\x1b[33m[\x1b[39m") @@ -75,7 +84,7 @@ d = m.groupdict() del d['front'] del d['rest'] - if 'numbers' in d and d['numbers'].split(';'): + if 'numbers' in d and all(d['numbers'].split(';')): d['numbers'] = [int(x) for x in d['numbers'].split(';')] return m.groupdict()['front'], d, m.groupdict()['rest'] @@ -86,7 +95,9 @@ """ """ if info['command'] == 'm': - value, = info['numbers'] + # The default action for ESC[m is to act like ESC[0m + # Ref: https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes + value, = info['numbers'] if len(info['numbers']) else [0] if value in FG_NUMBER_TO_COLOR: return {'fg':FG_NUMBER_TO_COLOR[value]} if value in BG_NUMBER_TO_COLOR: return {'bg':BG_NUMBER_TO_COLOR[value]} if value in NUMBER_TO_STYLE: return {NUMBER_TO_STYLE[value]:True} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/curtsies/events.py new/curtsies-0.2.11/curtsies/events.py --- old/curtsies-0.2.6/curtsies/events.py 2016-01-11 23:36:53.000000000 +0100 +++ new/curtsies-0.2.11/curtsies/events.py 2016-10-20 22:18:49.000000000 +0200 @@ -41,6 +41,13 @@ CURSES_NAMES[b'\x1b[21~'] = u'KEY_F(10)' CURSES_NAMES[b'\x1b[23~'] = u'KEY_F(11)' CURSES_NAMES[b'\x1b[24~'] = u'KEY_F(12)' + +# see bpython #626 +CURSES_NAMES[b'\x1b[11~'] = u'KEY_F(1)' +CURSES_NAMES[b'\x1b[12~'] = u'KEY_F(2)' +CURSES_NAMES[b'\x1b[13~'] = u'KEY_F(3)' +CURSES_NAMES[b'\x1b[14~'] = u'KEY_F(4)' + CURSES_NAMES[b'\x1b[A'] = u'KEY_UP' CURSES_NAMES[b'\x1b[B'] = u'KEY_DOWN' CURSES_NAMES[b'\x1b[C'] = u'KEY_RIGHT' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/curtsies/formatstring.py new/curtsies-0.2.11/curtsies/formatstring.py --- old/curtsies-0.2.6/curtsies/formatstring.py 2016-01-11 23:36:53.000000000 +0100 +++ new/curtsies-0.2.11/curtsies/formatstring.py 2016-10-20 22:18:49.000000000 +0200 @@ -26,7 +26,7 @@ import sys import wcwidth -from .escseqparse import parse +from .escseqparse import parse, remove_ansi from .termformatconstants import (FG_COLORS, BG_COLORS, STYLES, FG_NUMBER_TO_COLOR, BG_NUMBER_TO_COLOR, RESET_ALL, RESET_BG, RESET_FG, @@ -146,6 +146,11 @@ @classmethod def from_str(cls, s): r""" + Return a FmtStr representing input. + + The str() of a FmtStr is guaranteed to produced the same FmtStr. + Other input with escape sequences may not be preserved. + >>> fmtstr("|"+fmtstr("hey", fg='red', bg='blue')+"|") '|'+on_blue(red('hey'))+'|' >>> fmtstr('|\x1b[31m\x1b[44mhey\x1b[49m\x1b[39m|') @@ -153,18 +158,24 @@ """ if '\x1b[' in s: - tokens_and_strings = parse(s) - bases = [] - cur_fmt = {} - for x in tokens_and_strings: - if isinstance(x, dict): - cur_fmt.update(x) - elif isinstance(x, (bytes, unicode)): - atts = parse_args('', dict((k, v) for k,v in cur_fmt.items() if v is not None)) - bases.append(Chunk(x, atts=atts)) - else: - raise Exception("logic error") - return FmtStr(*bases) + try: + tokens_and_strings = parse(s) + except ValueError: + return FmtStr(Chunk(remove_ansi(s))) + else: + bases = [] + cur_fmt = {} + for x in tokens_and_strings: + if isinstance(x, dict): + cur_fmt.update(x) + elif isinstance(x, (bytes, unicode)): + atts = parse_args('', dict((k, v) + for k, v in cur_fmt.items() + if v is not None)) + bases.append(Chunk(x, atts=atts)) + else: + raise Exception("logic error") + return FmtStr(*bases) else: return FmtStr(Chunk(s)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/curtsies/window.py new/curtsies-0.2.11/curtsies/window.py --- old/curtsies-0.2.6/curtsies/window.py 2016-01-11 23:36:53.000000000 +0100 +++ new/curtsies-0.2.11/curtsies/window.py 2016-10-20 22:18:49.000000000 +0200 @@ -448,8 +448,8 @@ logger.debug( 'lines in current lines by row: %r' % current_lines_by_row.keys() ) - self._last_cursor_row = ( - cursor_pos[0] - offscreen_scrolls + self.top_usable_row + self._last_cursor_row = max( + 0, cursor_pos[0] - offscreen_scrolls + self.top_usable_row ) self._last_cursor_column = cursor_pos[1] self.write( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/curtsies.egg-info/PKG-INFO new/curtsies-0.2.11/curtsies.egg-info/PKG-INFO --- old/curtsies-0.2.6/curtsies.egg-info/PKG-INFO 2016-01-11 23:37:58.000000000 +0100 +++ new/curtsies-0.2.11/curtsies.egg-info/PKG-INFO 2016-10-23 01:02:51.000000000 +0200 @@ -1,12 +1,122 @@ Metadata-Version: 1.1 Name: curtsies -Version: 0.2.6 +Version: 0.2.11 Summary: Curses-like terminal wrapper, with colored strings! Home-page: https://github.com/thomasballinger/curtsies Author: Thomas Ballinger Author-email: thomasballinger@gmail.com License: MIT -Description: UNKNOWN +Description: |Build Status| |Documentation Status| |Curtsies Logo| + + Curtsies is a library for interacting with the terminal. This is what + using (nearly every feature of) curtsies looks like: + + .. code:: python + + from __future__ import unicode_literals # convenient for Python 2 + import random + + from curtsies import FullscreenWindow, Input, FSArray + from curtsies.fmtfuncs import red, bold, green, on_blue, yellow + + print(yellow('this prints normally, not to the alternate screen')) + with FullscreenWindow() as window: + with Input() as input_generator: + msg = red(on_blue(bold('Press escape to exit'))) + a = FSArray(window.height, window.width) + a[0:1, 0:msg.width] = [msg] + for c in input_generator: + if c == '<ESC>': + break + elif c == '<SPACE>': + a = FSArray(window.height, window.width) + else: + s = repr(c).decode() + row = random.choice(range(window.height)) + column = random.choice(range(window.width-len(s))) + color = random.choice([red, green, on_blue, yellow]) + a[row, column:column+len(s)] = [color(s)] + window.render_to_terminal(a) + + Paste it in a ``something.py`` file and try it out! + + Installation: ``pip install curtsies`` + + `Documentation http://curtsies.readthedocs.org/en/latest/`__ + + Primer + ------ + + `FmtStr http://curtsies.readthedocs.org/en/latest/FmtStr.html`__ + objects are strings formatted with colors and styles displayable in a + terminal with `ANSI escape + sequences http://en.wikipedia.org/wiki/ANSI_escape_code%3E%60_`__. + + (the import statement shown below is outdated) + + .. figure:: http://i.imgur.com/7lFaxsz.png + :alt: + + `FSArray http://curtsies.readthedocs.org/en/latest/FSArray.html`__ + objects contain multiple such strings with each formatted string on its + own row, and FSArray objects can be superimposed on each other to build + complex grids of colored and styled characters through composition. + + (the import statement shown below is outdated) + + .. figure:: http://i.imgur.com/rvTRPv1.png + :alt: + + Such grids of characters can be rendered to the terminal in alternate + screen mode (no history, like ``Vim``, ``top`` etc.) by + `FullscreenWindow http://curtsies.readthedocs.org/en/latest/window.html#curtsies.window.Fullsc...`__ + objects or normal history-preserving screen by + `CursorAwareWindow http://curtsies.readthedocs.org/en/latest/window.html#curtsies.window.Cursor...`__ + objects. User keyboard input events like pressing the up arrow key are + detected by an + `Input http://curtsies.readthedocs.org/en/latest/input.html`__ object. + + Examples + -------- + + - `Tic-Tac-Toe `__ + + .. figure:: http://i.imgur.com/AucB55B.png + :alt: + + - `Avoid the X's game `__ + + .. figure:: http://i.imgur.com/nv1RQd3.png + :alt: + + - `Bpython-curtsies uses + curtsies http://ballingt.com/2013/12/21/bpython-curtsies.html`__ + + |image3| + + - `More examples </examples>`__ + + About + ----- + + - `Curtsies + Documentation http://curtsies.readthedocs.org/en/latest/`__ + - Curtsies was written to for + `bpython-curtsies http://ballingt.com/2013/12/21/bpython-curtsies.html`__ + - ``#bpython`` on irc is a good place to talk about Curtsies, but feel + free to open an issue if you're having a problem! + - Thanks to the many contributors! + - If all you need are colored strings, consider one of these `other + libraries http://curtsies.readthedocs.io/en/latest/FmtStr.html#fmtstr-rationale`__! + + .. |Build Status| image:: https://travis-ci.org/thomasballinger/curtsies.svg?branch=master + :target: https://travis-ci.org/thomasballinger/curtsies + .. |Documentation Status| image:: https://readthedocs.org/projects/curtsies/badge/?version=latest + :target: https://readthedocs.org/projects/curtsies/?badge=latest + .. |Curtsies Logo| image:: http://ballingt.com/assets/curtsiestitle.png + .. |image3| image:: http://i.imgur.com/r7rZiBS.png + :target: http://www.youtube.com/watch?v=lwbpC4IJlyA + Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Environment :: Console diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/readme.md new/curtsies-0.2.11/readme.md --- old/curtsies-0.2.6/readme.md 2016-01-11 23:36:53.000000000 +0100 +++ new/curtsies-0.2.11/readme.md 2016-10-20 22:18:49.000000000 +0200 @@ -45,7 +45,8 @@ colors and styles displayable in a terminal with [ANSI escape sequences](http://en.wikipedia.org/wiki/ANSI_escape_code>`_). (the import statement shown below is outdated) -![fmtstr example screenshot](http://i.imgur.com/7lFaxsz.png) + +![](http://i.imgur.com/7lFaxsz.png) [FSArray](http://curtsies.readthedocs.org/en/latest/FSArray.html) objects contain multiple such strings with each formatted string on its own row, and FSArray @@ -53,7 +54,8 @@ to build complex grids of colored and styled characters through composition. (the import statement shown below is outdated) -![fsarray example screenshot](http://i.imgur.com/rvTRPv1.png) + +![](http://i.imgur.com/rvTRPv1.png) Such grids of characters can be rendered to the terminal in alternate screen mode (no history, like `Vim`, `top` etc.) by [FullscreenWindow](http://curtsies.readthedocs.org/en/latest/window.html#curtsies.window.Fullsc...) objects @@ -66,15 +68,15 @@ * [Tic-Tac-Toe](/examples/tictactoeexample.py) -![screenshot](http://i.imgur.com/AucB55B.png) +![](http://i.imgur.com/AucB55B.png) * [Avoid the X's game](/examples/gameexample.py) -![screenshot](http://i.imgur.com/nv1RQd3.png) +![](http://i.imgur.com/nv1RQd3.png) * [Bpython-curtsies uses curtsies](http://ballingt.com/2013/12/21/bpython-curtsies.html) -[![ScreenShot](http://i.imgur.com/r7rZiBS.png)](http://www.youtube.com/watch?v=lwbpC4IJlyA) +[![](http://i.imgur.com/r7rZiBS.png)](http://www.youtube.com/watch?v=lwbpC4IJlyA) * [More examples](/examples) @@ -86,4 +88,5 @@ * `#bpython` on irc is a good place to talk about Curtsies, but feel free to open an issue if you're having a problem! * Thanks to the many contributors! -* If all you need are colored strings, consider one of these [other libraries](http://curtsies.readthedocs.org/en/latest/FmtStr.html#rationale)! +* If all you need are colored strings, consider one of these [other + libraries](http://curtsies.readthedocs.io/en/latest/FmtStr.html#fmtstr-rationale)! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/setup.py new/curtsies-0.2.11/setup.py --- old/curtsies-0.2.6/setup.py 2016-01-11 23:36:53.000000000 +0100 +++ new/curtsies-0.2.11/setup.py 2016-10-20 22:18:49.000000000 +0200 @@ -1,6 +1,7 @@ from setuptools import setup import ast import os +import io def version(): """Return version string.""" @@ -9,9 +10,29 @@ if line.startswith('__version__'): return ast.parse(line).body[0].value.s +def get_long_description(): + with io.open('readme.md', encoding="utf-8") as f: + long_description = f.read() + + try: + import pypandoc + except ImportError: + print('pypandoc not installed, using file contents.') + return long_description + + try: + long_description = pypandoc.convert('readme.md', 'rst') + except OSError: + print("Pandoc not found. Long_description conversion failure.") + return long_description + else: + long_description = long_description.replace("\r", "") + return long_description + setup(name='curtsies', version=version(), description='Curses-like terminal wrapper, with colored strings!', + long_description=get_long_description(), url='https://github.com/thomasballinger/curtsies', author='Thomas Ballinger', author_email='thomasballinger@gmail.com', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/tests/test_events.py new/curtsies-0.2.11/tests/test_events.py --- old/curtsies-0.2.6/tests/test_events.py 2015-12-29 19:28:10.000000000 +0100 +++ new/curtsies-0.2.11/tests/test_events.py 2016-10-20 22:18:49.000000000 +0200 @@ -65,6 +65,7 @@ self.assertEqual(get_utf([b'\xc3'], full=True, keynames='curses'), 'xC3') def test_key_names(self): + "Every key sequence with a Curses name should have a Curtsies name too." self.assertTrue(set(events.CURTSIES_NAMES).issuperset(set(events.CURSES_NAMES)), set(events.CURSES_NAMES) - set(events.CURTSIES_NAMES)) class TestGetKeyAscii(unittest.TestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/tests/test_fmtstr.py new/curtsies-0.2.11/tests/test_fmtstr.py --- old/curtsies-0.2.6/tests/test_fmtstr.py 2016-01-11 23:36:53.000000000 +0100 +++ new/curtsies-0.2.11/tests/test_fmtstr.py 2016-10-20 22:18:49.000000000 +0200 @@ -47,6 +47,31 @@ FmtStr() +class TestFmtStrParsing(unittest.TestCase): + def test_no_escapes(self): + self.assertEqual(str(fmtstr('abc')), 'abc') + + def test_simple_escapes(self): + self.assertEqual(str(fmtstr('\x1b[33mhello\x1b[0m')), '\x1b[33mhello\x1b[39m') + self.assertEqual(str(fmtstr('\x1b[33mhello\x1b[39m')), '\x1b[33mhello\x1b[39m') + self.assertEqual(str(fmtstr('\x1b[33mhello')), '\x1b[33mhello\x1b[39m') + self.assertEqual(str(fmtstr('\x1b[43mhello\x1b[49m')), '\x1b[43mhello\x1b[49m') + self.assertEqual(str(fmtstr('\x1b[43mhello\x1b[0m')), '\x1b[43mhello\x1b[49m') + self.assertEqual(str(fmtstr('\x1b[43mhello')), '\x1b[43mhello\x1b[49m') + self.assertEqual(str(fmtstr('\x1b[33m\x1b[43mhello\x1b[0m')), + '\x1b[33m\x1b[43mhello\x1b[49m\x1b[39m') + + def test_out_of_order(self): + self.assertEqual(str(fmtstr('\x1b[33m\x1b[43mhello\x1b[39m\x1b[49m')), + '\x1b[33m\x1b[43mhello\x1b[49m\x1b[39m') + + def test_noncurtsies_output(self): + fmtstr('\x1b[35mx\x1b[m') + self.assertEqual(fmtstr('\x1b[Ahello'), 'hello') + self.assertEqual(fmtstr('\x1b[20Ahello'), 'hello') + self.assertEqual(fmtstr('\x1b[20mhello'), 'hello') + + class TestImmutability(unittest.TestCase): def test_fmt_strings_remain_unchanged_when_used_to_construct_other_ones(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/curtsies-0.2.6/tests/test_terminal.py new/curtsies-0.2.11/tests/test_terminal.py --- old/curtsies-0.2.6/tests/test_terminal.py 2016-01-11 23:36:53.000000000 +0100 +++ new/curtsies-0.2.11/tests/test_terminal.py 2016-10-20 22:18:49.000000000 +0200 @@ -17,11 +17,21 @@ from curtsies.window import BaseWindow, FullscreenWindow, CursorAwareWindow +# a few tests fail on TravisCI that have something to do with +# stdin not being able to be set to nonblocking +# (and still reporting isatty as True) +IS_TRAVIS = bool(os.environ.get("TRAVIS")) + try: - from unittest import skipUnless + from unittest import skipUnless, skipIf except ImportError: def skipUnless(condition, reason): if condition: + return lambda x: x + else: + return lambda x: None + def skipIf(condition, reason): + if condition: return lambda x: None else: return lambda x: x @@ -121,6 +131,7 @@ def __exit__(*args): pass +@skipIf(IS_TRAVIS, 'Travis stdin behaves strangely, see issue 89') @skipUnless(sys.stdin.isatty(), 'blessings Terminal needs streams open') class TestCursorAwareWindow(unittest.TestCase): def setUp(self): @@ -155,6 +166,7 @@ self.assertEqual(self.screen.display, [u' ', u'hi ', u'there ']) +@skipIf(IS_TRAVIS, 'Travis stdin behaves strangely, see issue 89') @skipUnless(sys.stdin.isatty(), 'blessings Terminal needs streams open') class TestCursorAwareWindowWithExtraInput(unittest.TestCase): def setUp(self):