Skip to content

Commit e0579b7

Browse files
committed
WIP: entrybox for plot
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 42b9fb4 commit e0579b7

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/uproot_browser/tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def children(self) -> list[UprootEntry]:
8484
else:
8585
items = {obj.name.split(";")[0] for obj in self.item.branches}
8686
return [
87-
UprootEntry(f"{self.path}/{key}", self.item[key]) for key in sorted(items)
87+
UprootEntry(key if self.path == "/" else f"{self.path}/{key}", self.item[key]) for key in sorted(items)
8888
]
8989

9090

src/uproot_browser/tui/browser.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ Browser.-show-tree #tree-view {
4646
content-align: center middle;
4747
}
4848

49+
#plot-input-container {
50+
height: 3;
51+
}
52+
53+
#plot-button {
54+
dock: right;
55+
}
56+
4957

5058
Footer > .footer--highlight {
5159
background: $secondary-darken-2;
@@ -82,3 +90,4 @@ HelpScreen {
8290
height: 3;
8391
background: $surface-lighten-1;
8492
}
93+

src/uproot_browser/tui/browser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ def compose(self) -> textual.app.ComposeResult:
8686
id="main-view",
8787
initial="logo",
8888
)
89+
with textual.containers.Container(id="plot-input-container"):
90+
yield textual.widgets.Input(id="plot-input")
91+
yield textual.widgets.Button("Plot", id="plot-button")
92+
8993
yield textual.widgets.Footer()
9094

9195
def on_mount(self, _event: textual.events.Mount) -> None:
@@ -147,6 +151,7 @@ def on_uproot_selected(self, message: UprootSelected) -> None:
147151
make_plot(message.upfile[message.path], theme, 20)
148152
self.plot_widget.item = Plotext(message.upfile, message.path, theme)
149153
content_switcher.current = "plot"
154+
self.query_one("#plot-input", textual.widgets.Input).value = f"f[{message.path!r}]"
150155

151156
except EmptyTreeError:
152157
content_switcher.current = "empty"

src/uproot_browser/tui/right_panel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import textual.widgets
1414

1515
import uproot_browser.plot
16+
import uproot_browser.dirs
1617

1718
LOGO = """\
1819
Scikit-HEP

0 commit comments

Comments
 (0)