Question about GUI

Deall all,

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?

Thanks for your help
B

Ps: using 6.14/06

Hi,

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 ?

I was working from this webpage:
https://root.cern.ch/root/htmldoc/guides/users-guide/WritingGUI.html

Do you confirm that there is no way to apply this procedure with modern graphics ?

Thanks a lot

Hi @bg92

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.

Regards,
Sergey

Hi @linev

thanks a lot for you reply.

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 !

B

Hi,

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.

Regards,
Sergey

I add two tutorials to the ROOT master branch.

  • 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

Hi @linev,

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?

Best wishes,
Hongyi

Hi,

Which web browser you are using? I never observe the error before - this is indication of very basic communication error.

If QWebEngine installed on your system and you build ROOT with -Dqt5web=ON flag, you just can use it exactly in the same way as browser. Just run:

root.exe --web=qt5 server.cxx

Advantage of this plugin - no real HTTP server is required.

Regards,
Sergey

Hi Sergey,

I used firefox 60.7.2 for testing.
But when I use google-chrome, there is no problem.

About qt5:(The version: qt/5.12.4)
The sample code webgui/panel/server.cxx not working. The figure below shows the outputs.


The code webgui/webwindow/server.cxx also has same issue.

Best wishes,
Hongyi

I used firefox 60.7.2 for testing.

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):

QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);

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.

If fixes help, I will submit them to repository.

Hi Sergey,

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.)

载入页面时与 ws://localhost:9349/win1/root.websocket?key=1048305 的连接中断。
websocket error [object Event]

The outputs mean:

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.

Best wishes,
Hongyi

Hi,

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.

Regards,
Sergey

Hi Sergey,

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

Best wishes,
Hongyi

Something wrong happens with OpenUI5 loading. It fails and as result, complete widget fails.

Try to create .rootrc file in directory with examples and put content:

WebGui.ForceHttp: 1

This will force usage of HTTP protocol. I suspect, that special URL handler does not work properly.

Regards,
Sergey

Hi Sergey,

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/.

Best wishes,
Hongyi

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

Hi Sergey,

Thank you for your help.
I will try to upgrade our TVirtualX-based GUI program.

Best wishes,
Hongyi