ALBA-Synchrotron / IcepapOSC

GNU General Public License v3.0
0 stars 8 forks source link

AttributeError: module 'PyQt5.QtGui' has no attribute 'QStyleOptionButton' #22

Closed beenje closed 2 years ago

beenje commented 2 years ago

Trying to run icepaposc with pyqt 5.12.3 raises the following exception:

Traceback (most recent call last):
File "/opt/conda/envs/icepap_client/lib/python3.9/site-packages/icepaposc/custom_widgets/square_radiobtn.py", line 26, in paintEvent
opt = QtGui.QStyleOptionButton()
AttributeError: module 'PyQt5.QtGui' has no attribute 'QStyleOptionButton'

QStyleOptionButton should be imported from QtWidgets. Same for QStyle.

I did a test with pyqt 5.6 and I could import QStyleOptionButton both from QtGui and QtWidgets modules. My understanding is that importing this from the QtGui module was deprecated and removed in recent pyqt releases. I couldn't find a PyQt5 changelog to confirm that.

I'll make the adequate MR.

marceloalcocer commented 2 years ago

I can confirm this issue affects IcepapOSC >= 0.7.1. IcepapOSC 0.5.2 is the latest release where this issue is not seen

rhomspuron commented 2 years ago

Hi @beenje and @marceloalcocer

Thanks for reporting and make a patch :).