summaryrefslogtreecommitdiff
path: root/docs/tutorial
diff options
context:
space:
mode:
authorIan Ward <ian@excess.org>2012-07-18 14:07:28 -0400
committerIan Ward <ian@excess.org>2012-07-18 14:07:28 -0400
commit527ddf8d0f820d79e741271b86cf3c5c95a4fb2e (patch)
treea3430106496889ff7b081d422d2f13fc636e16d3 /docs/tutorial
parent379c57a29fcff12ca77762400d1348a05a3ec65c (diff)
downloadurwid-527ddf8d0f820d79e741271b86cf3c5c95a4fb2e.tar.gz
tutorial: update examples, fix SelectablePudding, CursorPudding missing _invalidate calls
--HG-- branch : feature-sphinx
Diffstat (limited to 'docs/tutorial')
-rw-r--r--docs/tutorial/wanat.py13
-rw-r--r--docs/tutorial/wanat_multi.py5
-rw-r--r--docs/tutorial/wanat_new.py7
-rw-r--r--docs/tutorial/wcur1.py9
-rw-r--r--docs/tutorial/wmod.py2
-rw-r--r--docs/tutorial/wsel.py9
6 files changed, 15 insertions, 30 deletions
diff --git a/docs/tutorial/wanat.py b/docs/tutorial/wanat.py
index 30f4718..1a67080 100644
--- a/docs/tutorial/wanat.py
+++ b/docs/tutorial/wanat.py
@@ -1,10 +1,7 @@
import urwid
-
-class Pudding(urwid.FlowWidget):
-
- def selectable(self):
- return False
+class Pudding(urwid.Widget):
+ _sizing = frozenset(['flow'])
def rows(self, size, focus=False):
return 1
@@ -15,10 +12,8 @@ class Pudding(urwid.FlowWidget):
return urwid.TextCanvas(["Pudding"*num_pudding], maxcol=maxcol)
-class BoxPudding(urwid.BoxWidget):
-
- def selectable(self):
- return False
+class BoxPudding(urwid.Widget):
+ _sizing = frozenset(['box'])
def render(self, size, focus=False):
(maxcol, maxrow) = size
diff --git a/docs/tutorial/wanat_multi.py b/docs/tutorial/wanat_multi.py
index ec092d3..b6d6943 100644
--- a/docs/tutorial/wanat_multi.py
+++ b/docs/tutorial/wanat_multi.py
@@ -1,10 +1,7 @@
import urwid
-
class MultiPudding(urwid.Widget):
-
- def selectable(self):
- return False
+ _sizing = frozenset(['flow', 'box'])
def rows(self, size, focus=False):
return 1
diff --git a/docs/tutorial/wanat_new.py b/docs/tutorial/wanat_new.py
index 9b1b069..5a597b9 100644
--- a/docs/tutorial/wanat_new.py
+++ b/docs/tutorial/wanat_new.py
@@ -1,10 +1,7 @@
import urwid
-
-class NewPudding(urwid.FlowWidget):
-
- def selectable(self):
- return False
+class NewPudding(urwid.Widget):
+ _sizing = frozenset(['flow'])
def rows(self, size, focus=False):
w = self.display_widget(size, focus)
diff --git a/docs/tutorial/wcur1.py b/docs/tutorial/wcur1.py
index c22b0c5..6bf97f7 100644
--- a/docs/tutorial/wcur1.py
+++ b/docs/tutorial/wcur1.py
@@ -1,14 +1,12 @@
import urwid
-
-class CursorPudding(urwid.FlowWidget):
+class CursorPudding(urwid.Widget):
+ _sizing = frozenset(['flow'])
+ _selectable = True
def __init__(self):
self.cursor_col = 0
- def selectable(self):
- return True
-
def rows(self, size, focus=False):
return 1
@@ -34,3 +32,4 @@ class CursorPudding(urwid.FlowWidget):
else:
return key
self.cursor_x = max(0, min(maxcol - 1, col))
+ self._invalidate()
diff --git a/docs/tutorial/wmod.py b/docs/tutorial/wmod.py
index ba7d574..a066a49 100644
--- a/docs/tutorial/wmod.py
+++ b/docs/tutorial/wmod.py
@@ -1,8 +1,6 @@
import urwid
-
class QuestionnaireItem(urwid.WidgetWrap):
-
def __init__(self):
self.options = []
unsure = urwid.RadioButton(self.options, u"Unsure")
diff --git a/docs/tutorial/wsel.py b/docs/tutorial/wsel.py
index c8c80fb..15683d8 100644
--- a/docs/tutorial/wsel.py
+++ b/docs/tutorial/wsel.py
@@ -1,14 +1,12 @@
import urwid
-
-class SelectablePudding(urwid.FlowWidget):
+class SelectablePudding(urwid.Widget):
+ _sizing = frozenset(['flow'])
+ _selectable = True
def __init__(self):
self.pudding = "pudding"
- def selectable(self):
- return True
-
def rows(self, size, focus=False):
return 1
@@ -31,5 +29,6 @@ class SelectablePudding(urwid.FlowWidget):
self.pudding = self.pudding[:n] + self.pudding[n+1:]
if not self.pudding:
self.pudding = "pudding"
+ self._invalidate()
else:
return key