Skip to content

Commit b442df6

Browse files
committed
Make figure header/footer hideable
1 parent 44e89ea commit b442df6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

euporie/core/comm/ipympl.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from functools import partial
88
from typing import TYPE_CHECKING
99

10+
from prompt_toolkit.filters.base import Condition
11+
from prompt_toolkit.layout.containers import ConditionalContainer
1012
from prompt_toolkit.mouse_events import MouseButton, MouseEventType, MouseModifier
1113

1214
from euporie.core.comm.base import CommView
@@ -115,7 +117,24 @@ def create_view(self, parent: OutputParent) -> CommView:
115117
toolbar_view = toolbar_model.new_view(parent)
116118

117119
box = Box(
118-
HSplit([label, display, message, toolbar_view]),
120+
HSplit(
121+
[
122+
ConditionalContainer(
123+
label,
124+
filter=Condition(
125+
partial(self.data["state"].get, "header_visible", True)
126+
),
127+
),
128+
display,
129+
ConditionalContainer(
130+
message,
131+
filter=Condition(
132+
partial(self.data["state"].get, "footer_visible", True)
133+
),
134+
),
135+
toolbar_view,
136+
]
137+
),
119138
padding_left=0,
120139
padding_right=0,
121140
)

0 commit comments

Comments
 (0)