--- a/tuikit/scrollbar.py Fri Dec 14 10:32:43 2012 +0100
+++ b/tuikit/scrollbar.py Sun Dec 16 20:49:54 2012 +0100
@@ -16,11 +16,6 @@
self.dragging = False
self.move = None
- self.connect('draw', self.on_draw)
- self.connect('mousedown', self.on_mousedown)
- self.connect('mouseup', self.on_mouseup)
- self.connect('mousemove', self.on_mousemove)
-
self.add_events('change')
@@ -32,6 +27,7 @@
def on_draw(self, screen, x, y):
+ super().on_draw(screen, x, y)
screen.putch(x, y, screen.unigraph.UP_ARROW)
for i in range(y + 1, y + self.height - 1):
screen.putch(x, i, screen.unigraph.LIGHT_SHADE)
@@ -40,6 +36,7 @@
def on_mousedown(self, ev):
+ super().on_mousedown(ev)
self.dragging = False
self.move = None
# arrow buttons
@@ -48,7 +45,7 @@
self.move_up()
else:
self.move_down()
- self.top.add_timeout(self.interval * 2, self.on_timeout)
+ self.top.add_timeout(self.interval * 2, self._timeout)
return
# thumb bar
if ev.wy == 1 + self.thumbpos:
@@ -57,27 +54,29 @@
def on_mouseup(self, ev):
+ super().on_mouseup(ev)
if self.dragging:
self.drag(ev.wy)
self.dragging = False
return
if self.move:
- self.top.remove_timeout(self.on_timeout)
+ self.top.remove_timeout(self._timeout)
self.move = None
return
def on_mousemove(self, ev):
+ super().on_mousemove(ev)
if self.dragging:
self.drag(ev.wy)
- def on_timeout(self):
+ def _timeout(self):
if self.move == 'up':
self.move_up()
if self.move == 'down':
self.move_down()
- self.top.add_timeout(self.interval, self.on_timeout)
+ self.top.add_timeout(self.interval, self._timeout)
def move_up(self):
@@ -85,7 +84,7 @@
self.setpos(self.pos - 1)
self.move = 'up'
self.redraw()
- self.handle('change')
+ self.emit('change')
def move_down(self):
@@ -93,7 +92,7 @@
self.setpos(self.pos + 1)
self.move = 'down'
self.redraw()
- self.handle('change')
+ self.emit('change')
def drag(self, wy):
@@ -105,5 +104,5 @@
if self.pos != newpos:
self.setpos(newpos)
self.redraw()
- self.handle('change')
+ self.emit('change')