[Python-modules-commits] [urwid] 01/04: Imported Upstream version 1.3.1
Gianfranco Costamagna
locutusofborg at moszumanska.debian.org
Tue Nov 3 09:05:05 UTC 2015
This is an automated email from the git hooks/post-receive script.
locutusofborg pushed a commit to branch master
in repository urwid.
commit 48c1126b815dfea6bbc5057cea98e167a6acfd77
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date: Tue Nov 3 10:02:38 2015 +0100
Imported Upstream version 1.3.1
---
PKG-INFO | 4 +-
README.rst | 2 +-
docs/changelog.rst | 20 ++++++++
docs/tools/templates/indexcontent.html | 1 +
docs/tutorial/new/adventure.py | 83 +++++++++++++++++++++++++++++++++
docs/tutorial/new/adventure.py.xdotool | 4 ++
docs/tutorial/new/adventure1.png | Bin 0 -> 818 bytes
docs/tutorial/new/adventure2.png | Bin 0 -> 1218 bytes
docs/tutorial/new/adventure3.png | Bin 0 -> 1435 bytes
docs/tutorial/new/adventure4.png | Bin 0 -> 1321 bytes
docs/tutorial/new/lbscr1.png | Bin 0 -> 747 bytes
docs/tutorial/new/minimal1.png | Bin 0 -> 309 bytes
source/str_util.c | 8 ++--
urwid.egg-info/PKG-INFO | 4 +-
urwid.egg-info/SOURCES.txt | 8 ++++
urwid/display_common.py | 9 +++-
urwid/escape.py | 2 +
urwid/graphics.py | 1 +
urwid/main_loop.py | 6 ++-
urwid/monitored_list.py | 9 ++++
urwid/raw_display.py | 5 +-
urwid/version.py | 2 +-
22 files changed, 154 insertions(+), 14 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 747287e..01183c4 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: urwid
-Version: 1.3.0
+Version: 1.3.1
Summary: A full-featured console (xterm et al.) user interface library
Home-page: http://urwid.org/
Author: Ian Ward
@@ -10,7 +10,7 @@ Description:
Urwid is a console user interface library for Python.
It includes many features useful for text console application developers including:
- - Applcations resize quickly and smoothly
+ - Applications resize quickly and smoothly
- Automatic, programmable text alignment and wrapping
- Simple markup for setting text attributes within blocks of text
- Powerful list box with programmable content for scrolling all widget types
diff --git a/README.rst b/README.rst
index cfc4af8..e0d063e 100644
--- a/README.rst
+++ b/README.rst
@@ -9,7 +9,7 @@
Urwid is a console user interface library for Python.
It includes many features useful for text console application developers including:
-- Applcations resize quickly and smoothly
+- Applications resize quickly and smoothly
- Automatic, programmable text alignment and wrapping
- Simple markup for setting text attributes within blocks of text
- Powerful list box with programmable content for scrolling all widget types
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 6450af7..676a5d3 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -2,6 +2,26 @@
Changelog
---------
+Urwid 1.3.1
+===========
+
+2015-11-01
+
+ * Fix for screen not getting reset on exception regression
+ (by Rian Hunter)
+
+ * AttrSpec objects are now comparable (by Random User)
+
+ * MonitoredList now has a clear method if list has a clear method
+ (by neumond)
+
+ * Fix for BarGraph hlines sort order (by Heiko Noordhof)
+
+ * Fix for final output not appearing on exit with some terminals
+ now that extra newline was removed (by Jared Winborne)
+
+ * Fix for a resizing bug in raw_display (by Esteban null)
+
Urwid 1.3.0
===========
diff --git a/docs/tools/templates/indexcontent.html b/docs/tools/templates/indexcontent.html
index ad44940..851e7d1 100644
--- a/docs/tools/templates/indexcontent.html
+++ b/docs/tools/templates/indexcontent.html
@@ -53,6 +53,7 @@
<ul>
<li><a href="http://www.npcole.com/npyscreen/">npyscreen</a></li>
<li><a href="https://github.com/thomasballinger/curtsies">curtsies</a></li>
+<li><a href="https://github.com/jonathanslenders/python-prompt-toolkit">Python Prompt Toolkit</a></li>
</ul>
</div>
</div>
diff --git a/docs/tutorial/new/adventure.py b/docs/tutorial/new/adventure.py
new file mode 100644
index 0000000..129ff50
--- /dev/null
+++ b/docs/tutorial/new/adventure.py
@@ -0,0 +1,83 @@
+import urwid
+
+class ActionButton(urwid.Button):
+ def __init__(self, caption, callback):
+ super(ActionButton, self).__init__("")
+ urwid.connect_signal(self, 'click', callback)
+ self._w = urwid.AttrMap(urwid.SelectableIcon(caption, 1),
+ None, focus_map='reversed')
+
+class Place(urwid.WidgetWrap):
+ def __init__(self, name, choices):
+ super(Place, self).__init__(
+ ActionButton([u" > go to ", name], self.enter_place))
+ self.heading = urwid.Text([u"\nLocation: ", name, "\n"])
+ self.choices = choices
+ # create links back to ourself
+ for child in choices:
+ getattr(child, 'choices', []).insert(0, self)
+
+ def enter_place(self, button):
+ game.update_place(self)
+
+class Thing(urwid.WidgetWrap):
+ def __init__(self, name):
+ super(Thing, self).__init__(
+ ActionButton([u" * take ", name], self.take_thing))
+ self.name = name
+
+ def take_thing(self, button):
+ self._w = urwid.Text(u" - %s (taken)" % self.name)
+ game.take_thing(self)
+
+def exit_program(button):
+ raise urwid.ExitMainLoop()
+
+map_top = Place(u'porch', [
+ Place(u'kitchen', [
+ Place(u'refrigerator', []),
+ Place(u'cupboard', [
+ Thing(u'jug'),
+ ]),
+ ]),
+ Place(u'garden', [
+ Place(u'tree', [
+ Thing(u'lemon'),
+ Thing(u'bird'),
+ ]),
+ ]),
+ Place(u'street', [
+ Place(u'store', [
+ Thing(u'sugar'),
+ ]),
+ Place(u'lake', [
+ Place(u'beach', []),
+ ]),
+ ]),
+])
+
+class AdventureGame(object):
+ def __init__(self):
+ self.log = urwid.SimpleFocusListWalker([])
+ self.top = urwid.ListBox(self.log)
+ self.inventory = set()
+ self.update_place(map_top)
+
+ def update_place(self, place):
+ if self.log: # disable interaction with previous place
+ self.log[-1] = urwid.WidgetDisable(self.log[-1])
+ self.log.append(urwid.Pile([place.heading] + place.choices))
+ self.top.focus_position = len(self.log) - 1
+ self.place = place
+
+ def take_thing(self, thing):
+ self.inventory.add(thing.name)
+ if self.inventory >= set([u'sugar', u'lemon', u'jug']):
+ response = urwid.Text(u'You can make lemonade!\n')
+ done = ActionButton(u' - Joy', exit_program)
+ self.log[:] = [response, done]
+ else:
+ self.update_place(self.place)
+
+game = AdventureGame()
+urwid.MainLoop(game.top, palette=[('reversed', 'standout', '')]).run()
diff --git a/docs/tutorial/new/adventure.py.xdotool b/docs/tutorial/new/adventure.py.xdotool
new file mode 100644
index 0000000..a09d0fd
--- /dev/null
+++ b/docs/tutorial/new/adventure.py.xdotool
@@ -0,0 +1,4 @@
+windowsize --usehints $RXVTWINDOWID 23 16
+key --window $RXVTWINDOWID Return Down Down
+key --window $RXVTWINDOWID Return Down
+key --window $RXVTWINDOWID Return
diff --git a/docs/tutorial/new/adventure1.png b/docs/tutorial/new/adventure1.png
new file mode 100644
index 0000000..5714ed2
Binary files /dev/null and b/docs/tutorial/new/adventure1.png differ
diff --git a/docs/tutorial/new/adventure2.png b/docs/tutorial/new/adventure2.png
new file mode 100644
index 0000000..ad3b819
Binary files /dev/null and b/docs/tutorial/new/adventure2.png differ
diff --git a/docs/tutorial/new/adventure3.png b/docs/tutorial/new/adventure3.png
new file mode 100644
index 0000000..b8042b9
Binary files /dev/null and b/docs/tutorial/new/adventure3.png differ
diff --git a/docs/tutorial/new/adventure4.png b/docs/tutorial/new/adventure4.png
new file mode 100644
index 0000000..d3023f4
Binary files /dev/null and b/docs/tutorial/new/adventure4.png differ
diff --git a/docs/tutorial/new/lbscr1.png b/docs/tutorial/new/lbscr1.png
new file mode 100644
index 0000000..79db363
Binary files /dev/null and b/docs/tutorial/new/lbscr1.png differ
diff --git a/docs/tutorial/new/minimal1.png b/docs/tutorial/new/minimal1.png
new file mode 100644
index 0000000..4fb2188
Binary files /dev/null and b/docs/tutorial/new/minimal1.png differ
diff --git a/source/str_util.c b/source/str_util.c
index 5a9fce9..425a74a 100644
--- a/source/str_util.c
+++ b/source/str_util.c
@@ -40,7 +40,7 @@
#endif
static int widths_len = 2*38;
-static const long int widths[] = {
+static const int widths[] = {
126, 1,
159, 0,
687, 1,
@@ -709,7 +709,7 @@ static PyObject * calc_width(PyObject *self, PyObject *args)
{
PyObject *text;
int start_offs, end_offs;
- int ret;
+ long ret;
if (!PyArg_ParseTuple(args, "Oii", &text, &start_offs, &end_offs))
return NULL;
@@ -717,8 +717,8 @@ static PyObject * calc_width(PyObject *self, PyObject *args)
ret = Py_CalcWidth(text, start_offs, end_offs);
if (ret==-1) //an error occured
return NULL;
-
- return Py_BuildValue("i", ret);
+
+ return Py_BuildValue("l", ret);
}
diff --git a/urwid.egg-info/PKG-INFO b/urwid.egg-info/PKG-INFO
index 747287e..01183c4 100644
--- a/urwid.egg-info/PKG-INFO
+++ b/urwid.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: urwid
-Version: 1.3.0
+Version: 1.3.1
Summary: A full-featured console (xterm et al.) user interface library
Home-page: http://urwid.org/
Author: Ian Ward
@@ -10,7 +10,7 @@ Description:
Urwid is a console user interface library for Python.
It includes many features useful for text console application developers including:
- - Applcations resize quickly and smoothly
+ - Applications resize quickly and smoothly
- Automatic, programmable text alignment and wrapping
- Simple markup for setting text attributes within blocks of text
- Powerful list box with programmable content for scrolling all widget types
diff --git a/urwid.egg-info/SOURCES.txt b/urwid.egg-info/SOURCES.txt
index fd72eeb..eaa899c 100644
--- a/urwid.egg-info/SOURCES.txt
+++ b/urwid.egg-info/SOURCES.txt
@@ -152,6 +152,14 @@ docs/tutorial/smenu.py.xdotool
docs/tutorial/smenu1.png
docs/tutorial/smenu2.png
docs/tutorial/smenu3.png
+docs/tutorial/new/adventure.py
+docs/tutorial/new/adventure.py.xdotool
+docs/tutorial/new/adventure1.png
+docs/tutorial/new/adventure2.png
+docs/tutorial/new/adventure3.png
+docs/tutorial/new/adventure4.png
+docs/tutorial/new/lbscr1.png
+docs/tutorial/new/minimal1.png
examples/asyncio_socket_server.py
examples/bigtext.py
examples/browse.py
diff --git a/urwid/display_common.py b/urwid/display_common.py
index c3b9c5d..7ff4eef 100755
--- a/urwid/display_common.py
+++ b/urwid/display_common.py
@@ -574,7 +574,7 @@ class AttrSpec(object):
flags |= _FG_HIGH_COLOR
# _parse_color_*() return None for unrecognised colors
if scolor is None:
- raise AttrSpecError(("Unrecognised color specification %s" +
+ raise AttrSpecError(("Unrecognised color specification %s " +
"in foreground (%s)") % (repr(part), repr(foreground)))
if color is not None:
raise AttrSpecError(("More than one color given for " +
@@ -646,6 +646,13 @@ class AttrSpec(object):
else:
return vals + _COLOR_VALUES_256[self.background_number]
+ def __eq__(self, other):
+ return isinstance(other, AttrSpec) and self._value == other._value
+
+ def __ne__(self, other):
+ return not self == other
+
+ __hash__ = object.__hash__
class RealTerminal(object):
diff --git a/urwid/escape.py b/urwid/escape.py
index 12501b8..683466c 100644
--- a/urwid/escape.py
+++ b/urwid/escape.py
@@ -88,6 +88,8 @@ input_sequences = [
('[Z','shift tab'),
('On', '.'),
+
+ ('[200~', 'begin paste'), ('[201~', 'end paste'),
] + [
(prefix + letter, modifier + key)
for prefix, modifier in zip('O[', ('meta ', 'shift '))
diff --git a/urwid/graphics.py b/urwid/graphics.py
index d3dd277..cd03d33 100755
--- a/urwid/graphics.py
+++ b/urwid/graphics.py
@@ -304,6 +304,7 @@ class BarGraph(Widget):
if hlines is not None:
hlines = hlines[:] # shallow copy
hlines.sort()
+ hlines.reverse()
self.data = bardata, top, hlines
self._invalidate()
diff --git a/urwid/main_loop.py b/urwid/main_loop.py
index 77022bf..28577b2 100755
--- a/urwid/main_loop.py
+++ b/urwid/main_loop.py
@@ -372,7 +372,11 @@ class MainLoop(object):
finally:
self.screen.stop()
- self.event_loop.run()
+ try:
+ self.event_loop.run()
+ except:
+ self.screen.stop() # clean up screen control
+ raise
self.stop()
def _update(self, keys, raw):
diff --git a/urwid/monitored_list.py b/urwid/monitored_list.py
index f9170ca..dc67c84 100755
--- a/urwid/monitored_list.py
+++ b/urwid/monitored_list.py
@@ -80,6 +80,8 @@ class MonitoredList(list):
remove = _call_modified(list.remove)
reverse = _call_modified(list.reverse)
sort = _call_modified(list.sort)
+ if hasattr(list, 'clear'):
+ clear = _call_modified(list.clear)
class MonitoredFocusList(MonitoredList):
@@ -474,6 +476,13 @@ class MonitoredFocusList(MonitoredList):
self._set_focus(self.index(value))
return rval
+ if hasattr(list, 'clear'):
+ def clear(self):
+ focus = self._adjust_focus_on_contents_modified(slice(0, 0))
+ rval = super(MonitoredFocusList, self).clear()
+ self._set_focus(focus)
+ return rval
+
diff --git a/urwid/raw_display.py b/urwid/raw_display.py
index 86ac654..b304709 100644
--- a/urwid/raw_display.py
+++ b/urwid/raw_display.py
@@ -251,6 +251,7 @@ class Screen(BaseScreen, RealTerminal):
+ escape.SI
+ move_cursor
+ escape.SHOW_CURSOR)
+ self.flush()
if self._old_signal_keys:
self.tty_signal_keys(*(self._old_signal_keys + (fd,)))
@@ -746,7 +747,7 @@ class Screen(BaseScreen, RealTerminal):
cy = 0
for row in r.content():
y += 1
- if osb and osb[y] == row:
+ if osb and y < len(osb) and osb[y] == row:
# this row of the screen buffer matches what is
# currently displayed, so we can skip this line
sb.append( osb[y] )
@@ -935,7 +936,7 @@ class Screen(BaseScreen, RealTerminal):
bg = "5;%d" % (a.background_number - 8 + 40)
else:
# this doesn't work on most terminals
- bg = "%d" % (a.background_number + 100)
+ bg = "%d" % (a.background_number - 8 + 100)
else:
bg = "%d" % (a.background_number + 40)
else:
diff --git a/urwid/version.py b/urwid/version.py
index 09f16aa..e34283f 100644
--- a/urwid/version.py
+++ b/urwid/version.py
@@ -1,5 +1,5 @@
-VERSION = (1, 3, 0)
+VERSION = (1, 3, 1)
__version__ = ''.join(['-.'[type(x) == int]+str(x) for x in VERSION])[1:]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/urwid.git
More information about the Python-modules-commits
mailing list