diff options
author | Alexandre Marie <alexandre.marie@synchrotron-soleil.fr> | 2019-07-09 10:20:20 +0200 |
---|---|---|
committer | Alexandre Marie <alexandre.marie@synchrotron-soleil.fr> | 2019-07-09 10:20:20 +0200 |
commit | 654a6ac93513c3cc1ef97cacd782ff674c6f4559 (patch) | |
tree | 3b986e4972de7c57fa465820367602fc34bcb0d3 /silx/gui/qt/_qt.py | |
parent | a763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd (diff) |
New upstream version 0.11.0+dfsg
Diffstat (limited to 'silx/gui/qt/_qt.py')
-rw-r--r-- | silx/gui/qt/_qt.py | 30 |
1 files changed, 22 insertions, 8 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 |