McCode icon indicating copy to clipboard operation
McCode copied to clipboard

mxplot/mcplot: issue with Qt6

Open farhi opened this issue 1 year ago • 8 comments

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.

farhi avatar Feb 07 '24 08:02 farhi

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

willend avatar Feb 07 '24 08:02 willend

The issue is not on our side, but rather on the pyqtgraph which has changed to PyQt6, whereas our code assumes Qt5...

farhi avatar Feb 07 '24 08:02 farhi

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?

willend avatar Feb 07 '24 09:02 willend

@farhi I guess a similar effort is needed for mc/xdisplay?

willend avatar Feb 07 '24 09:02 willend

The mcdisplay/mxdisplay seems to globally work (zoom, keys, etc). The particle ray-trace is however not displayed on my side.

farhi avatar Feb 07 '24 09:02 farhi

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

willend avatar Feb 07 '24 10:02 willend

Rays look visible here with newly installed Debian 12 Arm Screenshot 2024-02-07 at 11 12 57 Screenshot 2024-02-07 at 11 12 37

willend avatar Feb 07 '24 10:02 willend

This is to keep track as "Ready for release"

farhi avatar Mar 04 '24 16:03 farhi