xref: /openbsd-src/gnu/llvm/lldb/utils/lui/eventwin.py (revision 061da546b983eb767bad15e67af1174fb0bcf31c)
1*061da546Spatrick##===-- eventwin.py ------------------------------------------*- Python -*-===##
2*061da546Spatrick##
3*061da546Spatrick# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*061da546Spatrick# See https://llvm.org/LICENSE.txt for license information.
5*061da546Spatrick# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*061da546Spatrick##
7*061da546Spatrick##===----------------------------------------------------------------------===##
8*061da546Spatrick
9*061da546Spatrickimport cui
10*061da546Spatrickimport lldb
11*061da546Spatrickimport lldbutil
12*061da546Spatrick
13*061da546Spatrick
14*061da546Spatrickclass EventWin(cui.TitledWin):
15*061da546Spatrick
16*061da546Spatrick    def __init__(self, x, y, w, h):
17*061da546Spatrick        super(EventWin, self).__init__(x, y, w, h, 'LLDB Event Log')
18*061da546Spatrick        self.win.scrollok(1)
19*061da546Spatrick        super(EventWin, self).draw()
20*061da546Spatrick
21*061da546Spatrick    def handleEvent(self, event):
22*061da546Spatrick        if isinstance(event, lldb.SBEvent):
23*061da546Spatrick            self.win.scroll()
24*061da546Spatrick            h = self.win.getmaxyx()[0]
25*061da546Spatrick            self.win.addstr(h - 1, 0, lldbutil.get_description(event))
26*061da546Spatrick        return
27