To Reproduce
root -l myFile.root
_file0->ls();
new TRootBrowser;
// Double click now on the opened file icon to unfold its keys / contents
I wondered if there is a trick to simulate this double click from the command line, within the macro, rather than having to double-click manually with the mouse on the GUI each time.
If not, could an “UnfoldTFile” function be added to the TRootBrowser interface? That internally calls the function
Thanks in advance!!
Setup
ROOT v6.32.04
Built for linuxx8664gcc on Aug 14 2024, 04:13:21
From tags/v6-32-04@v6-32-04
With c++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Binary directory: /opt/root/bin
Full click trace:
1 TGFileBrowser::DoubleClicked TGFileBrowser.cxx 1204 0x7fffdbf20d8f
2 TClingCallFunc::exec TClingCallFunc.cxx 1466 0x7fffef32b752
3 TClingCallFunc::Exec TClingCallFunc.cxx 1524 0x7fffef32bf64
4 TCling::CallFunc_Exec TCling.cxx 7851 0x7fffef168bba
5 TQConnection::SendSignal TQConnection.h 76 0x7ffff7c36488
6 TQObject::EmitVA<long [2]> TQObject.h 137 0x7fffdbee8ed5
7 TQObject::Emit<long [2]> TQObject.h 167 0x7fffdbee8b56
8 TGListTree::DoubleClicked TGListTree.cxx 1170 0x7fffdbf6b058
9 TGListTree::HandleDoubleClick TGListTree.cxx 694 0x7fffdbf692cc
10 TGFrame::HandleEvent TGFrame.cxx 514 0x7fffdbf3c42b
11 TGClient::HandleEvent TGClient.cxx 844 0x7fffdbeebd83
12 TGClient::ProcessOneEvent TGClient.cxx 654 0x7fffdbeeb644
13 TGClient::HandleInput TGClient.cxx 701 0x7fffdbeeb7fa
14 TGInputHandler::Notify TGClient.cxx 117 0x7fffdbee9b6e
15 TUnixSystem::DispatchOneEvent TUnixSystem.cxx 1099 0x7ffff7d8d479
16 TSystem::InnerLoop TSystem.cxx 403 0x7ffff7c6903b
17 TSystem::Run TSystem.cxx 353 0x7ffff7c68d9b
18 TApplication::Run TApplication.cxx 1897 0x7ffff7bdb997
19 TRint::Run TRint.cxx 501 0x7ffff7f9d7f8
20 main rmain.cxx 84 0x5555555555e4
Potential solution
root -l myFile.root
auto tbr = new TBrowser();
_file0->Browse(tbr);
but it doesn’t look well inside the TFile substructure.
Additional context
Sorry for this lazy question, but it’s sometimes useful to double click on files from the browser, using:
nano ~/.local/share/applications/ROOT.desktop
[Desktop Entry]
Type=Application
Name=ROOT Browser
Comment=Open CERN ROOT files
Icon=gnome-cernroot
Exec=/opt/root/bin/root -l %F -e '_file0->ls(); auto tbr = new TBrowser(); _file0->Browse(tbr);'
Terminal=true
Categories=Science
Then in file Browser, right click on .root, Open with Other application, ROOT Browser
Taken from: Open .root file with double click - #13 by petrstepanov