Skip to content

Commit

Permalink
Improve styles
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Jan 13, 2025
1 parent f25b79d commit 8fc2949
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/aiidalab_qe/app/result/components/status/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _render(self):
)
self.reset_button.on_click(self._reset_process_tree)

self.node_view_container = ipw.VBox()
self.node_view_container = ipw.VBox(layout=ipw.Layout(height="100%"))
self.node_view_container.add_class("node-view-container")

self.to_advanced_view_button = ipw.Button(
Expand Down
1 change: 1 addition & 0 deletions src/aiidalab_qe/app/result/components/status/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def _render(self):
self.collapse_button.on_click(self._collapse_all)
root = self._model.fetch_process_node()
self.trunk = WorkChainTreeNode(node=root, on_inspect=self._on_inspect)
self.trunk.layout.flex = "1"
self.trunk.initialize()
self.trunk.expand()
self.rendered = True
Expand Down
18 changes: 18 additions & 0 deletions src/aiidalab_qe/app/static/styles/status.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@

/* Process tree */

.rolling-output {
flex: 1;
min-height: 300px;
}

.rolling-output .widget-html .widget-html-content {
position: absolute !important;
width: 100%;
}

.rolling-output .widget-html .widget-html-content pre {
position: relative !important;
}

.simplified-process-tree {
height: 100%;
}

.simplified-process-tree .tree-node-header {
align-items: center;
padding-left: 12px;
Expand Down
8 changes: 7 additions & 1 deletion src/aiidalab_qe/common/node_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ def __init__(self, calcjob, **kwargs):
self.output_follower.observe(self._observe_output_follower_lineno, ["lineno"])

super().__init__(
[ipw.HTML(f"CalcJob: {self.calcjob}"), self.log_output], **kwargs
children=[
ipw.HTML(f"CalcJob: {self.calcjob}"),
self.log_output,
],
layout=ipw.Layout(height="100%"),
**kwargs,
)
self.add_class("calcjob-node-viewer")

def _observe_output_follower_lineno(self, _):
with self.hold_trait_notifications():
Expand Down
24 changes: 19 additions & 5 deletions src/aiidalab_qe/common/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ class RollingOutput(ipw.VBox):

def __init__(self, num_min_lines=10, max_output_height="200px", **kwargs): # noqa: ARG002
self._num_min_lines = num_min_lines
self._output = ipw.HTML(layout=ipw.Layout(min_width="50em"))
self._output = ipw.HTML(layout=ipw.Layout(min_width="80em"))
self._refresh_output()
super().__init__(
[self._output],
children=[
self._output,
],
layout=ipw.Layout(max_height=max_output_height),
)
self.add_class("rolling-output")

@traitlets.default("value")
def _default_value(self):
Expand Down Expand Up @@ -179,7 +182,10 @@ class LogOutputWidget(ipw.VBox):
def __init__(self, placeholder=None, **kwargs):
self.placeholder = placeholder

self._rolling_output = RollingOutput(layout=ipw.Layout(flex="1 1 auto"))
self._rolling_output = RollingOutput(
layout=ipw.Layout(flex="1 1 auto"),
max_output_height="unset",
)
ipw.dlink(
(self, "value"),
(self._rolling_output, "value"),
Expand Down Expand Up @@ -230,12 +236,20 @@ def __init__(self, placeholder=None, **kwargs):
)

super().__init__(
[
children=[
self._filename_display,
ipw.HBox([self._rolling_output, self._btns]),
ipw.HBox(
children=[
self._rolling_output,
self._btns,
],
layout=ipw.Layout(height="100%"),
),
],
layout=ipw.Layout(height="100%"),
**kwargs,
)
self.add_class("log-output")

@traitlets.default("placeholder")
def _default_placeholder(self):
Expand Down

0 comments on commit 8fc2949

Please sign in to comment.