]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - utils/lui/statuswin.py
Vendor import of lldb trunk r290819:
[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
11 import lldbutil
12 import cui
13 import curses
14
15
16 class StatusWin(cui.TextWin):
17
18     def __init__(self, x, y, w, h):
19         super(StatusWin, self).__init__(x, y, w)
20
21         self.keys = [  # ('F1', 'Help', curses.KEY_F1),
22             ('F3', 'Cycle-focus', curses.KEY_F3),
23             ('F10', 'Quit', curses.KEY_F10)]
24
25     def draw(self):
26         self.win.addstr(0, 0, '')
27         for key in self.keys:
28             self.win.addstr('{0}'.format(key[0]), curses.A_REVERSE)
29             self.win.addstr(' {0} '.format(key[1]), curses.A_NORMAL)
30         super(StatusWin, self).draw()
31
32     def handleEvent(self, event):
33         if isinstance(event, int):
34             pass
35         elif isinstance(event, lldb.SBEvent):
36             if lldb.SBProcess.EventIsProcessEvent(event):
37                 state = lldb.SBProcess.GetStateFromEvent(event)
38                 status = lldbutil.state_type_to_str(state)
39                 self.win.erase()
40                 x = self.win.getmaxyx()[1] - len(status) - 1
41                 self.win.addstr(0, x, status)
42         return