[jupyter] introduce %rootbrowse magic#21761
Conversation
In the NotebookDrawer implement handling of the TFile instance.
Full file content read in binary buffer and injected into HTML page
as base64-coded blob. In the JavaScript blob encoded back and
HierarchyPainter used to implement file content browsing.
File size limited by 10MB. Bigger files only can be drawn when
file.Draw("force") is invoked.
Fix problem with geometry display
Keep the only enableJSVis function to switch magic via `%jsroot on/off`
This is preparation to split functionality in subclasses
…file So one clearly separate functionality. Change slightly interface to be able reuse drawers.Draw function in python and C++ kernel in the same manner
Use specialized method in dedicated Drawer class
Need to be executed when %rootbrowse magic is used
Let open large files in python kernel
rootbrowse magic%rootbrowse magic
While JSROOT able to load files via http/https protocol, just delegate this work to it. Only if -f flag specified, ROOT TFile will be used to load file content.
Only when Draw function is invoked - try to open and read file. At this place one can have better possibility to display errors
vepadulano
left a comment
There was a problem hiding this comment.
Thank you, this is an interesting addition to the Jupyter notebook capabilities! A first round of comments from my side.
Use `with ROOT.TDirectory.TContext()` Update comments Simplify class declarations
Test Results 22 files 22 suites 3d 4h 48m 42s ⏱️ For more details on these failures, see this check. Results for commit 09e5897. ♻️ This comment has been updated with latest results. |
Too old ROOT versions not supported by JSROOT
|
It's not the same environment, but would it be feasible to have the browser as a window of jupyterlab? |
You mean TBrowser? Or better to say web-based RBrowser? |
vepadulano
left a comment
There was a problem hiding this comment.
The code works and the changes look alright, maybe except for the usage of global which should be avoided but it's not been introduced by this PR specifically.
I left a final comment before merging, this being a new feature it should probably be communicated very explicitly to users at least for the moment.
One should find better way to show info about new feature and contact url.
Can be done in extra PR

First of all - refactor jupyter drawer codes to make separate classes for TCanvas, RCanvas, TGeoManager, TFile
Introduce
rootbrowsemagic in cpp and python kernels. It works like:By default file is opened and shown in JSROOT page.
One can specify
-foption to force opening of large files. By default file up to 10MB can be viewed.Special handling for
http:///https://files. JSROOT can load such files directly - so there is no need to load full file content first. So size limitation is not important for such files - while JSROOT uses partial I/OSupersede #21364