4646 PlotWidget ,
4747 make_plot ,
4848)
49+ from .tools import Info , Tools
4950
5051
5152class Browser (textual .app .App [object ]):
@@ -58,12 +59,13 @@ class Browser(textual.app.App[object]):
5859 textual .binding .Binding ("b" , "toggle_files" , "Navbar" ),
5960 textual .binding .Binding ("q" , "quit" , "Quit" ),
6061 textual .binding .Binding ("d" , "quit_with_dump" , "Dump & Quit" ),
61- textual .binding .Binding ("t" , "toggle_theme" , "Theme" ),
6262 textual .binding .Binding ("f1" , "help" , "Help" ),
6363 textual .binding .Binding ("?" , "help" , "Help" , show = False ),
64+ textual .binding .Binding ("escape" , "quit" , "Quit" , show = False ),
6465 ]
6566
6667 show_tree = var (True )
68+ show_tools = var (False )
6769
6870 def __init__ (self , path : str , ** kwargs : Any ) -> None :
6971 self .path = path
@@ -77,24 +79,27 @@ def compose(self) -> textual.app.ComposeResult:
7779 yield Header ("uproot-browser" )
7880 with textual .containers .Container ():
7981 # left_panel
80- yield UprootTree (self .path , id = "tree-view" )
81- # right_panel
82- yield textual .widgets .ContentSwitcher (
83- LogoWidget (id = "logo" ),
84- self .plot_widget ,
85- self .error_widget ,
86- EmptyWidget (id = "empty" ),
87- id = "main-view" ,
88- initial = "logo" ,
89- )
82+ with textual .widgets .TabbedContent (id = "left-view" ):
83+ with textual .widgets .TabPane ("Tree" ):
84+ yield UprootTree (self .path , id = "tree-view" )
85+ with textual .widgets .TabPane ("Tools" ):
86+ yield Tools ()
87+ with textual .widgets .TabPane ("Info" ):
88+ yield Info ()
89+ # main_panel
90+ with textual .widgets .ContentSwitcher (id = "main-view" , initial = "logo" ):
91+ yield LogoWidget (id = "logo" )
92+ yield self .plot_widget
93+ yield self .error_widget
94+ yield EmptyWidget (id = "empty" )
9095 yield textual .widgets .Footer ()
9196
9297 def on_mount (self , _event : textual .events .Mount ) -> None :
93- self .query_one ("#tree-view" , UprootTree ).focus ()
98+ self .query_one ("#tree-view" ).focus ()
9499
95100 def watch_show_tree (self , show_tree : bool ) -> None :
96101 """Called when show_tree is modified."""
97- self .set_class (show_tree , "-show-tree " )
102+ self .set_class (show_tree , "-show-panel " )
98103
99104 def action_help (self ) -> None :
100105 self .push_screen (HelpScreen ())
@@ -133,14 +138,10 @@ def action_quit_with_dump(self) -> None:
133138
134139 self .exit (message = results )
135140
136- def action_toggle_theme (self ) -> None :
137- """An action to toggle dark mode."""
138- dark = self .theme != "textual-light"
139- theme = "textual-light" if dark else "textual-dark"
140-
141+ def watch_theme (self , _old : str , new : str ) -> None :
142+ dark = not new .endswith ("-light" )
141143 if self .plot_widget .item :
142- self .plot_widget .item .theme = "default" if dark else "dark"
143- self .theme = theme
144+ self .plot_widget .item .theme = "dark" if dark else "default"
144145
145146 def on_uproot_selected (self , message : UprootSelected ) -> None :
146147 """A message sent by the tree when a file is clicked."""
0 commit comments