--- a/tuikit/widgets/button.py Mon Feb 16 21:17:43 2015 +0100
+++ b/tuikit/widgets/button.py Sat Feb 21 12:01:57 2015 +0100
@@ -24,6 +24,7 @@
self.color = 'default'
self.color_active = 'default on red'
+ self.color_highlight = 'default on yellow'
self.highlight = False
self.sig_clicked = Signal()
@@ -47,6 +48,8 @@
self.color_active = theme.button_active
def _get_color(self):
+ if self.highlight:
+ return self.color_highlight
if self.has_focus():
return self.color_active
return self.color
@@ -71,20 +74,18 @@
# suffix
buffer.puts(self.suffix, pos)
- def on_mousedown(self, ev):
+ def mousedown_event(self, ev):
self.highlight = True
- self.redraw()
+ #self.redraw()
- def on_mouseup(self, ev):
+ def mouseup_event(self, ev):
self.highlight = False
- self.redraw()
+ #self.redraw()
+ self.sig_clicked()
- if self.enclose(ev.px, ev.py):
- self.emit('click')
-
- def on_keypress(self, ev):
+ def keypress_event(self, ev):
if ev.keyname == 'enter':
- self.emit('click')
+ self.sig_clicked()
def _divide_padding(self, pad):
# default is 'left'