Fixing for Qt5
Just a couple test rewrites to fix for booting in PySide2
This commit is contained in:
parent
11f59669aa
commit
d912b67f7c
|
@ -712,7 +712,7 @@ class FrameGUI( ClientGUITopLevelWindows.MainFrameThatResizes, CAC.ApplicationCo
|
|||
library_versions.append( ( 'PyQt5', PYQT_VERSION_STR ) )
|
||||
library_versions.append( ( 'sip', SIP_VERSION_STR ) )
|
||||
|
||||
elif qtpy.PYSIDE6:
|
||||
elif QP.WE_ARE_PYSIDE and QP.WE_ARE_QT6:
|
||||
|
||||
import PySide6
|
||||
import shiboken6
|
||||
|
@ -720,7 +720,7 @@ class FrameGUI( ClientGUITopLevelWindows.MainFrameThatResizes, CAC.ApplicationCo
|
|||
library_versions.append( ( 'PySide6', PySide6.__version__ ) )
|
||||
library_versions.append( ( 'shiboken6', shiboken6.__version__ ) )
|
||||
|
||||
elif qtpy.PYQT6:
|
||||
elif QP.WE_ARE_PYQT and QP.WE_ARE_QT6:
|
||||
|
||||
from PyQt6.QtCore import PYQT_VERSION_STR # pylint: disable=E0401
|
||||
from PyQt6.sip import SIP_VERSION_STR # pylint: disable=E0401
|
||||
|
|
|
@ -84,11 +84,11 @@ def ConvertQtImageToNumPy( qt_image: QG.QImage ):
|
|||
|
||||
data_bytearray = qt_image.bits()
|
||||
|
||||
if QP.qtpy.PYSIDE2 or QP.qtpy.PYSIDE6:
|
||||
if QP.WE_ARE_PYSIDE:
|
||||
|
||||
data_bytes = bytes( data_bytearray )
|
||||
|
||||
elif QP.qtpy.PYQT5 or QP.qtpy.PYQT6:
|
||||
elif QP.WE_ARE_PYQT:
|
||||
|
||||
data_bytes = data_bytearray.asstring( height * width * depth )
|
||||
|
||||
|
|
|
@ -4768,7 +4768,7 @@ class ManageTagSiblings( ClientGUIScrolledPanels.ManagePanel ):
|
|||
self._original_statuses_to_pairs = original_statuses_to_pairs
|
||||
self._current_statuses_to_pairs = current_statuses_to_pairs
|
||||
|
||||
self._status_st.setText( 'Tags on the left will be appear as those on the right.' )
|
||||
self._status_st.setText( 'Tags on the left will appear as those on the right.' )
|
||||
|
||||
looking_good = True
|
||||
|
||||
|
|
|
@ -36,11 +36,22 @@ from qtpy import QtGui as QG
|
|||
import math
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
# we can't test qtpy.PYQT6 unless it has it lmao, so we'll test and assign more carefully
|
||||
|
||||
WE_ARE_QT5 = False
|
||||
WE_ARE_QT6 = False
|
||||
|
||||
WE_ARE_PYQT = False
|
||||
WE_ARE_PYSIDE = False
|
||||
|
||||
if qtpy.PYQT5:
|
||||
|
||||
from PyQt5 import sip # pylint: disable=E0401
|
||||
|
||||
WE_ARE_QT5 = True
|
||||
WE_ARE_PYQT = True
|
||||
|
||||
def isValid( obj ):
|
||||
|
||||
if isinstance( obj, sip.simplewrapper ):
|
||||
|
@ -50,10 +61,14 @@ if qtpy.PYQT5:
|
|||
|
||||
return True
|
||||
|
||||
elif qtpy.PYQT6:
|
||||
|
||||
elif hasattr( qtpy, 'PYQT6' ) and qtpy.PYQT6:
|
||||
|
||||
from PyQt6 import sip # pylint: disable=E0401
|
||||
|
||||
WE_ARE_QT6 = True
|
||||
WE_ARE_PYQT = True
|
||||
|
||||
def isValid( obj ):
|
||||
|
||||
if isinstance( obj, sip.simplewrapper ):
|
||||
|
@ -62,19 +77,25 @@ elif qtpy.PYQT6:
|
|||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
elif qtpy.PYSIDE2:
|
||||
|
||||
import shiboken2
|
||||
|
||||
WE_ARE_QT5 = True
|
||||
WE_ARE_PYSIDE = True
|
||||
|
||||
isValid = shiboken2.isValid
|
||||
|
||||
|
||||
elif qtpy.PYSIDE6:
|
||||
|
||||
import shiboken6
|
||||
|
||||
WE_ARE_QT6 = True
|
||||
WE_ARE_PYSIDE = True
|
||||
|
||||
isValid = shiboken6.isValid
|
||||
|
||||
|
||||
else:
|
||||
|
||||
raise RuntimeError( 'You need one of PySide2, PySide6, PyQt5 or PyQt6' )
|
||||
|
@ -88,12 +109,13 @@ from hydrus.client import ClientConstants as CC
|
|||
|
||||
def MonkeyPatchMissingMethods():
|
||||
|
||||
if qtpy.PYQT5 or qtpy.PYSIDE2:
|
||||
if WE_ARE_QT5:
|
||||
|
||||
QG.QMouseEvent.globalPosition = lambda self, *args, **kwargs: self.globalPos( *args, **kwargs )
|
||||
QG.QDropEvent.position = lambda self, *args, **kwargs: self.posF( *args, **kwargs )
|
||||
|
||||
if qtpy.PYQT5 or qtpy.PYQT6:
|
||||
|
||||
if WE_ARE_PYQT:
|
||||
|
||||
def MonkeyPatchGetSaveFileName( original_function ):
|
||||
|
||||
|
|
Loading…
Reference in New Issue