McCode
McCode copied to clipboard
mxplot/mcplot: issue with Qt6
Hi, Our mcplot/mxplot default python GUI tools are currently based on Qt.
When launching the mcplot/mxplot on a recent (Debian 12 bookworm, june 2023) system with both Qt5 and Qt6, we get an error related to QtWidgets (from pyqtgraph):
File "tools/Python/mxplot/pyqtgraph/../../mccodelib/pqtgfrontend.py", line 144, in create_plotwindow
rect = QtWidgets.QApplication.desktop().screenGeometry()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'QApplication' has no attribute 'desktop'
This seems to be related to a change of behaviour/API from Qt5 -> Qt6 as handled by pyqtgraph.
For instance, we may solve locally the first issue with:
# window size
try: # pyQt5
rect = QtWidgets.QApplication.desktop().screenGeometry()
except: # pyQt6
rect = QtWidgets.QApplication.primaryScreen().size()
but we then get a further error:
File "tools/Python/mxplot/pyqtgraph/../../mccodelib/pqtgfrontend.py", line 182, in get_modifiers
return QtCore.Qt.AltModifier
^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Qt' has no attribute 'AltModifier'. Did you mean: 'Modifier'?
I have the feeling there will be a series of changes...
So there is a global issue with Qt 5,6,... evolutions wrt our python plot scripts based on pyqtgraph.
Thanks @farhi, I am also convinced there will be a good deal of work to do in this respect…
A first initial step to think of could be to explicitly require PyQt5 (in .deb recipes etc.)
The issue is not on our side, but rather on the pyqtgraph
which has changed to PyQt6, whereas our code assumes Qt5...
Yikes, disgusting!
In "conda-land" I guess we can go for pinning the pyqtgraph version to the last one still using PyQt5 - but perhaps not as easy on Debian?
@farhi I guess a similar effort is needed for mc/xdisplay?
The mcdisplay/mxdisplay seems to globally work (zoom, keys, etc). The particle ray-trace is however not displayed on my side.
Ok, thanks @farhi, could be that this has to do with default 'ray color'? Does --invcanvas
help in any way?
(I will get myself a Debian 12 vm to experiment a little, but expect slow progress... I am in bed with the flu...)
Rays look visible here with newly installed Debian 12 Arm
This is to keep track as "Ready for release"