Skip to content

Commit

Permalink
Merge pull request winpython#526 from stonebig/master
Browse files Browse the repository at this point in the history
switch to shared qtpy abstraction layer
  • Loading branch information
stonebig authored Apr 16, 2017
2 parents 643680f + 21820c5 commit 5070ab7
Show file tree
Hide file tree
Showing 35 changed files with 1,991 additions and 396 deletions.
49 changes: 49 additions & 0 deletions winpython/_vendor/qtpy/QtCore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- 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, 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 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__

# Those are imported from `import *`
del pyqtSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR
elif PYSIDE:
from PySide.QtCore import *
from PySide.QtGui import (QItemSelection, QItemSelectionModel,
QItemSelectionRange, QSortFilterProxyModel,
QStringListModel)
import PySide.QtCore
__version__ = PySide.QtCore.__version__
else:
raise PythonQtError('No Qt bindings could be found')
20 changes: 20 additions & 0 deletions winpython/_vendor/qtpy/QtDesigner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- 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')
103 changes: 103 additions & 0 deletions winpython/_vendor/qtpy/QtGui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# -*- 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, PythonQtError


if PYQT5:
from PyQt5.QtGui import *
elif PYQT4:
from PyQt4.Qt import QKeySequence, QTextCursor
from PyQt4.QtGui import (QAbstractTextDocumentLayout, QActionEvent, QBitmap,
QBrush, QClipboard, QCloseEvent, QColor,
QConicalGradient, QContextMenuEvent, QCursor,
QDesktopServices, QDoubleValidator, QDrag,
QDragEnterEvent, QDragLeaveEvent, QDragMoveEvent,
QDropEvent, QFileOpenEvent, QFocusEvent, QFont,
QFontDatabase, QFontInfo, QFontMetrics,
QFontMetricsF, QGlyphRun, QGradient, QHelpEvent,
QHideEvent, QHoverEvent, QIcon, QIconDragEvent,
QIconEngine, QImage, QImageIOHandler, QImageReader,
QImageWriter, QInputEvent, QInputMethodEvent,
QKeyEvent, 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, QRawFont,
QRegExpValidator, QRegion, QResizeEvent,
QSessionManager, QShortcutEvent, QShowEvent,
QStandardItem, QStandardItemModel, QStaticText,
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, QTouchEvent, QTransform,
QValidator, QVector2D, QVector3D, QVector4D,
QWhatsThisClickedEvent, QWheelEvent,
QWindowStateChangeEvent, qAlpha, qBlue,
qFuzzyCompare, qGray, qGreen, qIsGray, qRed, qRgb,
qRgba, QIntValidator)
elif PYSIDE:
from PySide.QtGui import (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)
else:
raise PythonQtError('No Qt bindings could be found')
13 changes: 13 additions & 0 deletions winpython/_vendor/qtpy/QtMultimedia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from . import PYQT5
from . import PYQT4
from . import PYSIDE


if PYQT5:
from PyQt5.QtMultimedia import *
elif PYQT4:
from PyQt4.QtMultimedia import *
from PyQt4.QtGui import QSound
elif PYSIDE:
from PySide.QtMultimedia import *
from PySide.QtGui import QSound
23 changes: 23 additions & 0 deletions winpython/_vendor/qtpy/QtNetwork.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- 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, PYQT4, PYSIDE, PythonQtError


if PYQT5:
from PyQt5.QtNetwork import *
elif PYQT4:
from PyQt4.QtNetwork import *
elif PYSIDE:
from PySide.QtNetwork import *
else:
raise PythonQtError('No Qt bindings could be found')
26 changes: 26 additions & 0 deletions winpython/_vendor/qtpy/QtPrintSupport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- 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, PYSIDE, PythonQtError


if PYQT5:
from PyQt5.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')
22 changes: 22 additions & 0 deletions winpython/_vendor/qtpy/QtSvg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- 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, PYQT5, PYSIDE, PythonQtError

if PYQT5:
from PyQt5.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
28 changes: 28 additions & 0 deletions winpython/_vendor/qtpy/QtTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- 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, PYQT4, PYSIDE, PythonQtError


if PYQT5:
from PyQt5.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')
41 changes: 41 additions & 0 deletions winpython/_vendor/qtpy/QtWebEngineWidgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- 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, 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 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')
Loading

0 comments on commit 5070ab7

Please sign in to comment.