QtPy-1.3.1/ 0000775 0001750 0001750 00000000000 13146607241 013207 5 ustar carlos carlos 0000000 0000000 QtPy-1.3.1/LICENSE.txt 0000664 0001750 0001750 00000002130 13032532177 015025 0 ustar carlos carlos 0000000 0000000 The 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.3.1/MANIFEST.in 0000664 0001750 0001750 00000000165 13146606231 014745 0 ustar carlos carlos 0000000 0000000 include AUTHORS.md
include CHANGELOG.md
include LICENSE.txt
include README.md
recursive-include qtpy/tests *.py *.ui
QtPy-1.3.1/QtPy.egg-info/ 0000775 0001750 0001750 00000000000 13146607241 015576 5 ustar carlos carlos 0000000 0000000 QtPy-1.3.1/QtPy.egg-info/PKG-INFO 0000664 0001750 0001750 00000005147 13146607240 016701 0 ustar carlos carlos 0000000 0000000 Metadata-Version: 1.1
Name: QtPy
Version: 1.3.1
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: Gonzalo Peña-Castellanos
Author-email: goanpeca@gmail.com
License: MIT
Description:
.. image:: https://img.shields.io/pypi/v/QtPy.svg
:target: https://pypi.python.org/pypi/QtPy/
:alt: Latest PyPI version
.. image:: https://img.shields.io/pypi/dm/QtPy.svg
:target: https://pypi.python.org/pypi/QtPy/
:alt: Number of PyPI downloads
QtPy: Abtraction layer for PyQt5/PyQt4/PySide
=============================================
**QtPy** (pronounced *'cutie pie'*) 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 and PySide using the PyQt5 layout (where
the QtGui module has been split into QtGui and QtWidgets).
Basically, you write your code as if you were using PyQt5 but import qt from
``qtpy`` instead of ``PyQt5``.
- `Issue tracker`_
- `Changelog`_
Attribution and acknowledgements
--------------------------------
This project is based on the `pyqode.qt`_ project and the `spyderlib.qt`_
module from the `spyder`_ project.
Unlike **pyqode.qt** this is not a namespace package so it is not *tied*
to a particular project, or namespace.
.. _spyder: https://github.com/spyder-ide/spyder
.. _spyderlib.qt: https://github.com/spyder-ide/spyder/tree/master/spyderlib/qt
.. _pyqode.qt: https://github.com/pyQode/pyqode.qt
.. _Changelog: https://github.com/spyder-ide/qtpy/blob/master/CHANGELOG.md
.. _Issue tracker: https://github.com/spyder-ide/qtpy/issues
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
QtPy-1.3.1/QtPy.egg-info/SOURCES.txt 0000664 0001750 0001750 00000001774 13146607241 017473 0 ustar carlos carlos 0000000 0000000 AUTHORS.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/QtCore.py
qtpy/QtDesigner.py
qtpy/QtGui.py
qtpy/QtMultimedia.py
qtpy/QtNetwork.py
qtpy/QtOpenGL.py
qtpy/QtPrintSupport.py
qtpy/QtSvg.py
qtpy/QtTest.py
qtpy/QtWebEngineWidgets.py
qtpy/QtWidgets.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_main.py
qtpy/tests/test_patch_qcombobox.py
qtpy/tests/test_patch_qheaderview.py
qtpy/tests/test_qdesktopservice_split.py
qtpy/tests/test_qtcore.py
qtpy/tests/test_qtdesigner.py
qtpy/tests/test_qtmultimedia.py
qtpy/tests/test_qtnetwork.py
qtpy/tests/test_qtprintsupport.py
qtpy/tests/test_qtsvg.py
qtpy/tests/test_qttest.py
qtpy/tests/test_uic.py QtPy-1.3.1/QtPy.egg-info/dependency_links.txt 0000664 0001750 0001750 00000000001 13146607240 021643 0 ustar carlos carlos 0000000 0000000
QtPy-1.3.1/QtPy.egg-info/top_level.txt 0000664 0001750 0001750 00000000005 13146607240 020322 0 ustar carlos carlos 0000000 0000000 qtpy
QtPy-1.3.1/qtpy/ 0000775 0001750 0001750 00000000000 13146607241 014204 5 ustar carlos carlos 0000000 0000000 QtPy-1.3.1/qtpy/_patch/ 0000775 0001750 0001750 00000000000 13146607241 015442 5 ustar carlos carlos 0000000 0000000 QtPy-1.3.1/qtpy/_patch/qcombobox.py 0000664 0001750 0001750 00000010046 13032532177 020005 0 ustar carlos carlos 0000000 0000000 # 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 = findData QtPy-1.3.1/qtpy/_patch/qheaderview.py 0000664 0001750 0001750 00000006420 13146606231 020320 0 ustar carlos carlos 0000000 0000000 # -*- 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.3.1/qtpy/_patch/__init__.py 0000664 0001750 0001750 00000000000 13032532177 017540 0 ustar carlos carlos 0000000 0000000 QtPy-1.3.1/qtpy/_version.py 0000664 0001750 0001750 00000000110 13146607143 016373 0 ustar carlos carlos 0000000 0000000 version_info = (1, 3, 1)
__version__ = '.'.join(map(str, version_info))
QtPy-1.3.1/qtpy/QtTest.py 0000664 0001750 0001750 00000001301 13105102344 015762 0 ustar carlos carlos 0000000 0000000 # -*- 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.3.1/qtpy/py3compat.py 0000775 0001750 0001750 00000014722 12645773454 016523 0 ustar carlos carlos 0000000 0000000 # -*- 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[0] == '2'
PY3 = sys.version[0] == '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
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())
if __name__ == '__main__':
pass
QtPy-1.3.1/qtpy/QtPrintSupport.py 0000664 0001750 0001750 00000001615 13105102344 017544 0 ustar carlos carlos 0000000 0000000 # -*- 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.3.1/qtpy/tests/ 0000775 0001750 0001750 00000000000 13146607241 015346 5 ustar carlos carlos 0000000 0000000 QtPy-1.3.1/qtpy/tests/test_qtprintsupport.py 0000664 0001750 0001750 00000001125 13105102344 022101 0 ustar carlos carlos 0000000 0000000 from __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.3.1/qtpy/tests/runtests.py 0000775 0001750 0001750 00000001310 13032532177 017604 0 ustar carlos carlos 0000000 0000000 #!/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.3.1/qtpy/tests/test_patch_qcombobox.py 0000664 0001750 0001750 00000005605 13105102344 022122 0 ustar carlos carlos 0000000 0000000 from __future__ import absolute_import
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, reason="It segfaults in Python 3 and 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'
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.3.1/qtpy/tests/test_qtcore.py 0000664 0001750 0001750 00000000326 13143616147 020257 0 ustar carlos carlos 0000000 0000000 from __future__ import absolute_import
import pytest
from qtpy import QtCore
"""Test QtCore."""
def test_qtmsghandler():
"""Test the qtpy.QtMsgHandler"""
assert QtCore.qInstallMessageHandler is not None
QtPy-1.3.1/qtpy/tests/test_qtmultimedia.py 0000664 0001750 0001750 00000000726 13105102344 021450 0 ustar carlos carlos 0000000 0000000 from __future__ import absolute_import
import pytest
from qtpy import PYSIDE2, QtMultimedia
@pytest.mark.skipif(PYSIDE2, reason="It fails on PySide2")
def test_qtmultimedia():
"""Test the qtpy.QtMultimedia namespace"""
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.3.1/qtpy/tests/test_qdesktopservice_split.py 0000664 0001750 0001750 00000001623 13105102344 023374 0 ustar carlos carlos 0000000 0000000 from __future__ import absolute_import
import pytest
from qtpy import PYSIDE2
"""Test QDesktopServices split in Qt5."""
@pytest.mark.skipif(PYSIDE2, reason="It fails on PySide2")
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
@pytest.mark.skipif(PYSIDE2, reason="It fails on PySide2")
def test_qdesktopservice():
"""Test the qtpy.QDesktopServices namespace"""
from qtpy.QtGui import QDesktopServices
assert QDesktopServices.setUrlHandler is not None
# Attributes from QStandardPaths shouldn't be in QDesktopServices
with pytest.raises(AttributeError) as excinfo:
QDesktopServices.StandardLocation QtPy-1.3.1/qtpy/tests/test_qtnetwork.py 0000664 0001750 0001750 00000003472 13105102344 021010 0 ustar carlos carlos 0000000 0000000 from __future__ import absolute_import
import pytest
from qtpy import PYSIDE, PYSIDE2, QtNetwork
@pytest.mark.skipif(PYSIDE2 or PYSIDE, reason="It fails on PySide/PySide2")
def test_qtnetwork():
"""Test the qtpy.QtNetwork namespace"""
assert QtNetwork.QAbstractNetworkCache is not None
assert QtNetwork.QNetworkCacheMetaData is not None
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
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.3.1/qtpy/tests/test_qtsvg.py 0000664 0001750 0001750 00000000613 13105102344 020110 0 ustar carlos carlos 0000000 0000000 from __future__ import absolute_import
import pytest
from qtpy import PYSIDE2
@pytest.mark.skipif(PYSIDE2, reason="It fails on PySide2")
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.3.1/qtpy/tests/conftest.py 0000664 0001750 0001750 00000003432 13105102344 017534 0 ustar carlos carlos 0000000 0000000 import 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.3.1/qtpy/tests/test_uic.py 0000664 0001750 0001750 00000004327 13143616147 017547 0 ustar carlos carlos 0000000 0000000 import 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
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)
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)
@pytest.mark.skipif(PYSIDE2, reason="It fails on PySide2")
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 == '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.3.1/qtpy/tests/test_main.py 0000664 0001750 0001750 00000004646 13105102344 017702 0 ustar carlos carlos 0000000 0000000 import 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.3.1/qtpy/tests/test_qtdesigner.py 0000664 0001750 0001750 00000002701 13105102344 021111 0 ustar carlos carlos 0000000 0000000 from __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 None QtPy-1.3.1/qtpy/tests/test_qttest.py 0000664 0001750 0001750 00000000260 13105102344 020266 0 ustar carlos carlos 0000000 0000000 from __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.3.1/qtpy/tests/__init__.py 0000664 0001750 0001750 00000000000 13105102344 017432 0 ustar carlos carlos 0000000 0000000 QtPy-1.3.1/qtpy/tests/test.ui 0000664 0001750 0001750 00000001517 13032532177 016667 0 ustar carlos carlos 0000000 0000000
Form
0
0
400
300
Form
-
-
Ceci n'est pas un bouton
-
QtPy-1.3.1/qtpy/tests/test_patch_qheaderview.py 0000664 0001750 0001750 00000007104 13146606231 022442 0 ustar carlos carlos 0000000 0000000 from __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.3.1/qtpy/tests/test_custom.ui 0000664 0001750 0001750 00000002012 13032532177 020250 0 ustar carlos carlos 0000000 0000000
Form
0
0
400
300
Form
-
-
Ceci n'est pas un bouton
-
_QComboBoxSubclass
QComboBox
QtPy-1.3.1/qtpy/compat.py 0000664 0001750 0001750 00000017370 13032532177 016050 0 ustar carlos carlos 0000000 0000000 # -*- 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.3.1/qtpy/QtMultimedia.py 0000664 0001750 0001750 00000000633 13105102344 017144 0 ustar carlos carlos 0000000 0000000 from . import PYQT5
from . import PYQT4
from . import PYSIDE
from . import PYSIDE2
if PYQT5:
from PyQt5.QtMultimedia import *
elif PYSIDE2:
# Current wheels don't have this module
# from PySide2.QtMultimedia import *
pass
elif PYQT4:
from PyQt4.QtMultimedia import *
from PyQt4.QtGui import QSound
elif PYSIDE:
from PySide.QtMultimedia import *
from PySide.QtGui import QSound
QtPy-1.3.1/qtpy/QtSvg.py 0000664 0001750 0001750 00000001300 13105102344 015601 0 ustar carlos carlos 0000000 0000000 # -*- 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.3.1/qtpy/QtWidgets.py 0000664 0001750 0001750 00000014303 13105102344 016457 0 ustar carlos carlos 0000000 0000000 # -*- 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.3.1/qtpy/QtDesigner.py 0000664 0001750 0001750 00000000617 13032532177 016626 0 ustar carlos carlos 0000000 0000000 # -*- 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.3.1/qtpy/QtGui.py 0000664 0001750 0001750 00000016505 13105102344 015603 0 ustar carlos carlos 0000000 0000000 # -*- 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.
"""
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
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
else:
raise PythonQtError('No Qt bindings could be found')
QtPy-1.3.1/qtpy/QtNetwork.py 0000664 0001750 0001750 00000001060 13105102344 016476 0 ustar carlos carlos 0000000 0000000 # -*- 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.3.1/qtpy/__init__.py 0000664 0001750 0001750 00000010463 13105102344 016306 0 ustar carlos carlos 0000000 0000000 # -*- 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.
The shim will automatically select the first available API (PyQt5, PyQt4 and
finally PySide).
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)
"""
import os
# Version of QtPy
from ._version import __version__
# 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']
# Setting a default value for QT_API
os.environ.setdefault(QT_API, 'pyqt5')
API = os.environ[QT_API].lower()
assert API in (PYQT5_API + PYQT4_API + PYSIDE_API + PYSIDE2_API)
is_old_pyqt = is_pyqt46 = False
PYQT5 = True
PYQT4 = PYSIDE = PYSIDE2 = False
class PythonQtError(Exception):
"""Error raise if no bindings could be selected"""
pass
if API in PYQT5_API:
try:
from PyQt5.Qt import PYQT_VERSION_STR as PYQT_VERSION # analysis:ignore
from PyQt5.Qt import QT_VERSION_STR as QT_VERSION # analysis:ignore
PYSIDE_VERSION = None
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
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:
# 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')
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.3.1/qtpy/QtCore.py 0000664 0001750 0001750 00000007700 13143616147 015761 0 ustar carlos carlos 0000000 0000000 # -*- 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__
# Those are imported from `import *`
del pyqtSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR
elif PYSIDE2:
from PySide2.QtCore import *
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
# 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
import PySide.QtCore
__version__ = PySide.QtCore.__version__
else:
raise PythonQtError('No Qt bindings could be found')
QtPy-1.3.1/qtpy/uic.py 0000664 0001750 0001750 00000022356 13143616147 015350 0 ustar carlos carlos 0000000 0000000 import 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.3.1/qtpy/QtOpenGL.py 0000664 0001750 0001750 00000001214 13105102344 016172 0 ustar carlos carlos 0000000 0000000 # -*- 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, PythonQtError
if PYQT5:
from PyQt5.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
QtPy-1.3.1/qtpy/QtWebEngineWidgets.py 0000664 0001750 0001750 00000003623 13105102344 020246 0 ustar carlos carlos 0000000 0000000 # -*- 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:
try:
from PySide2.QtWebEngineWidgets import QWebEnginePage
from PySide2.QtWebEngineWidgets import QWebEngineView
# Current PySide2 wheels seem to be missing this.
# from PySide2.QtWebEngineWidgets import QWebEngineSettings
except ImportError:
from PySide2.QtWebKitWidgets import QWebPage as QWebEnginePage
from PySide2.QtWebKitWidgets import QWebView as QWebEngineView
# Current PySide2 wheels seem to be missing this.
# from PySide2.QtWebKit import QWebSettings as QWebEngineSettings
WEBENGINE = False
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.3.1/README.md 0000664 0001750 0001750 00000004755 13143621263 014476 0 ustar carlos carlos 0000000 0000000 # QtPy: Abstraction layer for PyQt5/PyQt4/PySide2/PySide
Copyright © 2009- The Spyder Development Team.
## Project details
[](./LICENSE)
[](https://pypi.python.org/pypi/qtpy)
[](https://gitter.im/spyder-ide/public)
## Build status
[](https://ci.appveyor.com/project/spyder-ide/qtpy/branch/master)
[](https://circleci.com/gh/spyder-ide/qtpy)
[](https://coveralls.io/github/spyder-ide/qtpy?branch=master)
[](https://scrutinizer-ci.com/g/spyder-ide/qtpy/?branch=master)
## 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 write your code as if you were using PySide2 but import Qt modules
from `qtpy` instead of `PySide2` (or `PyQt5`)
### Attribution and acknowledgements
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 licensed 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
```
QtPy-1.3.1/CHANGELOG.md 0000664 0001750 0001750 00000022312 13146607017 015021 0 ustar carlos carlos 0000000 0000000 # History of changes
## 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
* Add support for QtMultimedia
* Add support for 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.3.1/setup.cfg 0000664 0001750 0001750 00000000130 13146607241 015022 0 ustar carlos carlos 0000000 0000000 [bdist_wheel]
universal = 1
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
QtPy-1.3.1/PKG-INFO 0000664 0001750 0001750 00000005147 13146607241 014313 0 ustar carlos carlos 0000000 0000000 Metadata-Version: 1.1
Name: QtPy
Version: 1.3.1
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: Gonzalo Peña-Castellanos
Author-email: goanpeca@gmail.com
License: MIT
Description:
.. image:: https://img.shields.io/pypi/v/QtPy.svg
:target: https://pypi.python.org/pypi/QtPy/
:alt: Latest PyPI version
.. image:: https://img.shields.io/pypi/dm/QtPy.svg
:target: https://pypi.python.org/pypi/QtPy/
:alt: Number of PyPI downloads
QtPy: Abtraction layer for PyQt5/PyQt4/PySide
=============================================
**QtPy** (pronounced *'cutie pie'*) 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 and PySide using the PyQt5 layout (where
the QtGui module has been split into QtGui and QtWidgets).
Basically, you write your code as if you were using PyQt5 but import qt from
``qtpy`` instead of ``PyQt5``.
- `Issue tracker`_
- `Changelog`_
Attribution and acknowledgements
--------------------------------
This project is based on the `pyqode.qt`_ project and the `spyderlib.qt`_
module from the `spyder`_ project.
Unlike **pyqode.qt** this is not a namespace package so it is not *tied*
to a particular project, or namespace.
.. _spyder: https://github.com/spyder-ide/spyder
.. _spyderlib.qt: https://github.com/spyder-ide/spyder/tree/master/spyderlib/qt
.. _pyqode.qt: https://github.com/pyQode/pyqode.qt
.. _Changelog: https://github.com/spyder-ide/qtpy/blob/master/CHANGELOG.md
.. _Issue tracker: https://github.com/spyder-ide/qtpy/issues
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
QtPy-1.3.1/setup.py 0000664 0001750 0001750 00000005606 13032532177 014727 0 ustar carlos carlos 0000000 0000000 #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup script for qtpy
"""
import os
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)
LONG_DESCRIPTION = """
.. image:: https://img.shields.io/pypi/v/QtPy.svg
:target: https://pypi.python.org/pypi/QtPy/
:alt: Latest PyPI version
.. image:: https://img.shields.io/pypi/dm/QtPy.svg
:target: https://pypi.python.org/pypi/QtPy/
:alt: Number of PyPI downloads
QtPy: Abtraction layer for PyQt5/PyQt4/PySide
=============================================
**QtPy** (pronounced *'cutie pie'*) 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 and PySide using the PyQt5 layout (where
the QtGui module has been split into QtGui and QtWidgets).
Basically, you write your code as if you were using PyQt5 but import qt from
``qtpy`` instead of ``PyQt5``.
- `Issue tracker`_
- `Changelog`_
Attribution and acknowledgements
--------------------------------
This project is based on the `pyqode.qt`_ project and the `spyderlib.qt`_
module from the `spyder`_ project.
Unlike **pyqode.qt** this is not a namespace package so it is not *tied*
to a particular project, or namespace.
.. _spyder: https://github.com/spyder-ide/spyder
.. _spyderlib.qt: https://github.com/spyder-ide/spyder/tree/master/spyderlib/qt
.. _pyqode.qt: https://github.com/pyQode/pyqode.qt
.. _Changelog: https://github.com/spyder-ide/qtpy/blob/master/CHANGELOG.md
.. _Issue tracker: https://github.com/spyder-ide/qtpy/issues
"""
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,
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.3.1/AUTHORS.md 0000664 0001750 0001750 00000000571 13032532177 014660 0 ustar carlos carlos 0000000 0000000 Maintainer
==========
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))