Skip to content

Commit 75afde6

Browse files
committed
add folded control panel
1 parent 581f5fe commit 75afde6

File tree

1 file changed

+76
-67
lines changed

1 file changed

+76
-67
lines changed

crystal_toolkit/components/phonon.py

Lines changed: 76 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _sub_layouts(self) -> dict[str, Component]:
9696
config={"displayModeBar": False},
9797
responsive=True,
9898
id=self.id("ph-bsdos-graph"),
99-
style={"height": "520px"},
99+
style={"height": "400px"},
100100
)
101101
]
102102
)
@@ -189,7 +189,7 @@ def _sub_layouts(self) -> dict[str, Component]:
189189
# CrystalToolkitAnimationScene(
190190
PhononAnimationScene(
191191
data={"app": "phonon"},
192-
sceneSize="500px",
192+
sceneSize="400px",
193193
id=self.id("crystal-animation"),
194194
settings={"defaultZoom": 1.2},
195195
axisView="SW",
@@ -205,81 +205,90 @@ def _sub_layouts(self) -> dict[str, Component]:
205205
}
206206
)
207207

208-
crystal_animation_controls = html.Div(
208+
crystal_animation_controls = html.Details(
209209
[
210-
html.Br(),
211-
html.H5("Control Panel", style={"textAlign": "center"}),
212-
hr,
213-
html.H6("Supercell modification", style={"textAlign": "center"}),
210+
html.Summary("Control Panel"),
214211
html.Div(
215212
[
216-
self.get_numerical_input(
217-
kwarg_label="scale-x",
218-
default=1,
219-
persistence_type="session",
220-
is_int=True,
221-
label="x",
222-
min=1,
223-
style={"width": "5rem"},
213+
# html.Br(),
214+
# html.H5("Control Panel", style={"textAlign": "center"}),
215+
# hr,
216+
html.H6(
217+
"Supercell modification", style={"textAlign": "center"}
224218
),
225-
self.get_numerical_input(
226-
kwarg_label="scale-y",
227-
default=1,
228-
persistence_type="session",
229-
is_int=True,
230-
label="y",
231-
min=1,
232-
style={"width": "5rem"},
219+
html.Div(
220+
[
221+
self.get_numerical_input(
222+
kwarg_label="scale-x",
223+
default=1,
224+
persistence_type="session",
225+
is_int=True,
226+
label="x",
227+
min=1,
228+
style={"height": "16px"},
229+
),
230+
self.get_numerical_input(
231+
kwarg_label="scale-y",
232+
default=1,
233+
persistence_type="session",
234+
is_int=True,
235+
label="y",
236+
min=1,
237+
style={"height": "16px"},
238+
),
239+
self.get_numerical_input(
240+
kwarg_label="scale-z",
241+
default=1,
242+
persistence_type="session",
243+
is_int=True,
244+
label="z",
245+
min=1,
246+
style={"height": "16px"},
247+
),
248+
],
249+
style={
250+
"display": "flex",
251+
"justify-content": "center",
252+
"gap": "16px",
253+
},
233254
),
234-
self.get_numerical_input(
235-
kwarg_label="scale-z",
236-
default=1,
237-
persistence_type="session",
238-
is_int=True,
239-
label="z",
240-
min=1,
241-
style={"width": "5rem"},
255+
hr,
256+
html.Div(
257+
self.get_slider_input(
258+
kwarg_label="magnitude",
259+
default=0.5,
260+
step=0.01,
261+
domain=[0, 1],
262+
label="Vibration magnitude",
263+
# styleInput={"height": "40px"},
264+
),
265+
),
266+
hr,
267+
html.Div(
268+
self.get_slider_input(
269+
kwarg_label="velocity",
270+
default=0.5,
271+
step=0.01,
272+
domain=[0, 1],
273+
label="Velocity",
274+
)
275+
),
276+
hr,
277+
html.Div(
278+
html.Button(
279+
"Update",
280+
id=self.id("supercell-controls-btn"),
281+
style={"height": "40px"},
282+
),
283+
style={"textAlign": "center", "width": "100%"},
242284
),
243285
],
244286
style={
245-
"display": "flex",
246-
"justify-content": "center",
247-
"gap": "16px",
287+
"width": "100%",
288+
# "scale": "0.9"
248289
},
249290
),
250-
hr,
251-
html.Div(
252-
self.get_slider_input(
253-
kwarg_label="magnitude",
254-
default=0.5,
255-
step=0.01,
256-
domain=[0, 1],
257-
label="Vibration magnitude",
258-
)
259-
),
260-
hr,
261-
html.Div(
262-
self.get_slider_input(
263-
kwarg_label="velocity",
264-
default=0.5,
265-
step=0.01,
266-
domain=[0, 1],
267-
label="Velocity",
268-
)
269-
),
270-
hr,
271-
html.Div(
272-
html.Button(
273-
"Update",
274-
id=self.id("supercell-controls-btn"),
275-
style={"height": "40px"},
276-
),
277-
style={"textAlign": "center", "width": "100%"},
278-
),
279-
],
280-
style={
281-
"width": "100%",
282-
},
291+
]
283292
)
284293

285294
return {

0 commit comments

Comments
 (0)