Merge pull request #1331 from LocutusOfBorg/new-sip

sip: switch to new PyQt5 api import, with fallback to the old impleme…
This commit is contained in:
Kenneth Lyons 2020-08-15 12:45:05 -07:00 committed by GitHub
commit ab13cd450e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 11 deletions

View File

@ -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:

View File

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

View File

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

View File

@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
#import sip
#sip.setapi('QString', 1)
#try:
# from PyQt5 import sip
#except ImportError:
# import sip
# sip.setapi('QString', 1)
import pyqtgraph as pg
pg.mkQApp()

View File

@ -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

View File

@ -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']

View File

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

View File

@ -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