Fix redraw of overlapping widgets inside AnchorLayout.
--- a/tuikit/container.py Sun Feb 03 16:38:41 2013 +0100
+++ b/tuikit/container.py Mon Feb 04 20:12:09 2013 +0100
@@ -123,6 +123,10 @@
for child in self.children:
child.redraw()
+ def child_need_draw(self):
+ """Called from child's redraw. Allows parent to react."""
+ pass
+
def draw(self, driver, x, y):
"""Draw the container and its children.
--- a/tuikit/layout.py Sun Feb 03 16:38:41 2013 +0100
+++ b/tuikit/layout.py Mon Feb 04 20:12:09 2013 +0100
@@ -53,6 +53,10 @@
'margin', Borders,
)
+ def child_need_draw(self):
+ """Called from child's redraw. Allows parent to react."""
+ self.redraw()
+
def on_resize(self, ev):
for child in self._get_children():
reqw = max(child.sizereq.w, child.sizemin.w)
--- a/tuikit/tableview.py Sun Feb 03 16:38:41 2013 +0100
+++ b/tuikit/tableview.py Mon Feb 04 20:12:09 2013 +0100
@@ -13,11 +13,11 @@
self.add_events('change', Event)
self.data = list_of_lists
- def getcount(self):
+ def rowcount(self):
'''Get number of rows.'''
return len(self.data)
- def getrows(self, begin, end):
+ def get_rows(self, begin, end):
'''Get rows from begin to end, including begin, excluding end.'''
return self.data[begin:end]
@@ -162,9 +162,9 @@
def on_draw(self, ev):
ev.driver.pushcolor('normal')
ev.driver.fill_clip()
- self.rowcount = self.model.getcount()
+ self.rowcount = self.model.rowcount()
numrows = min(self.rowcount - self.offset.y, self.height - self.headsize)
- rows = self.model.getrows(self.offset.y, self.offset.y + numrows)
+ rows = self.model.get_rows(self.offset.y, self.offset.y + numrows)
self.compute_column_sizes()
self.draw_head(ev.driver, ev.x, ev.y)
y = ev.y + self.headsize
--- a/tuikit/widget.py Sun Feb 03 16:38:41 2013 +0100
+++ b/tuikit/widget.py Mon Feb 04 20:12:09 2013 +0100
@@ -218,7 +218,10 @@
### events
def redraw(self):
- self._need_draw = True
+ if not self._need_draw:
+ self._need_draw = True
+ if self.parent:
+ self.parent.child_need_draw()
def draw(self, driver, x, y):
"""Draw the widget.
--- a/tuikit/window.py Sun Feb 03 16:38:41 2013 +0100
+++ b/tuikit/window.py Mon Feb 04 20:12:09 2013 +0100
@@ -97,17 +97,17 @@
self._resizing = True
elif self.movable:
self._moving = True
- self.parent.redraw()
+ self.redraw()
def after_mouseup(self, ev):
self._resize_or_move(ev)
self._resizing = False
self._moving = False
- self.parent.redraw()
+ self.redraw()
def after_mousemove(self, ev):
self._resize_or_move(ev)
- self.parent.redraw()
+ self.redraw()
def _resize_or_move(self, ev):
if self._resizing: