I wanted to start working on the ROOT GUI, but I find it … “very old style” (the GuiBuilder too). I just read that “Originally the GUI classes were based on Hector Peraza’s Xclass’95 widget library”. Does it mean that the graphical style has not evolved since 95 ?? I probably miss something, but can’t we do something more recent? Other ideas?
I believe you was reading a ROOT User guide (it was not updated for some time).
Actually there are new developments in ROOT graphics and particularly in GUI.
Please check more in presentation: https://indico.cern.ch/event/587955/contributions/2938011/
Thanks for your help. As far as I understand it, the only way to have a modern version of GUI with ROOT is to use a web based approach ? So basically, we code in C++ the gui, and it is display via JAVA tools into a browser ? Is that correct ?
Our long-term plans to implement all generic GUI widgets (TBrowser, TFitPanel, TCanvas, …) with web-based technology. There are prototypes for most of them - they will be moved from “ROOT::Experimental” namespace once they are ready for public use.
You still can use old TVirtualX-based GUI elements, but should not expect big new developments in this direction.
When you say “ready for public use”, do you think it will be ready for ROOT7 (do you know when this version will be released)? Do you guys plan to make tutorials and examples ?
Thanks for you answers, and thanks for your work, it will be highly appreciated !
WebGUI is important part of ROOT7 development. It is available already now - but under “Experimental” namespace while final interfaces not yet fixed. Actually basic functionality remains stable last 12 months, probably we can declare them as “stable” in the next release at the end of the year.
You are right - there is no proper tutorial for web-based GUIs.
Before I was refering to RFitPanel, but meanwhile it is already complex to be used as tutorial. I will try to create several tutorials in next days.
tutorials/webgui/webwindow shows usage of RWebWindow with plain HTML. One can add any kind of external frameworks. Text and binary communication demonstrated.
tutorials/webgui/panel shows usage of openui5 with RWebWindow. It includes model TestPanelModel class which is directly used as model object in openui5.
Both examples should be started just by calling: root server.cxx
Thank you very much for your example.
I tested the sample code and sometimes output the following error.
I downloaded the latest ROOT from github, my operating system is CentOS7.
Error in <ROOT [webgui] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/webdisplay/src/RWebWindow.cxx:571 in bool ROOT::Experimental::RWebWindow::ProcessWS(THttpCallArg&)>: missing number of acknowledged operations
In addition, I am also interested in qt5web, can you provide some sample code?
It is little bit old, but should work.
Can you check firefox browser console for error messages there?
About qt5:(The version: qt/5.12.4)
The sample code webgui/panel/server.cxx not working. The figure below shows the outputs.
Strange, I was using exactly this version for testing and it was working for me.
Now I have 5.13.0 and it still works.
But I see two error messages. First is about AA_ShareOpenGLContexts. Can you try to add following command to webgui/qt5webdisplay/rootqt5.cpp, line 104 (before creating application):
Second about custom scheme. Please replace #if QT_VERSION >= 0x051200 by #if QT_VERSION >= 0x050C00 in lines 24 and 93. This is mistake, I will fix it soon in repository.
The firefox browser console outputs messages about error:(Sorry, I don’t know how to make firefox only allow English to be output, even though I have deleted all other languages of the browser.)
The connection to ws://localhost:9349/win1/root.websocket?key=1048305 was interrupted while loading the page.
websocket error [object Event]
About qt5:
I add QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true); before rootqt5.cpp line 104 and change QT_VERSION in lines 24 and 93.
For the code webgui/panel/server.cxx outputs,
Processing server.cxx...
Assign UI5 dir /opt/rootmaster/ui5
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
root [1] Warning in <ROOT [Qt] Warning /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rootwebpage.cpp:31 in virtual void RootWebPage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel, const QString&, int, const QString&)>: rootscheme://root.server1/win1/jsrootsys/scripts/JSRootCore.js:939: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
Error in <ROOT [Qt5] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rooturlschemehandler.cpp:112 in virtual void TWebGuiCallArg::HttpReplied()>: Qt5 request FAIL path win1 file root.longpoll
connection closed 1
Error in <ROOT [Qt] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rootwebpage.cpp:35 in virtual void RootWebPage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel, const QString&, int, const QString&)>: rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1679: longpoll got short message in raw mode 0
root [1] .q
But the code webwindow/server.cxx only outputs as blow, it works normally.
Assign UI5 dir /opt/rootmaster/ui5
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
Something wrong with Firefox and websocket. I have no good idea. Can you try firefox with very simple ws.C example in $ROOTSYS/tutorials/http directory. It testing basic websocket functionality without all webgui extras.
Means tutorials/webgui/webwindow works correctly? It is already good news!
But something wrong with openui5 in QWebEngine. First error I can see is:
Try to add gDebug = 1; line into server.cxx before window->Show(); method. And please send me your output.
I will try to test firefox with ws.C.
Yes, the sample code tutorials/webgui/webwindow works correctly.
The debug mode output as blow,
[wuhongyi@localhost panel]$ root --web=qt5 server.cxx
root [0]
Processing server.cxx...
Assign UI5 dir /opt/rootmaster/ui5
Info in <TUnixSystem::Load>: loaded library /opt/rootmaster/lib/libROOTQt5WebDisplay.so, status 0
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
root [1] rootscheme://root.server1/win1/jsrootsys/scripts/JSRootCore.js:132: Set JSROOT.source_dir to rootscheme://root.server1/win1/jsrootsys/, dev 4/07/2019
rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1968: Opening web socket at rootscheme://root.server1/win1/
rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1985: configure longpoll rootscheme://root.server1/win1/root.longpoll
rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1637: longpoll connect rootscheme://root.server1/win1/root.longpoll?raw_connect&key=1048305 raw = true
rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1739: Get new longpoll connection with id 1618237641
rootscheme://root.server1/win1/jsrootsys/scripts/JSRoot.openui5.js:80: Load openui5 from rootscheme://root.server1/win1/rootui5sys/distribution/
root [1] .q
Error in <ROOT [Qt5] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rooturlschemehandler.cpp:112 in virtual void TWebGuiCallArg::HttpReplied()>: Qt5 request FAIL path win1 file root.longpoll
TFolder dtor called for http
I tested the firefox browser with ws.C, but did not find any issues.
About root --web=qt5 server.cxx
When I create .rootrc file, the sample code webgui/panel/server.cxx can running, but the following warning is output.
Warning in <ROOT [Qt] Warning /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rootwebpage.cpp:31 in virtual void RootWebPage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel, const QString&, int, const QString&)>: https://openui5.hana.ondemand.com/1.64.1/resources/sap-ui-core-nojQuery.js:90: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
This is known problem of OpenUI5, it should be resolved in the future versions.
Means problem is combination of custom URL scheme handler and OpenUI5.
Probably, it will be solved once synchronous XMLHttpRequest will be dropped in OpenUI5.
For now one should use HTTP for all webgui plugins - this is that WebGui.ForceHttp:1 is configuring