1##===-- statuswin.py -----------------------------------------*- Python -*-===## 2## 3# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4# See https://llvm.org/LICENSE.txt for license information. 5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6## 7##===----------------------------------------------------------------------===## 8 9import lldb 10import lldbutil 11import cui 12import curses 13 14 15class StatusWin(cui.TextWin): 16 17 def __init__(self, x, y, w, h): 18 super(StatusWin, self).__init__(x, y, w) 19 20 self.keys = [ # ('F1', 'Help', curses.KEY_F1), 21 ('F3', 'Cycle-focus', curses.KEY_F3), 22 ('F10', 'Quit', curses.KEY_F10)] 23 24 def draw(self): 25 self.win.addstr(0, 0, '') 26 for key in self.keys: 27 self.win.addstr('{0}'.format(key[0]), curses.A_REVERSE) 28 self.win.addstr(' {0} '.format(key[1]), curses.A_NORMAL) 29 super(StatusWin, self).draw() 30 31 def handleEvent(self, event): 32 if isinstance(event, int): 33 pass 34 elif isinstance(event, lldb.SBEvent): 35 if lldb.SBProcess.EventIsProcessEvent(event): 36 state = lldb.SBProcess.GetStateFromEvent(event) 37 status = lldbutil.state_type_to_str(state) 38 self.win.erase() 39 x = self.win.getmaxyx()[1] - len(status) - 1 40 self.win.addstr(0, x, status) 41 return 42