@@ -351,6 +351,19 @@ def add_to_history(self,
if self.history:
self.history.set_focus(len(self.history) - 1)
+ def mouse_event(self, size: Tuple[int, int], _event: str, button: float,
+ _x: int, _y: int, focus: bool) -> None:
+ # Scroll only on focus. Therefore it is required to
+ # click on the widget to enable scrolling.
+ if not focus:
+ return
+ # button == 4 represents scroll up event
+ if button == 4.0:
+ super().keypress(size, 'up')
+ # button == 5 represents scroll down event
+ elif button == 5.0:
+ super().keypress(size, 'down')
+
class HistoryWindow(urwid.Frame):
"""
Adds scroll support to history box. The list can now be scrolled using arrow keys, page up/down and the mouse. The current implementation requires the widget to be in focus to enable scrolling. Therefore the user has to click on the widget before scrolling. Signed-off-by: G S Niteesh Babu <niteesh.gs@gmail.com> --- python/qemu/aqmp/aqmp_tui.py | 13 +++++++++++++ 1 file changed, 13 insertions(+)