diff options
| author | Andrew Dunai <andunai@gmail.com> | 2018-01-04 13:56:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-04 13:56:40 +0200 |
| commit | cf0307c500e1d575fec5fc5a37e4ff4e69972b92 (patch) | |
| tree | cbc82f80d72cb15589f50c77847dc4c0ddabd072 /urwid/text_layout.py | |
| parent | 2496a176c00eab88492f1566f2a89c58be4e15d9 (diff) | |
| download | urwid-cf0307c500e1d575fec5fc5a37e4ff4e69972b92.tar.gz | |
Python dual support (#266)
* WIP
* Metaclasses
* String literal fixes
* Remove 2to3 and make tests compatible with both Python 2 & 3
* Removed debug code.
* Added tests for ProgressBar
* Fixed examples.
* future division & font literals fix
* Cleaner fonts initialization.
Diffstat (limited to 'urwid/text_layout.py')
| -rw-r--r-- | urwid/text_layout.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/urwid/text_layout.py b/urwid/text_layout.py index f09372b..d8663b6 100644 --- a/urwid/text_layout.py +++ b/urwid/text_layout.py @@ -19,9 +19,11 @@ # # Urwid web site: http://excess.org/urwid/ +from __future__ import division, print_function + from urwid.util import calc_width, calc_text_pos, calc_trim_text, is_wide_char, \ move_prev_char, move_next_char -from urwid.compat import bytes, PYTHON3, B +from urwid.compat import bytes, PYTHON3, B, xrange class TextLayout: def supports_align_mode(self, align): @@ -456,8 +458,8 @@ def calc_pos( text, layout, pref_col, row ): if pos is not None: return pos - rows_above = range(row-1,-1,-1) - rows_below = range(row+1,len(layout)) + rows_above = list(xrange(row-1,-1,-1)) + rows_below = list(xrange(row+1,len(layout))) while rows_above and rows_below: if rows_above: r = rows_above.pop(0) |
