]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - utils/lui/statuswin.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / utils / lui / statuswin.py
1 ##===-- statuswin.py -----------------------------------------*- Python -*-===##
2 ##
3 ##                     The LLVM Compiler Infrastructure
4 ##
5 ## This file is distributed under the University of Illinois Open Source
6 ## License. See LICENSE.TXT for details.
7 ##
8 ##===----------------------------------------------------------------------===##
9
10 import lldb, lldbutil
11 import cui
12 import curses
13
14 class StatusWin(cui.TextWin):
15   def __init__(self, x, y, w, h):
16     super(StatusWin, self).__init__(x, y, w)
17
18     self.keys = [#('F1', 'Help', curses.KEY_F1),
19                  ('F3', 'Cycle-focus', curses.KEY_F3),
20                  ('F10', 'Quit', curses.KEY_F10)]
21
22   def draw(self):
23     self.win.addstr(0, 0, '')
24     for key in self.keys:
25       self.win.addstr('{0}'.format(key[0]), curses.A_REVERSE)
26       self.win.addstr(' {0} '.format(key[1]), curses.A_NORMAL)
27     super(StatusWin, self).draw()
28
29   def handleEvent(self, event):
30     if isinstance(event, int):
31       pass
32     elif isinstance(event, lldb.SBEvent):
33       if lldb.SBProcess.EventIsProcessEvent(event):
34         state = lldb.SBProcess.GetStateFromEvent(event)
35         status = lldbutil.state_type_to_str(state)
36         self.win.erase()
37         x = self.win.getmaxyx()[1] - len(status) - 1
38         self.win.addstr(0, x, status)
39     return
40