59 if self._cursor is not None: |
59 if self._cursor is not None: |
60 return Point(self._cursor) |
60 return Point(self._cursor) |
61 |
61 |
62 ## input events ## |
62 ## input events ## |
63 |
63 |
64 def keypress(self, keyname, char, mod): |
64 def keypress_event(self, ev): |
65 # First, handle the keypress event to focused child widget |
65 # First, handle the keypress event to focused child widget |
66 if self.focus_widget is not None: |
66 if self.focus_widget is not None: |
67 if self.focus_widget.keypress(keyname, char, mod): |
67 if self.focus_widget.keypress_event(ev): |
68 return True |
68 return True |
69 # Next, handle default key behaviour by Container |
69 # Next, handle default key behaviour by Container |
70 if keyname == 'tab': |
70 if ev.keyname == 'tab': |
71 return self.focus_next(-1 if 'shift' in mod else 1) |
71 return self.focus_next(-1 if 'shift' in ev.mods else 1) |
72 # Finally, handle default keys by Widget |
72 # Finally, handle default keys by Widget |
73 # and send keypress signal |
73 # and send keypress signal |
74 if Widget.keypress(self, keyname, char, mod): |
74 if Widget.keypress_event(self, ev): |
75 return True |
75 return True |
76 |
76 |
77 ## focus ## |
77 ## focus ## |
78 |
78 |
79 def focus_next(self, step=1): |
79 def focus_next(self, step=1): |