[Workflow] Try to fix code-formatter failing to find changes in some cases.
[llvm-project.git] / lldb / utils / lui / statuswin.py
blob20f81181de43aaa0acdb54fe4532ca4314d4205a
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 ##===----------------------------------------------------------------------===##
9 import lldb
10 import lldbutil
11 import cui
12 import curses
15 class StatusWin(cui.TextWin):
16 def __init__(self, x, y, w, h):
17 super(StatusWin, self).__init__(x, y, w)
19 self.keys = [ # ('F1', 'Help', curses.KEY_F1),
20 ("F3", "Cycle-focus", curses.KEY_F3),
21 ("F10", "Quit", curses.KEY_F10),
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()
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