summaryrefslogtreecommitdiff
path: root/silx/gui/qt
diff options
context:
space:
mode:
authorAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2019-07-09 10:20:20 +0200
committerAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2019-07-09 10:20:20 +0200
commit654a6ac93513c3cc1ef97cacd782ff674c6f4559 (patch)
tree3b986e4972de7c57fa465820367602fc34bcb0d3 /silx/gui/qt
parenta763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd (diff)
New upstream version 0.11.0+dfsg
Diffstat (limited to 'silx/gui/qt')
-rw-r--r--silx/gui/qt/_qt.py30
-rw-r--r--silx/gui/qt/inspect.py13
2 files changed, 31 insertions, 12 deletions
diff --git a/silx/gui/qt/_qt.py b/silx/gui/qt/_qt.py
index a4b9007..9615342 100644
--- a/silx/gui/qt/_qt.py
+++ b/silx/gui/qt/_qt.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2004-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2004-2019 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -66,17 +66,34 @@ elif 'PyQt4.QtCore' in sys.modules:
else: # Then try Qt bindings
try:
- import PyQt5 # noqa
+ import PyQt5.QtCore # noqa
except ImportError:
+ if 'PyQt5' in sys.modules:
+ del sys.modules["PyQt5"]
try:
- import PyQt4 # noqa
+ import sip
+ sip.setapi("QString", 2)
+ sip.setapi("QVariant", 2)
+ sip.setapi('QDate', 2)
+ sip.setapi('QDateTime', 2)
+ sip.setapi('QTextStream', 2)
+ sip.setapi('QTime', 2)
+ sip.setapi('QUrl', 2)
+ import PyQt4.QtCore # noqa
except ImportError:
+ if 'PyQt4' in sys.modules:
+ del sys.modules["sip"]
+ del sys.modules["PyQt4"]
try:
- import PySide2 # noqa
+ import PySide2.QtCore # noqa
except ImportError:
+ if 'PySide2' in sys.modules:
+ del sys.modules["PySide2"]
try:
- import PySide # noqa
+ import PySide.QtCore # noqa
except ImportError:
+ if 'PySide' in sys.modules:
+ del sys.modules["PySide"]
raise ImportError(
'No Qt wrapper found. Install PyQt5, PyQt4 or PySide2.')
else:
@@ -98,7 +115,6 @@ if BINDING == 'PyQt4':
if sys.version_info < (3, ):
try:
import sip
-
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
sip.setapi('QDate', 2)
@@ -210,8 +226,6 @@ elif BINDING == 'PyQt5':
elif BINDING == 'PySide2':
_logger.debug('Using PySide2 bindings')
- _logger.warning(
- 'Using PySide2 Qt binding: PySide2 support in silx is experimental!')
import PySide2 as QtBinding # noqa
diff --git a/silx/gui/qt/inspect.py b/silx/gui/qt/inspect.py
index c6c2cbe..3c08835 100644
--- a/silx/gui/qt/inspect.py
+++ b/silx/gui/qt/inspect.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2018 European Synchrotron Radiation Facility
+# Copyright (c) 2018-2019 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -62,9 +62,14 @@ if qt.BINDING in ('PyQt4', 'PyQt5'):
return not _isdeleted(obj)
elif qt.BINDING == 'PySide2':
- from PySide2.shiboken2 import isValid # noqa
- from PySide2.shiboken2 import createdByPython # noqa
- from PySide2.shiboken2 import ownedByPython # noqa
+ try:
+ from PySide2.shiboken2 import isValid # noqa
+ from PySide2.shiboken2 import createdByPython # noqa
+ from PySide2.shiboken2 import ownedByPython # noqa
+ except ImportError:
+ from shiboken2 import isValid # noqa
+ from shiboken2 import createdByPython # noqa
+ from shiboken2 import ownedByPython # noqa
elif qt.BINDING == 'PySide':
try: # Available through PySide