-
Notifications
You must be signed in to change notification settings - Fork 1
/
argsnlocals.py
62 lines (49 loc) · 1.83 KB
/
argsnlocals.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright (c) Anand Krishnamoorthi
# Licensed under the MIT License
from re import search
from prompt_toolkit.filters import Condition
from prompt_toolkit.layout.containers import ConditionalContainer, HSplit
from prompt_toolkit.layout import Dimension
from lineitemswindow import LineItemsWindow
class ArgsnLocalsWindow:
def __init__(self,
app=None,
show=False,
height=Dimension(preferred=20)):
self.frame = None
self.app = app
self.show = show
self.args = LineItemsWindow(app=app,
show=show,
title ='[ Arguments ]',
show_divider=self._show_divider)
self.locals = LineItemsWindow(app=app,
show=show,
title ='[ Locals ]',
show_divider=self._show_divider)
self.container = ConditionalContainer(
content=HSplit([
self.args.get_ui(),
self.locals.get_ui()
]),
filter=Condition(lambda: self.show))
def get_ui(self):
return self.container
def toggle_show(self):
self.show = not self.show
self.args.toggle_show()
self.locals.toggle_show()
def handle_info_args(self, output):
self.args.handle_output(output)
self.args.fit_to_height()
def handle_info_locals(self, output):
self.locals.handle_output(output)
self.locals.fit_to_height()
def handle_frame_change(self):
self.args.reset()
self.locals.reset()
def _show_divider(self):
return self.app.source.show
def reset(self):
self.args.reset()
self.locals.reset()