QtPy-1.9.0/0000775000175000017500000000000013515557466013231 5ustar carloscarlos00000000000000QtPy-1.9.0/LICENSE.txt0000664000175000017500000000213013032532177015032 0ustar carloscarlos00000000000000The MIT License (MIT) Copyright (c) The Spyder Development Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. QtPy-1.9.0/MANIFEST.in0000664000175000017500000000016513251317657014762 0ustar carloscarlos00000000000000include AUTHORS.md include CHANGELOG.md include LICENSE.txt include README.md recursive-include qtpy/tests *.py *.ui QtPy-1.9.0/QtPy.egg-info/0000775000175000017500000000000013515557466015620 5ustar carloscarlos00000000000000QtPy-1.9.0/QtPy.egg-info/PKG-INFO0000664000175000017500000001122413515557466016715 0ustar carloscarlos00000000000000Metadata-Version: 2.1 Name: QtPy Version: 1.9.0 Summary: Provides an abstraction layer on top of the various Qt bindings (PyQt5, PyQt4 and PySide) and additional custom QWidgets. Home-page: https://github.com/spyder-ide/qtpy Author: Colin Duquesnoy, The Spyder Development Team Author-email: goanpeca@gmail.com Maintainer: Gonzalo Peña-Castellanos Maintainer-email: goanpeca@gmail.com License: MIT Description: # QtPy: Abstraction layer for PyQt5/PyQt4/PySide2/PySide [![license](https://img.shields.io/pypi/l/qtpy.svg)](./LICENSE) [![pypi version](https://img.shields.io/pypi/v/qtpy.svg)](https://pypi.org/project/QtPy/) [![conda version](https://img.shields.io/conda/vn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![download count](https://img.shields.io/conda/dn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![OpenCollective Backers](https://opencollective.com/spyder/backers/badge.svg?color=blue)](#backers) [![Join the chat at https://gitter.im/spyder-ide/public](https://badges.gitter.im/spyder-ide/spyder.svg)](https://gitter.im/spyder-ide/public)
[![PyPI status](https://img.shields.io/pypi/status/qtpy.svg)](https://github.com/spyder-ide/qtpy) [![Build status](https://ci.appveyor.com/api/projects/status/62y6i02vhn4hefg0/branch/master?svg=true)](https://ci.appveyor.com/project/spyder-ide/qtpy/branch/master) [![CircleCI](https://circleci.com/gh/spyder-ide/qtpy.svg?style=shield)](https://circleci.com/gh/spyder-ide/qtpy) [![Coverage Status](https://coveralls.io/repos/github/spyder-ide/qtpy/badge.svg?branch=master)](https://coveralls.io/github/spyder-ide/qtpy?branch=master) *Copyright © 2009–2019 The Spyder Development Team* ## Description **QtPy** is a small abstraction layer that lets you write applications using a single API call to either PyQt or PySide. It provides support for PyQt5, PyQt4, PySide2 and PySide using the Qt5 layout (where the QtGui module has been split into QtGui and QtWidgets). Basically, you can write your code as if you were using PySide2 but import Qt modules from `qtpy` instead of `PySide2` (or `PyQt5`) ### Attribution and acknowledgments This project is based on the [pyqode.qt](https://github.com/pyQode/pyqode.qt) project and the [spyderlib.qt](https://github.com/spyder-ide/spyder/tree/2.3/spyderlib/qt) module from the [Spyder](https://github.com/spyder-ide/spyder) project, and also includes contributions adapted from [qt-helpers](https://github.com/glue-viz/qt-helpers), developed as part of the [glue](http://glueviz.org) project. Unlike `pyqode.qt` this is not a namespace package, so it is not tied to a particular project or namespace. ### License This project is released under the MIT license. ### Requirements You need PyQt5, PyQt4, PySide2 or PySide installed in your system to make use of QtPy. If several of these packages are found, PyQt5 is used by default unless you set the `QT_API` environment variable. `QT_API` can take the following values: * `pyqt5` (to use PyQt5). * `pyqt` or `pyqt4` (to use PyQt4). * `pyside2` (to use PySide2) * `pyside` (to use PySide). ### Installation ```bash pip install qtpy ``` or ```bash conda install qtpy ``` ## Contributing Everyone is welcome to contribute! ## Sponsors Become a sponsor to get your logo on our README on Github. [![Sponsors](https://opencollective.com/spyder/sponsors.svg)](https://opencollective.com/spyder#support) Keywords: qt PyQt4 PyQt5 PySide Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: X11 Applications :: Qt Classifier: Environment :: Win32 (MS Windows) Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Description-Content-Type: text/markdown QtPy-1.9.0/QtPy.egg-info/SOURCES.txt0000664000175000017500000000370613515557466017512 0ustar carloscarlos00000000000000AUTHORS.md CHANGELOG.md LICENSE.txt MANIFEST.in README.md setup.cfg setup.py QtPy.egg-info/PKG-INFO QtPy.egg-info/SOURCES.txt QtPy.egg-info/dependency_links.txt QtPy.egg-info/top_level.txt qtpy/Qt3DAnimation.py qtpy/Qt3DCore.py qtpy/Qt3DExtras.py qtpy/Qt3DInput.py qtpy/Qt3DLogic.py qtpy/Qt3DRender.py qtpy/QtCharts.py qtpy/QtCore.py qtpy/QtDatavisualization.py qtpy/QtDesigner.py qtpy/QtGui.py qtpy/QtHelp.py qtpy/QtLocation.py qtpy/QtMultimedia.py qtpy/QtMultimediaWidgets.py qtpy/QtNetwork.py qtpy/QtOpenGL.py qtpy/QtPrintSupport.py qtpy/QtQml.py qtpy/QtQuick.py qtpy/QtQuickWidgets.py qtpy/QtSql.py qtpy/QtSvg.py qtpy/QtTest.py qtpy/QtWebChannel.py qtpy/QtWebEngineWidgets.py qtpy/QtWebSockets.py qtpy/QtWidgets.py qtpy/QtXmlPatterns.py qtpy/__init__.py qtpy/_version.py qtpy/compat.py qtpy/py3compat.py qtpy/uic.py qtpy/_patch/__init__.py qtpy/_patch/qcombobox.py qtpy/_patch/qheaderview.py qtpy/tests/__init__.py qtpy/tests/conftest.py qtpy/tests/runtests.py qtpy/tests/test.ui qtpy/tests/test_custom.ui qtpy/tests/test_macos_checks.py qtpy/tests/test_main.py qtpy/tests/test_patch_qcombobox.py qtpy/tests/test_patch_qheaderview.py qtpy/tests/test_qdesktopservice_split.py qtpy/tests/test_qt3danimation.py qtpy/tests/test_qt3dcore.py qtpy/tests/test_qt3dextras.py qtpy/tests/test_qt3dinput.py qtpy/tests/test_qt3dlogic.py qtpy/tests/test_qt3drender.py qtpy/tests/test_qtcharts.py qtpy/tests/test_qtcore.py qtpy/tests/test_qtdatavisualization.py qtpy/tests/test_qtdesigner.py qtpy/tests/test_qthelp.py qtpy/tests/test_qtlocation.py qtpy/tests/test_qtmultimedia.py qtpy/tests/test_qtmultimediawidgets.py qtpy/tests/test_qtnetwork.py qtpy/tests/test_qtprintsupport.py qtpy/tests/test_qtqml.py qtpy/tests/test_qtquick.py qtpy/tests/test_qtquickwidgets.py qtpy/tests/test_qtsql.py qtpy/tests/test_qtsvg.py qtpy/tests/test_qttest.py qtpy/tests/test_qtwebchannel.py qtpy/tests/test_qtwebenginewidgets.py qtpy/tests/test_qtwebsockets.py qtpy/tests/test_qtxmlpatterns.py qtpy/tests/test_uic.pyQtPy-1.9.0/QtPy.egg-info/dependency_links.txt0000664000175000017500000000000113515557466021666 0ustar carloscarlos00000000000000 QtPy-1.9.0/QtPy.egg-info/top_level.txt0000664000175000017500000000000513515557466020345 0ustar carloscarlos00000000000000qtpy QtPy-1.9.0/qtpy/0000775000175000017500000000000013515557466014226 5ustar carloscarlos00000000000000QtPy-1.9.0/qtpy/_patch/0000775000175000017500000000000013515557466015464 5ustar carloscarlos00000000000000QtPy-1.9.0/qtpy/_patch/qcombobox.py0000664000175000017500000001004613032532177020012 0ustar carloscarlos00000000000000# The code below, as well as the associated test were adapted from # qt-helpers, which was released under a 3-Clause BSD license: # # Copyright (c) 2015, Chris Beaumont and Thomas Robitaille # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the # distribution. # * Neither the name of the Glue project nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. def patch_qcombobox(QComboBox): """ In PySide, using Python objects as userData in QComboBox causes Segmentation faults under certain conditions. Even in cases where it doesn't, findData does not work correctly. Likewise, findData also does not work correctly with Python objects when using PyQt4. On the other hand, PyQt5 deals with this case correctly. We therefore patch QComboBox when using PyQt4 and PySide to avoid issues. """ from ..QtGui import QIcon from ..QtCore import Qt, QObject class userDataWrapper(): """ This class is used to wrap any userData object. If we don't do this, then certain types of objects can cause segmentation faults or issues depending on whether/how __getitem__ is defined. """ def __init__(self, data): self.data = data _addItem = QComboBox.addItem def addItem(self, *args, **kwargs): if len(args) == 3 or (not isinstance(args[0], QIcon) and len(args) == 2): args, kwargs['userData'] = args[:-1], args[-1] if 'userData' in kwargs: kwargs['userData'] = userDataWrapper(kwargs['userData']) _addItem(self, *args, **kwargs) _insertItem = QComboBox.insertItem def insertItem(self, *args, **kwargs): if len(args) == 4 or (not isinstance(args[1], QIcon) and len(args) == 3): args, kwargs['userData'] = args[:-1], args[-1] if 'userData' in kwargs: kwargs['userData'] = userDataWrapper(kwargs['userData']) _insertItem(self, *args, **kwargs) _setItemData = QComboBox.setItemData def setItemData(self, index, value, role=Qt.UserRole): value = userDataWrapper(value) _setItemData(self, index, value, role=role) _itemData = QComboBox.itemData def itemData(self, index, role=Qt.UserRole): userData = _itemData(self, index, role=role) if isinstance(userData, userDataWrapper): userData = userData.data return userData def findData(self, value): for i in range(self.count()): if self.itemData(i) == value: return i return -1 QComboBox.addItem = addItem QComboBox.insertItem = insertItem QComboBox.setItemData = setItemData QComboBox.itemData = itemData QComboBox.findData = findDataQtPy-1.9.0/qtpy/_patch/qheaderview.py0000664000175000017500000000642013251317657020335 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) import warnings def introduce_renamed_methods_qheaderview(QHeaderView): _isClickable = QHeaderView.isClickable def sectionsClickable(self): """ QHeaderView.sectionsClickable() -> bool """ return _isClickable(self) QHeaderView.sectionsClickable = sectionsClickable def isClickable(self): warnings.warn('isClickable is only available in Qt4. Use ' 'sectionsClickable instead.', stacklevel=2) return _isClickable(self) QHeaderView.isClickable = isClickable _isMovable = QHeaderView.isMovable def sectionsMovable(self): """ QHeaderView.sectionsMovable() -> bool """ return _isMovable(self) QHeaderView.sectionsMovable = sectionsMovable def isMovable(self): warnings.warn('isMovable is only available in Qt4. Use ' 'sectionsMovable instead.', stacklevel=2) return _isMovable(self) QHeaderView.isMovable = isMovable _resizeMode = QHeaderView.resizeMode def sectionResizeMode(self, logicalIndex): """ QHeaderView.sectionResizeMode(int) -> QHeaderView.ResizeMode """ return _resizeMode(self, logicalIndex) QHeaderView.sectionResizeMode = sectionResizeMode def resizeMode(self, logicalIndex): warnings.warn('resizeMode is only available in Qt4. Use ' 'sectionResizeMode instead.', stacklevel=2) return _resizeMode(self, logicalIndex) QHeaderView.resizeMode = resizeMode _setClickable = QHeaderView.setClickable def setSectionsClickable(self, clickable): """ QHeaderView.setSectionsClickable(bool) """ return _setClickable(self, clickable) QHeaderView.setSectionsClickable = setSectionsClickable def setClickable(self, clickable): warnings.warn('setClickable is only available in Qt4. Use ' 'setSectionsClickable instead.', stacklevel=2) return _setClickable(self, clickable) QHeaderView.setClickable = setClickable _setMovable = QHeaderView.setMovable def setSectionsMovable(self, movable): """ QHeaderView.setSectionsMovable(bool) """ return _setMovable(self, movable) QHeaderView.setSectionsMovable = setSectionsMovable def setMovable(self, movable): warnings.warn('setMovable is only available in Qt4. Use ' 'setSectionsMovable instead.', stacklevel=2) return _setMovable(self, movable) QHeaderView.setMovable = setMovable _setResizeMode = QHeaderView.setResizeMode def setSectionResizeMode(self, *args): """ QHeaderView.setSectionResizeMode(QHeaderView.ResizeMode) QHeaderView.setSectionResizeMode(int, QHeaderView.ResizeMode) """ _setResizeMode(self, *args) QHeaderView.setSectionResizeMode = setSectionResizeMode def setResizeMode(self, *args): warnings.warn('setResizeMode is only available in Qt4. Use ' 'setSectionResizeMode instead.', stacklevel=2) _setResizeMode(self, *args) QHeaderView.setResizeMode = setResizeMode QtPy-1.9.0/qtpy/_patch/__init__.py0000664000175000017500000000000013032532177017545 0ustar carloscarlos00000000000000QtPy-1.9.0/qtpy/QtMultimediaWidgets.py0000664000175000017500000000114213331634713020507 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtMultimediaWidgets classes and functions.""" # Local imports from . import PYSIDE2, PYQT5, PythonQtError if PYQT5: from PyQt5.QtMultimediaWidgets import * elif PYSIDE2: from PySide2.QtMultimediaWidgets import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/_version.py0000664000175000017500000000011013515557415016406 0ustar carloscarlos00000000000000version_info = (1, 9, 0) __version__ = '.'.join(map(str, version_info)) QtPy-1.9.0/qtpy/Qt3DRender.py0000664000175000017500000000170013513032273016467 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DRender classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION from .py3compat import PY2 if PYQT5: from PyQt5.Qt3DRender import * elif PYSIDE2: if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'): # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DRender as __temp import inspect for __name in inspect.getmembers(__temp.Qt3DRender): globals()[__name[0]] = __name[1] else: raise PythonQtError('A bug in Shiboken prevents this') else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/Qt3DCore.py0000664000175000017500000000167013513032273016146 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DCore classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION from .py3compat import PY2 if PYQT5: from PyQt5.Qt3DCore import * elif PYSIDE2: if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'): # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DCore as __temp import inspect for __name in inspect.getmembers(__temp.Qt3DCore): globals()[__name[0]] = __name[1] else: raise PythonQtError('A bug in Shiboken prevents this') else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/Qt3DExtras.py0000664000175000017500000000170013513032273016516 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DExtras classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION from .py3compat import PY2 if PYQT5: from PyQt5.Qt3DExtras import * elif PYSIDE2: if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'): # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DExtras as __temp import inspect for __name in inspect.getmembers(__temp.Qt3DExtras): globals()[__name[0]] = __name[1] else: raise PythonQtError('A bug in Shiboken prevents this') else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtSql.py0000664000175000017500000000130013251317657015627 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtSql classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PYQT4, PYSIDE, PythonQtError if PYQT5: from PyQt5.QtSql import * elif PYSIDE2: from PySide2.QtSql import * elif PYQT4: from PyQt4.QtSql import * elif PYSIDE: from PySide.QtSql import * else: raise PythonQtError('No Qt bindings could be found') del PYQT4, PYQT5, PYSIDE, PYSIDE2 QtPy-1.9.0/qtpy/QtTest.py0000664000175000017500000000130113105102344015767 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Developmet Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtTest and functions """ from . import PYQT5,PYSIDE2, PYQT4, PYSIDE, PythonQtError if PYQT5: from PyQt5.QtTest import QTest elif PYSIDE2: from PySide2.QtTest import QTest elif PYQT4: from PyQt4.QtTest import QTest as OldQTest class QTest(OldQTest): @staticmethod def qWaitForWindowActive(QWidget): OldQTest.qWaitForWindowShown(QWidget) elif PYSIDE: from PySide.QtTest import QTest else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtXmlPatterns.py0000664000175000017500000000130513331634713017350 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtXmlPatterns classes and functions.""" # Local imports from . import PYQT4, PYSIDE2, PYQT5, PYSIDE, PythonQtError if PYQT5: from PyQt5.QtXmlPatterns import * elif PYSIDE2: from PySide2.QtXmlPatterns import * elif PYQT4: from PyQt4.QtXmlPatterns import * elif PYSIDE: from PySide.QtXmlPatterns import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/py3compat.py0000664000175000017500000001444313463512651016512 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2012-2013 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """ spyderlib.py3compat ------------------- Transitional module providing compatibility functions intended to help migrating from Python 2 to Python 3. This module should be fully compatible with: * Python >=v2.6 * Python 3 """ from __future__ import print_function import sys import os PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 PY33 = PY3 and sys.version_info[1] >= 3 # ============================================================================= # Data types # ============================================================================= if PY2: # Python 2 TEXT_TYPES = (str, unicode) INT_TYPES = (int, long) else: # Python 3 TEXT_TYPES = (str,) INT_TYPES = (int,) NUMERIC_TYPES = tuple(list(INT_TYPES) + [float, complex]) # ============================================================================= # Renamed/Reorganized modules # ============================================================================= if PY2: # Python 2 import __builtin__ as builtins import ConfigParser as configparser try: import _winreg as winreg except ImportError: pass from sys import maxint as maxsize try: import CStringIO as io except ImportError: import StringIO as io try: import cPickle as pickle except ImportError: import pickle from UserDict import DictMixin as MutableMapping import thread as _thread import repr as reprlib else: # Python 3 import builtins import configparser try: import winreg except ImportError: pass from sys import maxsize import io import pickle if PY33: from collections.abc import MutableMapping else: from collections import MutableMapping import _thread import reprlib # ============================================================================= # Strings # ============================================================================= if PY2: # Python 2 import codecs def u(obj): """Make unicode object""" return codecs.unicode_escape_decode(obj)[0] else: # Python 3 def u(obj): """Return string as it is""" return obj def is_text_string(obj): """Return True if `obj` is a text string, False if it is anything else, like binary data (Python 3) or QString (Python 2, PyQt API #1)""" if PY2: # Python 2 return isinstance(obj, basestring) else: # Python 3 return isinstance(obj, str) def is_binary_string(obj): """Return True if `obj` is a binary string, False if it is anything else""" if PY2: # Python 2 return isinstance(obj, str) else: # Python 3 return isinstance(obj, bytes) def is_string(obj): """Return True if `obj` is a text or binary Python string object, False if it is anything else, like a QString (Python 2, PyQt API #1)""" return is_text_string(obj) or is_binary_string(obj) def is_unicode(obj): """Return True if `obj` is unicode""" if PY2: # Python 2 return isinstance(obj, unicode) else: # Python 3 return isinstance(obj, str) def to_text_string(obj, encoding=None): """Convert `obj` to (unicode) text string""" if PY2: # Python 2 if encoding is None: return unicode(obj) else: return unicode(obj, encoding) else: # Python 3 if encoding is None: return str(obj) elif isinstance(obj, str): # In case this function is not used properly, this could happen return obj else: return str(obj, encoding) def to_binary_string(obj, encoding=None): """Convert `obj` to binary string (bytes in Python 3, str in Python 2)""" if PY2: # Python 2 if encoding is None: return str(obj) else: return obj.encode(encoding) else: # Python 3 return bytes(obj, 'utf-8' if encoding is None else encoding) # ============================================================================= # Function attributes # ============================================================================= def get_func_code(func): """Return function code object""" if PY2: # Python 2 return func.func_code else: # Python 3 return func.__code__ def get_func_name(func): """Return function name""" if PY2: # Python 2 return func.func_name else: # Python 3 return func.__name__ def get_func_defaults(func): """Return function default argument values""" if PY2: # Python 2 return func.func_defaults else: # Python 3 return func.__defaults__ # ============================================================================= # Special method attributes # ============================================================================= def get_meth_func(obj): """Return method function object""" if PY2: # Python 2 return obj.im_func else: # Python 3 return obj.__func__ def get_meth_class_inst(obj): """Return method class instance""" if PY2: # Python 2 return obj.im_self else: # Python 3 return obj.__self__ def get_meth_class(obj): """Return method class""" if PY2: # Python 2 return obj.im_class else: # Python 3 return obj.__self__.__class__ # ============================================================================= # Misc. # ============================================================================= if PY2: # Python 2 input = raw_input getcwd = os.getcwdu cmp = cmp import string str_lower = string.lower from itertools import izip_longest as zip_longest else: # Python 3 input = input getcwd = os.getcwd def cmp(a, b): return (a > b) - (a < b) str_lower = str.lower from itertools import zip_longest def qbytearray_to_str(qba): """Convert QByteArray object to str in a way compatible with Python 2/3""" return str(bytes(qba.toHex().data()).decode()) QtPy-1.9.0/qtpy/QtPrintSupport.py0000664000175000017500000000161513105102344017551 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtPrintSupport classes and functions. """ from . import PYQT5, PYQT4,PYSIDE2, PYSIDE, PythonQtError if PYQT5: from PyQt5.QtPrintSupport import * elif PYSIDE2: from PySide2.QtPrintSupport import * elif PYQT4: from PyQt4.QtGui import (QAbstractPrintDialog, QPageSetupDialog, QPrintDialog, QPrintEngine, QPrintPreviewDialog, QPrintPreviewWidget, QPrinter, QPrinterInfo) elif PYSIDE: from PySide.QtGui import (QAbstractPrintDialog, QPageSetupDialog, QPrintDialog, QPrintEngine, QPrintPreviewDialog, QPrintPreviewWidget, QPrinter, QPrinterInfo) else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/tests/0000775000175000017500000000000013515557466015370 5ustar carloscarlos00000000000000QtPy-1.9.0/qtpy/tests/test_qtxmlpatterns.py0000664000175000017500000000210013331634713021703 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYSIDE2, PYSIDE def test_qtxmlpatterns(): """Test the qtpy.QtXmlPatterns namespace""" from qtpy import QtXmlPatterns assert QtXmlPatterns.QAbstractMessageHandler is not None assert QtXmlPatterns.QAbstractUriResolver is not None assert QtXmlPatterns.QAbstractXmlNodeModel is not None assert QtXmlPatterns.QAbstractXmlReceiver is not None if not PYSIDE2 and not PYSIDE: assert QtXmlPatterns.QSimpleXmlNodeModel is not None assert QtXmlPatterns.QSourceLocation is not None assert QtXmlPatterns.QXmlFormatter is not None assert QtXmlPatterns.QXmlItem is not None assert QtXmlPatterns.QXmlName is not None assert QtXmlPatterns.QXmlNamePool is not None assert QtXmlPatterns.QXmlNodeModelIndex is not None assert QtXmlPatterns.QXmlQuery is not None assert QtXmlPatterns.QXmlResultItems is not None assert QtXmlPatterns.QXmlSchema is not None assert QtXmlPatterns.QXmlSchemaValidator is not None assert QtXmlPatterns.QXmlSerializer is not None QtPy-1.9.0/qtpy/tests/test_qtprintsupport.py0000664000175000017500000000112513105102344022106 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import QtPrintSupport def test_qtprintsupport(): """Test the qtpy.QtPrintSupport namespace""" assert QtPrintSupport.QAbstractPrintDialog is not None assert QtPrintSupport.QPageSetupDialog is not None assert QtPrintSupport.QPrintDialog is not None assert QtPrintSupport.QPrintPreviewDialog is not None assert QtPrintSupport.QPrintEngine is not None assert QtPrintSupport.QPrinter is not None assert QtPrintSupport.QPrinterInfo is not None assert QtPrintSupport.QPrintPreviewWidget is not None QtPy-1.9.0/qtpy/tests/runtests.py0000775000175000017500000000131013032532177017611 0ustar carloscarlos00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # Copyright © 2015- The Spyder Development Team # # Licensed under the terms of the MIT License # ---------------------------------------------------------------------------- """File for running tests programmatically.""" # Standard library imports import sys # Third party imports import qtpy # to ensure that Qt4 uses API v2 import pytest def main(): """Run pytest tests.""" errno = pytest.main(['-x', 'qtpy', '-v', '-rw', '--durations=10', '--cov=qtpy', '--cov-report=term-missing']) sys.exit(errno) if __name__ == '__main__': main() QtPy-1.9.0/qtpy/tests/test_patch_qcombobox.py0000664000175000017500000000615513437451346022151 0ustar carloscarlos00000000000000from __future__ import absolute_import import os import sys import pytest from qtpy import PYSIDE2, QtGui, QtWidgets PY3 = sys.version[0] == "3" def get_qapp(icon_path=None): qapp = QtWidgets.QApplication.instance() if qapp is None: qapp = QtWidgets.QApplication(['']) return qapp class Data(object): """ Test class to store in userData. The __getitem__ is needed in order to reproduce the segmentation fault. """ def __getitem__(self, item): raise ValueError("Failing") @pytest.mark.skipif(PY3 or (PYSIDE2 and os.environ.get('CI', None) is not None), reason="It segfaults in Python 3 and in our CIs with PySide2") def test_patched_qcombobox(): """ In PySide, using Python objects as userData in QComboBox causes Segmentation faults under certain conditions. Even in cases where it doesn't, findData does not work correctly. Likewise, findData also does not work correctly with Python objects when using PyQt4. On the other hand, PyQt5 deals with this case correctly. We therefore patch QComboBox when using PyQt4 and PySide to avoid issues. """ app = get_qapp() data1 = Data() data2 = Data() data3 = Data() data4 = Data() data5 = Data() data6 = Data() icon1 = QtGui.QIcon() icon2 = QtGui.QIcon() widget = QtWidgets.QComboBox() widget.addItem('a', data1) widget.insertItem(0, 'b', data2) widget.addItem('c', data1) widget.setItemData(2, data3) widget.addItem(icon1, 'd', data4) widget.insertItem(3, icon2, 'e', data5) widget.addItem(icon1, 'f') widget.insertItem(5, icon2, 'g') widget.show() assert widget.findData(data1) == 1 assert widget.findData(data2) == 0 assert widget.findData(data3) == 2 assert widget.findData(data4) == 4 assert widget.findData(data5) == 3 assert widget.findData(data6) == -1 assert widget.itemData(0) == data2 assert widget.itemData(1) == data1 assert widget.itemData(2) == data3 assert widget.itemData(3) == data5 assert widget.itemData(4) == data4 assert widget.itemData(5) is None assert widget.itemData(6) is None assert widget.itemText(0) == 'b' assert widget.itemText(1) == 'a' assert widget.itemText(2) == 'c' assert widget.itemText(3) == 'e' assert widget.itemText(4) == 'd' assert widget.itemText(5) == 'g' assert widget.itemText(6) == 'f' @pytest.mark.skipif((PYSIDE2 and os.environ.get('CI', None) is not None), reason="It segfaults in our CIs with PYSIDE2") def test_model_item(): """ This is a regression test for an issue that caused the call to item(0) below to trigger segmentation faults in PySide. The issue is non-deterministic when running the call once, so we include a loop to make sure that we trigger the fault. """ app = get_qapp() combo = QtWidgets.QComboBox() label_data = [('a', None)] for iter in range(10000): combo.clear() for i, (label, data) in enumerate(label_data): combo.addItem(label, userData=data) model = combo.model() model.item(0) QtPy-1.9.0/qtpy/tests/test_qtlocation.py0000664000175000017500000000432613331634713021146 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qtlocation(): """Test the qtpy.QtLocation namespace""" from qtpy import QtLocation assert QtLocation.QGeoCodeReply is not None assert QtLocation.QGeoCodingManager is not None assert QtLocation.QGeoCodingManagerEngine is not None assert QtLocation.QGeoManeuver is not None assert QtLocation.QGeoRoute is not None assert QtLocation.QGeoRouteReply is not None assert QtLocation.QGeoRouteRequest is not None assert QtLocation.QGeoRouteSegment is not None assert QtLocation.QGeoRoutingManager is not None assert QtLocation.QGeoRoutingManagerEngine is not None assert QtLocation.QGeoServiceProvider is not None #assert QtLocation.QGeoServiceProviderFactory is not None assert QtLocation.QPlace is not None assert QtLocation.QPlaceAttribute is not None assert QtLocation.QPlaceCategory is not None assert QtLocation.QPlaceContactDetail is not None assert QtLocation.QPlaceContent is not None assert QtLocation.QPlaceContentReply is not None assert QtLocation.QPlaceContentRequest is not None assert QtLocation.QPlaceDetailsReply is not None assert QtLocation.QPlaceEditorial is not None assert QtLocation.QPlaceIcon is not None assert QtLocation.QPlaceIdReply is not None assert QtLocation.QPlaceImage is not None assert QtLocation.QPlaceManager is not None assert QtLocation.QPlaceManagerEngine is not None assert QtLocation.QPlaceMatchReply is not None assert QtLocation.QPlaceMatchRequest is not None assert QtLocation.QPlaceProposedSearchResult is not None assert QtLocation.QPlaceRatings is not None assert QtLocation.QPlaceReply is not None assert QtLocation.QPlaceResult is not None assert QtLocation.QPlaceReview is not None assert QtLocation.QPlaceSearchReply is not None assert QtLocation.QPlaceSearchRequest is not None assert QtLocation.QPlaceSearchResult is not None assert QtLocation.QPlaceSearchSuggestionReply is not None assert QtLocation.QPlaceSupplier is not None assert QtLocation.QPlaceUser is not None QtPy-1.9.0/qtpy/tests/test_qtsql.py0000664000175000017500000000151313251317657020136 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import QtSql def test_qtsql(): """Test the qtpy.QtSql namespace""" assert QtSql.QSqlDatabase is not None assert QtSql.QSqlDriverCreatorBase is not None assert QtSql.QSqlDriver is not None assert QtSql.QSqlError is not None assert QtSql.QSqlField is not None assert QtSql.QSqlIndex is not None assert QtSql.QSqlQuery is not None assert QtSql.QSqlRecord is not None assert QtSql.QSqlResult is not None assert QtSql.QSqlQueryModel is not None assert QtSql.QSqlRelationalDelegate is not None assert QtSql.QSqlRelation is not None assert QtSql.QSqlRelationalTableModel is not None assert QtSql.QSqlTableModel is not None # Following modules are not (yet) part of any wrapper: # QSqlDriverCreator, QSqlDriverPlugin QtPy-1.9.0/qtpy/tests/test_qtcore.py0000664000175000017500000000067513340322756020272 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2, QtCore """Test QtCore.""" def test_qtmsghandler(): """Test qtpy.QtMsgHandler""" assert QtCore.qInstallMessageHandler is not None @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Targeted to PyQt5 or PySide2") def test_DateTime_toPython(): """Test QDateTime.toPython""" assert QtCore.QDateTime.toPython is not None QtPy-1.9.0/qtpy/tests/test_qtmultimedia.py0000664000175000017500000000110413361461641021460 0ustar carloscarlos00000000000000from __future__ import absolute_import import os import sys import pytest @pytest.mark.skipif(os.name == 'nt' and sys.version_info[:2] == (3, 5), reason="Conda packages don't seem to include QtMultimedia") def test_qtmultimedia(): """Test the qtpy.QtMultimedia namespace""" from qtpy import QtMultimedia assert QtMultimedia.QAbstractVideoBuffer is not None assert QtMultimedia.QAudio is not None assert QtMultimedia.QAudioDeviceInfo is not None assert QtMultimedia.QAudioInput is not None assert QtMultimedia.QSound is not None QtPy-1.9.0/qtpy/tests/test_qt3dcore.py0000664000175000017500000000376313500157371020517 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qt3dcore(): """Test the qtpy.Qt3DCore namespace""" Qt3DCore = pytest.importorskip("qtpy.Qt3DCore") assert Qt3DCore.QPropertyValueAddedChange is not None assert Qt3DCore.QSkeletonLoader is not None assert Qt3DCore.QPropertyNodeRemovedChange is not None assert Qt3DCore.QPropertyUpdatedChange is not None assert Qt3DCore.QAspectEngine is not None assert Qt3DCore.QPropertyValueAddedChangeBase is not None assert Qt3DCore.QStaticPropertyValueRemovedChangeBase is not None assert Qt3DCore.QPropertyNodeAddedChange is not None assert Qt3DCore.QDynamicPropertyUpdatedChange is not None assert Qt3DCore.QStaticPropertyUpdatedChangeBase is not None assert Qt3DCore.ChangeFlags is not None assert Qt3DCore.QAbstractAspect is not None assert Qt3DCore.QBackendNode is not None assert Qt3DCore.QTransform is not None assert Qt3DCore.QPropertyUpdatedChangeBase is not None assert Qt3DCore.QNodeId is not None assert Qt3DCore.QJoint is not None assert Qt3DCore.QSceneChange is not None assert Qt3DCore.QNodeIdTypePair is not None assert Qt3DCore.QAbstractSkeleton is not None assert Qt3DCore.QComponentRemovedChange is not None assert Qt3DCore.QComponent is not None assert Qt3DCore.QEntity is not None assert Qt3DCore.QNodeCommand is not None assert Qt3DCore.QNode is not None assert Qt3DCore.QPropertyValueRemovedChange is not None assert Qt3DCore.QPropertyValueRemovedChangeBase is not None assert Qt3DCore.QComponentAddedChange is not None assert Qt3DCore.QNodeCreatedChangeBase is not None assert Qt3DCore.QNodeDestroyedChange is not None assert Qt3DCore.QArmature is not None assert Qt3DCore.QStaticPropertyValueAddedChangeBase is not None assert Qt3DCore.ChangeFlag is not None assert Qt3DCore.QSkeleton is not None QtPy-1.9.0/qtpy/tests/test_qtquick.py0000664000175000017500000000431213331634713020445 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qtquick(): """Test the qtpy.QtQuick namespace""" from qtpy import QtQuick assert QtQuick.QQuickAsyncImageProvider is not None if not PYSIDE2: assert QtQuick.QQuickCloseEvent is not None assert QtQuick.QQuickFramebufferObject is not None assert QtQuick.QQuickImageProvider is not None assert QtQuick.QQuickImageResponse is not None assert QtQuick.QQuickItem is not None assert QtQuick.QQuickItemGrabResult is not None assert QtQuick.QQuickPaintedItem is not None assert QtQuick.QQuickRenderControl is not None assert QtQuick.QQuickTextDocument is not None assert QtQuick.QQuickTextureFactory is not None assert QtQuick.QQuickView is not None assert QtQuick.QQuickWindow is not None assert QtQuick.QSGAbstractRenderer is not None assert QtQuick.QSGBasicGeometryNode is not None assert QtQuick.QSGClipNode is not None assert QtQuick.QSGDynamicTexture is not None assert QtQuick.QSGEngine is not None if not PYSIDE2: assert QtQuick.QSGFlatColorMaterial is not None assert QtQuick.QSGGeometry is not None assert QtQuick.QSGGeometryNode is not None #assert QtQuick.QSGImageNode is not None if not PYSIDE2: assert QtQuick.QSGMaterial is not None assert QtQuick.QSGMaterialShader is not None assert QtQuick.QSGMaterialType is not None assert QtQuick.QSGNode is not None assert QtQuick.QSGOpacityNode is not None if not PYSIDE2: assert QtQuick.QSGOpaqueTextureMaterial is not None #assert QtQuick.QSGRectangleNode is not None #assert QtQuick.QSGRenderNode is not None #assert QtQuick.QSGRendererInterface is not None assert QtQuick.QSGSimpleRectNode is not None assert QtQuick.QSGSimpleTextureNode is not None assert QtQuick.QSGTexture is not None if not PYSIDE2: assert QtQuick.QSGTextureMaterial is not None assert QtQuick.QSGTextureProvider is not None assert QtQuick.QSGTransformNode is not None if not PYSIDE2: assert QtQuick.QSGVertexColorMaterial is not None QtPy-1.9.0/qtpy/tests/test_qt3dextras.py0000664000175000017500000000425413500157371021071 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qt3dextras(): """Test the qtpy.Qt3DExtras namespace""" Qt3DExtras = pytest.importorskip("qtpy.Qt3DExtras") assert Qt3DExtras.QTextureMaterial is not None assert Qt3DExtras.QPhongAlphaMaterial is not None assert Qt3DExtras.QOrbitCameraController is not None assert Qt3DExtras.QAbstractSpriteSheet is not None assert Qt3DExtras.QNormalDiffuseMapMaterial is not None assert Qt3DExtras.QDiffuseSpecularMaterial is not None assert Qt3DExtras.QSphereGeometry is not None assert Qt3DExtras.QCuboidGeometry is not None assert Qt3DExtras.QForwardRenderer is not None assert Qt3DExtras.QPhongMaterial is not None assert Qt3DExtras.QSpriteGrid is not None assert Qt3DExtras.QDiffuseMapMaterial is not None assert Qt3DExtras.QConeGeometry is not None assert Qt3DExtras.QSpriteSheetItem is not None assert Qt3DExtras.QPlaneGeometry is not None assert Qt3DExtras.QSphereMesh is not None assert Qt3DExtras.QNormalDiffuseSpecularMapMaterial is not None assert Qt3DExtras.QCuboidMesh is not None assert Qt3DExtras.QGoochMaterial is not None assert Qt3DExtras.QText2DEntity is not None assert Qt3DExtras.QTorusMesh is not None assert Qt3DExtras.Qt3DWindow is not None assert Qt3DExtras.QPerVertexColorMaterial is not None assert Qt3DExtras.QExtrudedTextGeometry is not None assert Qt3DExtras.QSkyboxEntity is not None assert Qt3DExtras.QAbstractCameraController is not None assert Qt3DExtras.QExtrudedTextMesh is not None assert Qt3DExtras.QCylinderGeometry is not None assert Qt3DExtras.QTorusGeometry is not None assert Qt3DExtras.QMorphPhongMaterial is not None assert Qt3DExtras.QPlaneMesh is not None assert Qt3DExtras.QDiffuseSpecularMapMaterial is not None assert Qt3DExtras.QSpriteSheet is not None assert Qt3DExtras.QConeMesh is not None assert Qt3DExtras.QFirstPersonCameraController is not None assert Qt3DExtras.QMetalRoughMaterial is not None assert Qt3DExtras.QCylinderMesh is not None QtPy-1.9.0/qtpy/tests/test_qthelp.py0000664000175000017500000000130313271203105020244 0ustar carloscarlos00000000000000"""Test for QtHelp namespace.""" from __future__ import absolute_import import pytest def test_qthelp(): """Test the qtpy.QtHelp namespace.""" from qtpy import QtHelp assert QtHelp.QHelpContentItem is not None assert QtHelp.QHelpContentModel is not None assert QtHelp.QHelpContentWidget is not None assert QtHelp.QHelpEngine is not None assert QtHelp.QHelpEngineCore is not None assert QtHelp.QHelpIndexModel is not None assert QtHelp.QHelpIndexWidget is not None assert QtHelp.QHelpSearchEngine is not None assert QtHelp.QHelpSearchQuery is not None assert QtHelp.QHelpSearchQueryWidget is not None assert QtHelp.QHelpSearchResultWidget is not None QtPy-1.9.0/qtpy/tests/test_qtqml.py0000664000175000017500000000260513331634713020125 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qtqml(): """Test the qtpy.QtQml namespace""" from qtpy import QtQml assert QtQml.QJSEngine is not None assert QtQml.QJSValue is not None assert QtQml.QJSValueIterator is not None assert QtQml.QQmlAbstractUrlInterceptor is not None assert QtQml.QQmlApplicationEngine is not None assert QtQml.QQmlComponent is not None assert QtQml.QQmlContext is not None assert QtQml.QQmlEngine is not None assert QtQml.QQmlImageProviderBase is not None assert QtQml.QQmlError is not None assert QtQml.QQmlExpression is not None assert QtQml.QQmlExtensionPlugin is not None assert QtQml.QQmlFileSelector is not None assert QtQml.QQmlIncubationController is not None assert QtQml.QQmlIncubator is not None if not PYSIDE2: # https://wiki.qt.io/Qt_for_Python_Missing_Bindings#QtQml assert QtQml.QQmlListProperty is not None assert QtQml.QQmlListReference is not None assert QtQml.QQmlNetworkAccessManagerFactory is not None assert QtQml.QQmlParserStatus is not None assert QtQml.QQmlProperty is not None assert QtQml.QQmlPropertyValueSource is not None assert QtQml.QQmlScriptString is not None assert QtQml.QQmlPropertyMap is not None QtPy-1.9.0/qtpy/tests/test_qdesktopservice_split.py0000664000175000017500000000242113271203105023377 0ustar carloscarlos00000000000000"""Test QDesktopServices split in Qt5.""" from __future__ import absolute_import import pytest import warnings from qtpy import PYQT4, PYSIDE def test_qstandarpath(): """Test the qtpy.QStandardPaths namespace""" from qtpy.QtCore import QStandardPaths assert QStandardPaths.StandardLocation is not None # Attributes from QDesktopServices shouldn't be in QStandardPaths with pytest.raises(AttributeError) as excinfo: QStandardPaths.setUrlHandler def test_qdesktopservice(): """Test the qtpy.QDesktopServices namespace""" from qtpy.QtGui import QDesktopServices assert QDesktopServices.setUrlHandler is not None @pytest.mark.skipif(not (PYQT4 or PYSIDE), reason="Warning is only raised in old bindings") def test_qdesktopservice_qt4_pyside(): from qtpy.QtGui import QDesktopServices # Attributes from QStandardPaths should raise a warning when imported # from QDesktopServices with warnings.catch_warnings(record=True) as w: # Cause all warnings to always be triggered. warnings.simplefilter("always") # Try to import QtHelp. QDesktopServices.StandardLocation assert len(w) == 1 assert issubclass(w[-1].category, DeprecationWarning) assert "deprecated" in str(w[-1].message) QtPy-1.9.0/qtpy/tests/test_qtnetwork.py0000664000175000017500000000350413331634713021024 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYSIDE, PYSIDE2, QtNetwork def test_qtnetwork(): """Test the qtpy.QtNetwork namespace""" assert QtNetwork.QAbstractNetworkCache is not None assert QtNetwork.QNetworkCacheMetaData is not None if not PYSIDE and not PYSIDE2: assert QtNetwork.QHttpMultiPart is not None assert QtNetwork.QHttpPart is not None assert QtNetwork.QNetworkAccessManager is not None assert QtNetwork.QNetworkCookie is not None assert QtNetwork.QNetworkCookieJar is not None assert QtNetwork.QNetworkDiskCache is not None assert QtNetwork.QNetworkReply is not None assert QtNetwork.QNetworkRequest is not None assert QtNetwork.QNetworkConfigurationManager is not None assert QtNetwork.QNetworkConfiguration is not None assert QtNetwork.QNetworkSession is not None assert QtNetwork.QAuthenticator is not None assert QtNetwork.QHostAddress is not None assert QtNetwork.QHostInfo is not None assert QtNetwork.QNetworkAddressEntry is not None assert QtNetwork.QNetworkInterface is not None assert QtNetwork.QNetworkProxy is not None assert QtNetwork.QNetworkProxyFactory is not None assert QtNetwork.QNetworkProxyQuery is not None assert QtNetwork.QAbstractSocket is not None assert QtNetwork.QLocalServer is not None assert QtNetwork.QLocalSocket is not None assert QtNetwork.QTcpServer is not None assert QtNetwork.QTcpSocket is not None assert QtNetwork.QUdpSocket is not None if not PYSIDE: assert QtNetwork.QSslCertificate is not None assert QtNetwork.QSslCipher is not None assert QtNetwork.QSslConfiguration is not None assert QtNetwork.QSslError is not None assert QtNetwork.QSslKey is not None assert QtNetwork.QSslSocket is not None QtPy-1.9.0/qtpy/tests/test_qtsvg.py0000664000175000017500000000047113271203105020120 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest def test_qtsvg(): """Test the qtpy.QtSvg namespace""" from qtpy import QtSvg assert QtSvg.QGraphicsSvgItem is not None assert QtSvg.QSvgGenerator is not None assert QtSvg.QSvgRenderer is not None assert QtSvg.QSvgWidget is not None QtPy-1.9.0/qtpy/tests/test_qtmultimediawidgets.py0000664000175000017500000000131413361461641023052 0ustar carloscarlos00000000000000from __future__ import absolute_import import os import sys import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") @pytest.mark.skipif(os.name == 'nt' and sys.version_info[:2] == (3, 5), reason="Conda packages don't seem to include QtMultimedia") def test_qtmultimediawidgets(): """Test the qtpy.QtMultimediaWidgets namespace""" from qtpy import QtMultimediaWidgets assert QtMultimediaWidgets.QCameraViewfinder is not None assert QtMultimediaWidgets.QGraphicsVideoItem is not None assert QtMultimediaWidgets.QVideoWidget is not None #assert QtMultimediaWidgets.QVideoWidgetControl is not None QtPy-1.9.0/qtpy/tests/conftest.py0000664000175000017500000000343213105102344017541 0ustar carloscarlos00000000000000import os def pytest_configure(config): """ This function gets run by py.test at the very start """ if 'USE_QT_API' in os.environ: os.environ['QT_API'] = os.environ['USE_QT_API'].lower() # We need to import qtpy here to make sure that the API versions get set # straight away. import qtpy def pytest_report_header(config): """ This function is used by py.test to insert a customized header into the test report. """ versions = os.linesep versions += 'PyQt4: ' try: from PyQt4 import Qt versions += "PyQt: {0} - Qt: {1}".format(Qt.PYQT_VERSION_STR, Qt.QT_VERSION_STR) except ImportError: versions += 'not installed' except AttributeError: versions += 'unknown version' versions += os.linesep versions += 'PyQt5: ' try: from PyQt5 import Qt versions += "PyQt: {0} - Qt: {1}".format(Qt.PYQT_VERSION_STR, Qt.QT_VERSION_STR) except ImportError: versions += 'not installed' except AttributeError: versions += 'unknown version' versions += os.linesep versions += 'PySide: ' try: import PySide from PySide import QtCore versions += "PySide: {0} - Qt: {1}".format(PySide.__version__, QtCore.__version__) except ImportError: versions += 'not installed' except AttributeError: versions += 'unknown version' versions += os.linesep versions += 'PySide2: ' try: import PySide2 from PySide2 import QtCore versions += "PySide: {0} - Qt: {1}".format(PySide2.__version__, QtCore.__version__) except ImportError: versions += 'not installed' except AttributeError: versions += 'unknown version' versions += os.linesep return versions QtPy-1.9.0/qtpy/tests/test_qt3danimation.py0000664000175000017500000000217313512576004021541 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qt3danimation(): """Test the qtpy.Qt3DAnimation namespace""" Qt3DAnimation = pytest.importorskip("qtpy.Qt3DAnimation") assert Qt3DAnimation.QAnimationController is not None assert Qt3DAnimation.QAdditiveClipBlend is not None assert Qt3DAnimation.QAbstractClipBlendNode is not None assert Qt3DAnimation.QAbstractAnimation is not None assert Qt3DAnimation.QKeyframeAnimation is not None assert Qt3DAnimation.QAbstractAnimationClip is not None assert Qt3DAnimation.QAbstractClipAnimator is not None assert Qt3DAnimation.QClipAnimator is not None assert Qt3DAnimation.QAnimationGroup is not None assert Qt3DAnimation.QLerpClipBlend is not None assert Qt3DAnimation.QMorphingAnimation is not None assert Qt3DAnimation.QAnimationAspect is not None assert Qt3DAnimation.QVertexBlendAnimation is not None assert Qt3DAnimation.QBlendedClipAnimator is not None assert Qt3DAnimation.QMorphTarget is not None QtPy-1.9.0/qtpy/tests/test_uic.py0000664000175000017500000000467713437451346017570 0ustar carloscarlos00000000000000import os import sys import contextlib import pytest from qtpy import PYSIDE2, QtWidgets from qtpy.QtWidgets import QComboBox from qtpy import uic from qtpy.uic import loadUi QCOMBOBOX_SUBCLASS = """ from qtpy.QtWidgets import QComboBox class _QComboBoxSubclass(QComboBox): pass """ @contextlib.contextmanager def enabled_qcombobox_subclass(tmpdir): """ Context manager that sets up a temporary module with a QComboBox subclass and then removes it once we are done. """ with open(tmpdir.join('qcombobox_subclass.py').strpath, 'w') as f: f.write(QCOMBOBOX_SUBCLASS) sys.path.insert(0, tmpdir.strpath) yield sys.path.pop(0) def get_qapp(icon_path=None): """ Helper function to return a QApplication instance """ qapp = QtWidgets.QApplication.instance() if qapp is None: qapp = QtWidgets.QApplication(['']) return qapp @pytest.mark.skipif((PYSIDE2 and os.environ.get('CI', None) is not None), reason="It segfaults in our CIs with PYSIDE2") def test_load_ui(): """ Make sure that the patched loadUi function behaves as expected with a simple .ui file. """ app = get_qapp() ui = loadUi(os.path.join(os.path.dirname(__file__), 'test.ui')) assert isinstance(ui.pushButton, QtWidgets.QPushButton) assert isinstance(ui.comboBox, QComboBox) @pytest.mark.skipif((PYSIDE2 and os.environ.get('CI', None) is not None), reason="It segfaults in our CIs with PYSIDE2") def test_load_ui_custom_auto(tmpdir): """ Test that we can load a .ui file with custom widgets without having to explicitly specify a dictionary of custom widgets, even in the case of PySide. """ app = get_qapp() with enabled_qcombobox_subclass(tmpdir): from qcombobox_subclass import _QComboBoxSubclass ui = loadUi(os.path.join(os.path.dirname(__file__), 'test_custom.ui')) assert isinstance(ui.pushButton, QtWidgets.QPushButton) assert isinstance(ui.comboBox, _QComboBoxSubclass) def test_load_full_uic(): """Test that we load the full uic objects for PyQt5 and PyQt4.""" QT_API = os.environ.get('QT_API', '').lower() if QT_API.startswith('pyside'): assert hasattr(uic, 'loadUi') assert not hasattr(uic, 'loadUiType') else: objects = ['compileUi', 'compileUiDir', 'loadUi', 'loadUiType', 'widgetPluginPath'] assert all([hasattr(uic, o) for o in objects]) QtPy-1.9.0/qtpy/tests/test_qt3drender.py0000664000175000017500000001306713500157371021044 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qt3drender(): """Test the qtpy.Qt3DRender namespace""" Qt3DRender = pytest.importorskip("qtpy.Qt3DRender") assert Qt3DRender.QPointSize is not None assert Qt3DRender.QFrustumCulling is not None assert Qt3DRender.QPickPointEvent is not None assert Qt3DRender.QRenderPassFilter is not None assert Qt3DRender.QMesh is not None assert Qt3DRender.QRayCaster is not None assert Qt3DRender.QStencilMask is not None assert Qt3DRender.QPickLineEvent is not None assert Qt3DRender.QPickTriangleEvent is not None assert Qt3DRender.QRenderState is not None assert Qt3DRender.QTextureWrapMode is not None assert Qt3DRender.QRenderPass is not None assert Qt3DRender.QGeometryRenderer is not None assert Qt3DRender.QAttribute is not None assert Qt3DRender.QStencilOperation is not None assert Qt3DRender.QScissorTest is not None assert Qt3DRender.QTextureCubeMapArray is not None assert Qt3DRender.QRenderTarget is not None assert Qt3DRender.QStencilTest is not None assert Qt3DRender.QTextureData is not None assert Qt3DRender.QBuffer is not None assert Qt3DRender.QLineWidth is not None assert Qt3DRender.QLayer is not None assert Qt3DRender.QTextureRectangle is not None assert Qt3DRender.QRenderTargetSelector is not None assert Qt3DRender.QPickingSettings is not None assert Qt3DRender.QCullFace is not None assert Qt3DRender.QAbstractFunctor is not None assert Qt3DRender.PropertyReaderInterface is not None assert Qt3DRender.QMaterial is not None assert Qt3DRender.QAlphaCoverage is not None assert Qt3DRender.QClearBuffers is not None assert Qt3DRender.QAlphaTest is not None assert Qt3DRender.QStencilOperationArguments is not None assert Qt3DRender.QTexture2DMultisample is not None assert Qt3DRender.QLevelOfDetailSwitch is not None assert Qt3DRender.QRenderStateSet is not None assert Qt3DRender.QViewport is not None assert Qt3DRender.QObjectPicker is not None assert Qt3DRender.QPolygonOffset is not None assert Qt3DRender.QRenderSettings is not None assert Qt3DRender.QFrontFace is not None assert Qt3DRender.QTexture3D is not None assert Qt3DRender.QTextureBuffer is not None assert Qt3DRender.QTechniqueFilter is not None assert Qt3DRender.QLayerFilter is not None assert Qt3DRender.QFilterKey is not None assert Qt3DRender.QRenderSurfaceSelector is not None assert Qt3DRender.QEnvironmentLight is not None assert Qt3DRender.QMemoryBarrier is not None assert Qt3DRender.QNoDepthMask is not None assert Qt3DRender.QBlitFramebuffer is not None assert Qt3DRender.QGraphicsApiFilter is not None assert Qt3DRender.QAbstractTexture is not None assert Qt3DRender.QRenderCaptureReply is not None assert Qt3DRender.QAbstractLight is not None assert Qt3DRender.QAbstractRayCaster is not None assert Qt3DRender.QDirectionalLight is not None assert Qt3DRender.QDispatchCompute is not None assert Qt3DRender.QBufferDataGenerator is not None assert Qt3DRender.QPointLight is not None assert Qt3DRender.QStencilTestArguments is not None assert Qt3DRender.QTexture1D is not None assert Qt3DRender.QCameraSelector is not None assert Qt3DRender.QProximityFilter is not None assert Qt3DRender.QTexture1DArray is not None assert Qt3DRender.QBlendEquation is not None assert Qt3DRender.QTextureImageDataGenerator is not None assert Qt3DRender.QSpotLight is not None assert Qt3DRender.QEffect is not None assert Qt3DRender.QSeamlessCubemap is not None assert Qt3DRender.QTexture2DMultisampleArray is not None assert Qt3DRender.QComputeCommand is not None assert Qt3DRender.QFrameGraphNode is not None assert Qt3DRender.QSortPolicy is not None assert Qt3DRender.QTextureImageData is not None assert Qt3DRender.QCamera is not None assert Qt3DRender.QGeometry is not None assert Qt3DRender.QScreenRayCaster is not None assert Qt3DRender.QClipPlane is not None assert Qt3DRender.QMultiSampleAntiAliasing is not None assert Qt3DRender.QRayCasterHit is not None assert Qt3DRender.QAbstractTextureImage is not None assert Qt3DRender.QNoDraw is not None assert Qt3DRender.QPickEvent is not None assert Qt3DRender.QRenderCapture is not None assert Qt3DRender.QDepthTest is not None assert Qt3DRender.QParameter is not None assert Qt3DRender.QLevelOfDetail is not None assert Qt3DRender.QGeometryFactory is not None assert Qt3DRender.QTexture2D is not None assert Qt3DRender.QRenderAspect is not None assert Qt3DRender.QPaintedTextureImage is not None assert Qt3DRender.QDithering is not None assert Qt3DRender.QTextureGenerator is not None assert Qt3DRender.QBlendEquationArguments is not None assert Qt3DRender.QLevelOfDetailBoundingSphere is not None assert Qt3DRender.QColorMask is not None assert Qt3DRender.QSceneLoader is not None assert Qt3DRender.QTextureLoader is not None assert Qt3DRender.QShaderProgram is not None assert Qt3DRender.QTextureCubeMap is not None assert Qt3DRender.QTexture2DArray is not None assert Qt3DRender.QTextureImage is not None assert Qt3DRender.QCameraLens is not None assert Qt3DRender.QRenderTargetOutput is not None assert Qt3DRender.QShaderProgramBuilder is not None assert Qt3DRender.QTechnique is not None assert Qt3DRender.QShaderData is not None QtPy-1.9.0/qtpy/tests/test_qtwebenginewidgets.py0000664000175000017500000000053213437451346022671 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import QtWebEngineWidgets def test_qtwebenginewidgets(): """Test the qtpy.QtWebSockets namespace""" assert QtWebEngineWidgets.QWebEnginePage is not None assert QtWebEngineWidgets.QWebEngineView is not None assert QtWebEngineWidgets.QWebEngineSettings is not None QtPy-1.9.0/qtpy/tests/test_main.py0000664000175000017500000000464613105102344017707 0ustar carloscarlos00000000000000import os from qtpy import QtCore, QtGui, QtWidgets, QtWebEngineWidgets def assert_pyside(): """ Make sure that we are using PySide """ import PySide assert QtCore.QEvent is PySide.QtCore.QEvent assert QtGui.QPainter is PySide.QtGui.QPainter assert QtWidgets.QWidget is PySide.QtGui.QWidget assert QtWebEngineWidgets.QWebEnginePage is PySide.QtWebKit.QWebPage def assert_pyside2(): """ Make sure that we are using PySide """ import PySide2 assert QtCore.QEvent is PySide2.QtCore.QEvent assert QtGui.QPainter is PySide2.QtGui.QPainter assert QtWidgets.QWidget is PySide2.QtWidgets.QWidget assert QtWebEngineWidgets.QWebEnginePage is PySide2.QtWebEngineWidgets.QWebEnginePage def assert_pyqt4(): """ Make sure that we are using PyQt4 """ import PyQt4 assert QtCore.QEvent is PyQt4.QtCore.QEvent assert QtGui.QPainter is PyQt4.QtGui.QPainter assert QtWidgets.QWidget is PyQt4.QtGui.QWidget assert QtWebEngineWidgets.QWebEnginePage is PyQt4.QtWebKit.QWebPage def assert_pyqt5(): """ Make sure that we are using PyQt5 """ import PyQt5 assert QtCore.QEvent is PyQt5.QtCore.QEvent assert QtGui.QPainter is PyQt5.QtGui.QPainter assert QtWidgets.QWidget is PyQt5.QtWidgets.QWidget if QtWebEngineWidgets.WEBENGINE: assert QtWebEngineWidgets.QWebEnginePage is PyQt5.QtWebEngineWidgets.QWebEnginePage else: assert QtWebEngineWidgets.QWebEnginePage is PyQt5.QtWebKitWidgets.QWebPage def test_qt_api(): """ If QT_API is specified, we check that the correct Qt wrapper was used """ QT_API = os.environ.get('QT_API', '').lower() if QT_API == 'pyside': assert_pyside() elif QT_API in ('pyqt', 'pyqt4'): assert_pyqt4() elif QT_API == 'pyqt5': assert_pyqt5() elif QT_API == 'pyside2': assert_pyside2() else: # If the tests are run locally, USE_QT_API and QT_API may not be # defined, but we still want to make sure qtpy is behaving sensibly. # We should then be loading, in order of decreasing preference, PyQt5, # PyQt4, and PySide. try: import PyQt5 except ImportError: try: import PyQt4 except ImportError: import PySide assert_pyside() else: assert_pyqt4() else: assert_pyqt5() QtPy-1.9.0/qtpy/tests/test_macos_checks.py0000664000175000017500000000557313350204735021416 0ustar carloscarlos00000000000000from __future__ import absolute_import import mock import platform import sys import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not PYQT5, reason="Targeted to PyQt5") @mock.patch.object(platform, 'mac_ver') def test_qt59_exception(mac_ver, monkeypatch): # Remove qtpy to reimport it again try: del sys.modules["qtpy"] except KeyError: pass # Patch stdlib to emulate a macOS system monkeypatch.setattr("sys.platform", 'darwin') mac_ver.return_value = ('10.9.2',) # Patch Qt version monkeypatch.setattr("PyQt5.QtCore.QT_VERSION_STR", '5.9.1') # This should raise an Exception with pytest.raises(Exception) as e: import qtpy assert '10.10' in str(e.value) assert '5.9' in str(e.value) @pytest.mark.skipif(not PYQT5, reason="Targeted to PyQt5") @mock.patch.object(platform, 'mac_ver') def test_qt59_no_exception(mac_ver, monkeypatch): # Remove qtpy to reimport it again try: del sys.modules["qtpy"] except KeyError: pass # Patch stdlib to emulate a macOS system monkeypatch.setattr("sys.platform", 'darwin') mac_ver.return_value = ('10.10.1',) # Patch Qt version monkeypatch.setattr("PyQt5.QtCore.QT_VERSION_STR", '5.9.5') # This should not raise an Exception try: import qtpy except Exception: pytest.fail("Error!") @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Targeted to PyQt5 or PySide2") @mock.patch.object(platform, 'mac_ver') def test_qt511_exception(mac_ver, monkeypatch): # Remove qtpy to reimport it again try: del sys.modules["qtpy"] except KeyError: pass # Patch stdlib to emulate a macOS system monkeypatch.setattr("sys.platform", 'darwin') mac_ver.return_value = ('10.10.3',) # Patch Qt version if PYQT5: monkeypatch.setattr("PyQt5.QtCore.QT_VERSION_STR", '5.11.1') else: monkeypatch.setattr("PySide2.QtCore.__version__", '5.11.1') # This should raise an Exception with pytest.raises(Exception) as e: import qtpy assert '10.11' in str(e.value) assert '5.11' in str(e.value) @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Targeted to PyQt5 or PySide2") @mock.patch.object(platform, 'mac_ver') def test_qt511_no_exception(mac_ver, monkeypatch): # Remove qtpy to reimport it again try: del sys.modules["qtpy"] except KeyError: pass # Patch stdlib to emulate a macOS system monkeypatch.setattr("sys.platform", 'darwin') mac_ver.return_value = ('10.13.2',) # Patch Qt version if PYQT5: monkeypatch.setattr("PyQt5.QtCore.QT_VERSION_STR", '5.11.1') else: monkeypatch.setattr("PySide2.QtCore.__version__", '5.11.1') # This should not raise an Exception try: import qtpy except Exception: pytest.fail("Error!") QtPy-1.9.0/qtpy/tests/test_qtdesigner.py0000664000175000017500000000270113105102344021116 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYSIDE2, PYSIDE @pytest.mark.skipif(PYSIDE2 or PYSIDE, reason="QtDesigner is not avalaible in PySide/PySide2") def test_qtdesigner(): from qtpy import QtDesigner """Test the qtpy.QtDesigner namespace""" assert QtDesigner.QAbstractExtensionFactory is not None assert QtDesigner.QAbstractExtensionManager is not None assert QtDesigner.QDesignerActionEditorInterface is not None assert QtDesigner.QDesignerContainerExtension is not None assert QtDesigner.QDesignerCustomWidgetCollectionInterface is not None assert QtDesigner.QDesignerCustomWidgetInterface is not None assert QtDesigner.QDesignerFormEditorInterface is not None assert QtDesigner.QDesignerFormWindowCursorInterface is not None assert QtDesigner.QDesignerFormWindowInterface is not None assert QtDesigner.QDesignerFormWindowManagerInterface is not None assert QtDesigner.QDesignerMemberSheetExtension is not None assert QtDesigner.QDesignerObjectInspectorInterface is not None assert QtDesigner.QDesignerPropertyEditorInterface is not None assert QtDesigner.QDesignerPropertySheetExtension is not None assert QtDesigner.QDesignerTaskMenuExtension is not None assert QtDesigner.QDesignerWidgetBoxInterface is not None assert QtDesigner.QExtensionFactory is not None assert QtDesigner.QExtensionManager is not None assert QtDesigner.QFormBuilder is not NoneQtPy-1.9.0/qtpy/tests/test_qtquickwidgets.py0000664000175000017500000000051713437451346022045 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qtquickwidgets(): """Test the qtpy.QtQuickWidgets namespace""" from qtpy import QtQuickWidgets assert QtQuickWidgets.QQuickWidget is not None QtPy-1.9.0/qtpy/tests/test_qt3dlogic.py0000664000175000017500000000060313500157371020652 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qt3dlogic(): """Test the qtpy.Qt3DLogic namespace""" Qt3DLogic = pytest.importorskip("qtpy.Qt3DLogic") assert Qt3DLogic.QLogicAspect is not None assert Qt3DLogic.QFrameAction is not None QtPy-1.9.0/qtpy/tests/test_qtwebchannel.py0000664000175000017500000000061113331634713021435 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qtwebchannel(): """Test the qtpy.QtWebChannel namespace""" from qtpy import QtWebChannel assert QtWebChannel.QWebChannel is not None assert QtWebChannel.QWebChannelAbstractTransport is not None QtPy-1.9.0/qtpy/tests/test_qtdatavisualization.py0000664000175000017500000000456413500157371023073 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qtdatavisualization(): """Test the qtpy.QtDataVisualization namespace""" QtDataVisualization = pytest.importorskip("qtpy.QtDataVisualization") assert QtDataVisualization.QScatter3DSeries is not None assert QtDataVisualization.QSurfaceDataItem is not None assert QtDataVisualization.QSurface3DSeries is not None assert QtDataVisualization.QAbstract3DInputHandler is not None assert QtDataVisualization.QHeightMapSurfaceDataProxy is not None assert QtDataVisualization.QAbstractDataProxy is not None assert QtDataVisualization.Q3DCamera is not None assert QtDataVisualization.QAbstract3DGraph is not None assert QtDataVisualization.QCustom3DVolume is not None assert QtDataVisualization.Q3DInputHandler is not None assert QtDataVisualization.QBarDataProxy is not None assert QtDataVisualization.QSurfaceDataProxy is not None assert QtDataVisualization.QScatterDataItem is not None assert QtDataVisualization.Q3DLight is not None assert QtDataVisualization.QScatterDataProxy is not None assert QtDataVisualization.QValue3DAxis is not None assert QtDataVisualization.Q3DBars is not None assert QtDataVisualization.QBarDataItem is not None assert QtDataVisualization.QItemModelBarDataProxy is not None assert QtDataVisualization.Q3DTheme is not None assert QtDataVisualization.QCustom3DItem is not None assert QtDataVisualization.QItemModelScatterDataProxy is not None assert QtDataVisualization.QValue3DAxisFormatter is not None assert QtDataVisualization.QItemModelSurfaceDataProxy is not None assert QtDataVisualization.Q3DScatter is not None assert QtDataVisualization.QTouch3DInputHandler is not None assert QtDataVisualization.QBar3DSeries is not None assert QtDataVisualization.QAbstract3DAxis is not None assert QtDataVisualization.Q3DScene is not None assert QtDataVisualization.QCategory3DAxis is not None assert QtDataVisualization.QAbstract3DSeries is not None assert QtDataVisualization.Q3DObject is not None assert QtDataVisualization.QCustom3DLabel is not None assert QtDataVisualization.Q3DSurface is not None assert QtDataVisualization.QLogValue3DAxisFormatter is not None QtPy-1.9.0/qtpy/tests/test_qtcharts.py0000664000175000017500000000045713437451346020631 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYSIDE2 @pytest.mark.skipif(not PYSIDE2, reason="Only available by default in PySide2") def test_qtcharts(): """Test the qtpy.QtCharts namespace""" from qtpy import QtCharts assert QtCharts.QtCharts.QChart is not None QtPy-1.9.0/qtpy/tests/test_qttest.py0000664000175000017500000000026013105102344020273 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import QtTest def test_qttest(): """Test the qtpy.QtTest namespace""" assert QtTest.QTest is not None QtPy-1.9.0/qtpy/tests/__init__.py0000664000175000017500000000000013105102344017437 0ustar carloscarlos00000000000000QtPy-1.9.0/qtpy/tests/test_qtwebsockets.py0000664000175000017500000000104513415770362021506 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qtwebsockets(): """Test the qtpy.QtWebSockets namespace""" from qtpy import QtWebSockets assert QtWebSockets.QMaskGenerator is not None assert QtWebSockets.QWebSocket is not None assert QtWebSockets.QWebSocketCorsAuthenticator is not None assert QtWebSockets.QWebSocketProtocol is not None assert QtWebSockets.QWebSocketServer is not None QtPy-1.9.0/qtpy/tests/test.ui0000664000175000017500000000151713032532177016674 0ustar carloscarlos00000000000000 Form 0 0 400 300 Form Ceci n'est pas un bouton QtPy-1.9.0/qtpy/tests/test_patch_qheaderview.py0000664000175000017500000000710413251317657022457 0ustar carloscarlos00000000000000from __future__ import absolute_import import sys import pytest from qtpy import PYSIDE, PYSIDE2, PYQT4 from qtpy.QtWidgets import QApplication from qtpy.QtWidgets import QHeaderView from qtpy.QtCore import Qt from qtpy.QtCore import QAbstractListModel PY3 = sys.version[0] == "3" def get_qapp(icon_path=None): qapp = QApplication.instance() if qapp is None: qapp = QApplication(['']) return qapp @pytest.mark.skipif(PY3 or PYSIDE2, reason="It fails on Python 3 and PySide2") def test_patched_qheaderview(): """ This will test whether QHeaderView has the new methods introduced in Qt5. It will then create an instance of QHeaderView and test that no exceptions are raised and that some basic behaviour works. """ assert QHeaderView.sectionsClickable is not None assert QHeaderView.sectionsMovable is not None assert QHeaderView.sectionResizeMode is not None assert QHeaderView.setSectionsClickable is not None assert QHeaderView.setSectionsMovable is not None assert QHeaderView.setSectionResizeMode is not None # setup a model and add it to a headerview qapp = get_qapp() headerview = QHeaderView(Qt.Horizontal) class Model(QAbstractListModel): pass model = Model() headerview.setModel(model) assert headerview.count() == 1 # test it assert isinstance(headerview.sectionsClickable(), bool) assert isinstance(headerview.sectionsMovable(), bool) if PYSIDE: assert isinstance(headerview.sectionResizeMode(0), QHeaderView.ResizeMode) else: assert isinstance(headerview.sectionResizeMode(0), int) headerview.setSectionsClickable(True) assert headerview.sectionsClickable() == True headerview.setSectionsClickable(False) assert headerview.sectionsClickable() == False headerview.setSectionsMovable(True) assert headerview.sectionsMovable() == True headerview.setSectionsMovable(False) assert headerview.sectionsMovable() == False headerview.setSectionResizeMode(QHeaderView.Interactive) assert headerview.sectionResizeMode(0) == QHeaderView.Interactive headerview.setSectionResizeMode(QHeaderView.Fixed) assert headerview.sectionResizeMode(0) == QHeaderView.Fixed headerview.setSectionResizeMode(QHeaderView.Stretch) assert headerview.sectionResizeMode(0) == QHeaderView.Stretch headerview.setSectionResizeMode(QHeaderView.ResizeToContents) assert headerview.sectionResizeMode(0) == QHeaderView.ResizeToContents headerview.setSectionResizeMode(0, QHeaderView.Interactive) assert headerview.sectionResizeMode(0) == QHeaderView.Interactive headerview.setSectionResizeMode(0, QHeaderView.Fixed) assert headerview.sectionResizeMode(0) == QHeaderView.Fixed headerview.setSectionResizeMode(0, QHeaderView.Stretch) assert headerview.sectionResizeMode(0) == QHeaderView.Stretch headerview.setSectionResizeMode(0, QHeaderView.ResizeToContents) assert headerview.sectionResizeMode(0) == QHeaderView.ResizeToContents # test that the old methods in Qt4 raise exceptions if PYQT4 or PYSIDE: with pytest.warns(UserWarning): headerview.isClickable() with pytest.warns(UserWarning): headerview.isMovable() with pytest.warns(UserWarning): headerview.resizeMode(0) with pytest.warns(UserWarning): headerview.setClickable(True) with pytest.warns(UserWarning): headerview.setMovable(True) with pytest.warns(UserWarning): headerview.setResizeMode(0, QHeaderView.Interactive) QtPy-1.9.0/qtpy/tests/test_qt3dinput.py0000664000175000017500000000247713500157371020727 0ustar carloscarlos00000000000000from __future__ import absolute_import import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings") def test_qt3dinput(): """Test the qtpy.Qt3DInput namespace""" Qt3DInput = pytest.importorskip("qtpy.Qt3DInput") assert Qt3DInput.QAxisAccumulator is not None assert Qt3DInput.QInputSettings is not None assert Qt3DInput.QAnalogAxisInput is not None assert Qt3DInput.QAbstractAxisInput is not None assert Qt3DInput.QMouseHandler is not None assert Qt3DInput.QButtonAxisInput is not None assert Qt3DInput.QInputSequence is not None assert Qt3DInput.QWheelEvent is not None assert Qt3DInput.QActionInput is not None assert Qt3DInput.QKeyboardDevice is not None assert Qt3DInput.QMouseDevice is not None assert Qt3DInput.QAxis is not None assert Qt3DInput.QInputChord is not None assert Qt3DInput.QMouseEvent is not None assert Qt3DInput.QKeyboardHandler is not None assert Qt3DInput.QKeyEvent is not None assert Qt3DInput.QAbstractActionInput is not None assert Qt3DInput.QInputAspect is not None assert Qt3DInput.QLogicalDevice is not None assert Qt3DInput.QAction is not None assert Qt3DInput.QAbstractPhysicalDevice is not None assert Qt3DInput.QAxisSetting is not None QtPy-1.9.0/qtpy/tests/test_custom.ui0000664000175000017500000000201213032532177020255 0ustar carloscarlos00000000000000 Form 0 0 400 300 Form Ceci n'est pas un bouton _QComboBoxSubclass QComboBox
qcombobox_subclass
QtPy-1.9.0/qtpy/compat.py0000664000175000017500000001706413463512651016060 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2009- The Spyder Development Team # Licensed under the terms of the MIT License """ Compatibility functions """ from __future__ import print_function import sys import collections from . import PYQT4 from .QtWidgets import QFileDialog from .py3compat import is_text_string, to_text_string, TEXT_TYPES # ============================================================================= # QVariant conversion utilities # ============================================================================= PYQT_API_1 = False if PYQT4: import sip try: PYQT_API_1 = sip.getapi('QVariant') == 1 # PyQt API #1 except AttributeError: # PyQt =v4.4 (API #1 and #2) and PySide >=v1.0""" # Calling QFileDialog static method if sys.platform == "win32": # On Windows platforms: redirect standard outputs _temp1, _temp2 = sys.stdout, sys.stderr sys.stdout, sys.stderr = None, None try: result = QFileDialog.getExistingDirectory(parent, caption, basedir, options) finally: if sys.platform == "win32": # On Windows platforms: restore standard outputs sys.stdout, sys.stderr = _temp1, _temp2 if not is_text_string(result): # PyQt API #1 result = to_text_string(result) return result def _qfiledialog_wrapper(attr, parent=None, caption='', basedir='', filters='', selectedfilter='', options=None): if options is None: options = QFileDialog.Options(0) try: # PyQt =v4.6 QString = None # analysis:ignore tuple_returned = True try: # PyQt >=v4.6 func = getattr(QFileDialog, attr+'AndFilter') except AttributeError: # PySide or PyQt =v4.6 output, selectedfilter = result else: # PyQt =v4.4 (API #1 and #2) and PySide >=v1.0""" return _qfiledialog_wrapper('getOpenFileName', parent=parent, caption=caption, basedir=basedir, filters=filters, selectedfilter=selectedfilter, options=options) def getopenfilenames(parent=None, caption='', basedir='', filters='', selectedfilter='', options=None): """Wrapper around QtGui.QFileDialog.getOpenFileNames static method Returns a tuple (filenames, selectedfilter) -- when dialog box is canceled, returns a tuple (empty list, empty string) Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0""" return _qfiledialog_wrapper('getOpenFileNames', parent=parent, caption=caption, basedir=basedir, filters=filters, selectedfilter=selectedfilter, options=options) def getsavefilename(parent=None, caption='', basedir='', filters='', selectedfilter='', options=None): """Wrapper around QtGui.QFileDialog.getSaveFileName static method Returns a tuple (filename, selectedfilter) -- when dialog box is canceled, returns a tuple of empty strings Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0""" return _qfiledialog_wrapper('getSaveFileName', parent=parent, caption=caption, basedir=basedir, filters=filters, selectedfilter=selectedfilter, options=options) QtPy-1.9.0/qtpy/QtQuick.py0000664000175000017500000000107613331634713016150 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQuick classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtQuick import * elif PYSIDE2: from PySide2.QtQuick import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtMultimedia.py0000664000175000017500000000056413271203105017155 0ustar carloscarlos00000000000000import warnings from . import PYQT5 from . import PYQT4 from . import PYSIDE from . import PYSIDE2 if PYQT5: from PyQt5.QtMultimedia import * elif PYSIDE2: from PySide2.QtMultimedia import * elif PYQT4: from PyQt4.QtMultimedia import * from PyQt4.QtGui import QSound elif PYSIDE: from PySide.QtMultimedia import * from PySide.QtGui import QSound QtPy-1.9.0/qtpy/QtSvg.py0000664000175000017500000000130013105102344015606 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtSvg classes and functions.""" # Local imports from . import PYQT4, PYSIDE2, PYQT5, PYSIDE, PythonQtError if PYQT5: from PyQt5.QtSvg import * elif PYSIDE2: from PySide2.QtSvg import * elif PYQT4: from PyQt4.QtSvg import * elif PYSIDE: from PySide.QtSvg import * else: raise PythonQtError('No Qt bindings could be found') del PYQT4, PYQT5, PYSIDE, PYSIDE2 QtPy-1.9.0/qtpy/QtWidgets.py0000664000175000017500000001430313105102344016464 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Developmet Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides widget classes and functions. .. warning:: Only PyQt4/PySide QtGui classes compatible with PyQt5.QtWidgets are exposed here. Therefore, you need to treat/use this package as if it were the ``PyQt5.QtWidgets`` module. """ from . import PYQT5, PYSIDE2, PYQT4, PYSIDE, PythonQtError from ._patch.qcombobox import patch_qcombobox from ._patch.qheaderview import introduce_renamed_methods_qheaderview if PYQT5: from PyQt5.QtWidgets import * elif PYSIDE2: from PySide2.QtWidgets import * elif PYQT4: from PyQt4.QtGui import * QStyleOptionViewItem = QStyleOptionViewItemV4 del QStyleOptionViewItemV4 # These objects belong to QtGui try: # Older versions of PyQt4 do not provide these del (QGlyphRun, QMatrix2x2, QMatrix2x3, QMatrix2x4, QMatrix3x2, QMatrix3x3, QMatrix3x4, QMatrix4x2, QMatrix4x3, QMatrix4x4, QQuaternion, QRadialGradient, QRawFont, QRegExpValidator, QStaticText, QTouchEvent, QVector2D, QVector3D, QVector4D, qFuzzyCompare) except NameError: pass del (QAbstractTextDocumentLayout, QActionEvent, QBitmap, QBrush, QClipboard, QCloseEvent, QColor, QConicalGradient, QContextMenuEvent, QCursor, QDesktopServices, QDoubleValidator, QDrag, QDragEnterEvent, QDragLeaveEvent, QDragMoveEvent, QDropEvent, QFileOpenEvent, QFocusEvent, QFont, QFontDatabase, QFontInfo, QFontMetrics, QFontMetricsF, QGradient, QHelpEvent, QHideEvent, QHoverEvent, QIcon, QIconDragEvent, QIconEngine, QImage, QImageIOHandler, QImageReader, QImageWriter, QInputEvent, QInputMethodEvent, QKeyEvent, QKeySequence, QLinearGradient, QMouseEvent, QMoveEvent, QMovie, QPaintDevice, QPaintEngine, QPaintEngineState, QPaintEvent, QPainter, QPainterPath, QPainterPathStroker, QPalette, QPen, QPicture, QPictureIO, QPixmap, QPixmapCache, QPolygon, QPolygonF, QRegion, QResizeEvent, QSessionManager, QShortcutEvent, QShowEvent, QStandardItem, QStandardItemModel, QStatusTipEvent, QSyntaxHighlighter, QTabletEvent, QTextBlock, QTextBlockFormat, QTextBlockGroup, QTextBlockUserData, QTextCharFormat, QTextCursor, QTextDocument, QTextDocumentFragment, QTextDocumentWriter, QTextFormat, QTextFragment, QTextFrame, QTextFrameFormat, QTextImageFormat, QTextInlineObject, QTextItem, QTextLayout, QTextLength, QTextLine, QTextList, QTextListFormat, QTextObject, QTextObjectInterface, QTextOption, QTextTable, QTextTableCell, QTextTableCellFormat, QTextTableFormat, QTransform, QValidator, QWhatsThisClickedEvent, QWheelEvent, QWindowStateChangeEvent, qAlpha, qBlue, qGray, qGreen, qIsGray, qRed, qRgb, qRgba, QIntValidator, QStringListModel) # These objects belong to QtPrintSupport del (QAbstractPrintDialog, QPageSetupDialog, QPrintDialog, QPrintEngine, QPrintPreviewDialog, QPrintPreviewWidget, QPrinter, QPrinterInfo) # These objects belong to QtCore del (QItemSelection, QItemSelectionModel, QItemSelectionRange, QSortFilterProxyModel) # Patch QComboBox to allow Python objects to be passed to userData patch_qcombobox(QComboBox) # QHeaderView: renamed methods introduce_renamed_methods_qheaderview(QHeaderView) elif PYSIDE: from PySide.QtGui import * QStyleOptionViewItem = QStyleOptionViewItemV4 del QStyleOptionViewItemV4 # These objects belong to QtGui del (QAbstractTextDocumentLayout, QActionEvent, QBitmap, QBrush, QClipboard, QCloseEvent, QColor, QConicalGradient, QContextMenuEvent, QCursor, QDesktopServices, QDoubleValidator, QDrag, QDragEnterEvent, QDragLeaveEvent, QDragMoveEvent, QDropEvent, QFileOpenEvent, QFocusEvent, QFont, QFontDatabase, QFontInfo, QFontMetrics, QFontMetricsF, QGradient, QHelpEvent, QHideEvent, QHoverEvent, QIcon, QIconDragEvent, QIconEngine, QImage, QImageIOHandler, QImageReader, QImageWriter, QInputEvent, QInputMethodEvent, QKeyEvent, QKeySequence, QLinearGradient, QMatrix2x2, QMatrix2x3, QMatrix2x4, QMatrix3x2, QMatrix3x3, QMatrix3x4, QMatrix4x2, QMatrix4x3, QMatrix4x4, QMouseEvent, QMoveEvent, QMovie, QPaintDevice, QPaintEngine, QPaintEngineState, QPaintEvent, QPainter, QPainterPath, QPainterPathStroker, QPalette, QPen, QPicture, QPictureIO, QPixmap, QPixmapCache, QPolygon, QPolygonF, QQuaternion, QRadialGradient, QRegExpValidator, QRegion, QResizeEvent, QSessionManager, QShortcutEvent, QShowEvent, QStandardItem, QStandardItemModel, QStatusTipEvent, QSyntaxHighlighter, QTabletEvent, QTextBlock, QTextBlockFormat, QTextBlockGroup, QTextBlockUserData, QTextCharFormat, QTextCursor, QTextDocument, QTextDocumentFragment, QTextFormat, QTextFragment, QTextFrame, QTextFrameFormat, QTextImageFormat, QTextInlineObject, QTextItem, QTextLayout, QTextLength, QTextLine, QTextList, QTextListFormat, QTextObject, QTextObjectInterface, QTextOption, QTextTable, QTextTableCell, QTextTableCellFormat, QTextTableFormat, QTouchEvent, QTransform, QValidator, QVector2D, QVector3D, QVector4D, QWhatsThisClickedEvent, QWheelEvent, QWindowStateChangeEvent, qAlpha, qBlue, qGray, qGreen, qIsGray, qRed, qRgb, qRgba, QIntValidator, QStringListModel) # These objects belong to QtPrintSupport del (QAbstractPrintDialog, QPageSetupDialog, QPrintDialog, QPrintEngine, QPrintPreviewDialog, QPrintPreviewWidget, QPrinter, QPrinterInfo) # These objects belong to QtCore del (QItemSelection, QItemSelectionModel, QItemSelectionRange, QSortFilterProxyModel) # Patch QComboBox to allow Python objects to be passed to userData patch_qcombobox(QComboBox) # QHeaderView: renamed methods introduce_renamed_methods_qheaderview(QHeaderView) else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/Qt3DLogic.py0000664000175000017500000000167413513032273016317 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DLogic classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION from .py3compat import PY2 if PYQT5: from PyQt5.Qt3DLogic import * elif PYSIDE2: if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'): # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DLogic as __temp import inspect for __name in inspect.getmembers(__temp.Qt3DLogic): globals()[__name[0]] = __name[1] else: raise PythonQtError('A bug in Shiboken prevents this') else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtWebSockets.py0000664000175000017500000000111513331634713017137 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtWebSockets classes and functions.""" # Local imports from . import PYSIDE2, PYQT5, PythonQtError if PYQT5: from PyQt5.QtWebSockets import * elif PYSIDE2: from PySide2.QtWebSockets import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/Qt3DAnimation.py0000664000175000017500000000171413513032273017174 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DAnimation classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION from .py3compat import PY2 if PYQT5: from PyQt5.Qt3DAnimation import * elif PYSIDE2: if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'): # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DAnimation as __temp import inspect for __name in inspect.getmembers(__temp.Qt3DAnimation): globals()[__name[0]] = __name[1] else: raise PythonQtError('A bug in Shiboken prevents this') else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtHelp.py0000664000175000017500000000071013271203105015744 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """QtHelp Wrapper.""" import warnings from . import PYQT5 from . import PYQT4 from . import PYSIDE from . import PYSIDE2 if PYQT5: from PyQt5.QtHelp import * elif PYSIDE2: from PySide2.QtHelp import * elif PYQT4: from PyQt4.QtHelp import * elif PYSIDE: from PySide.QtHelp import * QtPy-1.9.0/qtpy/QtWebChannel.py0000664000175000017500000000111513331634713017074 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtWebChannel classes and functions.""" # Local imports from . import PYSIDE2, PYQT5, PythonQtError if PYQT5: from PyQt5.QtWebChannel import * elif PYSIDE2: from PySide2.QtWebChannel import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtQuickWidgets.py0000664000175000017500000000112313437451346017476 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQuickWidgets classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtQuickWidgets import * elif PYSIDE2: from PySide2.QtQuickWidgets import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtDesigner.py0000664000175000017500000000061713032532177016633 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtDesigner classes and functions. """ from . import PYQT5, PYQT4, PythonQtError if PYQT5: from PyQt5.QtDesigner import * elif PYQT4: from PyQt4.QtDesigner import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtGui.py0000664000175000017500000002047213251317657015627 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtGui classes and functions. .. warning:: Only PyQt4/PySide QtGui classes compatible with PyQt5.QtGui are exposed here. Therefore, you need to treat/use this package as if it were the ``PyQt5.QtGui`` module. """ import warnings from . import PYQT5, PYQT4, PYSIDE, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtGui import * elif PYSIDE2: from PySide2.QtGui import * elif PYQT4: try: # Older versions of PyQt4 do not provide these from PyQt4.QtGui import (QGlyphRun, QMatrix2x2, QMatrix2x3, QMatrix2x4, QMatrix3x2, QMatrix3x3, QMatrix3x4, QMatrix4x2, QMatrix4x3, QMatrix4x4, QTouchEvent, QQuaternion, QRadialGradient, QRawFont, QStaticText, QVector2D, QVector3D, QVector4D, qFuzzyCompare) except ImportError: pass from PyQt4.Qt import QKeySequence, QTextCursor from PyQt4.QtGui import (QAbstractTextDocumentLayout, QActionEvent, QBitmap, QBrush, QClipboard, QCloseEvent, QColor, QConicalGradient, QContextMenuEvent, QCursor, QDoubleValidator, QDrag, QDragEnterEvent, QDragLeaveEvent, QDragMoveEvent, QDropEvent, QFileOpenEvent, QFocusEvent, QFont, QFontDatabase, QFontInfo, QFontMetrics, QFontMetricsF, QGradient, QHelpEvent, QHideEvent, QHoverEvent, QIcon, QIconDragEvent, QIconEngine, QImage, QImageIOHandler, QImageReader, QImageWriter, QInputEvent, QInputMethodEvent, QKeyEvent, QLinearGradient, QMouseEvent, QMoveEvent, QMovie, QPaintDevice, QPaintEngine, QPaintEngineState, QPaintEvent, QPainter, QPainterPath, QPainterPathStroker, QPalette, QPen, QPicture, QPictureIO, QPixmap, QPixmapCache, QPolygon, QPolygonF, QRegExpValidator, QRegion, QResizeEvent, QSessionManager, QShortcutEvent, QShowEvent, QStandardItem, QStandardItemModel, QStatusTipEvent, QSyntaxHighlighter, QTabletEvent, QTextBlock, QTextBlockFormat, QTextBlockGroup, QTextBlockUserData, QTextCharFormat, QTextDocument, QTextDocumentFragment, QTextDocumentWriter, QTextFormat, QTextFragment, QTextFrame, QTextFrameFormat, QTextImageFormat, QTextInlineObject, QTextItem, QTextLayout, QTextLength, QTextLine, QTextList, QTextListFormat, QTextObject, QTextObjectInterface, QTextOption, QTextTable, QTextTableCell, QTextTableCellFormat, QTextTableFormat, QTransform, QValidator, QWhatsThisClickedEvent, QWheelEvent, QWindowStateChangeEvent, qAlpha, qBlue, qGray, qGreen, qIsGray, qRed, qRgb, qRgba, QIntValidator) # QDesktopServices has has been split into (QDesktopServices and # QStandardPaths) in Qt5 # It only exposes QDesktopServices that are still in pyqt5 from PyQt4.QtGui import QDesktopServices as _QDesktopServices class QDesktopServices(): openUrl = _QDesktopServices.openUrl setUrlHandler = _QDesktopServices.setUrlHandler unsetUrlHandler = _QDesktopServices.unsetUrlHandler def __getattr__(self, name): attr = getattr(_QDesktopServices, name) new_name = name if name == 'storageLocation': new_name = 'writableLocation' warnings.warn(("Warning QDesktopServices.{} is deprecated in Qt5" "we recommend you use QDesktopServices.{} instead").format(name, new_name), DeprecationWarning) return attr QDesktopServices = QDesktopServices() elif PYSIDE: from PySide.QtGui import (QAbstractTextDocumentLayout, QActionEvent, QBitmap, QBrush, QClipboard, QCloseEvent, QColor, QConicalGradient, QContextMenuEvent, QCursor, QDoubleValidator, QDrag, QDragEnterEvent, QDragLeaveEvent, QDragMoveEvent, QDropEvent, QFileOpenEvent, QFocusEvent, QFont, QFontDatabase, QFontInfo, QFontMetrics, QFontMetricsF, QGradient, QHelpEvent, QHideEvent, QHoverEvent, QIcon, QIconDragEvent, QIconEngine, QImage, QImageIOHandler, QImageReader, QImageWriter, QInputEvent, QInputMethodEvent, QKeyEvent, QKeySequence, QLinearGradient, QMatrix2x2, QMatrix2x3, QMatrix2x4, QMatrix3x2, QMatrix3x3, QMatrix3x4, QMatrix4x2, QMatrix4x3, QMatrix4x4, QMouseEvent, QMoveEvent, QMovie, QPaintDevice, QPaintEngine, QPaintEngineState, QPaintEvent, QPainter, QPainterPath, QPainterPathStroker, QPalette, QPen, QPicture, QPictureIO, QPixmap, QPixmapCache, QPolygon, QPolygonF, QQuaternion, QRadialGradient, QRegExpValidator, QRegion, QResizeEvent, QSessionManager, QShortcutEvent, QShowEvent, QStandardItem, QStandardItemModel, QStatusTipEvent, QSyntaxHighlighter, QTabletEvent, QTextBlock, QTextBlockFormat, QTextBlockGroup, QTextBlockUserData, QTextCharFormat, QTextCursor, QTextDocument, QTextDocumentFragment, QTextFormat, QTextFragment, QTextFrame, QTextFrameFormat, QTextImageFormat, QTextInlineObject, QTextItem, QTextLayout, QTextLength, QTextLine, QTextList, QTextListFormat, QTextObject, QTextObjectInterface, QTextOption, QTextTable, QTextTableCell, QTextTableCellFormat, QTextTableFormat, QTouchEvent, QTransform, QValidator, QVector2D, QVector3D, QVector4D, QWhatsThisClickedEvent, QWheelEvent, QWindowStateChangeEvent, qAlpha, qBlue, qGray, qGreen, qIsGray, qRed, qRgb, qRgba, QIntValidator) # QDesktopServices has has been split into (QDesktopServices and # QStandardPaths) in Qt5 # It only exposes QDesktopServices that are still in pyqt5 from PySide.QtGui import QDesktopServices as _QDesktopServices class QDesktopServices(): openUrl = _QDesktopServices.openUrl setUrlHandler = _QDesktopServices.setUrlHandler unsetUrlHandler = _QDesktopServices.unsetUrlHandler def __getattr__(self, name): attr = getattr(_QDesktopServices, name) new_name = name if name == 'storageLocation': new_name = 'writableLocation' warnings.warn(("Warning QDesktopServices.{} is deprecated in Qt5" "we recommend you use QDesktopServices.{} instead").format(name, new_name), DeprecationWarning) return attr QDesktopServices = QDesktopServices() else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtNetwork.py0000664000175000017500000000106013105102344016503 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtNetwork classes and functions. """ from . import PYQT5, PYSIDE2, PYQT4, PYSIDE, PythonQtError if PYQT5: from PyQt5.QtNetwork import * elif PYSIDE2: from PySide2.QtNetwork import * elif PYQT4: from PyQt4.QtNetwork import * elif PYSIDE: from PySide.QtNetwork import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtQml.py0000664000175000017500000000107013331634713015617 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQml classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtQml import * elif PYSIDE2: from PySide2.QtQml import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtDatavisualization.py0000664000175000017500000000144513500157371020565 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtDataVisualization classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtDataVisualization import * elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.QtDataVisualization as __temp import inspect for __name in inspect.getmembers(__temp.QtDataVisualization): globals()[__name[0]] = __name[1] else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtLocation.py0000664000175000017500000000110713331634713016637 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtLocation classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtLocation import * elif PYSIDE2: from PySide2.QtLocation import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/__init__.py0000664000175000017500000001567713515556216016347 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2009- The Spyder Development Team # Copyright © 2014-2015 Colin Duquesnoy # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ **QtPy** is a shim over the various Python Qt bindings. It is used to write Qt binding indenpendent libraries or applications. If one of the APIs has already been imported, then it will be used. Otherwise, the shim will automatically select the first available API (PyQt5, PySide2, PyQt4 and finally PySide); in that case, you can force the use of one specific bindings (e.g. if your application is using one specific bindings and you need to use library that use QtPy) by setting up the ``QT_API`` environment variable. PyQt5 ===== For PyQt5, you don't have to set anything as it will be used automatically:: >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) PySide2 ====== Set the QT_API environment variable to 'pyside2' before importing other packages:: >>> import os >>> os.environ['QT_API'] = 'pyside2' >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) PyQt4 ===== Set the ``QT_API`` environment variable to 'pyqt' before importing any python package:: >>> import os >>> os.environ['QT_API'] = 'pyqt' >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) PySide ====== Set the QT_API environment variable to 'pyside' before importing other packages:: >>> import os >>> os.environ['QT_API'] = 'pyside' >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) """ from distutils.version import LooseVersion import os import platform import sys import warnings # Version of QtPy from ._version import __version__ class PythonQtError(RuntimeError): """Error raise if no bindings could be selected.""" pass class PythonQtWarning(Warning): """Warning if some features are not implemented in a binding.""" pass # Qt API environment variable name QT_API = 'QT_API' # Names of the expected PyQt5 api PYQT5_API = ['pyqt5'] # Names of the expected PyQt4 api PYQT4_API = [ 'pyqt', # name used in IPython.qt 'pyqt4' # pyqode.qt original name ] # Names of the expected PySide api PYSIDE_API = ['pyside'] # Names of the expected PySide2 api PYSIDE2_API = ['pyside2'] # Detecting if a binding was specified by the user binding_specified = QT_API in os.environ # Setting a default value for QT_API os.environ.setdefault(QT_API, 'pyqt5') API = os.environ[QT_API].lower() initial_api = API assert API in (PYQT5_API + PYQT4_API + PYSIDE_API + PYSIDE2_API) is_old_pyqt = is_pyqt46 = False PYQT5 = True PYQT4 = PYSIDE = PYSIDE2 = False # When `FORCE_QT_API` is set, we disregard # any previously imported python bindings. if os.environ.get('FORCE_QT_API') is not None: if 'PyQt5' in sys.modules: API = initial_api if initial_api in PYQT5_API else 'pyqt5' elif 'PySide2' in sys.modules: API = initial_api if initial_api in PYSIDE2_API else 'pyside2' elif 'PyQt4' in sys.modules: API = initial_api if initial_api in PYQT4_API else 'pyqt4' elif 'PySide' in sys.modules: API = initial_api if initial_api in PYSIDE_API else 'pyside' if API in PYQT5_API: try: from PyQt5.QtCore import PYQT_VERSION_STR as PYQT_VERSION # analysis:ignore from PyQt5.QtCore import QT_VERSION_STR as QT_VERSION # analysis:ignore PYSIDE_VERSION = None if sys.platform == 'darwin': macos_version = LooseVersion(platform.mac_ver()[0]) if macos_version < LooseVersion('10.10'): if LooseVersion(QT_VERSION) >= LooseVersion('5.9'): raise PythonQtError("Qt 5.9 or higher only works in " "macOS 10.10 or higher. Your " "program will fail in this " "system.") elif macos_version < LooseVersion('10.11'): if LooseVersion(QT_VERSION) >= LooseVersion('5.11'): raise PythonQtError("Qt 5.11 or higher only works in " "macOS 10.11 or higher. Your " "program will fail in this " "system.") del macos_version except ImportError: API = os.environ['QT_API'] = 'pyside2' if API in PYSIDE2_API: try: from PySide2 import __version__ as PYSIDE_VERSION # analysis:ignore from PySide2.QtCore import __version__ as QT_VERSION # analysis:ignore PYQT_VERSION = None PYQT5 = False PYSIDE2 = True if sys.platform == 'darwin': macos_version = LooseVersion(platform.mac_ver()[0]) if macos_version < LooseVersion('10.11'): if LooseVersion(QT_VERSION) >= LooseVersion('5.11'): raise PythonQtError("Qt 5.11 or higher only works in " "macOS 10.11 or higher. Your " "program will fail in this " "system.") del macos_version except ImportError: API = os.environ['QT_API'] = 'pyqt' if API in PYQT4_API: try: import sip try: 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) except (AttributeError, ValueError): # PyQt < v4.6 pass from PyQt4.Qt import PYQT_VERSION_STR as PYQT_VERSION # analysis:ignore from PyQt4.Qt import QT_VERSION_STR as QT_VERSION # analysis:ignore PYSIDE_VERSION = None PYQT5 = False PYQT4 = True except ImportError: API = os.environ['QT_API'] = 'pyside' else: is_old_pyqt = PYQT_VERSION.startswith(('4.4', '4.5', '4.6', '4.7')) is_pyqt46 = PYQT_VERSION.startswith('4.6') if API in PYSIDE_API: try: from PySide import __version__ as PYSIDE_VERSION # analysis:ignore from PySide.QtCore import __version__ as QT_VERSION # analysis:ignore PYQT_VERSION = None PYQT5 = PYSIDE2 = False PYSIDE = True except ImportError: raise PythonQtError('No Qt bindings could be found') # If a correct API name is passed to QT_API and it could not be found, # switches to another and informs through the warning if API != initial_api and binding_specified: warnings.warn('Selected binding "{}" could not be found, ' 'using "{}"'.format(initial_api, API), RuntimeWarning) API_NAME = {'pyqt5': 'PyQt5', 'pyqt': 'PyQt4', 'pyqt4': 'PyQt4', 'pyside': 'PySide', 'pyside2':'PySide2'}[API] if PYQT4: import sip try: API_NAME += (" (API v{0})".format(sip.getapi('QString'))) except AttributeError: pass QtPy-1.9.0/qtpy/QtCore.py0000664000175000017500000001055613437451346015775 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtCore classes and functions. """ from . import PYQT5, PYSIDE2, PYQT4, PYSIDE, PythonQtError if PYQT5: from PyQt5.QtCore import * from PyQt5.QtCore import pyqtSignal as Signal from PyQt5.QtCore import pyqtSlot as Slot from PyQt5.QtCore import pyqtProperty as Property from PyQt5.QtCore import QT_VERSION_STR as __version__ # For issue #153 from PyQt5.QtCore import QDateTime QDateTime.toPython = QDateTime.toPyDateTime # Those are imported from `import *` del pyqtSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR elif PYSIDE2: from PySide2.QtCore import * try: # may be limited to PySide-5.11a1 only from PySide2.QtGui import QStringListModel except: pass import PySide2.QtCore __version__ = PySide2.QtCore.__version__ elif PYQT4: from PyQt4.QtCore import * # Those are things we inherited from Spyder that fix crazy crashes under # some specific situations. (See #34) from PyQt4.QtCore import QCoreApplication from PyQt4.QtCore import Qt from PyQt4.QtCore import pyqtSignal as Signal from PyQt4.QtCore import pyqtSlot as Slot from PyQt4.QtCore import pyqtProperty as Property from PyQt4.QtGui import (QItemSelection, QItemSelectionModel, QItemSelectionRange, QSortFilterProxyModel, QStringListModel) from PyQt4.QtCore import QT_VERSION_STR as __version__ from PyQt4.QtCore import qInstallMsgHandler as qInstallMessageHandler # QDesktopServices has has been split into (QDesktopServices and # QStandardPaths) in Qt5 # This creates a dummy class that emulates QStandardPaths from PyQt4.QtGui import QDesktopServices as _QDesktopServices class QStandardPaths(): StandardLocation = _QDesktopServices.StandardLocation displayName = _QDesktopServices.displayName DesktopLocation = _QDesktopServices.DesktopLocation DocumentsLocation = _QDesktopServices.DocumentsLocation FontsLocation = _QDesktopServices.FontsLocation ApplicationsLocation = _QDesktopServices.ApplicationsLocation MusicLocation = _QDesktopServices.MusicLocation MoviesLocation = _QDesktopServices.MoviesLocation PicturesLocation = _QDesktopServices.PicturesLocation TempLocation = _QDesktopServices.TempLocation HomeLocation = _QDesktopServices.HomeLocation DataLocation = _QDesktopServices.DataLocation CacheLocation = _QDesktopServices.CacheLocation writableLocation = _QDesktopServices.storageLocation # Those are imported from `import *` del pyqtSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR, qInstallMsgHandler elif PYSIDE: from PySide.QtCore import * from PySide.QtGui import (QItemSelection, QItemSelectionModel, QItemSelectionRange, QSortFilterProxyModel, QStringListModel) from PySide.QtCore import qInstallMsgHandler as qInstallMessageHandler del qInstallMsgHandler # QDesktopServices has has been split into (QDesktopServices and # QStandardPaths) in Qt5 # This creates a dummy class that emulates QStandardPaths from PySide.QtGui import QDesktopServices as _QDesktopServices class QStandardPaths(): StandardLocation = _QDesktopServices.StandardLocation displayName = _QDesktopServices.displayName DesktopLocation = _QDesktopServices.DesktopLocation DocumentsLocation = _QDesktopServices.DocumentsLocation FontsLocation = _QDesktopServices.FontsLocation ApplicationsLocation = _QDesktopServices.ApplicationsLocation MusicLocation = _QDesktopServices.MusicLocation MoviesLocation = _QDesktopServices.MoviesLocation PicturesLocation = _QDesktopServices.PicturesLocation TempLocation = _QDesktopServices.TempLocation HomeLocation = _QDesktopServices.HomeLocation DataLocation = _QDesktopServices.DataLocation CacheLocation = _QDesktopServices.CacheLocation writableLocation = _QDesktopServices.storageLocation import PySide.QtCore __version__ = PySide.QtCore.__version__ else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/uic.py0000664000175000017500000002235613143616147015355 0ustar carloscarlos00000000000000import os from . import PYSIDE, PYSIDE2, PYQT4, PYQT5 from .QtWidgets import QComboBox if PYQT5: from PyQt5.uic import * elif PYQT4: from PyQt4.uic import * else: __all__ = ['loadUi'] # In PySide, loadUi does not exist, so we define it using QUiLoader, and # then make sure we expose that function. This is adapted from qt-helpers # which was released under a 3-clause BSD license: # qt-helpers - a common front-end to various Qt modules # # Copyright (c) 2015, Chris Beaumont and Thomas Robitaille # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the # distribution. # * Neither the name of the Glue project nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Which itself was based on the solution at # # https://gist.github.com/cpbotha/1b42a20c8f3eb9bb7cb8 # # which was released under the MIT license: # # Copyright (c) 2011 Sebastian Wiesner # Modifications by Charl Botha # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. if PYSIDE: from PySide.QtCore import QMetaObject from PySide.QtUiTools import QUiLoader elif PYSIDE2: from PySide2.QtCore import QMetaObject from PySide2.QtUiTools import QUiLoader class UiLoader(QUiLoader): """ Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interface in an existing instance of the top-level class if needed. This mimics the behaviour of :func:`PyQt4.uic.loadUi`. """ def __init__(self, baseinstance, customWidgets=None): """ Create a loader for the given ``baseinstance``. The user interface is created in ``baseinstance``, which must be an instance of the top-level class in the user interface to load, or a subclass thereof. ``customWidgets`` is a dictionary mapping from class name to class object for custom widgets. Usually, this should be done by calling registerCustomWidget on the QUiLoader, but with PySide 1.1.2 on Ubuntu 12.04 x86_64 this causes a segfault. ``parent`` is the parent object of this loader. """ QUiLoader.__init__(self, baseinstance) self.baseinstance = baseinstance if customWidgets is None: self.customWidgets = {} else: self.customWidgets = customWidgets def createWidget(self, class_name, parent=None, name=''): """ Function that is called for each widget defined in ui file, overridden here to populate baseinstance instead. """ if parent is None and self.baseinstance: # supposed to create the top-level widget, return the base # instance instead return self.baseinstance else: # For some reason, Line is not in the list of available # widgets, but works fine, so we have to special case it here. if class_name in self.availableWidgets() or class_name == 'Line': # create a new widget for child widgets widget = QUiLoader.createWidget(self, class_name, parent, name) else: # If not in the list of availableWidgets, must be a custom # widget. This will raise KeyError if the user has not # supplied the relevant class_name in the dictionary or if # customWidgets is empty. try: widget = self.customWidgets[class_name](parent) except KeyError: raise Exception('No custom widget ' + class_name + ' ' 'found in customWidgets') if self.baseinstance: # set an attribute for the new child widget on the base # instance, just like PyQt4.uic.loadUi does. setattr(self.baseinstance, name, widget) return widget def _get_custom_widgets(ui_file): """ This function is used to parse a ui file and look for the section, then automatically load all the custom widget classes. """ import sys import importlib from xml.etree.ElementTree import ElementTree # Parse the UI file etree = ElementTree() ui = etree.parse(ui_file) # Get the customwidgets section custom_widgets = ui.find('customwidgets') if custom_widgets is None: return {} custom_widget_classes = {} for custom_widget in custom_widgets.getchildren(): cw_class = custom_widget.find('class').text cw_header = custom_widget.find('header').text module = importlib.import_module(cw_header) custom_widget_classes[cw_class] = getattr(module, cw_class) return custom_widget_classes def loadUi(uifile, baseinstance=None, workingDirectory=None): """ Dynamically load a user interface from the given ``uifile``. ``uifile`` is a string containing a file name of the UI file to load. If ``baseinstance`` is ``None``, the a new instance of the top-level widget will be created. Otherwise, the user interface is created within the given ``baseinstance``. In this case ``baseinstance`` must be an instance of the top-level widget class in the UI file to load, or a subclass thereof. In other words, if you've created a ``QMainWindow`` interface in the designer, ``baseinstance`` must be a ``QMainWindow`` or a subclass thereof, too. You cannot load a ``QMainWindow`` UI file with a plain :class:`~PySide.QtGui.QWidget` as ``baseinstance``. :method:`~PySide.QtCore.QMetaObject.connectSlotsByName()` is called on the created user interface, so you can implemented your slots according to its conventions in your widget class. Return ``baseinstance``, if ``baseinstance`` is not ``None``. Otherwise return the newly created instance of the user interface. """ # We parse the UI file and import any required custom widgets customWidgets = _get_custom_widgets(uifile) loader = UiLoader(baseinstance, customWidgets) if workingDirectory is not None: loader.setWorkingDirectory(workingDirectory) widget = loader.load(uifile) QMetaObject.connectSlotsByName(widget) return widget QtPy-1.9.0/qtpy/QtOpenGL.py0000664000175000017500000000131713361462003016210 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtOpenGL classes and functions.""" # Local imports from . import PYQT4, PYQT5, PYSIDE, PYSIDE2, PythonQtError if PYQT5: from PyQt5.QtOpenGL import * elif PYSIDE2: from PySide2.QtOpenGL import * elif PYQT4: from PyQt4.QtOpenGL import * elif PYSIDE: from PySide.QtOpenGL import * else: raise PythonQtError('No Qt bindings could be found') del PYQT4, PYQT5, PYSIDE, PYSIDE2 QtPy-1.9.0/qtpy/Qt3DInput.py0000664000175000017500000000167413513032273016361 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DInput classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION from .py3compat import PY2 if PYQT5: from PyQt5.Qt3DInput import * elif PYSIDE2: if not PY2 or (PY2 and PYSIDE_VERSION < '5.12.4'): # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.Qt3DInput as __temp import inspect for __name in inspect.getmembers(__temp.Qt3DInput): globals()[__name[0]] = __name[1] else: raise PythonQtError('A bug in Shiboken prevents this') else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtCharts.py0000664000175000017500000000137513437451346016330 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © 2019- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtChart classes and functions.""" # Local imports from . import PYQT5, PYSIDE2, PythonQtError if PYQT5: try: from PyQt5 import QtChart as QtCharts except ImportError: raise PythonQtError('The QtChart module was not found. ' 'It needs to be installed separately for PyQt5.') elif PYSIDE2: from PySide2.QtCharts import * else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/qtpy/QtWebEngineWidgets.py0000664000175000017500000000277613437451346020304 0ustar carloscarlos00000000000000# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtWebEngineWidgets classes and functions. """ from . import PYQT5,PYSIDE2, PYQT4, PYSIDE, PythonQtError # To test if we are using WebEngine or WebKit WEBENGINE = True if PYQT5: try: from PyQt5.QtWebEngineWidgets import QWebEnginePage from PyQt5.QtWebEngineWidgets import QWebEngineView from PyQt5.QtWebEngineWidgets import QWebEngineSettings except ImportError: from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage from PyQt5.QtWebKitWidgets import QWebView as QWebEngineView from PyQt5.QtWebKit import QWebSettings as QWebEngineSettings WEBENGINE = False elif PYSIDE2: from PySide2.QtWebEngineWidgets import QWebEnginePage from PySide2.QtWebEngineWidgets import QWebEngineView from PySide2.QtWebEngineWidgets import QWebEngineSettings elif PYQT4: from PyQt4.QtWebKit import QWebPage as QWebEnginePage from PyQt4.QtWebKit import QWebView as QWebEngineView from PyQt4.QtWebKit import QWebSettings as QWebEngineSettings WEBENGINE = False elif PYSIDE: from PySide.QtWebKit import QWebPage as QWebEnginePage from PySide.QtWebKit import QWebView as QWebEngineView from PySide.QtWebKit import QWebSettings as QWebEngineSettings WEBENGINE = False else: raise PythonQtError('No Qt bindings could be found') QtPy-1.9.0/README.md0000664000175000017500000000566713437460477014524 0ustar carloscarlos00000000000000# QtPy: Abstraction layer for PyQt5/PyQt4/PySide2/PySide [![license](https://img.shields.io/pypi/l/qtpy.svg)](./LICENSE) [![pypi version](https://img.shields.io/pypi/v/qtpy.svg)](https://pypi.org/project/QtPy/) [![conda version](https://img.shields.io/conda/vn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![download count](https://img.shields.io/conda/dn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![OpenCollective Backers](https://opencollective.com/spyder/backers/badge.svg?color=blue)](#backers) [![Join the chat at https://gitter.im/spyder-ide/public](https://badges.gitter.im/spyder-ide/spyder.svg)](https://gitter.im/spyder-ide/public)
[![PyPI status](https://img.shields.io/pypi/status/qtpy.svg)](https://github.com/spyder-ide/qtpy) [![Build status](https://ci.appveyor.com/api/projects/status/62y6i02vhn4hefg0/branch/master?svg=true)](https://ci.appveyor.com/project/spyder-ide/qtpy/branch/master) [![CircleCI](https://circleci.com/gh/spyder-ide/qtpy.svg?style=shield)](https://circleci.com/gh/spyder-ide/qtpy) [![Coverage Status](https://coveralls.io/repos/github/spyder-ide/qtpy/badge.svg?branch=master)](https://coveralls.io/github/spyder-ide/qtpy?branch=master) *Copyright © 2009–2019 The Spyder Development Team* ## Description **QtPy** is a small abstraction layer that lets you write applications using a single API call to either PyQt or PySide. It provides support for PyQt5, PyQt4, PySide2 and PySide using the Qt5 layout (where the QtGui module has been split into QtGui and QtWidgets). Basically, you can write your code as if you were using PySide2 but import Qt modules from `qtpy` instead of `PySide2` (or `PyQt5`) ### Attribution and acknowledgments This project is based on the [pyqode.qt](https://github.com/pyQode/pyqode.qt) project and the [spyderlib.qt](https://github.com/spyder-ide/spyder/tree/2.3/spyderlib/qt) module from the [Spyder](https://github.com/spyder-ide/spyder) project, and also includes contributions adapted from [qt-helpers](https://github.com/glue-viz/qt-helpers), developed as part of the [glue](http://glueviz.org) project. Unlike `pyqode.qt` this is not a namespace package, so it is not tied to a particular project or namespace. ### License This project is released under the MIT license. ### Requirements You need PyQt5, PyQt4, PySide2 or PySide installed in your system to make use of QtPy. If several of these packages are found, PyQt5 is used by default unless you set the `QT_API` environment variable. `QT_API` can take the following values: * `pyqt5` (to use PyQt5). * `pyqt` or `pyqt4` (to use PyQt4). * `pyside2` (to use PySide2) * `pyside` (to use PySide). ### Installation ```bash pip install qtpy ``` or ```bash conda install qtpy ``` ## Contributing Everyone is welcome to contribute! ## Sponsors Become a sponsor to get your logo on our README on Github. [![Sponsors](https://opencollective.com/spyder/sponsors.svg)](https://opencollective.com/spyder#support) QtPy-1.9.0/CHANGELOG.md0000664000175000017500000004516013515557261015041 0ustar carloscarlos00000000000000# History of changes ## Version 1.9.0 (2019-07-23) ### New features * Add the FORCE_QT_API environment variable to keep using the Qt bindings selected with the QT_API variable and avoid switching to the currently imported bindings. This allows to have applications that import PySide and PyQt bindings at the same time (which is possible if both bindings are compiled for the same Qt version). ### Issues Closed * [Issue 195](https://github.com/spyder-ide/qtpy/issues/195) - Errors in the Qt3D modules with PySide2 5.12.4+ and Python 2 ([PR 196](https://github.com/spyder-ide/qtpy/pull/196)) * [Issue 192](https://github.com/spyder-ide/qtpy/issues/192) - Binding Selection Logic ([PR 194](https://github.com/spyder-ide/qtpy/pull/194)) In this release 2 issues were closed. ### Pull Requests Merged * [PR 196](https://github.com/spyder-ide/qtpy/pull/196) - PR: Don't load Qt3D modules for buggy versions of PySide2 ([195](https://github.com/spyder-ide/qtpy/issues/195)) * [PR 194](https://github.com/spyder-ide/qtpy/pull/194) - PR: Add FORCE_QT_API environment variable ([192](https://github.com/spyder-ide/qtpy/issues/192)) In this release 2 pull requests were closed. ---- ## Version 1.8.0 (2019-06-12) ### New features * Add support for several Qt 3D modules. ### Issues Closed * [Issue 172](https://github.com/spyder-ide/qtpy/issues/172) - Support for Qt3D ([PR 191](https://github.com/spyder-ide/qtpy/pull/191)) In this release 1 issue was closed. ### Pull Requests Merged * [PR 191](https://github.com/spyder-ide/qtpy/pull/191) - PR: Add Qt 3D bindings ([172](https://github.com/spyder-ide/qtpy/issues/172)) In this release 1 pull request was closed. ---- ## Version 1.7.1 (2019-05-05) ### Pull Requests Merged * [PR 189](https://github.com/spyder-ide/qtpy/pull/189) - PR: Skip testing PyQt4 and PySide in Python 3.5 * [PR 188](https://github.com/spyder-ide/qtpy/pull/188) - PR: Trivial maintenance tweaks * [PR 187](https://github.com/spyder-ide/qtpy/pull/187) - PR: Avoid deprecated "from collections import MutableMapping" In this release 3 pull requests were closed. ---- ## Version 1.7.0 (2019-03-16) ### New features * Add support for QtCharts. ### Pull Requests Merged * [PR 186](https://github.com/spyder-ide/qtpy/pull/186) - PR: Generate PyPI long description from README.md * [PR 183](https://github.com/spyder-ide/qtpy/pull/183) - PR: Add QtCharts module support * [PR 182](https://github.com/spyder-ide/qtpy/pull/182) - PR: Prevent warnings for equivalent APIs * [PR 176](https://github.com/spyder-ide/qtpy/pull/176) - PR: Don't warn about bindings change if user did not specify a binding In this release 4 pull requests were closed. ---- ## Version 1.6 (2019-01-12) ### New features * Add support for QtQuickWidgets. ### Issues Closed * [Issue 178](https://github.com/spyder-ide/qtpy/issues/178) - Error when import QtCore.__version__ in PySide2 ([PR 180](https://github.com/spyder-ide/qtpy/pull/180)) In this release 1 issue was closed. ### Pull Requests Merged * [PR 181](https://github.com/spyder-ide/qtpy/pull/181) - PR: Restore QWebEngineSettings for PySide2 * [PR 180](https://github.com/spyder-ide/qtpy/pull/180) - PR: Add QtCore.__version__ for PySide2 ([178](https://github.com/spyder-ide/qtpy/issues/178)) * [PR 179](https://github.com/spyder-ide/qtpy/pull/179) - PR: Add QtQuickWidgets In this release 3 pull requests were closed. ---- ## Version 1.5.2 (2018-10-20) ### Pull Requests Merged * [PR 175](https://github.com/spyder-ide/qtpy/pull/175) - PR: Fix tests * [PR 174](https://github.com/spyder-ide/qtpy/pull/174) - PR: Add support for PySide2.QtOpenGL In this release 2 pull requests were closed. ---- ## Version 1.5.1 (2018-09-18) ### Issues Closed * [Issue 170](https://github.com/spyder-ide/qtpy/issues/170) - Can't catch PythonQtError ([PR 173](https://github.com/spyder-ide/qtpy/pull/173)) In this release 1 issue was closed. ### Pull Requests Merged * [PR 173](https://github.com/spyder-ide/qtpy/pull/173) - PR: Make PythonQtError inherit from RuntimeError to be easily catchable ([170](https://github.com/spyder-ide/qtpy/issues/170)) In this release 1 pull request was closed. ---- ## Version 1.5 (2018-08-25) ### New features * Add support for QtLocation, QtMultimediaWidgets, QtQml, QtQuick, QtWebChannel, QtWebSockets and QtXmlPatterns. * Raise an error when trying to use the wrong combination of macOS and Qt versions. ### Issues Closed * [Issue 155](https://github.com/spyder-ide/qtpy/issues/155) - Add warnings for Qt 5.9 in macOS 10.9 and Qt 5.11 and macOS 10.11 ([PR 168](https://github.com/spyder-ide/qtpy/pull/168)) * [Issue 153](https://github.com/spyder-ide/qtpy/issues/153) - Shim PyQt5 ToPyDateTime for compatibility with PySide2 ([PR 169](https://github.com/spyder-ide/qtpy/pull/169)) * [Issue 123](https://github.com/spyder-ide/qtpy/issues/123) - Wrap QWebChannel module ([PR 157](https://github.com/spyder-ide/qtpy/pull/157)) In this release 3 issues were closed. ### Pull Requests Merged * [PR 169](https://github.com/spyder-ide/qtpy/pull/169) - PR: Shim PyQt5 QDateTime.toPyDateTime to QDateTime.toPython for compatibility with PySide2 ([153](https://github.com/spyder-ide/qtpy/issues/153)) * [PR 168](https://github.com/spyder-ide/qtpy/pull/168) - PR: Raise error when trying to use the wrong combination of macOS and Qt versions ([155](https://github.com/spyder-ide/qtpy/issues/155)) * [PR 167](https://github.com/spyder-ide/qtpy/pull/167) - PR: Migrate to CircleCI 2.0 * [PR 163](https://github.com/spyder-ide/qtpy/pull/163) - PR: Add QtLocation * [PR 162](https://github.com/spyder-ide/qtpy/pull/162) - PR: Update readme to remove funding appeal, harmonize with other readmes and minor fixes * [PR 161](https://github.com/spyder-ide/qtpy/pull/161) - PR: Fix pyside2 wheels install * [PR 157](https://github.com/spyder-ide/qtpy/pull/157) - PR: Add more Qt modules ([123](https://github.com/spyder-ide/qtpy/issues/123)) In this release 7 pull requests were closed. ---- ## Version 1.4.2 (2018-05-06) ### Issues Closed * [Issue 150](https://github.com/spyder-ide/qtpy/issues/150) - PySide2-5.11 alpha2 compatibility ([PR 151](https://github.com/spyder-ide/qtpy/pull/151)) * [Issue 144](https://github.com/spyder-ide/qtpy/issues/144) - ValueError: API 'QString' has already been set to version 1 at line 141 in __init__.py file. ([PR 152](https://github.com/spyder-ide/qtpy/pull/152)) In this release 2 issues were closed. ### Pull Requests Merged * [PR 152](https://github.com/spyder-ide/qtpy/pull/152) - PR: Catch ValueError when trying to set sip API ([144](https://github.com/spyder-ide/qtpy/issues/144)) * [PR 151](https://github.com/spyder-ide/qtpy/pull/151) - PR: Add a preventive change for PySide-5.11a2 ([150](https://github.com/spyder-ide/qtpy/issues/150)) * [PR 149](https://github.com/spyder-ide/qtpy/pull/149) - PR: Use Qt official wheels to run tests for PySide2 * [PR 148](https://github.com/spyder-ide/qtpy/pull/148) - PR: Remove internal conda recipe In this release 4 pull requests were closed. ---- ## Version 1.4.1 (2018-04-28) ### New features * Show a warning when QT_API is changed automatically by qtpy. ### Issues Closed * [Issue 145](https://github.com/spyder-ide/qtpy/issues/145) - Raise a warning if QT_API value is changed automatically ([PR 146](https://github.com/spyder-ide/qtpy/pull/146)) * [Issue 142](https://github.com/spyder-ide/qtpy/issues/142) - On OSX qtpy applications are forcing discrete graphics ([PR 143](https://github.com/spyder-ide/qtpy/pull/143)) In this release 2 issues were closed. ### Pull Requests Merged * [PR 147](https://github.com/spyder-ide/qtpy/pull/147) - PR: Add better compatibility with PySide2 * [PR 146](https://github.com/spyder-ide/qtpy/pull/146) - PR: Add a warning if API is changed automatically ([145](https://github.com/spyder-ide/qtpy/issues/145)) * [PR 143](https://github.com/spyder-ide/qtpy/pull/143) - PR: Avoid using PyQt5.Qt, which imports unneeded stuff and forces discrete GPU on OSX ([142](https://github.com/spyder-ide/qtpy/issues/142)) In this release 3 pull requests were closed. ---- ## Version 1.4 (2018-03-11) ### New features * Add support for QtHelp and QtSql * Use already imported bindings ### Issues Closed * [Issue 138](https://github.com/spyder-ide/qtpy/issues/138) - If one binding has already been imported, then qtpy should just use it ([PR 139](https://github.com/spyder-ide/qtpy/pull/139)) * [Issue 135](https://github.com/spyder-ide/qtpy/issues/135) - Add Wrapper for QtSql [feature request] ([PR 136](https://github.com/spyder-ide/qtpy/pull/136)) * [Issue 131](https://github.com/spyder-ide/qtpy/issues/131) - Methods missing from QStandardPaths when QT_API=pyqt4 * [Issue 127](https://github.com/spyder-ide/qtpy/issues/127) - Add Wrapper for QtHelp [feature request] ([PR 128](https://github.com/spyder-ide/qtpy/pull/128)) In this release 4 issues were closed. ### Pull Requests Merged * [PR 140](https://github.com/spyder-ide/qtpy/pull/140) - PR: Pin PyQt5 to 5.9.2 in CircleCI because 5.10 is generating segfaults * [PR 139](https://github.com/spyder-ide/qtpy/pull/139) - PR: If a Qt binding is already imported, then use it. ([138](https://github.com/spyder-ide/qtpy/issues/138)) * [PR 136](https://github.com/spyder-ide/qtpy/pull/136) - PR: Add QtSql wrapper (incl. test) ([135](https://github.com/spyder-ide/qtpy/issues/135)) * [PR 132](https://github.com/spyder-ide/qtpy/pull/132) - PR: Changes to QDesktop split * [PR 128](https://github.com/spyder-ide/qtpy/pull/128) - PR: Add QtHelp Wrapper ([127](https://github.com/spyder-ide/qtpy/issues/127)) In this release 5 pull requests were closed. ---- ## Version 1.3.1 (2017-08-21) ### Bugs fixed **Issues** * [Issue 129](https://github.com/spyder-ide/qtpy/issues/129) - Spurious cache files in PyPI tarball * [Issue 119](https://github.com/spyder-ide/qtpy/issues/119) - Importing qtpy should not raise exceptions In this release 2 issues were closed **Pull requests** * [PR 130](https://github.com/spyder-ide/qtpy/pull/130) - PR: No cache files included in the release tarball * [PR 126](https://github.com/spyder-ide/qtpy/pull/126) - PR: Remove Quantified Code badge because the service doesn't exist anymore * [PR 121](https://github.com/spyder-ide/qtpy/pull/121) - PR: Warn if QHeaderView deprecated methods are used In this release 3 pull requests were merged ---- ## Version 1.3 (2017-08-12) ### New features * Add support for PySide2 and PyQt 4.6 ### Bugs fixed **Issues** * [Issue 124](https://github.com/spyder-ide/qtpy/issues/124) - Typo in readme title * [Issue 111](https://github.com/spyder-ide/qtpy/issues/111) - Update Readme for 1.3 release * [Issue 110](https://github.com/spyder-ide/qtpy/issues/110) - Add tests for untested modules * [Issue 101](https://github.com/spyder-ide/qtpy/issues/101) - Missing: QtOpenGL Module * [Issue 89](https://github.com/spyder-ide/qtpy/issues/89) - QDesktopServices split into QDesktopServices and QStandardPaths * [Issue 57](https://github.com/spyder-ide/qtpy/issues/57) - qInstallMessageHandler <-> qInstallMsgHandler * [Issue 15](https://github.com/spyder-ide/qtpy/issues/15) - Feature Request: PySide2 support In this release 7 issues were closed **Pull requests** * [PR 125](https://github.com/spyder-ide/qtpy/pull/125) - PR: Fix typo in Readme. * [PR 117](https://github.com/spyder-ide/qtpy/pull/117) - PR: Add compatibility for the rename of qInstallMsgHandler to qInstallMessageHandler * [PR 115](https://github.com/spyder-ide/qtpy/pull/115) - PR: Update Readme to reflect that we actually use the PySide2 layout * [PR 114](https://github.com/spyder-ide/qtpy/pull/114) - PR: Update Readme to mention that we now support PySide2. * [PR 113](https://github.com/spyder-ide/qtpy/pull/113) - PR: Add tests for Qtdesigner, QtNetwork, QtPrintSupport, QtSvg and QtTest. * [PR 112](https://github.com/spyder-ide/qtpy/pull/112) - PR: Follow QStandardPaths location in Qt5 for PyQt4/PySide * [PR 109](https://github.com/spyder-ide/qtpy/pull/109) - PR: Add a coveragerc file * [PR 106](https://github.com/spyder-ide/qtpy/pull/106) - PR: Add support for PyQt 4.6 * [PR 102](https://github.com/spyder-ide/qtpy/pull/102) - PR: Add a new QtOpenGL module * [PR 84](https://github.com/spyder-ide/qtpy/pull/84) - PR: Add PySide2 support In this release 10 pull requests were merged ---- ## Version 1.2.1 (2017/01/21) ### Bugs fixed **Pull requests** * [PR 98](https://github.com/spyder-ide/qtpy/pull/98) - PR: Don't use Travis to test macOS because it slows down the entire spyder-ide organization * [PR 97](https://github.com/spyder-ide/qtpy/pull/97) - PR: Update Appveyor badge in Readme because of moving to an org account * [PR 94](https://github.com/spyder-ide/qtpy/pull/94) - PR: Include test suite in sdist In this release 3 pull requests were merged ---- ## Version 1.2 (2017/01/08) ### New features * Add support for QtMultimedia * Use relative imports so its vendored more easily ### Bugs fixed **Issues** * [Issue 83](https://github.com/spyder-ide/qtpy/issues/83) - Include core doc files in PyPi releases * [Issue 78](https://github.com/spyder-ide/qtpy/issues/78) - Request for a new bugfix release * [Issue 75](https://github.com/spyder-ide/qtpy/issues/75) - Missing copyright headers * [Issue 67](https://github.com/spyder-ide/qtpy/issues/67) - uic.loadUiType is missing * [Issue 64](https://github.com/spyder-ide/qtpy/issues/64) - QHeaderView.setSectionResizeMode * [Issue 49](https://github.com/spyder-ide/qtpy/issues/49) - QtMultimedia support In this release 6 issues were closed **Pull requests** * [PR 93](https://github.com/spyder-ide/qtpy/pull/93) - Restore uic full namespace for PyQt5 and PyQt4 * [PR 92](https://github.com/spyder-ide/qtpy/pull/92) - Add missing copyright header in _patch/qheaderview.py * [PR 91](https://github.com/spyder-ide/qtpy/pull/91) - Use star imports in QtSvg again instead of direct ones (reverts PR #55) * [PR 88](https://github.com/spyder-ide/qtpy/pull/88) - PR: Add manifest * [PR 74](https://github.com/spyder-ide/qtpy/pull/74) - Move QStringListModel to QtCore * [PR 71](https://github.com/spyder-ide/qtpy/pull/71) - PR: Use relative imports so its vendored more easily * [PR 65](https://github.com/spyder-ide/qtpy/pull/65) - Introduce renamed methods of QHeaderView in PyQt4 and PySide * [PR 59](https://github.com/spyder-ide/qtpy/pull/59) - Don't install qtpy as a conda package in CircleCI * [PR 58](https://github.com/spyder-ide/qtpy/pull/58) - Remove reference to how qtpy is pronounced in README * [PR 55](https://github.com/spyder-ide/qtpy/pull/55) - PR: Add explicit imports to QtSvg module * [PR 50](https://github.com/spyder-ide/qtpy/pull/50) - Add support for QtMultimedia In this release 11 pull requests were merged ---- ## Version 1.1.2 (2016-08-08) ### Bugfixes **Pull requests** * [PR 54](https://github.com/spyder-ide/qtpy/pull/54) - PR: Fix/ci * [PR 53](https://github.com/spyder-ide/qtpy/pull/53) - PR: Move tests to module so they can be run when installed * [PR 52](https://github.com/spyder-ide/qtpy/pull/52) - PR: Update readme * [PR 51](https://github.com/spyder-ide/qtpy/pull/51) - PR: Add circle ci * [PR 47](https://github.com/spyder-ide/qtpy/pull/47) - Remove PyQt variant symbols from QtCore * [PR 46](https://github.com/spyder-ide/qtpy/pull/46) - del QtWidgets.QStyleOptionViewItemV4 * [PR 45](https://github.com/spyder-ide/qtpy/pull/45) - Allow QT_API values that are not completely in lower case In this release 7 pull requests were merged ---- ## Version 1.1.1 (2016-07-01) ### Bugfixes **Pull requests** * [PR 44](https://github.com/spyder-ide/qtpy/pull/44) - Make qtpy to set the QT_API environment variable In this release 1 pull requests were merged --- ## Version 1.1 (2016-06-30) ### New features * Make importing `qtpy` thread-safe * Add a uic module to make loadUI work for PySide * Add QtTest support for PySide ### Bugfixes **Issues** * [Issue 42](https://github.com/spyder-ide/qtpy/issues/42) - Wrong old PyQt4 version check * [Issue 21](https://github.com/spyder-ide/qtpy/issues/21) - Patch QComboBox with PySide? * [Issue 16](https://github.com/spyder-ide/qtpy/issues/16) - Add loadUI functionality In this release 3 issues were closed **Pull requests** * [PR 43](https://github.com/spyder-ide/qtpy/pull/43) - Don't check PyQt version with qtpy's version for old PyQt versions * [PR 41](https://github.com/spyder-ide/qtpy/pull/41) - `qtpy.__version__` should be QtPy version, not Qt version * [PR 40](https://github.com/spyder-ide/qtpy/pull/40) - Mention qt-helpers in README.md, and add myself to AUTHORS.md * [PR 39](https://github.com/spyder-ide/qtpy/pull/39) - Fix remaining segmentation fault that occurs with the patched QComboBox in PySide * [PR 38](https://github.com/spyder-ide/qtpy/pull/38) - QtTest for PySide * [PR 37](https://github.com/spyder-ide/qtpy/pull/37) - Automatically load custom widget classes when using PySide * [PR 33](https://github.com/spyder-ide/qtpy/pull/33) - Ignore case for QT_API env variable in qtpy submodules * [PR 32](https://github.com/spyder-ide/qtpy/pull/32) - Remove QItemSelectionModel from QtWidgets for PyQt4 and PySide * [PR 31](https://github.com/spyder-ide/qtpy/pull/31) - Add compatibility for QItemSelectionModel * [PR 29](https://github.com/spyder-ide/qtpy/pull/29) - Use ci-helpers (from Astropy) for CI and enable AppVeyor * [PR 28](https://github.com/spyder-ide/qtpy/pull/28) - Make tests.py into proper unit test, and add Qt version info to pytest header * [PR 27](https://github.com/spyder-ide/qtpy/pull/27) - Make sure loadUi is available * [PR 25](https://github.com/spyder-ide/qtpy/pull/25) - Add patched version of QComboBox In this release 13 pull requests were merged --- ## Version 1.0.2 (2016-06-02) ### New features * Add a WEBENGINE constant to QtWebEngineWidgets, which is True if Qt 5 comes with the WebEngine module and False otherwise. ### Bugfixes **Pull requests** * [PR 24](https://github.com/spyder-ide/qtpy/pull/24) - Add constant to QtWebEngineWidgets to see if we are using WebEngine or WebKit * [PR 23](https://github.com/spyder-ide/qtpy/pull/23) - Fix "Prefer `format()` over string interpolation operator" issue In this release 2 pull requests were merged --- ## Version 1.0.1 (2016-04-10) ### Bugfixes **Issues** * [Issue 18](https://github.com/spyder-ide/qtpy/issues/18) - QIntValidator left in QtWidgets, should be in QtGui In this release 1 issues were closed **Pull requests** * [PR 19](https://github.com/spyder-ide/qtpy/pull/19) - Import QIntValidator in QtGui and remove it from QtWidgets In this release 1 pull requests were merged ---- ## Version 1.0 (2016-03-22) * Add QtWebEngineWidgets module for Qt 5.6. This module replaces the previous QtWebKit one. * Import the right objects in QtGui, QtWidgets and QtCore * Add a QtPrintSupport module --- ## Version 0.1.3 (2015-12-30) * Add tests and continuous integration ## Version 0.1.2 (2015-03-01) * First release QtPy-1.9.0/setup.cfg0000664000175000017500000000010313515557466015044 0ustar carloscarlos00000000000000[bdist_wheel] universal = 1 [egg_info] tag_build = tag_date = 0 QtPy-1.9.0/PKG-INFO0000664000175000017500000001122413515557466014326 0ustar carloscarlos00000000000000Metadata-Version: 2.1 Name: QtPy Version: 1.9.0 Summary: Provides an abstraction layer on top of the various Qt bindings (PyQt5, PyQt4 and PySide) and additional custom QWidgets. Home-page: https://github.com/spyder-ide/qtpy Author: Colin Duquesnoy, The Spyder Development Team Author-email: goanpeca@gmail.com Maintainer: Gonzalo Peña-Castellanos Maintainer-email: goanpeca@gmail.com License: MIT Description: # QtPy: Abstraction layer for PyQt5/PyQt4/PySide2/PySide [![license](https://img.shields.io/pypi/l/qtpy.svg)](./LICENSE) [![pypi version](https://img.shields.io/pypi/v/qtpy.svg)](https://pypi.org/project/QtPy/) [![conda version](https://img.shields.io/conda/vn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![download count](https://img.shields.io/conda/dn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![OpenCollective Backers](https://opencollective.com/spyder/backers/badge.svg?color=blue)](#backers) [![Join the chat at https://gitter.im/spyder-ide/public](https://badges.gitter.im/spyder-ide/spyder.svg)](https://gitter.im/spyder-ide/public)
[![PyPI status](https://img.shields.io/pypi/status/qtpy.svg)](https://github.com/spyder-ide/qtpy) [![Build status](https://ci.appveyor.com/api/projects/status/62y6i02vhn4hefg0/branch/master?svg=true)](https://ci.appveyor.com/project/spyder-ide/qtpy/branch/master) [![CircleCI](https://circleci.com/gh/spyder-ide/qtpy.svg?style=shield)](https://circleci.com/gh/spyder-ide/qtpy) [![Coverage Status](https://coveralls.io/repos/github/spyder-ide/qtpy/badge.svg?branch=master)](https://coveralls.io/github/spyder-ide/qtpy?branch=master) *Copyright © 2009–2019 The Spyder Development Team* ## Description **QtPy** is a small abstraction layer that lets you write applications using a single API call to either PyQt or PySide. It provides support for PyQt5, PyQt4, PySide2 and PySide using the Qt5 layout (where the QtGui module has been split into QtGui and QtWidgets). Basically, you can write your code as if you were using PySide2 but import Qt modules from `qtpy` instead of `PySide2` (or `PyQt5`) ### Attribution and acknowledgments This project is based on the [pyqode.qt](https://github.com/pyQode/pyqode.qt) project and the [spyderlib.qt](https://github.com/spyder-ide/spyder/tree/2.3/spyderlib/qt) module from the [Spyder](https://github.com/spyder-ide/spyder) project, and also includes contributions adapted from [qt-helpers](https://github.com/glue-viz/qt-helpers), developed as part of the [glue](http://glueviz.org) project. Unlike `pyqode.qt` this is not a namespace package, so it is not tied to a particular project or namespace. ### License This project is released under the MIT license. ### Requirements You need PyQt5, PyQt4, PySide2 or PySide installed in your system to make use of QtPy. If several of these packages are found, PyQt5 is used by default unless you set the `QT_API` environment variable. `QT_API` can take the following values: * `pyqt5` (to use PyQt5). * `pyqt` or `pyqt4` (to use PyQt4). * `pyside2` (to use PySide2) * `pyside` (to use PySide). ### Installation ```bash pip install qtpy ``` or ```bash conda install qtpy ``` ## Contributing Everyone is welcome to contribute! ## Sponsors Become a sponsor to get your logo on our README on Github. [![Sponsors](https://opencollective.com/spyder/sponsors.svg)](https://opencollective.com/spyder#support) Keywords: qt PyQt4 PyQt5 PySide Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: X11 Applications :: Qt Classifier: Environment :: Win32 (MS Windows) Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Description-Content-Type: text/markdown QtPy-1.9.0/setup.py0000664000175000017500000000324013437460477014740 0ustar carloscarlos00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- """ Setup script for qtpy """ import os import io from setuptools import setup, find_packages HERE = os.path.abspath(os.path.dirname(__file__)) version_ns = {} with open(os.path.join(HERE, 'qtpy', '_version.py')) as f: exec(f.read(), {}, version_ns) with io.open(os.path.join(HERE, 'README.md'), encoding='utf-8') as f: LONG_DESCRIPTION = f.read() setup( name='QtPy', version=version_ns['__version__'], packages=find_packages(exclude=['contrib', 'docs', 'tests*']), keywords=["qt PyQt4 PyQt5 PySide"], url='https://github.com/spyder-ide/qtpy', license='MIT', author='Colin Duquesnoy, The Spyder Development Team', author_email='goanpeca@gmail.com', maintainer='Gonzalo Peña-Castellanos', maintainer_email='goanpeca@gmail.com', description='Provides an abstraction layer on top of the various Qt ' 'bindings (PyQt5, PyQt4 and PySide) and additional custom ' 'QWidgets.', long_description=LONG_DESCRIPTION, long_description_content_type='text/markdown', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: X11 Applications :: Qt', 'Environment :: Win32 (MS Windows)', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5'] ) QtPy-1.9.0/AUTHORS.md0000664000175000017500000000057113032532177014665 0ustar carloscarlos00000000000000Maintainer ========== Gonzalo Peña-Castellanos ([@goanpeca](http://github.com/goanpeca)) Main Authors ============ * Colin Duquesnoy ([@ColinDuquesnoy](http://github.com/ColinDuquesnoy)) * [The Spyder Development Team](https://github.com/spyder-ide/spyder/graphs/contributors) Contributors ============ * Thomas Robitaille ([@astrofrog](http://www.github.com/astrofrog))