summaryrefslogtreecommitdiff
path: root/urwid/curses_display.py
diff options
context:
space:
mode:
Diffstat (limited to 'urwid/curses_display.py')
-rwxr-xr-xurwid/curses_display.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/urwid/curses_display.py b/urwid/curses_display.py
index 441042e..0aaa2f1 100755
--- a/urwid/curses_display.py
+++ b/urwid/curses_display.py
@@ -19,6 +19,8 @@
#
# Urwid web site: http://excess.org/urwid/
+from __future__ import division, print_function
+
"""
Curses-based UI implementation
"""
@@ -30,7 +32,7 @@ from urwid import escape
from urwid.display_common import BaseScreen, RealTerminal, AttrSpec, \
UNPRINTABLE_TRANS_TABLE
-from urwid.compat import bytes, PYTHON3
+from urwid.compat import bytes, PYTHON3, text_type, xrange
KEY_RESIZE = 410 # curses.KEY_RESIZE (sometimes not defined)
KEY_MOUSE = 409 # curses.KEY_MOUSE
@@ -481,10 +483,12 @@ class Screen(BaseScreen, RealTerminal):
self.s.attrset(attr)
- def draw_screen(self, (cols, rows), r ):
+ def draw_screen(self, size, r ):
"""Paint screen with rendered canvas."""
assert self._started
+ cols, rows = size
+
assert r.rows() == rows, "canvas size and passed size don't match"
y = -1
@@ -558,7 +562,7 @@ class Screen(BaseScreen, RealTerminal):
class _test:
def __init__(self):
self.ui = Screen()
- self.l = _curses_colours.keys()
+ self.l = list(_curses_colours.keys())
self.l.sort()
for c in self.l:
self.ui.register_palette( [
@@ -602,7 +606,7 @@ class _test:
t = ""
a = []
for k in keys:
- if type(k) == unicode: k = k.encode("utf-8")
+ if type(k) == text_type: k = k.encode("utf-8")
t += "'"+k + "' "
a += [(None,1), ('yellow on dark blue',len(k)),
(None,2)]