sip: switch to new PyQt5 api import, with fallback to the old implementation if not found.
Also calls to setapi are not needed anymore, so use them only with the old implementation. See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966045 for reference
This commit is contained in:
parent
abfac52c34
commit
32a79f18a4
@ -16,6 +16,9 @@ getMillis = lambda: int(round(time.time() * 1000))
|
||||
|
||||
if hasattr(QtCore, 'PYQT_VERSION'):
|
||||
try:
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
except ImportError:
|
||||
import sip
|
||||
HAVE_SIP = True
|
||||
except ImportError:
|
||||
|
@ -320,6 +320,9 @@ if QT_LIB in [PYSIDE, PYSIDE2]:
|
||||
if QT_LIB in [PYQT4, PYQT5]:
|
||||
QtVersion = QtCore.QT_VERSION_STR
|
||||
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
except ImportError:
|
||||
import sip
|
||||
def isQObjectAlive(obj):
|
||||
return not sip.isdeleted(obj)
|
||||
|
@ -1083,6 +1083,9 @@ def listQThreads():
|
||||
"""Prints Thread IDs (Qt's, not OS's) for all QThreads."""
|
||||
thr = findObj('[Tt]hread')
|
||||
thr = [t for t in thr if isinstance(t, QtCore.QThread)]
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
except ImportError:
|
||||
import sip
|
||||
for t in thr:
|
||||
print("--> ", t)
|
||||
|
@ -1,4 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#try:
|
||||
# from PyQt5 import sip
|
||||
#except ImportError:
|
||||
# import sip
|
||||
# sip.setapi('QString', 1)
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
from ..Qt import QtGui, QtCore, QT_LIB
|
||||
if QT_LIB in ['PyQt4', 'PyQt5']:
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
except ImportError:
|
||||
import sip
|
||||
from .GraphicsItem import GraphicsItem
|
||||
|
||||
|
@ -2,6 +2,9 @@ from ..Qt import QtGui, QtCore, QT_LIB
|
||||
import weakref
|
||||
from .GraphicsObject import GraphicsObject
|
||||
if QT_LIB in ['PyQt4', 'PyQt5']:
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
except ImportError:
|
||||
import sip
|
||||
|
||||
__all__ = ['UIGraphicsItem']
|
||||
|
@ -25,6 +25,9 @@ if __name__ == '__main__':
|
||||
|
||||
pyqtapis = opts.pop('pyqtapis', None)
|
||||
if pyqtapis is not None:
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
except ImportError:
|
||||
import sip
|
||||
for k,v in pyqtapis.items():
|
||||
sip.setapi(k, v)
|
||||
|
@ -1,5 +1,8 @@
|
||||
from ..Qt import QtGui, QtCore, QT_LIB
|
||||
if QT_LIB in ['PyQt4', 'PyQt5']:
|
||||
try:
|
||||
from PyQt5 import sip
|
||||
except ImportError:
|
||||
import sip
|
||||
from .. import multiprocess as mp
|
||||
from .GraphicsView import GraphicsView
|
||||
|
Loading…
Reference in New Issue
Block a user