diff options
Diffstat (limited to 'silx/gui/qt')
-rw-r--r-- | silx/gui/qt/__init__.py | 12 | ||||
-rw-r--r-- | silx/gui/qt/_qt.py | 23 |
2 files changed, 17 insertions, 18 deletions
diff --git a/silx/gui/qt/__init__.py b/silx/gui/qt/__init__.py index 44daa94..f7bc916 100644 --- a/silx/gui/qt/__init__.py +++ b/silx/gui/qt/__init__.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2004-2017 European Synchrotron Radiation Facility +# Copyright (c) 2004-2018 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 @@ -24,12 +24,13 @@ # ###########################################################################*/ """Common wrapper over Python Qt bindings: -- `PyQt5 <http://pyqt.sourceforge.net/Docs/PyQt5/>`_, -- `PyQt4 <http://pyqt.sourceforge.net/Docs/PyQt4/>`_ or -- `PySide <http://www.pyside.org>`_. +- `PyQt5 <http://pyqt.sourceforge.net/Docs/PyQt5/>`_ +- `PyQt4 <http://pyqt.sourceforge.net/Docs/PyQt4/>`_ +- `PySide <http://www.pyside.org>`_ +- `PySide2 <https://wiki.qt.io/PySide2>`_ If a Qt binding is already loaded, it will use it, otherwise the different -Qt bindings are tried in this order: PyQt4, PySide, PyQt5. +Qt bindings are tried in this order: PyQt5, PyQt4, PySide, PySide2. The name of the loaded Qt binding is stored in the BINDING variable. @@ -50,7 +51,6 @@ see `qtpy <https://pypi.python.org/pypi/QtPy/>`_ which provides the namespace of PyQt5 over PyQt4 and PySide. """ -import sys from ._qt import * # noqa from ._utils import * # noqa diff --git a/silx/gui/qt/_qt.py b/silx/gui/qt/_qt.py index a54ea67..6bf7d93 100644 --- a/silx/gui/qt/_qt.py +++ b/silx/gui/qt/_qt.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2004-2017 European Synchrotron Radiation Facility +# Copyright (c) 2004-2018 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 @@ -40,7 +40,7 @@ provides the namespace of PyQt5 over PyQt4, PySide and PySide2. __authors__ = ["V.A. Sole"] __license__ = "MIT" -__date__ = "11/10/2017" +__date__ = "23/05/2018" import logging @@ -78,27 +78,27 @@ elif 'PyQt4.QtCore' in sys.modules: else: # Then try Qt bindings try: - import PyQt4 # noqa + import PyQt5 # noqa except ImportError: try: - import PySide # noqa + import PyQt4 # noqa except ImportError: try: - import PyQt5 # noqa + import PySide # noqa except ImportError: try: import PySide2 # noqa except ImportError: raise ImportError( - 'No Qt wrapper found. Install PyQt4, PyQt5 or PySide2.') + 'No Qt wrapper found. Install PyQt5, PyQt4 or PySide2.') else: BINDING = 'PySide2' else: - BINDING = 'PyQt5' + BINDING = 'PySide' else: - BINDING = 'PySide' + BINDING = 'PyQt4' else: - BINDING = 'PyQt4' + BINDING = 'PyQt5' if BINDING == 'PyQt4': @@ -255,10 +255,10 @@ def exceptionHandler(type_, value, trace): The script/application willing to use it should implement code similar to: .. code-block:: python - + if __name__ == "__main__": sys.excepthook = qt.exceptionHandler - + """ _logger.error("%s %s %s", type_, value, ''.join(traceback.format_tb(trace))) msg = QMessageBox() @@ -268,4 +268,3 @@ def exceptionHandler(type_, value, trace): msg.setDetailedText(("%s " % value) + ''.join(traceback.format_tb(trace))) msg.raise_() msg.exec_() - |