labscript-suite / labscript-devices

A modular and extensible plugin architecture to control experiment hardware using the 𝘭𝘒𝘣𝘴𝘀𝘳π˜ͺ𝘱𝘡 𝘴𝘢π˜ͺ𝘡𝘦.
http://labscriptsuite.org
Other
5 stars 58 forks source link

Replace QtGui.QSizePolicy β†’ QtWidgets.QSizePolicy #92

Closed chrisjbillington closed 2 years ago

chrisjbillington commented 2 years ago

The former doesn't exist in PyQt5 or PySide2, causing BLACS to fail to load ImaqdxCamera tabs.

I do see google results for QtGui.QSizePolicy, so it existed at some point - perhaps in Qt4, and maybe provided in QtGui since then as an alias for backwards compatibility, but the alias was removed at some point.

I'm confused though because ImaqdxCamera is in common use and was written long after we moved away from PyQt4, but I don't see QtGui.QSizePolicy in PyQt5 5.9 or 5.15. 5.9 is pretty old, so ... how did this ever work? Was qtutils providing an alias? If so I don't see it doing so now.

Whatever, as long as QtWidgets.QSizePolicy works for everyone, we should be good.

If anyone wants to check if QtGui.QSizePolicy or QtWidgets.QSizePolicy exist on their systems before I merge this, would be much appreciated.

dihm commented 2 years ago

My home dev system shows this same problem now. I haven't run a camera on it in some time and I tend to update packages willy-nilly. We are having a fair bit of snow, so Monday I can check a lab installation that hasn't been updated in quite some time and see what is going on.

For my future reference, my home install has python=3.8.11, qtutils=3.0.0, pyqt=5.9.2, and qt=5.9.7

dihm commented 2 years ago

Got it!

Older in lab system also showed this issue. Tested by running the following from the interpreter

>>>from qtutils.qt import QtGui
>>>QtGui.QSizePolicy
AttributeError: module 'PyQt5.QtGui' has no attribute 'QSizePolicy'

But I opened BLACS and lo and behold, the camera tab is working just fine!

Little bit of testing later, it appears PyQt5.QtGui.QSizePolicy is being correctly redirected to QtWidgets by pyqtgraph.

>>>from qtutils.qt import QtGui
>>>import pyqtgraph as pg
>>>QtGui.QSizePolicy
<class 'PyQt5.QtWidgets.QSizePolicy'>
chrisjbillington commented 2 years ago

Good find, that makes sense! Ptqtgraph would have been doing it for backward compatibility to aid their port to Qt 5.