pax_global_header 0000666 0000000 0000000 00000000064 14272202670 0014514 g ustar 00root root 0000000 0000000 52 comment=ffd6e9587109330ea2793b920ff4e4ed6b39774a
anyqt-0.2.0/ 0000775 0000000 0000000 00000000000 14272202670 0012647 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/.github/ 0000775 0000000 0000000 00000000000 14272202670 0014207 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14272202670 0016244 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/.github/workflows/test-workflow.yml 0000664 0000000 0000000 00000010652 14272202670 0021622 0 ustar 00root root 0000000 0000000 name : Run tests
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
env:
PYTHONFAULTHANDLER: 1
PIP_NO_PIP_VERSION_CHECK: 1
PIP_CACHE_DIR: .pip-cache
PIP_PREFER_BINARY: 1
strategy:
fail-fast: False
matrix:
include:
# Linux
- os: ubuntu-20.04
python-version: 3.6
test-env: "PyQt5~=5.9.2"
qt-api: "PyQt5"
- os: ubuntu-18.04
python-version: 3.7
test-env: "PyQt5~=5.12.0"
qt-api: "PyQt5"
- os: ubuntu-20.04
python-version: 3.8
test-env: "PyQt5~=5.14.0"
qt-api: "PyQt5"
- os: ubuntu-20.04
python-version: 3.9
test-env: "PyQt5~=5.15.0"
qt-api: "PyQt5"
- os: ubuntu-20.04
python-version: "3.10"
test-env: "PyQt5~=5.15.0"
qt-api: "PyQt5"
- os: ubuntu-20.04
python-version: "3.10"
test-env: "PyQt6~=6.2.3 PyQt6-Qt6~=6.2.3"
qt-api: "PyQt6"
- os: ubuntu-20.04
python-version: "3.10"
test-env: "PySide2~=5.15.0"
qt-api: "PySide2"
# macOS
- os: macos-10.15
python-version: 3.6
test-env: "PyQt5~=5.9.2"
- os: macos-10.15
python-version: 3.7
test-env: "PyQt5~=5.12.0"
- os: macos-10.15
python-version: 3.8
test-env: "PyQt5~=5.14.0"
- os: macos-10.15
python-version: 3.9
test-env: "PyQt5~=5.15.0"
- os: macos-11
python-version: "3.10"
test-env: "PyQt5~=5.15.0"
- os: macos-11
python-version: "3.10"
test-env: "PyQt6~=6.2.3 PyQt6-Qt6~=6.2.3"
- os: macos-11
python-version: "3.10"
test-env: "PySide2~=5.15.0"
# Windows
- os: windows-2019
python-version: 3.6
test-env: "PyQt5~=5.9.2"
- os: windows-2019
python-version: 3.7
test-env: "PyQt5~=5.12.0"
- os: windows-2019
python-version: 3.8
test-env: "PyQt5~=5.14.0"
- os: windows-2019
python-version: 3.9
test-env: "PyQt5~=5.15.0"
- os: windows-2019
python-version: "3.10"
test-env: "PyQt5~=5.15.0"
- os: windows-2019
python-version: "3.10"
test-env: "PyQt6~=6.2.3 PyQt6-Qt6~=6.2.3"
- os: windows-2019
python-version: "3.10"
test-env: "PySide2~=5.15.0"
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install System Deps
if: ${{ startsWith(runner.os, 'Linux') }}
# https://www.riverbankcomputing.com/pipermail/pyqt/2020-June/042949.html
run: sudo apt-get install -y libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libegl1-mesa libxcb-shape0
- name: Setup Pip Cache
uses: actions/cache@v2
with:
path: .pip-cache
key: ${{ runner.os }}-py-${{ matrix.python-version }}-pip-${{ hashFiles('setup.*', '.github/workflows/test-workflow.yml') }}
restore-keys: |
${{ runner.os }}-py-${{ matrix.python-version }}-pip
- name: Install Test Deps
env:
TEST_ENV: ${{ matrix.test-env }}
TEST_DEPS: pytest pytest-cov codecov wheel
run: python -m pip install $TEST_DEPS $TEST_ENV
shell: bash
- name: Install
run: python -m pip install -e .
- name: List Test Env
run: pip list --format=freeze
- name: Run Tests
if: ${{ !startsWith(runner.os, 'Linux') }}
run: pytest -v --cov=AnyQt
- name: Run Tests with Xvfb
if: ${{ startsWith(runner.os, 'Linux') }}
env:
XVFBARGS: "-screen 0 1280x1024x24"
run: catchsegv xvfb-run -a -s "$XVFBARGS" pytest -v --cov=AnyQt
- name: Test import hooks
if: ${{ startsWith(runner.os, 'Linux') && matrix.qt-api == 'PyQt5' }}
run: |
ANYQT_HOOK_BACKPORT=PyQt4 python -c "import AnyQt.QtCore, PyQt4"
- name: Upload Coverage
run: codecov
anyqt-0.2.0/.gitignore 0000664 0000000 0000000 00000000216 14272202670 0014636 0 ustar 00root root 0000000 0000000 # Build files
build
dist
MANIFEST
*.egg-info
docs/build
*.pyc
__pycache__
# Editor/hidden files
.*
*~
*#
# Windows temp files
Thumbs.db
anyqt-0.2.0/AnyQt/ 0000775 0000000 0000000 00000000000 14272202670 0013703 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/AnyQt/QtCore.py 0000664 0000000 0000000 00000027747 14272202670 0015473 0 ustar 00root root 0000000 0000000 from . import _api
# List names imported from Qt4's QtCore module
__Qt4_QtCore = [
'QAbstractAnimation',
'QAbstractEventDispatcher',
'QAbstractFileEngine',
'QAbstractFileEngineHandler',
'QAbstractFileEngineIterator',
'QAbstractItemModel',
'QAbstractListModel',
'QAbstractState',
'QAbstractTableModel',
'QAbstractTransition',
'QAnimationGroup',
'QBasicTimer',
'QBitArray',
'QBuffer',
'QByteArray',
'QByteArrayMatcher',
'QChildEvent',
'QCoreApplication',
'QCryptographicHash',
'QDataStream',
'QDate',
'QDateTime',
'QDir',
'QDirIterator',
'QDynamicPropertyChangeEvent',
'QEasingCurve',
'QElapsedTimer',
'QEvent',
'QEventLoop',
'QEventTransition',
'QFSFileEngine',
'QFile',
'QFileInfo',
'QFileSystemWatcher',
'QFinalState',
'QGenericArgument',
'QGenericReturnArgument',
'QHistoryState',
'QIODevice',
'QLibrary',
'QLibraryInfo',
'QLine',
'QLineF',
'QLocale',
'QMargins',
'QMetaClassInfo',
'QMetaEnum',
'QMetaMethod',
'QMetaObject',
'QMetaProperty',
'QMetaType',
'QMimeData',
'QModelIndex',
'QMutex',
'QMutexLocker',
'QObject',
'QObjectCleanupHandler',
'QParallelAnimationGroup',
'QPauseAnimation',
'QPersistentModelIndex',
'QPluginLoader',
'QPoint',
'QPointF',
'QProcess',
'QProcessEnvironment',
'QPropertyAnimation',
'QPyNullVariant',
'QReadLocker',
'QReadWriteLock',
'QRect',
'QRectF',
'QRegExp',
'QResource',
'QRunnable',
'QSemaphore',
'QSequentialAnimationGroup',
'QSettings',
'QSharedMemory',
'QSignalMapper',
'QSignalTransition',
'QSize',
'QSizeF',
'QSocketNotifier',
'QState',
'QStateMachine',
'QSysInfo',
'QSystemLocale',
'QSystemSemaphore',
'QT_TRANSLATE_NOOP',
'QT_TR_NOOP',
'QT_TR_NOOP_UTF8',
'QT_VERSION',
'QT_VERSION_STR',
'QTemporaryFile',
'QTextBoundaryFinder',
'QTextCodec',
'QTextDecoder',
'QTextEncoder',
'QTextStream',
'QTextStreamManipulator',
'QThread',
'QThreadPool',
'QTime',
'QTimeLine',
'QTimer',
'QTimerEvent',
'QTranslator',
'QUrl',
'QUuid',
'QVariant',
'QVariantAnimation',
'QWaitCondition',
'QWriteLocker',
'QXmlStreamAttribute',
'QXmlStreamAttributes',
'QXmlStreamEntityDeclaration',
'QXmlStreamEntityResolver',
'QXmlStreamNamespaceDeclaration',
'QXmlStreamNotationDeclaration',
'QXmlStreamReader',
'QXmlStreamWriter',
'Q_ARG',
'Q_CLASSINFO',
'Q_ENUMS',
'Q_FLAGS',
'Q_RETURN_ARG',
'Qt',
'QtCriticalMsg',
'QtDebugMsg',
'QtFatalMsg',
'QtMsgType',
'QtSystemMsg',
'QtWarningMsg',
'SIGNAL',
'SLOT',
'bin_',
'bom',
'center',
'dec',
'endl',
'fixed',
'flush',
'forcepoint',
'forcesign',
'hex_',
'left',
'lowercasebase',
'lowercasedigits',
'noforcepoint',
'noforcesign',
'noshowbase',
'oct_',
'qAbs',
'qAddPostRoutine',
'qChecksum',
'qCompress',
'qCritical',
'qDebug',
'qErrnoWarning',
'qFatal',
'qFuzzyCompare',
'qInf',
'qInstallMsgHandler',
'qIsFinite',
'qIsInf',
'qIsNaN',
'qIsNull',
'qQNaN',
'qRegisterResourceData',
'qRemovePostRoutine',
'qRound',
'qRound64',
'qSNaN',
'qSetFieldWidth',
'qSetPadChar',
'qSetRealNumberPrecision',
'qSharedBuild',
'qSwap',
'qUncompress',
'qUnregisterResourceData',
'qVersion',
'qWarning',
'qrand',
'qsrand',
'reset',
'right',
'scientific',
'showbase',
'uppercasebase',
'uppercasedigits',
'ws'
]
# Extra PyQt4 defined names mapped from PyQt4 which are not present in
# PySide
__PyQt4_QtCore = [
'PYQT_CONFIGURATION',
'PYQT_VERSION',
'PYQT_VERSION_STR',
'pyqtBoundSignal',
'pyqtPickleProtocol',
'pyqtProperty',
'pyqtRemoveInputHook',
'pyqtRestoreInputHook',
'pyqtSetPickleProtocol',
'pyqtSignal',
'pyqtSignature',
'pyqtSlot',
'pyqtWrapperType',
]
# List names imported from Qt4's QtGui module
__Qt4_QtGui = [
'QAbstractProxyModel',
'QIdentityProxyModel',
'QItemSelection',
'QItemSelectionModel',
'QItemSelectionRange',
'QSortFilterProxyModel',
'QStringListModel',
]
#: Names in Qt4's QtCore module not in Qt5
__Qt4_QtCore_missing_in_Qt5 = [
'QAbstractFileEngine',
'QAbstractFileEngineHandler',
'QAbstractFileEngineIterator',
'QFSFileEngine',
'QPyNullVariant',
'QSystemLocale',
'SIGNAL',
'SLOT',
'qInstallMsgHandler',
'qSwap'
]
# extra names in PyQt4's QtCore not in Qt5
__PyQt4_QtCore_missing_in_Qt5 = [
'pyqtSignature',
]
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtCore import *
Signal = pyqtSignal
Slot = pyqtSlot
Property = pyqtProperty
BoundSignal = pyqtBoundSignal
Qt.Alignment = Qt.AlignmentFlag
Qt.ApplicationStates = Qt.ApplicationState
Qt.DockWidgetAreas = Qt.DockWidgetArea
Qt.Edges = Qt.Edge
Qt.FindChildOptions = Qt.FindChildOption
Qt.GestureFlags = Qt.GestureFlag
Qt.ImageConversionFlags = Qt.ImageConversionFlag
Qt.ItemFlags = Qt.ItemFlag
Qt.KeyboardModifiers = Qt.KeyboardModifier
Qt.MatchFlags = Qt.MatchFlag
Qt.MouseButtons = Qt.MouseButton
Qt.MouseEventFlags = Qt.MouseEventFlag
Qt.Orientations = Qt.Orientation
Qt.ScreenOrientations = Qt.ScreenOrientation
# Qt.SplitBehavior = Qt.SplitBehaviorFlags
Qt.TextInteractionFlags = Qt.TextInteractionFlag
Qt.ToolBarAreas = Qt.ToolBarArea
Qt.TouchPointStates = Qt.TouchPointState
Qt.WindowFlags = Qt.WindowType
Qt.WindowStates = Qt.WindowState
QItemSelectionModel.SelectionFlags = QItemSelectionModel.SelectionFlag
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtCore import *
try:
# QSignalMapper.mapped[QWidget] does not work unless QtWidgets is
# imported before QSignalMapper is touched (even hasattr(QSM, "aa"))
# will cause QSignalMapper.mapped[QWidget] to fail with KeyError.
import PyQt5.QtWidgets
except ImportError:
pass
Signal = pyqtSignal
Slot = pyqtSlot
Property = pyqtProperty
BoundSignal = pyqtBoundSignal
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4 import QtCore as _QtCore, QtGui as _QtGui
globals().update(
{name: getattr(_QtCore, name)
for name in __Qt4_QtCore + __PyQt4_QtCore if hasattr(_QtCore, name)}
)
globals().update(
{name: getattr(_QtGui, name)
for name in __Qt4_QtGui if hasattr(_QtCore, name)}
)
Signal = _QtCore.pyqtSignal
Slot = _QtCore.pyqtSlot
Property = _QtCore.pyqtProperty
QAbstractProxyModel = _QtGui.QAbstractProxyModel
QIdentityProxyModel = _QtGui.QIdentityProxyModel
QItemSelection = _QtGui.QItemSelection
QItemSelectionModel = _QtGui.QItemSelectionModel
QItemSelectionRange = _QtGui.QItemSelectionRange
QSortFilterProxyModel = _QtGui.QSortFilterProxyModel
QStringListModel = _QtGui.QStringListModel
del _QtCore, _QtGui
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide import QtCore as _QtCore, QtGui as _QtGui
globals().update(
{name: getattr(_QtCore, name)
for name in __Qt4_QtCore if hasattr(_QtCore, name)}
)
Signal = _QtCore.Signal
Slot = _QtCore.Slot
Property = _QtCore.Property
QAbstractProxyModel = _QtGui.QAbstractProxyModel
if hasattr(_QtGui, "QIdentityProxyModel"):
QIdentityProxyModel = _QtGui.QIdentityProxyModel
QItemSelection = _QtGui.QItemSelection
QItemSelectionModel = _QtGui.QItemSelectionModel
QItemSelectionRange = _QtGui.QItemSelectionRange
QSortFilterProxyModel = _QtGui.QSortFilterProxyModel
QStringListModel = _QtGui.QStringListModel
_major, _minor, _micro = tuple(map(int, _QtCore.qVersion().split(".")[:3]))
QT_VERSION = (_major << 16) + (_minor << 8) + _micro
QT_VERSION_STR = "{}.{}.{}".format(_major, _minor, _micro)
del _QtCore, _QtGui, _major, _minor, _micro
# Known to be in PyQt4 but missing in PySide:
# Q_ARG, Q_CLASSINFO, Q_ENUMS, Q_FLAGS, Q_RETURN_ARG, ...
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtCore import *
_major, _minor, _micro = tuple(map(int, qVersion().split(".")[:3]))
QT_VERSION = (_major << 16) + (_minor << 8) + _micro
QT_VERSION_STR = "{}.{}.{}".format(_major, _minor, _micro)
BoundSignal = Signal
# Missing in PyQt4 <= 4.11.3
if not hasattr(QEvent, "MacSizeChange"):
QEvent.MacSizeChange = QEvent.Type(177)
if not hasattr(QEvent, "ContentsRectChange"):
QEvent.ContentsRectChange = QEvent.Type(178)
if not hasattr(QEvent, "NonClientAreaMouseButtonDblClick"):
QEvent.NonClientAreaMouseButtonDblClick = QEvent.Type(176)
if not hasattr(QEvent, "NonClientAreaMouseButtonPress"):
QEvent.NonClientAreaMouseButtonPress = QEvent.Type(174)
if not hasattr(QEvent, "NonClientAreaMouseButtonRelease"):
QEvent.NonClientAreaMouseButtonRelease = QEvent.Type(175)
if not hasattr(QEvent, "NonClientAreaMouseMove"):
QEvent.NonClientAreaMouseMove = QEvent.Type(173)
if not hasattr(QSignalMapper, "mappedInt"): # Qt < 5.15
class QSignalMapper(QSignalMapper):
mappedInt = Signal(int)
mappedString = Signal(str)
mappedObject = Signal("QObject*")
mappedWidget = Signal("QWidget*")
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.mapped[int].connect(self.mappedInt)
self.mapped[str].connect(self.mappedString)
self.mapped["QObject*"].connect(self.mappedObject)
try:
self.mapped["QWidget*"].connect(self.mappedWidget)
except (KeyError, TypeError):
pass
if not hasattr(QLibraryInfo, "path"):
QLibraryInfo.path = QLibraryInfo.location
if not hasattr(QLibraryInfo, "LibraryLocation"):
QLibraryInfo.LibraryLocation = QLibraryInfo.LibraryPath
if not hasattr(QLibraryInfo, "location"):
QLibraryInfo.location = QLibraryInfo.path
if _api.USED_API == _api.QT_API_PYSIDE2:
class QSettings(QSettings):
"""
A subclass of QSettings with a simulated `type` parameter in
value method.
"""
# QSettings.value does not have `type` type in PySide2
def value(self, key, defaultValue=None, type=None):
"""
Returns the value for setting key. If the setting doesn't exist,
returns defaultValue.
"""
if not self.contains(key):
return defaultValue
value = super().value(key)
if type is not None:
value = self.__qvariant_cast(value, type)
if value is None:
value = defaultValue
return value
from AnyQt._compat import qvariant_cast as __qvariant_cast
__qvariant_cast = staticmethod(__qvariant_cast)
try:
QStringListModel
except NameError:
from PySide2.QtGui import QStringListModel
pyqtSignal = Signal
pyqtSlot = Slot
pyqtProperty = Property
if _api.USED_API == _api.QT_API_PYSIDE2:
try:
from PySide2 import shiboken2 as __shiboken2
except ImportError:
import shiboken2 as __shiboken2
def cast(obj, type_):
addr = unwrapinstance(obj)
return wrapinstance(addr, type_)
def unwrapinstance(obj):
addr, = __shiboken2.getCppPointer(obj)
return addr
wrapinstance = __shiboken2.wrapInstance
def isdeleted(obj):
return not __shiboken2.isValid(obj)
ispyowned = __shiboken2.ownedByPython
delete = __shiboken2.delete
ispycreated = __shiboken2.createdByPython
elif _api.USED_API in (_api.QT_API_PYQT5, _api.QT_API_PYQT6):
from AnyQt.sip import (
cast, isdeleted, ispyowned, ispycreated, delete, unwrapinstance,
wrapinstance
)
#: Qt version as a (major, minor, micro) tuple
QT_VERSION_INFO = tuple(map(int, qVersion().split(".")[:3]))
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtDBus.py 0000664 0000000 0000000 00000000530 14272202670 0015415 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtDBus import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtDBus import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtDBus import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtDBus import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtDesigner.py 0000664 0000000 0000000 00000000550 14272202670 0016322 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtDesigner import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtDesigner import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtDesigner import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtDesigner import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtGui.py 0000664 0000000 0000000 00000035131 14272202670 0015311 0 ustar 00root root 0000000 0000000 from warnings import warn
from .QtCore import QT_VERSION_INFO as __QT_VERSION_INFO
from . import _api
# Names imported from Qt4's QtGui module
__Qt4_QtGui = [
'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',
'QIntValidator',
'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',
'QRawFont',
'QRegExpValidator',
'QRegion',
'QResizeEvent',
'QSessionManager',
'QShortcutEvent',
'QShowEvent',
'QStandardItem',
'QStandardItemModel',
'QStaticText',
'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',
'QTouchEvent',
'QTransform',
'QValidator',
'QVector2D',
'QVector3D',
'QVector4D',
'QWhatsThisClickedEvent',
'QWheelEvent',
'QWindowStateChangeEvent',
'qAlpha',
'qBlue',
'qFuzzyCompare',
'qGray',
'qGreen',
'qIsGray',
'qRed',
'qRgb',
'qRgba'
]
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtGui import *
# Deprecated QEnterEvent accessors
if not hasattr(QEnterEvent, "pos"):
QEnterEvent.pos = lambda self: self.position().toPoint()
if not hasattr(QEnterEvent, "globalPos"):
QEnterEvent.globalPos = lambda self: self.globalPosition().toPoint()
if not hasattr(QEnterEvent, "x"):
QEnterEvent.x = lambda self: self.position().toPoint().x()
if not hasattr(QEnterEvent, "y"):
QEnterEvent.y = lambda self: self.position().toPoint().y()
if not hasattr(QEnterEvent, "globalX"):
QEnterEvent.globalX = lambda self: self.globalPosition().toPoint().x()
if not hasattr(QEnterEvent, "globalY"):
QEnterEvent.globalY = lambda self: self.globalPosition().toPoint().y()
if not hasattr(QEnterEvent, "localPos"):
QEnterEvent.localPos = lambda self: self.position()
if not hasattr(QEnterEvent, "windowPos"):
QEnterEvent.windowPos = lambda self: self.scenePosition()
if not hasattr(QEnterEvent, "screenPos"):
QEnterEvent.screenPos = lambda self: self.globalPosition()
# Deprecated QMouseEvent accessors
if not hasattr(QMouseEvent, "pos"):
QMouseEvent.pos = lambda self: self.position().toPoint()
if not hasattr(QMouseEvent, "globalPos"):
QMouseEvent.globalPos = lambda self: self.globalPosition().toPoint()
if not hasattr(QMouseEvent, "x"):
QMouseEvent.x = lambda self: self.position().x()
if not hasattr(QMouseEvent, "y"):
QMouseEvent.y = lambda self: self.position().y()
if not hasattr(QMouseEvent, "globalX"):
QMouseEvent.globalX = lambda self: self.globalPosition().x()
if not hasattr(QMouseEvent, "globalY"):
QMouseEvent.globalY = lambda self: self.globalPosition().y()
# Deprecated QDropEvent accessors
if not hasattr(QDropEvent, "pos"):
QDropEvent.pos = lambda self: self.position().toPoint()
if not hasattr(QDropEvent, "posF"):
QDropEvent.posF = lambda self: self.position()
if not hasattr(QDropEvent, "mouseButtons"):
QDropEvent.mouseButtons = lambda self: self.buttons()
if not hasattr(QDropEvent, "keyboardModifiers"):
QDropEvent.keyboardModifiers = lambda self: self.modifiers()
# Deprecated QWheelEvent accessors
if not hasattr(QWheelEvent, "pos"):
QWheelEvent.pos = lambda self: self.position().toPoint()
if not hasattr(QWheelEvent, "posF"):
QWheelEvent.posF = lambda self: self.position()
if not hasattr(QWheelEvent, "globalPos"):
QWheelEvent.globalPos = lambda self: self.globalPosition().toPoint()
if not hasattr(QWheelEvent, "globalPosF"):
QWheelEvent.globalPosF = lambda self: self.globalPosition()
if not hasattr(QWheelEvent, "x"):
QWheelEvent.x = lambda self: self.position().x()
if not hasattr(QWheelEvent, "y"):
QWheelEvent.y = lambda self: self.position().y()
if not hasattr(QWheelEvent, "globalX"):
QWheelEvent.globalX = lambda self: self.globalPosition().x()
if not hasattr(QWheelEvent, "globalY"):
QWheelEvent.globalY = lambda self: self.globalPosition().y()
if not hasattr(QWheelEvent, "mouseButtons"):
QWheelEvent.mouseButtons = lambda self: self.buttons()
if not hasattr(QWheelEvent, "keyboardModifiers"):
QWheelEvent.keyboardModifiers = lambda self: self.modifiers()
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtGui import *
from PyQt5.QtWidgets import QUndoCommand, QUndoStack, QUndoGroup
from PyQt5.QtWidgets import QShortcut, QAction, QActionGroup
from PyQt5.QtCore import PYQT_VERSION as _PYQT_VERSION
if _PYQT_VERSION < 0x50c00: # 5.12.0
class WheelEvent(QWheelEvent):
from PyQt5.QtCore import (QPointF as _QPointF,
QPoint as _QPoint,
Qt as _Qt)
_constructor_signature = \
((_QPointF, _QPoint),
(_QPointF, _QPoint),
(_QPoint,),
(_QPoint,),
(_Qt.MouseButtons, _Qt.MouseButton),
(_Qt.KeyboardModifiers, _Qt.KeyboardModifier),
(_Qt.ScrollPhase,),
(bool,),
(_Qt.MouseEventSource,))
def __init__(self, *args):
sig = WheelEvent._constructor_signature
if len(args) == len(sig) and \
all(any(isinstance(a, t) for t in ts)
for a, ts in zip(args, sig)):
angleDelta = args[3]
if abs(angleDelta.x()) > abs(angleDelta.y()):
orientation = 0x1 # horizontal
delta = angleDelta.x()
else:
orientation = 0x2 # vertical
delta = angleDelta.y()
args = args[:4] + \
(delta, orientation) + \
args[4:7] + (args[8], args[7])
super().__init__(*args)
QWheelEvent = WheelEvent
elif _api.USED_API == _api.QT_API_PYQT4:
import PyQt4.QtGui as _QtGui
globals().update(
{name: getattr(_QtGui, name)
for name in __Qt4_QtGui if hasattr(_QtGui, name)}
)
del _QtGui
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide import QtGui as _QtGui
globals().update(
{name: getattr(_QtGui, name)
for name in __Qt4_QtGui if hasattr(_QtGui, name)}
)
del _QtGui
# Known to be present in PyQt4 but not in PySide:
# QGlyphRun, QRawFont, QStaticText, QTextDocumentWriter
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtGui import *
from PySide2.QtWidgets import QUndoCommand, QUndoStack, QUndoGroup
from PySide2.QtWidgets import QShortcut, QAction, QActionGroup
if _api.USED_API in [_api.QT_API_PYQT4, _api.QT_API_PYSIDE]:
from AnyQt import QtCore as __QtCore
def __QWheelEvent_angleDelta(self):
"""
Qt5 compatible QWheelEvent.angleDelta
Return the delta as an x or y axis aligned QPoint vector
"""
if self.orientation() == __QtCore.Qt.Horizontal:
return __QtCore.QPoint(self.delta(), 0)
else:
return __QtCore.QPoint(0, self.delta())
def __QWheelEvent_pixelDelta(self):
"""
Qt5 compatible QWheelEvent.pixelDelta
Always return a null QPoint. This is acceptable and compatible with
the API (i.e. the pixelDelta is only supported on platforms where
high resolution is available).
"""
return __QtCore.QPoint()
QWheelEvent.angleDelta = __QWheelEvent_angleDelta
QWheelEvent.pixelDelta = __QWheelEvent_pixelDelta
if _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtCore import QRectF as __QRectF
_QPainter_drawPixmapFragments_orig = QPainter.drawPixmapFragments
class __ArgsTypeError(TypeError): pass
def _QPainter_drawPixmapFragments(painter, fragments, *args, **kwargs):
def f1(fragment, size, pixmap=None, hints=QPainter.PixmapFragmentHints()):
# dispatch to original if possible
if isinstance(size, int) and isinstance(pixmap, QPixmap):
_QPainter_drawPixmapFragments_orig(painter, fragment, size, pixmap, hints)
else:
raise __ArgsTypeError
try:
f1(fragments, *args, **kwargs)
return
except __ArgsTypeError:
pass
def f2(fragments, pixmap, hints=QPainter.PixmapFragmentHints()):
if isinstance(pixmap, QPixmap):
return (fragments, pixmap)
else:
raise TypeError
fragments, pixmap = f2(fragments, *args, **kwargs)
# emulate the api
painter.save()
oldtr = painter.worldTransform()
oldopacity = painter.opacity()
for frag in fragments: # type: QPainter.PixmapFragment
tr = QTransform(oldtr)
x, y = frag.x, frag.y
tr.translate(x, y)
tr.rotate(frag.rotation)
painter.setTransform(tr)
painter.setOpacity(oldopacity * frag.opacity)
w = frag.scaleX * frag.width
h = frag.scaleY * frag.height
sourceRect = __QRectF(
frag.sourceLeft, frag.sourceTop, frag.width, frag.height)
painter.drawPixmap(
__QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect)
painter.restore()
QPainter.drawPixmapFragments = _QPainter_drawPixmapFragments
if _api.USED_API in (_api.QT_API_PYQT5, _api.QT_API_PYSIDE2):
# PyQt5, PySide2 do not support setPageSize(QPageSize) overload
def QPdfWriter_setPageSize(self, size):
if isinstance(size, QPageSize):
self.setPageSizeMM(size.size(QPageSize.Millimeter))
return self.pageLayout().pageSize().isEquivalentTo(size)
else:
__QPdfWriter_setPageSize(self, size)
__QPdfWriter_setPageSize = QPdfWriter.setPageSize
QPdfWriter.setPageSize = QPdfWriter_setPageSize
del QPdfWriter_setPageSize
if not hasattr(QGuiApplication, 'screenAt'):
def QGuiApplication_screenAt(pos):
visited = set()
for screen in QGuiApplication.screens():
if screen in visited:
continue
# The virtual siblings include the screen itself, so iterate directly
for sibling in screen.virtualSiblings():
if sibling.geometry().contains(pos):
return sibling
visited.add(sibling)
return None
QGuiApplication.screenAt = staticmethod(QGuiApplication_screenAt)
del QGuiApplication_screenAt
# Alias QFontMetrics(F).horizontalAdvance to QFontMetrics(F).width
# when it does not exists
if not hasattr(QFontMetrics, "horizontalAdvance"):
def QFontMetrics_horizontalAdvance(self, *args, **kwargs):
return __QFontMetrics_width(self, *args, **kwargs)
__QFontMetrics_width = QFontMetrics.width
QFontMetrics.horizontalAdvance = QFontMetrics_horizontalAdvance
del QFontMetrics_horizontalAdvance
if not hasattr(QFontMetricsF, "horizontalAdvance"):
def QFontMetricsF_horizontalAdvance(self, *args, **kwargs):
return __QFontMetricsF_width(self, *args, **kwargs)
__QFontMetricsF_width = QFontMetricsF.width
QFontMetricsF.horizontalAdvance = QFontMetricsF_horizontalAdvance
del QFontMetricsF_horizontalAdvance
# Warn on deprecated QFontMetrics.width
def QFontMetrics_width(self, *args, **kwargs):
warn("QFontMetrics(F).width is obsolete. "
"Replace with QFontMetrics(F).horizontalAdvance",
DeprecationWarning, stacklevel=2)
return self.horizontalAdvance(*args, **kwargs)
QFontMetricsF.width = QFontMetrics_width
QFontMetrics.width = QFontMetrics_width
del QFontMetrics_width
if __QT_VERSION_INFO < (6, 0):
class QFontDatabase(QFontDatabase):
def staticwrapper(f):
from functools import wraps
@wraps(f)
def wrapped(*args, **kwargs):
return f(QFontDatabase(), *args, **kwargs)
return staticmethod(wrapped)
bold = staticwrapper(QFontDatabase.bold)
families = staticwrapper(QFontDatabase.families)
font = staticwrapper(QFontDatabase.font)
isBitmapScalable = staticwrapper(QFontDatabase.isBitmapScalable)
isFixedPitch = staticwrapper(QFontDatabase.isFixedPitch)
isPrivateFamily = staticwrapper(QFontDatabase.isPrivateFamily)
isScalable = staticwrapper(QFontDatabase.isScalable)
isSmoothlyScalable = staticwrapper(QFontDatabase.isSmoothlyScalable)
italic = staticwrapper(QFontDatabase.italic)
pointSizes = staticwrapper(QFontDatabase.pointSizes)
smoothSizes = staticwrapper(QFontDatabase.smoothSizes)
styleString = staticwrapper(QFontDatabase.styleString)
styles = staticwrapper(QFontDatabase.styles)
weight = staticwrapper(QFontDatabase.weight)
writingSystems = staticwrapper(QFontDatabase.writingSystems)
del staticwrapper
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtHelp.py 0000664 0000000 0000000 00000000644 14272202670 0015456 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtHelp import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtHelp import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtHelp import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtHelp import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtHelp import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtMacExtras.py 0000664 0000000 0000000 00000000726 14272202670 0016456 0 ustar 00root root 0000000 0000000 from . import _api
# Names imported from Qt4's QtGui module
__Qt4_QtGui = [
'QMacPasteboardMime'
]
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtMacExtras import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtMacExtras import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtGui import QMacPasteboardMime
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtGui import QMacPasteboardMime
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtMultimedia.py 0000664 0000000 0000000 00000000702 14272202670 0016653 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtMultimedia import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtMultimedia import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtMultimedia import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtMultimedia import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtMultimedia import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtMultimediaWidgets.py 0000664 0000000 0000000 00000000710 14272202670 0020201 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtMultimediaWidgets import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtMultimediaWidgets import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtMultimediaWidgets import *
else:
raise ImportError("No module named 'QtMultimediaWidgets' in the selected"
"Qt api ({})".format(_api.USED_API))
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtNetwork.py 0000664 0000000 0000000 00000002767 14272202670 0016227 0 ustar 00root root 0000000 0000000 from . import _api
# Names imported from Qt4' QtNetwork module
__Qt4_QtNetwork = [
'QAbstractNetworkCache',
'QAbstractSocket',
'QAuthenticator',
# 'QDnsDomainNameRecord',
# 'QDnsHostAddressRecord',
# 'QDnsLookup',
# 'QDnsMailExchangeRecord',
# 'QDnsServiceRecord',
# 'QDnsTextRecord',
'QHostAddress',
'QHostInfo',
'QHttpMultiPart',
'QHttpPart',
'QLocalServer',
'QLocalSocket',
'QNetworkAccessManager',
'QNetworkAddressEntry',
'QNetworkCacheMetaData',
'QNetworkConfiguration',
'QNetworkConfigurationManager',
'QNetworkCookie',
'QNetworkCookieJar',
'QNetworkDiskCache',
'QNetworkInterface',
'QNetworkProxy',
'QNetworkProxyFactory',
'QNetworkProxyQuery',
'QNetworkReply',
'QNetworkRequest',
'QNetworkSession',
'QSsl',
'QSslCertificate',
# 'QSslCertificateExtension',
'QSslCipher',
'QSslConfiguration',
# 'QSslEllipticCurve',
'QSslError',
'QSslKey',
# 'QSslPreSharedKeyAuthenticator',
'QSslSocket',
'QTcpServer',
'QTcpSocket',
'QUdpSocket',
]
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtNetwork import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtNetwork import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtNetwork import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtNetwork import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtNetwork import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtOpenGL.py 0000664 0000000 0000000 00000000656 14272202670 0015715 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtOpenGL import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtOpenGL import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtOpenGL import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtOpenGL import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtOpenGL import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtPrintSupport.py 0000664 0000000 0000000 00000002077 14272202670 0017261 0 ustar 00root root 0000000 0000000 from . import _api
# Names imported from Qt'4 QtGui module
__Qt4_QtGui = [
'QAbstractPrintDialog',
'QPageSetupDialog',
'QPrintDialog',
'QPrintEngine',
'QPrintPreviewDialog',
'QPrintPreviewWidget',
'QPrinter',
'QPrinterInfo'
]
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtPrintSupport import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtPrintSupport import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtGui import (
QAbstractPrintDialog,
QPageSetupDialog,
QPrintDialog,
QPrintEngine,
QPrintPreviewDialog,
QPrintPreviewWidget,
QPrinter,
QPrinterInfo
)
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtGui import (
QAbstractPrintDialog,
QPageSetupDialog,
QPrintDialog,
QPrintEngine,
QPrintPreviewDialog,
QPrintPreviewWidget,
QPrinter,
QPrinterInfo
)
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtPrintSupport import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtQml.py 0000664 0000000 0000000 00000000621 14272202670 0015312 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtQml import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtQml import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtQml import *
else:
raise ImportError("No module named 'QtQml' in the selected "
"Qt api ({})".format(_api.USED_API))
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtQuick.py 0000664 0000000 0000000 00000000631 14272202670 0015636 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtQuick import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtQuick import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtQuick import *
else:
raise ImportError("No module named 'QtQuick' in the selected "
"Qt api ({})".format(_api.USED_API))
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtSql.py 0000664 0000000 0000000 00000000636 14272202670 0015326 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtSql import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtSql import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtSql import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtSql import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtSql import *
_api.apply_global_fixes(globals()) anyqt-0.2.0/AnyQt/QtSvg.py 0000664 0000000 0000000 00000000737 14272202670 0015330 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtSvg import *
from PyQt6.QtSvgWidgets import QSvgWidget, QGraphicsSvgItem
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtSvg import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtSvg import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtSvg import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtSvg import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtSvgWidgets.py 0000664 0000000 0000000 00000001022 14272202670 0016643 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtSvgWidgets import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtSvg import QSvgWidget, QGraphicsSvgItem
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtSvg import QSvgWidget, QGraphicsSvgItem
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtSvg import QSvgWidget, QGraphicsSvgItem
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtSvg import QSvgWidget, QGraphicsSvgItem
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtTest.py 0000664 0000000 0000000 00000014372 14272202670 0015510 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtTest import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtTest import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtTest import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtTest import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtTest import *
def _QTest_qSleep(ms: int):
import time
time.sleep(ms / 1000)
if not hasattr(QTest, "qSleep"):
QTest.qSleep = _QTest_qSleep
def _QTest_qWaitForWindowExposed(widget, timeout=1000):
# A Qt5 compatible (probably) QTest.qWaitForWindowExposed(QWidget, int)
# (mostly copied from qtestsystem.h in qt5/qtbase)
from AnyQt.QtCore import \
Qt, QCoreApplication, QEventLoop, QElapsedTimer, QEvent
window = widget.window()
timer = QElapsedTimer()
timer.start()
# Is widget.testAttribute(Qt.WA_Mapped) a suitable replacement for
# QWindow.isExposed in Qt5??
# Not exactly. In Qt5
# window().testAttribute(Qt.WA_Mapped) == window().windowHandle.isExposed()
# but both are False if a window is fully obscured by other windows,
# in Qt4 there is no difference if a window is obscured.
while not window.testAttribute(Qt.WA_Mapped):
remaining = timeout - timer.elapsed()
if remaining <= 0:
break
QCoreApplication.processEvents(QEventLoop.AllEvents, remaining)
QCoreApplication.sendPostedEvents(None, QEvent.DeferredDelete)
QTest.qSleep(10)
return window.testAttribute(Qt.WA_Mapped)
if not hasattr(QTest, "qWaitForWindowExposed"):
QTest.qWaitForWindowExposed = _QTest_qWaitForWindowExposed
def _QTest_qWaitForWindowActive(widget, timeout=1000):
# A Qt5 compatible (probably) QTest.qWaitForWindowActive(QWidget, int)
# (mostly copied from qtestsystem.h in qt5/qtbase)
from AnyQt.QtCore import \
Qt, QCoreApplication, QEventLoop, QElapsedTimer, QEvent
window = widget.window()
timer = QElapsedTimer()
timer.start()
while not window.isActiveWindow():
remaining = timeout - timer.elapsed()
if remaining <= 0:
break
QCoreApplication.processEvents(QEventLoop.AllEvents, remaining)
QCoreApplication.sendPostedEvents(None, QEvent.DeferredDelete)
QTest.qSleep(10)
# See the explanation in qtestsystem.h
if window.isActiveWindow():
wait_no = 0
while window.pos().isNull():
if wait_no > timeout // 10:
break
wait_no += 1
QTest.qWait(10)
return window.isActiveWindow()
if not hasattr(QTest, "qWaitForWindowActive"):
QTest.qWaitForWindowActive = _QTest_qWaitForWindowActive
if _api.USED_API in {_api.QT_API_PYQT4, _api.QT_API_PYSIDE, _api.QT_API_PYSIDE2}:
from AnyQt.QtCore import QObject, QByteArray as _QByteArray
# not exposed in PyQt4 or PySide. Going by PyQt5 interface
class QSignalSpy(QObject):
"""
QSignalSpy(boundsignal)
"""
def __init__(self, boundsig, **kwargs):
super(QSignalSpy, self).__init__(**kwargs)
from AnyQt.QtCore import QEventLoop, QTimer
self.__boundsig = boundsig
self.__recorded = recorded = [] # type: List[List[Any]]
self.__loop = loop = QEventLoop()
self.__timer = QTimer(self, singleShot=True)
self.__timer.timeout.connect(self.__loop.quit)
def record(*args):
# Record the emitted arguments and quit the loop if running.
# NOTE: not capturing self from parent scope
recorded.append(list(args))
if loop.isRunning():
loop.quit()
# Need to keep reference at least for PyQt4 4.11.4, sip 4.16.9 on
# python 3.4 (if the signal is emitted during gc collection, and
# the boundsignal is a QObject.destroyed signal).
self.__record = record
boundsig.connect(record)
def signal(self):
return _QByteArray(self.__boundsig.signal[1:].encode("latin-1"))
def isValid(self):
return True
def wait(self, timeout=5000):
count = len(self)
self.__timer.stop()
self.__timer.setInterval(timeout)
self.__timer.start()
self.__loop.exec_()
self.__timer.stop()
return len(self) != count
def __getitem__(self, index):
return self.__recorded[index]
def __setitem__(self, index, value):
self.__recorded.__setitem__(index, value)
def __delitem__(self, index):
self.__recorded.__delitem__(index)
def __len__(self):
return len(self.__recorded)
del QObject
def _QTest_qWaitFor(predicate, timeout=5000):
# type: (Callable[[], bool], int) -> bool
# Copied and adapted from Qt
from AnyQt.QtCore import Qt, QCoreApplication, QEvent, QEventLoop, QDeadlineTimer
if predicate():
return True
deadline = QDeadlineTimer(Qt.PreciseTimer)
deadline.setRemainingTime(timeout)
while True:
QCoreApplication.processEvents(QEventLoop.AllEvents)
QCoreApplication.sendPostedEvents(None, QEvent.DeferredDelete)
if predicate():
return True
remaining = deadline.remainingTime()
if remaining > 0:
QTest.qSleep(min(10, remaining))
remaining = deadline.remainingTime()
if remaining <= 0:
break
return predicate() # Last chance
if not hasattr(QTest, "qWaitFor"): # Qt < 5.10
QTest.qWaitFor = _QTest_qWaitFor
def _QTest_qWait(timeout):
from AnyQt.QtCore import Qt, QCoreApplication, QEvent, QEventLoop, QDeadlineTimer
remaining = timeout
deadline = QDeadlineTimer(remaining, Qt.PreciseTimer)
while True:
QCoreApplication.processEvents(QEventLoop.AllEvents, remaining)
QCoreApplication.sendPostedEvents(None, QEvent.DeferredDelete)
remaining = deadline.remainingTime()
if remaining <= 0:
break
QTest.qSleep(min(10, remaining))
remaining = deadline.remainingTime()
if remaining <= 0:
break
if not hasattr(QTest, "qWait"): # PySide2
QTest.qWait = _QTest_qWait
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtWebChannel.py 0000664 0000000 0000000 00000000654 14272202670 0016575 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtWebChannel import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtWebChannel import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtWebChannel import *
else:
raise ImportError("No module named 'QtWebChannel' in the selected "
"Qt api ({})".format(_api.USED_API))
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtWebEngineCore.py 0000664 0000000 0000000 00000001314 14272202670 0017235 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtWebEngineCore import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtWebEngineCore import *
try:
from PyQt5.QtWebEngineWidgets import (
QWebEngineHistory,
QWebEngineProfile,
QWebEngineScript,
QWebEngineScriptCollection,
QWebEngineClientCertificateSelection,
QWebEngineSettings,
QWebEngineFullScreenRequest,
)
except ImportError:
pass
else:
raise ImportError("No module named 'QtWebEngineCore' in the selected "
"Qt api ({})".format(_api.USED_API))
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtWebEngineWidgets.py 0000664 0000000 0000000 00000001326 14272202670 0017756 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtWebEngineWidgets import *
from PyQt6.QtWebEngineCore import (
QWebEngineHistory,
QWebEngineProfile,
QWebEngineScript,
QWebEngineScriptCollection,
QWebEngineClientCertificateSelection,
QWebEngineSettings,
QWebEngineFullScreenRequest,
)
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtWebEngineWidgets import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtWebEngineWidgets import *
else:
raise ImportError("No module named 'QtWebEngineWidgets' in the selected "
"Qt api ({})".format(_api.USED_API))
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtWebKit.py 0000664 0000000 0000000 00000002716 14272202670 0015755 0 ustar 00root root 0000000 0000000 from . import _api
# Names imported from Qt4's QtWebKit module
__Qt4_QtWebKit = [
'QWebDatabase',
'QWebElement',
'QWebElementCollection',
'QWebHistory',
'QWebHistoryInterface',
'QWebHistoryItem',
'QWebPluginFactory',
'QWebSecurityOrigin',
'QWebSettings',
'qWebKitMajorVersion',
'qWebKitMinorVersion',
'qWebKitVersion'
]
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtWebKit import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtWebKit import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtWebKit import (
QWebDatabase,
QWebElement,
QWebElementCollection,
QWebHistory,
QWebHistoryInterface,
QWebHistoryItem,
QWebPluginFactory,
QWebSecurityOrigin,
QWebSettings,
qWebKitMajorVersion,
qWebKitMinorVersion,
qWebKitVersion
)
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtWebKit import (
QWebDatabase,
QWebElement,
QWebElementCollection,
QWebHistory,
QWebHistoryInterface,
QWebHistoryItem,
QWebPluginFactory,
QWebSecurityOrigin,
QWebSettings,
)
try:
# missing in current PySide 1.2.2
from PySide.QtWebKit import \
qWebKitMajorVersion, qWebKitMinorVersion, qWebKitVersion
except ImportError:
pass
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtWebKit import *
anyqt-0.2.0/AnyQt/QtWebKitWidgets.py 0000664 0000000 0000000 00000001471 14272202670 0017301 0 ustar 00root root 0000000 0000000 from . import _api
# Names imported from Qt4's QtWebKit module
__Qt4_QtWebKit = [
'QGraphicsWebView',
'QWebFrame',
'QWebHitTestResult',
'QWebInspector',
'QWebPage',
'QWebView',
]
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtWebKitWidgets import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtWebKitWidgets import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtWebKit import (
QGraphicsWebView,
QWebFrame,
QWebHitTestResult,
QWebInspector,
QWebPage,
QWebView,
)
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtWebKit import (
QGraphicsWebView,
QWebFrame,
QWebHitTestResult,
QWebInspector,
QWebPage,
QWebView,
)
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtWebSockets.py 0000664 0000000 0000000 00000000655 14272202670 0016641 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtWebSockets import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtWebSockets import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtWebSockets import *
else:
raise ImportError("No module named 'QtWebSockets' in the selected "
"Qt api ({})".format(_api.USED_API))
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtWidgets.py 0000664 0000000 0000000 00000041306 14272202670 0016174 0 ustar 00root root 0000000 0000000 from warnings import warn
from . import _api
# Names imported from Qt4's QtGui module
__Qt4_QtGui = [
'QAbstractButton',
'QAbstractGraphicsShapeItem',
'QAbstractItemDelegate',
'QAbstractItemView',
'QAbstractScrollArea',
'QAbstractSlider',
'QAbstractSpinBox',
'QAction',
'QActionGroup',
'QApplication',
'QBoxLayout',
'QButtonGroup',
'QCalendarWidget',
'QCheckBox',
'QColorDialog',
'QColumnView',
'QComboBox',
'QCommandLinkButton',
'QCommonStyle',
'QCompleter',
'QDataWidgetMapper',
'QDateEdit',
'QDateTimeEdit',
'QDesktopWidget',
'QDial',
'QDialog',
'QDialogButtonBox',
'QDirModel',
'QDockWidget',
'QDoubleSpinBox',
'QErrorMessage',
'QFileDialog',
'QFileIconProvider',
'QFileSystemModel',
'QFocusFrame',
'QFontComboBox',
'QFontDialog',
'QFormLayout',
'QFrame',
'QGesture',
'QGestureEvent',
'QGestureRecognizer',
'QGraphicsAnchor',
'QGraphicsAnchorLayout',
'QGraphicsBlurEffect',
'QGraphicsColorizeEffect',
'QGraphicsDropShadowEffect',
'QGraphicsEffect',
'QGraphicsEllipseItem',
'QGraphicsGridLayout',
'QGraphicsItem',
'QGraphicsItemGroup',
'QGraphicsLayout',
'QGraphicsLayoutItem',
'QGraphicsLineItem',
'QGraphicsLinearLayout',
'QGraphicsObject',
'QGraphicsOpacityEffect',
'QGraphicsPathItem',
'QGraphicsPixmapItem',
'QGraphicsPolygonItem',
'QGraphicsProxyWidget',
'QGraphicsRectItem',
'QGraphicsRotation',
'QGraphicsScale',
'QGraphicsScene',
'QGraphicsSceneContextMenuEvent',
'QGraphicsSceneDragDropEvent',
'QGraphicsSceneEvent',
'QGraphicsSceneHelpEvent',
'QGraphicsSceneHoverEvent',
'QGraphicsSceneMouseEvent',
'QGraphicsSceneMoveEvent',
'QGraphicsSceneResizeEvent',
'QGraphicsSceneWheelEvent',
'QGraphicsSimpleTextItem',
'QGraphicsTextItem',
'QGraphicsTransform',
'QGraphicsView',
'QGraphicsWidget',
'QGridLayout',
'QGroupBox',
'QHBoxLayout',
'QHeaderView',
'QInputDialog',
'QItemDelegate',
'QItemEditorCreatorBase',
'QItemEditorFactory',
'QKeyEventTransition',
# 'QKeySequenceEdit',
'QLCDNumber',
'QLabel',
'QLayout',
'QLayoutItem',
'QLineEdit',
'QListView',
'QListWidget',
'QListWidgetItem',
'QMacCocoaViewContainer',
'QMainWindow',
'QMdiArea',
'QMdiSubWindow',
'QMenu',
'QMenuBar',
'QMessageBox',
'QMouseEventTransition',
# 'QOpenGLWidget',
'QPanGesture',
'QPinchGesture',
'QPlainTextDocumentLayout',
'QPlainTextEdit',
'QProgressBar',
'QProgressDialog',
# 'QProxyStyle',
'QPushButton',
'QRadioButton',
'QRubberBand',
'QScrollArea',
'QScrollBar',
# 'QScroller',
# 'QScrollerProperties',
'QShortcut',
'QSizeGrip',
'QSizePolicy',
'QSlider',
'QSpacerItem',
'QSpinBox',
'QSplashScreen',
'QSplitter',
'QSplitterHandle',
'QStackedLayout',
'QStackedWidget',
'QStatusBar',
'QStyle',
'QStyleFactory',
'QStyleHintReturn',
'QStyleHintReturnMask',
'QStyleHintReturnVariant',
'QStyleOption',
'QStyleOptionButton',
'QStyleOptionComboBox',
'QStyleOptionComplex',
'QStyleOptionDockWidget',
'QStyleOptionFocusRect',
'QStyleOptionFrame',
'QStyleOptionGraphicsItem',
'QStyleOptionGroupBox',
'QStyleOptionHeader',
'QStyleOptionMenuItem',
'QStyleOptionProgressBar',
'QStyleOptionRubberBand',
'QStyleOptionSizeGrip',
'QStyleOptionSlider',
'QStyleOptionSpinBox',
'QStyleOptionTab',
'QStyleOptionTabBarBase',
'QStyleOptionTabWidgetFrame',
'QStyleOptionTitleBar',
'QStyleOptionToolBar',
'QStyleOptionToolBox',
'QStyleOptionToolButton',
'QStyleOptionViewItem',
'QStylePainter',
'QStyledItemDelegate',
'QSwipeGesture',
'QSystemTrayIcon',
'QTabBar',
'QTabWidget',
'QTableView',
'QTableWidget',
'QTableWidgetItem',
'QTableWidgetSelectionRange',
'QTapAndHoldGesture',
'QTapGesture',
'QTextBrowser',
'QTextEdit',
'QTimeEdit',
'QToolBar',
'QToolBox',
'QToolButton',
'QToolTip',
'QTreeView',
'QTreeWidget',
'QTreeWidgetItem',
'QTreeWidgetItemIterator',
'QUndoCommand',
'QUndoGroup',
'QUndoStack',
'QUndoView',
'QVBoxLayout',
'QWIDGETSIZE_MAX',
'QWhatsThis',
'QWidget',
'QWidgetAction',
'QWidgetItem',
'QWizard',
'QWizardPage',
'qApp',
'qDrawBorderPixmap',
'qDrawPlainRect',
'qDrawShadeLine',
'qDrawShadePanel',
'qDrawShadeRect',
'qDrawWinButton',
'qDrawWinPanel'
]
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtWidgets import *
from PyQt6.QtGui import QAction, QActionGroup
from PyQt6.QtGui import QUndoCommand, QUndoStack, QUndoGroup
from PyQt6.QtGui import QShortcut
QStyle.State = QStyle.StateFlag
QStyle.SubControls = QStyle.SubControl
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtWidgets import *
from PyQt5.QtCore import PYQT_VERSION as _PYQT_VERSION
if _PYQT_VERSION < 0x50502: # ?
from . import _fixes
_fixes.fix_pyqt5_QGraphicsItem_itemChange()
del _fixes
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4 import QtGui as _QtGui
globals().update(
{name: getattr(_QtGui, name)
for name in __Qt4_QtGui if hasattr(_QtGui, name)}
)
# Alias the QStyleOption version classes
QStyleOptionViewItem = _QtGui.QStyleOptionViewItemV4
QStyleOptionViewItem_ = _QtGui.QStyleOptionViewItem
QStyleOptionToolBox = _QtGui.QStyleOptionToolBoxV2
QStyleOptionToolBox_ = _QtGui.QStyleOptionToolBox
QStyleOptionDockWidget = _QtGui.QStyleOptionDockWidgetV2
QStyleOptionDockWidget_ = _QtGui.QStyleOptionDockWidget
QStyleOptionFrame = _QtGui.QStyleOptionFrameV3
QStyleOptionFrame_ = _QtGui.QStyleOptionFrame
QStyleOptionProgressBar = _QtGui.QStyleOptionProgressBarV2
QStyleOptionProgressBar_ = _QtGui.QStyleOptionProgressBar
QStyleOptionTabWidgetFrame = _QtGui.QStyleOptionTabWidgetFrameV2
QStyleOptionTabWidgetFrame_ = _QtGui.QStyleOptionTabWidgetFrame
QStyleOptionTabBarBase = _QtGui.QStyleOptionTabBarBaseV2
QStyleOptionTabBarBase_ = _QtGui.QStyleOptionTabBarBase
QStyleOptionTab = _QtGui.QStyleOptionTabV3
QStyleOptionTab_ = _QtGui.QStyleOptionTab
# PyQt5's version of QFileDialog's static methods
class QFileDialog(_QtGui.QFileDialog):
getOpenFileName = _QtGui.QFileDialog.getOpenFileNameAndFilter
getOpenFileNames = _QtGui.QFileDialog.getOpenFileNamesAndFilter
getSaveFileName = _QtGui.QFileDialog.getSaveFileNameAndFilter
# Some extra forward compatibility
QHeaderView.setSectionResizeMode = lambda self, *args: self.setResizeMode(*args)
QHeaderView.sectionResizeMode = lambda self: self.resizeMode()
QHeaderView.sectionsClickable = lambda self: self.isClickable()
QHeaderView.setSectionsClickable = \
lambda self, clickable: self.setClickable(clickable)
QHeaderView.sectionsMovable = lambda self: self.isMovable()
QHeaderView.setSectionsMovable = \
lambda self, movable: self.setMovable(movable)
from PyQt4 import QtCore as __QtCore
QWidget = _QtGui.QWidget
__QPixmap = _QtGui.QPixmap
def _QWidget_grab(self, rect=__QtCore.QRect(0, 0, -1, -1)):
if not rect.isValid():
return __QPixmap.grabWidget(self)
else:
return __QPixmap.grabWidget(self, rect)
QWidget.grab = _QWidget_grab
del _QtGui, __QtCore
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide import QtGui as _QtGui
globals().update(
{name: getattr(_QtGui, name)
for name in __Qt4_QtGui if hasattr(_QtGui, name)}
)
# Alias the QStyleOption version classes
QStyleOptionViewItem = _QtGui.QStyleOptionViewItemV4
QStyleOptionViewItem_ = _QtGui.QStyleOptionViewItem
QStyleOptionToolBox = _QtGui.QStyleOptionToolBoxV2
QStyleOptionToolBox_ = _QtGui.QStyleOptionToolBox
QStyleOptionDockWidget = _QtGui.QStyleOptionDockWidgetV2
QStyleOptionDockWidget_ = _QtGui.QStyleOptionDockWidget
QStyleOptionFrame = _QtGui.QStyleOptionFrameV3
QStyleOptionFrame_ = _QtGui.QStyleOptionFrame
QStyleOptionProgressBar = _QtGui.QStyleOptionProgressBarV2
QStyleOptionProgressBar_ = _QtGui.QStyleOptionProgressBar
if hasattr(_QtGui, "QStyleOptionTabWidgetFrameV2"):
QStyleOptionTabWidgetFrame = _QtGui.QStyleOptionTabWidgetFrameV2
QStyleOptionTabWidgetFrame_ = _QtGui.QStyleOptionTabWidgetFrame
else:
QStyleOptionTabWidgetFrame = _QtGui.QStyleOptionTabWidgetFrame
QStyleOptionTabWidgetFrame_ = _QtGui.QStyleOptionTabWidgetFrame
QStyleOptionTabBarBase = _QtGui.QStyleOptionTabBarBaseV2
QStyleOptionTabBarBase_ = _QtGui.QStyleOptionTabBarBase
QStyleOptionTab = _QtGui.QStyleOptionTabV3
QStyleOptionTab_ = _QtGui.QStyleOptionTab
# Some extra forward compatibility
QHeaderView.setSectionResizeMode = lambda self, *args: self.setResizeMode(*args)
QHeaderView.sectionResizeMode = lambda self: self.resizeMode()
QHeaderView.sectionsClickable = lambda self: self.isClickable()
QHeaderView.setSectionsClickable = \
lambda self, clickable: self.setClickable(clickable)
QHeaderView.sectionsMovable = lambda self: self.isMovable()
QHeaderView.setSectionsMovable = \
lambda self, movable: self.setMovable(movable)
from PySide import QtCore as __QtCore
QWidget = _QtGui.QWidget
__QPixmap = _QtGui.QPixmap
def _QWidget_grab(self, rect=__QtCore.QRect(0, 0, -1, -1)):
if not rect.isValid():
return __QPixmap.grabWidget(self)
else:
return __QPixmap.grabWidget(self, rect)
QWidget.grab = _QWidget_grab
del _QtGui, __QtCore
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtWidgets import *
try:
QWIDGETSIZE_MAX # Missing in older PyQt5, PyQt4
except NameError:
QWIDGETSIZE_MAX = (1 << 24) - 1
if not hasattr(QWidget, "screen"):
def QWidget_screen(self):
screens = QApplication.screens()
desktop = __QApplication_desktop() # avoid deprecation warning
screen_num = desktop.screenNumber(self)
if 0 <= screen_num < len(screens):
return screens[screen_num]
else:
return QApplication.primaryScreen()
QWidget.screen = QWidget_screen
del QWidget_screen
if hasattr(QWidget, "getContentsMargins"):
def QWidget_getContentsMargins(self):
warn("QWidget.getContentsMargins is obsolete and is removed in Qt6",
DeprecationWarning, stacklevel=2)
return __QWidget_getContentsMargins(self)
__QWidget_getContentsMargins = QWidget.getContentsMargins
QWidget.getContentsMargins = QWidget_getContentsMargins
if hasattr(QLineEdit, "getTextMargins"):
def __QLineEdit_getTextMargins(self):
warn("QLineEdit.getTextMargins is deprecated and will be removed.",
DeprecationWarning, stacklevel=2)
m = self.textMargins()
return m.left(), m.top(), m.right(), m.bottom()
QLineEdit.getTextMargins = __QLineEdit_getTextMargins
del __QLineEdit_getTextMargins
if not hasattr(QAbstractItemView, "viewOptions"):
def __QAbstractItemView_viewOptions(self):
opt = QStyleOptionViewItem()
self.initViewItemOption(opt)
return opt
QAbstractItemView.viewOptions = __QAbstractItemView_viewOptions
del __QAbstractItemView_viewOptions
elif not hasattr(QAbstractItemView, "initViewItemOption"):
def __QAbstractItemView_initViewItemOption(self, option):
opt = self.viewOptions()
option.initFrom(self)
option.state = opt.state
option.font = opt.font
option.decorationSize = opt.decorationSize
option.decorationPosition = opt.decorationPosition
option.decorationAlignment = opt.decorationAlignment
option.displayAlignment = opt.displayAlignment
option.textElideMode = opt.textElideMode
option.rect = opt.rect
option.showDecorationSelected = opt.showDecorationSelected
option.features = opt.features
option.locale = opt.locale
option.widget = opt.widget
QAbstractItemView.initViewItemOption = __QAbstractItemView_initViewItemOption
del __QAbstractItemView_initViewItemOption
from AnyQt.QtCore import QModelIndex as __QModelIndex
def __QAbstractItemView_itemDelegate(self, *args):
if args and isinstance(args[0], __QModelIndex):
return self.itemDelegateForIndex(*args)
return __QAbstractItemView_itemDelegate_orig(self, *args)
if not hasattr(QAbstractItemView, "itemDelegateForIndex"):
def __QAbstractItemView_itemDelegateForIndex(self, index):
return __QAbstractItemView_itemDelegate_orig(self, index)
QAbstractItemView.itemDelegateForIndex = __QAbstractItemView_itemDelegateForIndex
__QAbstractItemView_itemDelegate_orig = QAbstractItemView.itemDelegate
QAbstractItemView.itemDelegate = __QAbstractItemView_itemDelegate
if hasattr(QApplication, "desktop"):
def QApplication_desktop():
warn("QApplication.desktop is obsolete and is removed in Qt6",
DeprecationWarning, stacklevel=2)
return __QApplication_desktop()
__QApplication_desktop = QApplication.desktop
QApplication.desktop = staticmethod(QApplication_desktop)
del QApplication_desktop
if not hasattr(QPlainTextEdit, "setTabStopDistance"):
def __QPlainTextEdit_setTabStopDistance(self, width: float):
self.setTabStopWidth(int(width))
def __QPlainTextEdit_tabStopDistance(self) -> float:
return float(self.tabStopWidth())
QPlainTextEdit.setTabStopDistance = __QPlainTextEdit_setTabStopDistance
QPlainTextEdit.tabStopDistance = __QPlainTextEdit_tabStopDistance
if not hasattr(QTextEdit, "setTabStopDistance"):
def __QTextEdit_setTabStopDistance(self, width: float):
self.setTabStopWidth(int(width))
def __QTextEdit_tabStopDistance(self) -> float:
return float(self.tabStopWidth())
QTextEdit.setTabStopDistance = __QTextEdit_setTabStopDistance
QTextEdit.tabStopDistance = __QTextEdit_tabStopDistance
from AnyQt.QtCore import Signal, Slot
if not hasattr(QButtonGroup, "idClicked"):
class QButtonGroup(QButtonGroup):
idClicked = Signal(int)
idPressed = Signal(int)
idReleased = Signal(int)
idToggled = Signal(int, bool)
def __init__(self, *args, **kwargs):
buttonClicked = kwargs.pop("buttonClicked", None)
buttonPressed = kwargs.pop("buttonPressed", None)
buttonReleased = kwargs.pop("buttonReleased", None)
buttonToggled = kwargs.pop("buttonToggled", None)
super().__init__(*args, **kwargs)
self.buttonClicked.connect(self.__button_clicked)
self.buttonPressed.connect(self.__button_pressed)
self.buttonReleased.connect(self.__button_released)
self.buttonToggled.connect(self.__button_toggled)
if buttonClicked is not None:
self.buttonClicked.connect(buttonClicked)
if buttonPressed is not None:
self.buttonPressed.connect(buttonPressed)
if buttonReleased is not None:
self.buttonReleased.connect(buttonReleased)
if buttonToggled is not None:
self.buttonToggled.connect(buttonToggled)
@Slot(QAbstractButton)
def __button_clicked(self, button):
self.idClicked.emit(self.id(button))
@Slot(QAbstractButton)
def __button_pressed(self, button):
self.idPressed.emit(self.id(button))
@Slot(QAbstractButton)
def __button_released(self, button):
self.idReleased.emit(self.id(button))
@Slot(QAbstractButton, bool)
def __button_toggled(self, button, checked):
self.idToggled.emit(self.id(button), checked)
if not hasattr(QComboBox, "textActivated"):
class QComboBox(QComboBox):
textActivated = Signal(str)
textHighlighted = Signal(str)
def __init__(self, *args, **kwargs):
activated = kwargs.pop("activated", None)
highlighted = kwargs.pop("highlighted", None)
super().__init__(*args, **kwargs)
self.activated[int].connect(self.__activated)
self.highlighted[int].connect(self.__highlighted)
if activated is not None:
self.activated.connect(activated)
if highlighted is not None:
self.highlighted.connect(highlighted)
@Slot(int)
def __activated(self, index):
self.textActivated.emit(self.itemText(index))
@Slot(int)
def __highlighted(self, index):
self.textHighlighted.emit(self.itemText(index))
del Signal, Slot
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtWinExtras.py 0000664 0000000 0000000 00000000476 14272202670 0016515 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtWinExtras import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtWinExtras import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtWinExtras import *
else:
raise ImportError
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtX11Extras.py 0000664 0000000 0000000 00000000727 14272202670 0016330 0 ustar 00root root 0000000 0000000 from . import _api
__all__ = ["QX11Info"]
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtX11Extras import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtX11Extras import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtGui import QX11Info
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtGui import QX11Info
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtX11Extras import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtXml.py 0000664 0000000 0000000 00000000637 14272202670 0015330 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtXml import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtXml import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtXml import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtXml import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtXml import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/QtXmlPatterns.py 0000664 0000000 0000000 00000000707 14272202670 0017047 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtXmlPatterns import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtXmlPatterns import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtXmlPatterns import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtXmlPatterns import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtXmlPatterns import *
_api.apply_global_fixes(globals())
anyqt-0.2.0/AnyQt/__init__.py 0000664 0000000 0000000 00000003671 14272202670 0016023 0 ustar 00root root 0000000 0000000 import sys
__PREFERRED_API = None
__SELECTED_API = None
#: A string indicating which Qt api is used (will be `None` *until* a api is
#: selected and commited to.
USED_API = None
def setpreferredapi(api):
"""
Set the preferred Qt API.
Will raise a RuntimeError if a Qt API was already selected.
Note that QT_API environment variable (if set) will take precedence.
"""
global __PREFERRED_API
if __SELECTED_API is not None:
raise RuntimeError("A Qt api {} was already selected"
.format(__SELECTED_API))
if api.lower() not in {"pyqt4", "pyqt5", "pyside", "pyside2"}:
raise ValueError(api)
__PREFERRED_API = api.lower()
def selectapi(api):
"""
Select an Qt API to use.
This can only be set once and before any of the Qt modules are explicitly
imported.
"""
global __SELECTED_API, USED_API
if api.lower() not in {"pyqt4", "pyqt5", "pyside", "pyside2"}:
raise ValueError(api)
if __SELECTED_API is not None and __SELECTED_API.lower() != api.lower():
raise RuntimeError("A Qt API {} was already selected"
.format(__SELECTED_API))
elif __SELECTED_API is None:
__SELECTED_API = api.lower()
from . import _api
USED_API = _api.USED_API
if sys.version_info < (3, 4):
import imp as _imp
def __islocatable(name):
try:
_imp.find_module(name)
except ImportError:
return False
else:
return True
else:
import importlib.util as _importlibutil
def __islocatable(name):
try:
return _importlibutil.find_spec(name) is not None
except (ValueError, ImportError):
return False
def availableapi():
"""
Return a list of available Qt interfaces.
"""
search = ["PyQt5", "PyQt6", "PyQt4", "PySide2", "PySide6", "PySide"]
return [name for name in search if __islocatable(name)]
anyqt-0.2.0/AnyQt/_api.py 0000664 0000000 0000000 00000007326 14272202670 0015175 0 ustar 00root root 0000000 0000000 """
NOTE: Importing this module will select and commit to a Qt API.
"""
import os
import sys
import warnings
import AnyQt
if sys.version_info < (3,):
_intern = intern
else:
_intern = sys.intern
USED_API = None
QT_API_PYQT6 = "pyqt6"
QT_API_PYQT5 = "pyqt5"
QT_API_PYQT4 = "pyqt4"
QT_API_PYSIDE6 = "pyside6"
QT_API_PYSIDE2 = "pyside2"
QT_API_PYSIDE = "pyside"
ALL_APIS = [
QT_API_PYQT6, QT_API_PYQT5, QT_API_PYQT4,
QT_API_PYSIDE6, QT_API_PYSIDE2, QT_API_PYSIDE
]
def comittoapi(api):
"""
Commit to the use of specified Qt api.
Raise an error if another Qt api is already loaded in sys.modules
"""
global USED_API
assert USED_API is None, "committoapi called again!"
check = ["PyQt4", "PyQt5", "PyQt6", "PySide", "PySide2", "PySide6"]
assert api in ALL_APIS
for name in check:
if name.lower() != api and name in sys.modules:
raise RuntimeError(
"{} was already imported. Cannot commit to {}!"
.format(name, api)
)
else:
api = _intern(api)
USED_API = api
AnyQt.__SELECTED_API = api
AnyQt.USED_API = api
if AnyQt.__SELECTED_API is not None:
comittoapi(AnyQt.__SELECTED_API)
elif "QT_API" in os.environ:
api = os.environ["QT_API"].lower()
if api == "pyqt":
# Qt.py allows both pyqt4 and pyqt to specify PyQt4.
# When run from anaconda-navigator, pyqt is used.
api = "pyqt4"
if api in ALL_APIS:
comittoapi(api)
else:
warnings.warn(
"'QT_API' environment variable names an unknown Qt API ('{}')."
.format(os.environ["QT_API"]),
RuntimeWarning, stacklevel=3)
# pass through
if USED_API is None:
# Check sys.modules for existing imports
__existing = None
if "PyQt6" in sys.modules:
__existing = QT_API_PYQT6
elif "PyQt5" in sys.modules:
__existing = QT_API_PYQT5
elif "PyQt4" in sys.modules:
__existing = QT_API_PYQT4
elif "PySide6" in sys.modules:
__existing = QT_API_PYSIDE6
elif "PySide2" in sys.modules:
__existing = QT_API_PYSIDE2
elif "PySide" in sys.modules:
__existing = QT_API_PYSIDE
if __existing is not None:
comittoapi(__existing)
else:
available = AnyQt.availableapi()
__available = None
if AnyQt.__PREFERRED_API is not None and \
AnyQt.__PREFERRED_API.lower() in [name.lower() for name in available]:
__available = AnyQt.__PREFERRED_API.lower()
elif "PyQt5" in available:
__available = QT_API_PYQT5
elif "PyQt4" in available:
__available = QT_API_PYQT4
elif "PySide" in available:
__available = QT_API_PYSIDE
elif "PySide2" in available:
__available = QT_API_PYSIDE2
elif "PyQt6" in available:
__available = QT_API_PYQT6
if __available is not None:
comittoapi(__available)
del __available
del __existing
if USED_API is None:
raise ImportError("PyQt4, PyQt5, PySide or PySide2 are not available for import")
if "ANYQT_HOOK_DENY" in os.environ:
from AnyQt.importhooks import install_deny_hook
for __denyapi in os.environ["ANYQT_HOOK_DENY"].split(","):
if __denyapi.lower() != USED_API:
install_deny_hook(__denyapi.lower())
del install_deny_hook
if "ANYQT_HOOK_BACKPORT" in os.environ:
from AnyQt.importhooks import install_backport_hook
for __backportapi in os.environ["ANYQT_HOOK_BACKPORT"].split(","):
if __backportapi.lower() != USED_API:
install_backport_hook(__backportapi.lower())
del install_backport_hook
from ._fixes import global_fixes as apply_global_fixes
anyqt-0.2.0/AnyQt/_backport/ 0000775 0000000 0000000 00000000000 14272202670 0015647 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/AnyQt/_backport/QtCore.py 0000664 0000000 0000000 00000013041 14272202670 0017415 0 ustar 00root root 0000000 0000000 import warnings
from .. import _api
assert _api.USED_API is _api.QT_API_PYQT5
from PyQt5.QtCore import (
PYQT_CONFIGURATION,
PYQT_VERSION,
PYQT_VERSION_STR,
QAbstractAnimation,
QAbstractEventDispatcher,
# QAbstractFileEngine,
# QAbstractFileEngineHandler,
# QAbstractFileEngineIterator,
QAbstractItemModel,
QAbstractListModel,
QAbstractState,
QAbstractTableModel,
QAbstractTransition,
QAnimationGroup,
QBasicTimer,
QBitArray,
QBuffer,
QByteArray,
QByteArrayMatcher,
QChildEvent,
QCoreApplication,
QCryptographicHash,
QDataStream,
QDate,
QDateTime,
QDir,
QDirIterator,
QDynamicPropertyChangeEvent,
QEasingCurve,
QElapsedTimer,
QEvent,
QEventLoop,
QEventTransition,
# QFSFileEngine,
QFile,
QFileInfo,
QFileSystemWatcher,
QFinalState,
QGenericArgument,
QGenericReturnArgument,
QHistoryState,
QIODevice,
QLibrary,
QLibraryInfo,
QLine,
QLineF,
QLocale,
QMargins,
QMetaClassInfo,
QMetaEnum,
QMetaMethod,
QMetaObject,
QMetaProperty,
QMetaType,
QMimeData,
QModelIndex,
QMutex,
QMutexLocker,
QObject,
QObjectCleanupHandler,
QParallelAnimationGroup,
QPauseAnimation,
QPersistentModelIndex,
QPluginLoader,
QPoint,
QPointF,
QProcess,
QProcessEnvironment,
QPropertyAnimation,
# QPyNullVariant,
QReadLocker,
QReadWriteLock,
QRect,
QRectF,
QRegExp,
QResource,
QRunnable,
QSemaphore,
QSequentialAnimationGroup,
QSettings,
QSharedMemory,
QSignalMapper,
QSignalTransition,
QSize,
QSizeF,
QSocketNotifier,
QState,
QStateMachine,
QSysInfo,
# QSystemLocale,
QSystemSemaphore,
QT_TRANSLATE_NOOP,
QT_TR_NOOP,
QT_TR_NOOP_UTF8,
QT_VERSION,
QT_VERSION_STR,
QTemporaryFile,
QTextBoundaryFinder,
QTextCodec,
QTextDecoder,
QTextEncoder,
QTextStream,
QTextStreamManipulator,
QThread,
QThreadPool,
QTime,
QTimeLine,
QTimer,
QTimerEvent,
QTranslator,
QUrl,
QUuid,
QVariant,
QVariantAnimation,
QWaitCondition,
QWriteLocker,
QXmlStreamAttribute,
QXmlStreamAttributes,
QXmlStreamEntityDeclaration,
QXmlStreamEntityResolver,
QXmlStreamNamespaceDeclaration,
QXmlStreamNotationDeclaration,
QXmlStreamReader,
QXmlStreamWriter,
Q_ARG,
Q_CLASSINFO,
Q_ENUMS,
Q_FLAGS,
Q_RETURN_ARG,
Qt,
QtCriticalMsg,
QtDebugMsg,
QtFatalMsg,
QtMsgType,
QtSystemMsg,
QtWarningMsg,
# SIGNAL,
# SLOT,
bin_,
bom,
center,
dec,
endl,
fixed,
flush,
forcepoint,
forcesign,
hex_,
left,
lowercasebase,
lowercasedigits,
noforcepoint,
noforcesign,
noshowbase,
oct_,
pyqtBoundSignal,
pyqtPickleProtocol,
pyqtProperty,
pyqtRemoveInputHook,
pyqtRestoreInputHook,
pyqtSetPickleProtocol,
pyqtSignal,
# pyqtSignature,
pyqtSlot,
# pyqtWrapperType,
qAbs,
qAddPostRoutine,
qChecksum,
qCompress,
qCritical,
qDebug,
qErrnoWarning,
qFatal,
qFuzzyCompare,
qInf,
# qInstallMsgHandler,
qIsFinite,
qIsInf,
qIsNaN,
qIsNull,
qQNaN,
qRegisterResourceData,
qRemovePostRoutine,
qRound,
qRound64,
qSNaN,
qSetFieldWidth,
qSetPadChar,
qSetRealNumberPrecision,
qSharedBuild,
# qSwap,
qUncompress,
qUnregisterResourceData,
qVersion,
qWarning,
qrand,
qsrand,
reset,
right,
scientific,
showbase,
uppercasebase,
uppercasedigits,
ws
)
from PyQt5.QtCore import (
qInstallMessageHandler as _qInstallMessageHandler,
QUrlQuery as _QUrlQuery
)
__missing__ = [
'QAbstractFileEngine',
'QAbstractFileEngineHandler',
'QAbstractFileEngineIterator',
'QFSFileEngine',
'QPyNullVariant',
'QSystemLocale'
"SIGNAL",
"SLOT",
"pyqtSignature",
"qInstallMsgHandler",
"qSwap"
]
from ._utils import obsolete_rename as _obsolete_rename
def qInstallMsgHandler(func):
wrapped = lambda msgtype, context, text: func(msgtype, text)
old = getattr(qInstallMsgHandler, "_handler", None)
if func is not None:
_qInstallMessageHandler(wrapped)
else:
_qInstallMessageHandler(None)
qInstallMsgHandler._handler = func
return old
def _QMetaMethod_signature(self):
# Return the method signature as bytes
return bytes(self.methodSignature())
QMetaMethod.signature = _QMetaMethod_signature
SIGNAL = lambda str: QMetaObject.normalizedSignature(str)
SLOT = lambda str: QMetaObject.normalisedSignature(str)
def _QObject_emit(self, sig, *args):
warnings.warn(
"QObject.emit is obsolete and is removed in PyQt5. "
"Use new style signal.emit(...)",
stacklevel=2
)
meta = self.metaObject()
sindex = meta.indexOfSignal(sig)
if sindex == -1:
warnings.warn(
"No signal '{}' defined in {}".format(sig, type(self).__name__),
stacklevel=2)
return False
method = meta.method(sindex)
return method.invoke(self, Qt.DirectConnection,
*[Q_ARG(type(a), a) for a in args])
QObject.emit = _QObject_emit
QRectF.intersect = _obsolete_rename("QRectF.intersect", QRectF.intersected)
QRectF.unite = _obsolete_rename("QRectF.unite", QRectF.united)
QRect.intersect = _obsolete_rename("QRect.intersect", QRect.intersected)
QRect.unite = _obsolete_rename("QRect.unite", QRect.united)
anyqt-0.2.0/AnyQt/_backport/QtDBus.py 0000664 0000000 0000000 00000000133 14272202670 0017360 0 ustar 00root root 0000000 0000000 from .. import _api
assert _api.USED_API is _api.QT_API_PYQT5
from PyQt5.QtDBus import *
anyqt-0.2.0/AnyQt/_backport/QtDesigner.py 0000664 0000000 0000000 00000000036 14272202670 0020265 0 ustar 00root root 0000000 0000000 from PyQt5.QtDesigner import * anyqt-0.2.0/AnyQt/_backport/QtGui.py 0000664 0000000 0000000 00000061107 14272202670 0017257 0 ustar 00root root 0000000 0000000 import warnings
from .. import _api
__all__ = [
'QAbstractButton',
'QAbstractGraphicsShapeItem',
'QAbstractItemDelegate',
'QAbstractItemView',
'QAbstractPrintDialog',
'QAbstractProxyModel',
'QAbstractScrollArea',
'QAbstractSlider',
'QAbstractSpinBox',
'QAbstractTextDocumentLayout',
'QAction',
'QActionEvent',
'QActionGroup',
'QApplication',
'QBitmap',
'QBoxLayout',
'QBrush',
'QButtonGroup',
'QCalendarWidget',
'QCheckBox',
'QClipboard',
'QCloseEvent',
'QColor',
'QColorDialog',
'QColumnView',
'QComboBox',
'QCommandLinkButton',
'QCommonStyle',
'QCompleter',
'QConicalGradient',
'QContextMenuEvent',
'QCursor',
'QDataWidgetMapper',
'QDateEdit',
'QDateTimeEdit',
'QDesktopServices',
'QDesktopWidget',
'QDial',
'QDialog',
'QDialogButtonBox',
'QDirModel',
'QDockWidget',
'QDoubleSpinBox',
'QDoubleValidator',
'QDrag',
'QDragEnterEvent',
'QDragLeaveEvent',
'QDragMoveEvent',
'QDropEvent',
'QErrorMessage',
'QFileDialog',
'QFileIconProvider',
'QFileOpenEvent',
'QFileSystemModel',
'QFocusEvent',
'QFocusFrame',
'QFont',
'QFontComboBox',
'QFontDatabase',
'QFontDialog',
'QFontInfo',
'QFontMetrics',
'QFontMetricsF',
'QFormLayout',
'QFrame',
'QGesture',
'QGestureEvent',
'QGestureRecognizer',
'QGlyphRun',
'QGradient',
'QGraphicsAnchor',
'QGraphicsAnchorLayout',
'QGraphicsBlurEffect',
'QGraphicsColorizeEffect',
'QGraphicsDropShadowEffect',
'QGraphicsEffect',
'QGraphicsEllipseItem',
'QGraphicsGridLayout',
'QGraphicsItem',
'QGraphicsItemGroup',
'QGraphicsLayout',
'QGraphicsLayoutItem',
'QGraphicsLineItem',
'QGraphicsLinearLayout',
'QGraphicsObject',
'QGraphicsOpacityEffect',
'QGraphicsPathItem',
'QGraphicsPixmapItem',
'QGraphicsPolygonItem',
'QGraphicsProxyWidget',
'QGraphicsRectItem',
'QGraphicsRotation',
'QGraphicsScale',
'QGraphicsScene',
'QGraphicsSceneContextMenuEvent',
'QGraphicsSceneDragDropEvent',
'QGraphicsSceneEvent',
'QGraphicsSceneHelpEvent',
'QGraphicsSceneHoverEvent',
'QGraphicsSceneMouseEvent',
'QGraphicsSceneMoveEvent',
'QGraphicsSceneResizeEvent',
'QGraphicsSceneWheelEvent',
'QGraphicsSimpleTextItem',
'QGraphicsTextItem',
'QGraphicsTransform',
'QGraphicsView',
'QGraphicsWidget',
'QGridLayout',
'QGroupBox',
'QHBoxLayout',
'QHeaderView',
'QHelpEvent',
'QHideEvent',
'QHoverEvent',
'QIcon',
'QIconDragEvent',
'QIconEngine',
'QIconEngineV2',
'QIdentityProxyModel',
'QImage',
'QImageIOHandler',
'QImageReader',
'QImageWriter',
# 'QInputContext',
# 'QInputContextFactory',
'QInputDialog',
'QInputEvent',
'QInputMethodEvent',
'QIntValidator',
'QItemDelegate',
'QItemEditorCreatorBase',
'QItemEditorFactory',
'QItemSelection',
'QItemSelectionModel',
'QItemSelectionRange',
'QKeyEvent',
'QKeyEventTransition',
'QKeySequence',
'QLCDNumber',
'QLabel',
'QLayout',
'QLayoutItem',
'QLineEdit',
'QLinearGradient',
'QListView',
'QListWidget',
'QListWidgetItem',
# 'QMacCocoaViewContainer',
# 'QMacPasteboardMime',
'QMainWindow',
# 'QMatrix',
'QMatrix2x2',
'QMatrix2x3',
'QMatrix2x4',
'QMatrix3x2',
'QMatrix3x3',
'QMatrix3x4',
'QMatrix4x2',
'QMatrix4x3',
'QMatrix4x4',
'QMdiArea',
'QMdiSubWindow',
'QMenu',
'QMenuBar',
'QMessageBox',
# 'QMimeSource',
'QMouseEvent',
'QMouseEventTransition',
'QMoveEvent',
'QMovie',
'QPageSetupDialog',
'QPaintDevice',
'QPaintEngine',
'QPaintEngineState',
'QPaintEvent',
'QPainter',
'QPainterPath',
'QPainterPathStroker',
'QPalette',
'QPanGesture',
'QPen',
'QPicture',
'QPictureIO',
'QPinchGesture',
'QPixmap',
'QPixmapCache',
'QPlainTextDocumentLayout',
'QPlainTextEdit',
'QPolygon',
'QPolygonF',
'QPrintDialog',
'QPrintEngine',
'QPrintPreviewDialog',
'QPrintPreviewWidget',
'QPrinter',
'QPrinterInfo',
'QProgressBar',
'QProgressDialog',
# 'QProxyModel',
'QPushButton',
# 'QPyTextObject',
'QQuaternion',
'QRadialGradient',
'QRadioButton',
'QRawFont',
'QRegExpValidator',
'QRegion',
'QResizeEvent',
'QRubberBand',
'QScrollArea',
'QScrollBar',
'QSessionManager',
'QShortcut',
'QShortcutEvent',
'QShowEvent',
'QSizeGrip',
'QSizePolicy',
'QSlider',
'QSortFilterProxyModel',
# 'QSound',
'QSpacerItem',
'QSpinBox',
'QSplashScreen',
'QSplitter',
'QSplitterHandle',
'QStackedLayout',
'QStackedWidget',
'QStandardItem',
'QStandardItemModel',
'QStaticText',
'QStatusBar',
'QStatusTipEvent',
'QStringListModel',
'QStyle',
'QStyleFactory',
'QStyleHintReturn',
'QStyleHintReturnMask',
'QStyleHintReturnVariant',
'QStyleOption',
'QStyleOptionButton',
'QStyleOptionComboBox',
'QStyleOptionComplex',
'QStyleOptionDockWidget',
'QStyleOptionDockWidgetV2',
'QStyleOptionFocusRect',
'QStyleOptionFrame',
'QStyleOptionFrameV2',
'QStyleOptionFrameV3',
'QStyleOptionGraphicsItem',
'QStyleOptionGroupBox',
'QStyleOptionHeader',
'QStyleOptionMenuItem',
'QStyleOptionProgressBar',
'QStyleOptionProgressBarV2',
'QStyleOptionRubberBand',
'QStyleOptionSizeGrip',
'QStyleOptionSlider',
'QStyleOptionSpinBox',
'QStyleOptionTab',
'QStyleOptionTabBarBase',
'QStyleOptionTabBarBaseV2',
'QStyleOptionTabV2',
'QStyleOptionTabV3',
'QStyleOptionTabWidgetFrame',
'QStyleOptionTabWidgetFrameV2',
'QStyleOptionTitleBar',
'QStyleOptionToolBar',
'QStyleOptionToolBox',
'QStyleOptionToolBoxV2',
'QStyleOptionToolButton',
'QStyleOptionViewItem',
'QStyleOptionViewItemV2',
'QStyleOptionViewItemV3',
'QStyleOptionViewItemV4',
'QStylePainter',
'QStyledItemDelegate',
'QSwipeGesture',
'QSyntaxHighlighter',
'QSystemTrayIcon',
'QTabBar',
'QTabWidget',
'QTableView',
'QTableWidget',
'QTableWidgetItem',
'QTableWidgetSelectionRange',
'QTabletEvent',
'QTapAndHoldGesture',
'QTapGesture',
'QTextBlock',
'QTextBlockFormat',
'QTextBlockGroup',
'QTextBlockUserData',
'QTextBrowser',
'QTextCharFormat',
'QTextCursor',
'QTextDocument',
'QTextDocumentFragment',
'QTextDocumentWriter',
'QTextEdit',
'QTextFormat',
'QTextFragment',
'QTextFrame',
'QTextFrameFormat',
'QTextImageFormat',
'QTextInlineObject',
'QTextItem',
'QTextLayout',
'QTextLength',
'QTextLine',
'QTextList',
'QTextListFormat',
'QTextObject',
'QTextObjectInterface',
'QTextOption',
'QTextTable',
'QTextTableCell',
'QTextTableCellFormat',
'QTextTableFormat',
'QTimeEdit',
'QToolBar',
'QToolBox',
'QToolButton',
'QToolTip',
'QTouchEvent',
'QTransform',
'QTreeView',
'QTreeWidget',
'QTreeWidgetItem',
'QTreeWidgetItemIterator',
'QUndoCommand',
'QUndoGroup',
'QUndoStack',
'QUndoView',
'QVBoxLayout',
'QValidator',
'QVector2D',
'QVector3D',
'QVector4D',
'QWhatsThis',
'QWhatsThisClickedEvent',
'QWheelEvent',
'QWidget',
'QWidgetAction',
'QWidgetItem',
'QWindowStateChangeEvent',
'QWizard',
'QWizardPage',
# 'QWorkspace',
"QWIDGETSIZE_MAX",
'qAlpha',
'qApp',
'qBlue',
'qDrawBorderPixmap',
'qDrawPlainRect',
'qDrawShadeLine',
'qDrawShadePanel',
'qDrawShadeRect',
'qDrawWinButton',
'qDrawWinPanel',
'qFuzzyCompare',
'qGray',
'qGreen',
'qIsGray',
'qRed',
'qRgb',
'qRgba',
# 'qSwap',
# 'qt_mac_secure_keyboard',
# 'qt_mac_set_dock_menu',
# 'qt_mac_set_menubar_icons',
# 'qt_mac_set_menubar_merge',
# 'qt_mac_set_native_menubar',
# 'qt_mac_set_press_and_hold_context',
# 'qt_set_sequence_auto_mnemonic'
]
__removed__ = [
'QMatrix',
'QMimeSource',
'QProxyModel',
'QPyTextObject',
'QWorkspace',
'qSwap',
]
assert _api.USED_API == _api.QT_API_PYQT5
from PyQt5.QtCore import (
QAbstractProxyModel,
QIdentityProxyModel,
QItemSelection,
QItemSelectionModel,
QItemSelectionRange,
QSortFilterProxyModel,
QStringListModel,
)
from PyQt5.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,
QIntValidator,
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,
QRawFont,
QRegExpValidator,
QRegion,
QResizeEvent,
QSessionManager,
QShortcutEvent,
QShowEvent,
QStandardItem,
QStandardItemModel,
QStaticText,
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,
QTouchEvent,
QTransform,
QValidator,
QVector2D,
QVector3D,
QVector4D,
QWhatsThisClickedEvent,
QWheelEvent,
QWindowStateChangeEvent,
qAlpha,
qBlue,
qFuzzyCompare,
qGray,
qGreen,
qIsGray,
qRed,
qRgb,
qRgba
)
QIconEngineV2 = QIconEngine
from PyQt5.QtWidgets import (
QAbstractButton,
QAbstractGraphicsShapeItem,
QAbstractItemDelegate,
QAbstractItemView,
QAbstractScrollArea,
QAbstractSlider,
QAbstractSpinBox,
QAction,
QActionGroup,
QApplication,
QBoxLayout,
QButtonGroup,
QCalendarWidget,
QCheckBox,
QColorDialog,
QColumnView,
QComboBox,
QCommandLinkButton,
QCommonStyle,
QCompleter,
QDataWidgetMapper,
QDateEdit,
QDateTimeEdit,
QDesktopWidget,
QDial,
QDialog,
QDialogButtonBox,
QDirModel,
QDockWidget,
QDoubleSpinBox,
QErrorMessage,
QFileDialog,
QFileIconProvider,
QFileSystemModel,
QFocusFrame,
QFontComboBox,
QFontDialog,
QFormLayout,
QFrame,
QGesture,
QGestureEvent,
QGestureRecognizer,
QGraphicsAnchor,
QGraphicsAnchorLayout,
QGraphicsBlurEffect,
QGraphicsColorizeEffect,
QGraphicsDropShadowEffect,
QGraphicsEffect,
QGraphicsEllipseItem,
QGraphicsGridLayout,
QGraphicsItem,
QGraphicsItemGroup,
QGraphicsLayout,
QGraphicsLayoutItem,
QGraphicsLineItem,
QGraphicsLinearLayout,
QGraphicsObject,
QGraphicsOpacityEffect,
QGraphicsPathItem,
QGraphicsPixmapItem,
QGraphicsPolygonItem,
QGraphicsProxyWidget,
QGraphicsRectItem,
QGraphicsRotation,
QGraphicsScale,
QGraphicsScene,
QGraphicsSceneContextMenuEvent,
QGraphicsSceneDragDropEvent,
QGraphicsSceneEvent,
QGraphicsSceneHelpEvent,
QGraphicsSceneHoverEvent,
QGraphicsSceneMouseEvent,
QGraphicsSceneMoveEvent,
QGraphicsSceneResizeEvent,
QGraphicsSceneWheelEvent,
QGraphicsSimpleTextItem,
QGraphicsTextItem,
QGraphicsTransform,
QGraphicsView,
QGraphicsWidget,
QGridLayout,
QGroupBox,
QHBoxLayout,
QHeaderView,
QInputDialog,
QItemDelegate,
QItemEditorCreatorBase,
QItemEditorFactory,
QKeyEventTransition,
# QKeySequenceEdit,
QLCDNumber,
QLabel,
QLayout,
QLayoutItem,
QLineEdit,
QListView,
QListWidget,
QListWidgetItem,
QMainWindow,
QMdiArea,
QMdiSubWindow,
QMenu,
QMenuBar,
QMessageBox,
QMouseEventTransition,
# QOpenGLWidget,
QPanGesture,
QPinchGesture,
QPlainTextDocumentLayout,
QPlainTextEdit,
QProgressBar,
QProgressDialog,
# QProxyStyle,
QPushButton,
QRadioButton,
QRubberBand,
QScrollArea,
QScrollBar,
# QScroller,
# QScrollerProperties,
QShortcut,
QSizeGrip,
QSizePolicy,
QSlider,
QSpacerItem,
QSpinBox,
QSplashScreen,
QSplitter,
QSplitterHandle,
QStackedLayout,
QStackedWidget,
QStatusBar,
QStyle,
QStyleFactory,
QStyleHintReturn,
QStyleHintReturnMask,
QStyleHintReturnVariant,
QStyleOption,
QStyleOptionButton,
QStyleOptionComboBox,
QStyleOptionComplex,
QStyleOptionDockWidget,
QStyleOptionFocusRect,
QStyleOptionFrame,
QStyleOptionGraphicsItem,
QStyleOptionGroupBox,
QStyleOptionHeader,
QStyleOptionMenuItem,
QStyleOptionProgressBar,
QStyleOptionRubberBand,
QStyleOptionSizeGrip,
QStyleOptionSlider,
QStyleOptionSpinBox,
QStyleOptionTab,
QStyleOptionTabBarBase,
QStyleOptionTabWidgetFrame,
QStyleOptionTitleBar,
QStyleOptionToolBar,
QStyleOptionToolBox,
QStyleOptionToolButton,
QStyleOptionViewItem,
QStylePainter,
QStyledItemDelegate,
QSwipeGesture,
QSystemTrayIcon,
QTabBar,
QTabWidget,
QTableView,
QTableWidget,
QTableWidgetItem,
QTableWidgetSelectionRange,
QTapAndHoldGesture,
QTapGesture,
QTextBrowser,
QTextEdit,
QTimeEdit,
QToolBar,
QToolBox,
QToolButton,
QToolTip,
QTreeView,
QTreeWidget,
QTreeWidgetItem,
QTreeWidgetItemIterator,
QUndoCommand,
QUndoGroup,
QUndoStack,
QUndoView,
QVBoxLayout,
QWhatsThis,
QWidget,
QWidgetAction,
QWidgetItem,
QWizard,
QWizardPage,
qApp,
qDrawBorderPixmap,
qDrawPlainRect,
qDrawShadeLine,
qDrawShadePanel,
qDrawShadeRect,
qDrawWinButton,
qDrawWinPanel
)
QStyleOptionViewItemV4 = QStyleOptionViewItem
QStyleOptionViewItemV3 = QStyleOptionViewItem
QStyleOptionViewItemV2 = QStyleOptionViewItem
QStyleOptionToolBoxV2 = QStyleOptionToolBox
QStyleOptionDockWidgetV2 = QStyleOptionDockWidget
QStyleOptionFrameV3 = QStyleOptionFrame
QStyleOptionFrameV2 = QStyleOptionFrame
QStyleOptionProgressBarV2 = QStyleOptionProgressBar
QStyleOptionTabWidgetFrameV2 = QStyleOptionTabWidgetFrame
QStyleOptionTabBarBaseV2 = QStyleOptionTabBarBase
QStyleOptionTabV2 = QStyleOptionTab
QStyleOptionTabV3 = QStyleOptionTab
from PyQt5.QtPrintSupport import (
QAbstractPrintDialog,
QPageSetupDialog,
QPrintDialog,
QPrintEngine,
QPrintPreviewDialog,
QPrintPreviewWidget,
QPrinter,
QPrinterInfo
)
try:
# missing in some older PyQt5 releases (which?)
from PyQt5.QtWidgets import QWIDGETSIZE_MAX
except ImportError:
QWIDGETSIZE_MAX = (1 << 24) - 1
try:
from PyQt5.QtMultimedia import QSound
__all__.append("QSound")
except ImportError:
pass
try:
from PyQt5.QtWidgets import QMacCocoaViewContainer
from PyQt5.QtMacExtras import QMacPasteboardMime, qRegisterDraggedTypes
__all__.extend(
['QMacPasteboardMime',
'QMacCocoaViewContainer',
'qRegisterDraggedTypes']
)
except ImportError:
pass
try:
from PyQt5.QtX11Extras import QX11Info
QX11Info.isCompositingManagerRunning = staticmethod(lambda: True)
__all__.append('QX11Info')
except ImportError:
pass
from PyQt5.QtCore import (
QStandardPaths as _QStandardPaths, QObject as _QObject
)
from ._utils import obsolete_rename as _obsolete_rename
# recreate Qt4 QDesktopServices
class QDesktopServices(QDesktopServices):
StandardLocation = _QStandardPaths.StandardLocation
DocumentsLocation = _QStandardPaths.DocumentsLocation
FontsLocation = _QStandardPaths.FontsLocation
ApplicationsLocation = _QStandardPaths.ApplicationsLocation
MusicLocation = _QStandardPaths.MusicLocation
MoviesLocation = _QStandardPaths.MoviesLocation
PicturesLocation = _QStandardPaths.PicturesLocation
TempLocation = _QStandardPaths.TempLocation
HomeLocation = _QStandardPaths.HomeLocation
DataLocation = _QStandardPaths.DataLocation
CacheLocation = _QStandardPaths.CacheLocation
@staticmethod
def storageLocation(location):
return _QStandardPaths.writableLocation(location)
@staticmethod
def displayName(location):
return _QStandardPaths.displayName(location)
# recreate PyQt4's QPyTextObject
class QPyTextObject(_QObject, QTextObjectInterface):
pass
_QFileDialog = QFileDialog
# Recreate PyQt4 QFileDialog get{Open,Save}FileName..
class QFileDialog(_QFileDialog):
@staticmethod
def getOpenFileName(*args, **kwargs):
fn, _ = _QFileDialog.getOpenFileName(*args, **kwargs)
return fn
@staticmethod
def getOpenFileNameAndFilter(*args, **kwargs):
return _QFileDialog.getOpenFileName(*args, **kwargs)
@staticmethod
def getOpenFileNames(*args, **kwargs):
fn, _ = _QFileDialog.getOpenFileNames(*args, **kwargs)
return fn
@staticmethod
def getOpenFileNamesAndFilter(*args, **kwargs):
return _QFileDialog.getOpenFileNames(*args, **kwargs)
@staticmethod
def getSaveFileName(*args, **kwargs):
fn, _ = _QFileDialog.getSaveFileName(*args, **kwargs)
return fn
@staticmethod
def getSaveFileNameAndFilter(*args, **kwargs):
return _QFileDialog.getSaveFileName(*args, **kwargs)
# Obsolete members of QHeaderView
QHeaderView.isClickable = lambda self: self.sectionsClickable()
QHeaderView.setClickable = lambda self, clickable: \
self.setSectionsClickable(clickable)
QHeaderView.isMovable = lambda self: self.sectionsMovable()
QHeaderView.setMovable = lambda self, movable: \
self.setSectionsMovable(movable)
QHeaderView.resizeMode = lambda self, logicalIndex: \
self.sectionResizeMode(logicalIndex)
QHeaderView.setResizeMode = lambda self, *args: \
self.setSectionResizeMode(*args)
def _QApplication_setGraphicsSystem(system):
warnings.warn("QApplication.setGraphicsSystem() is not available in Qt5",)
QApplication.setGraphicsSystem = _QApplication_setGraphicsSystem
def _QLayout_setMargins(self, margin):
warnings.warn(
"QLayout.setMargin is obsolete and removed in PyQt5. "
"Use setContentsMargins instead.",
DeprecationWarning, stacklevel=2)
self.setContentsMargins(margin, margin, margin, margin)
QLayout.setMargin = _QLayout_setMargins
_QGraphicsItem_scale1 = QGraphicsItem.scale
def _QGraphicssItem_scale(self, *args):
if args:
warnings.warn(
"QGraphicsItem.scale(sx, sy) is obsolete and removed in PyQt5. "
"Use setTransform(QTransform.fromScale(sx, sy), True) instead.",
DeprecationWarning,
stacklevel=2
)
self.setTransform(QTransform.fromScale(*args), True)
else:
return _QGraphicsItem_scale1(self)
QGraphicsItem.scale = _QGraphicssItem_scale
def _QGraphicsItem_translate(self, dx, dy):
warnings.warn(
"QGraphicsItem.translate(sx, dy) is obsolete and removed in PyQt5. "
"Use setTransform(QTransform().translate(dx, dy), True) instead.",
DeprecationWarning,
stacklevel=2
)
self.setTransform(QTransform().translate(dx, dy), True)
QGraphicsItem.translate = _QGraphicsItem_translate
def _QGraphicsItem_rotate(self, angle):
warnings.warn(
"QGraphicsItem.rotate(angle) is obsolete and removed in PyQt5. "
"Use setTransform(QTransform().rotate(angle), True)",
DeprecationWarning,
stacklevel=2
)
self.setTransform(QTransform().rotate(angle), True)
QGraphicsItem.rotate = _QGraphicsItem_rotate
_QPainter_drawPixmapFragments1 = QPainter.drawPixmapFragments
def _QPainter_drawPixmapFragments(self, a1, a2, *args, **kwargs):
if isinstance(a2, QPixmap):
_QPainter_drawPixmapFragments1(self, a1, a2, *args, **kwargs)
else:
warnings.warn(
"QPainter.drawPixmapFragments(list-of-QRectF, list-of-QRectF, "
"QPixmap, QPainter.PixmapFragmentHints hints=0) is obsolete and "
"removed in Qt5. "
"Use QPainter.drawPixmapFragments(list-of-QPainter.PixmapFragment,"
"QPixmap, QPainter.PixmapFragmentHints hints=0) instead",
DeprecationWarning,
stacklevel=2
)
targetRects, sourceRects = a1, a2
pixmap = args[0]
args = args[1:]
fragments = [
QPainter.PixmapFragment.create(
tr.center(), sr,
tr.width() / sr.width(),
tr.height() / sr.height(),
)
for (tr, sr) in zip(targetRects, sourceRects)
]
_QPainter_drawPixmapFragments1(
self, fragments, pixmap, *args, **kwargs)
QPainter.drawPixmapFragments = _QPainter_drawPixmapFragments
QPixmap.grabWidget = staticmethod(lambda w: w.grab())
QColor.light = _obsolete_rename("QColor.light", QColor.lighter)
QColor.dark = _obsolete_rename("QColor.dark", QColor.darker)
QColor.getRgba = _obsolete_rename("QColor.getRgba", QColor.getRgb)
QRegion.unite = _obsolete_rename("QRegion.unite", QRegion.united)
QRegion.subtract = _obsolete_rename("QRegion.subtract", QRegion.subtracted)
QRegion.intersect = _obsolete_rename("QRegion.intersect", QRegion.intersected)
QRegion.eor = _obsolete_rename("QRegion.eor", QRegion.xored)
from PyQt5.QtCore import PYQT_VERSION as _PYQT_VERSION
if _PYQT_VERSION < 0x50502: # ?
from AnyQt import _fixes
_fixes.fix_pyqt5_QGraphicsItem_itemChange()
del _fixes
from AnyQt.QtCore import Qt as __Qt
# PyQt5 does not expose the obsolete QWheelEvent.orientation and
# QWheelEvent.delta
# Qt5 sends single wheel events if only one of angleDelta.{x,y} is non zero,
# otherwise two events are dispatched. First with the correct combined
# angleDelta and delta=angleDelta.y(), orientation=Qt.Vertical and
# another with null angleDelta and delta=angleDelta.x(),
# orientation = Qt.Horizontal
# (see QWindowSystemInterface::handleWheelEvent for details).
# Here we only report the Qt.Vertical parts of the non axis aligned deltas
def __QWheelEvent_delta(self):
# type: () -> int
warnings.warn("QWheelEvent.delta is obsolete and removed in PyQt5. "
"use angleDelta instead.",
DeprecationWarning, stacklevel=2)
delta = self.angleDelta() # type: QPoint
if delta.x() == 0 and delta.y() != 0:
# vertical
return delta.y()
elif delta.x() != 0 and delta.y() == 0:
# horizontal
return delta.x()
elif delta.x() != 0 and delta.y() != 0:
# vertical; the first of the assumed Qt4 compatibility events.
return delta.y()
elif delta.x() == 0 and delta.y() == 0:
# horizontal; the second of the assumed Qt4 compatibility events.
# report a 0 delta
return 0
else:
assert False
QWheelEvent.delta = __QWheelEvent_delta
def __QWheelEvent_orientation(self):
# type: () -> Qt.Orientation
warnings.warn("QWheelEvent.orientation is obsolete and removed in PyQt5. "
"Use angleDelta instead.",
DeprecationWarning, stacklevel=2)
delta = self.angleDelta() # type: QPoint
if delta.x() == 0 and delta.y() != 0:
return __Qt.Vertical
elif delta.x() != 0 and delta.y() == 0:
return __Qt.Horizontal
elif delta.x() != 0 and delta.y() != 0:
# vertical; the first assumed Qt4 compatibility events
return __Qt.Vertical
elif delta.x() == 0 and delta.y() == 0:
# horizontal; The second assumed Qt4 compatibility events
return __Qt.Horizontal
else:
assert False
QWheelEvent.orientation = __QWheelEvent_orientation
anyqt-0.2.0/AnyQt/_backport/QtHelp.py 0000664 0000000 0000000 00000000427 14272202670 0017421 0 ustar 00root root 0000000 0000000 from PyQt5.QtHelp import (
QHelpContentItem,
QHelpContentModel,
QHelpContentWidget,
QHelpEngine,
QHelpEngineCore,
QHelpIndexModel,
QHelpIndexWidget,
QHelpSearchEngine,
QHelpSearchQuery,
QHelpSearchQueryWidget,
QHelpSearchResultWidget
) anyqt-0.2.0/AnyQt/_backport/QtMultimedia.py 0000664 0000000 0000000 00000000327 14272202670 0020622 0 ustar 00root root 0000000 0000000 from PyQt5.QtMultimedia import (
QAbstractVideoBuffer,
QAbstractVideoSurface,
QAudio,
QAudioDeviceInfo,
QAudioFormat,
QAudioInput,
QAudioOutput,
QVideoFrame,
QVideoSurfaceFormat
) anyqt-0.2.0/AnyQt/_backport/QtNetwork.py 0000664 0000000 0000000 00000001713 14272202670 0020161 0 ustar 00root root 0000000 0000000 from PyQt5.QtNetwork import (
QAbstractNetworkCache,
QAbstractSocket,
QAuthenticator,
# QDnsDomainNameRecord,
# QDnsHostAddressRecord,
# QDnsLookup,
# QDnsMailExchangeRecord,
# QDnsServiceRecord,
# QDnsTextRecord,
QHostAddress,
QHostInfo,
QHttpMultiPart,
QHttpPart,
QLocalServer,
QLocalSocket,
QNetworkAccessManager,
QNetworkAddressEntry,
QNetworkCacheMetaData,
QNetworkConfiguration,
QNetworkConfigurationManager,
QNetworkCookie,
QNetworkCookieJar,
QNetworkDiskCache,
QNetworkInterface,
QNetworkProxy,
QNetworkProxyFactory,
QNetworkProxyQuery,
QNetworkReply,
QNetworkRequest,
QNetworkSession,
QSsl,
QSslCertificate,
# QSslCertificateExtension,
QSslCipher,
QSslConfiguration,
# QSslEllipticCurve,
QSslError,
QSslKey,
# QSslPreSharedKeyAuthenticator,
QSslSocket,
QTcpServer,
QTcpSocket,
QUdpSocket,
) anyqt-0.2.0/AnyQt/_backport/QtOpenGL.py 0000664 0000000 0000000 00000000243 14272202670 0017651 0 ustar 00root root 0000000 0000000 __all__ = [
'QGL',
'QGLContext',
'QGLFormat',
'QGLWidget'
]
from PyQt5.QtOpenGL import (
QGL,
QGLContext,
QGLFormat,
QGLWidget,
)
anyqt-0.2.0/AnyQt/_backport/QtSql.py 0000664 0000000 0000000 00000000462 14272202670 0017267 0 ustar 00root root 0000000 0000000 from PyQt5.QtSql import (
QSql,
QSqlDatabase,
QSqlDriver,
QSqlDriverCreatorBase,
QSqlError,
QSqlField,
QSqlIndex,
QSqlQuery,
QSqlQueryModel,
QSqlRecord,
QSqlRelation,
QSqlRelationalDelegate,
QSqlRelationalTableModel,
QSqlResult,
QSqlTableModel,
) anyqt-0.2.0/AnyQt/_backport/QtSvg.py 0000664 0000000 0000000 00000000246 14272202670 0017267 0 ustar 00root root 0000000 0000000 from .. import _api
assert _api.USED_API == _api.QT_API_PYQT5
from PyQt5.QtSvg import (
QGraphicsSvgItem,
QSvgGenerator,
QSvgRenderer,
QSvgWidget,
) anyqt-0.2.0/AnyQt/_backport/QtTest.py 0000664 0000000 0000000 00000000037 14272202670 0017445 0 ustar 00root root 0000000 0000000 from PyQt5.QtTest import QTest
anyqt-0.2.0/AnyQt/_backport/QtWebKit.py 0000664 0000000 0000000 00000000664 14272202670 0017721 0 ustar 00root root 0000000 0000000 from PyQt5.QtWebKit import (
QWebDatabase,
QWebElement,
QWebElementCollection,
QWebHistory,
QWebHistoryInterface,
QWebHistoryItem,
QWebPluginFactory,
QWebSecurityOrigin,
QWebSettings,
qWebKitMajorVersion,
qWebKitMinorVersion,
qWebKitVersion
)
from PyQt5.QtWebKitWidgets import (
QGraphicsWebView,
QWebFrame,
QWebHitTestResult,
QWebInspector,
QWebPage,
QWebView,
) anyqt-0.2.0/AnyQt/_backport/QtXml.py 0000664 0000000 0000000 00000001241 14272202670 0017264 0 ustar 00root root 0000000 0000000 from PyQt5.QtXml import (
QDomAttr,
QDomCDATASection,
QDomCharacterData,
QDomComment,
QDomDocument,
QDomDocumentFragment,
QDomDocumentType,
QDomElement,
QDomEntity,
QDomEntityReference,
QDomImplementation,
QDomNamedNodeMap,
QDomNode,
QDomNodeList,
QDomNotation,
QDomProcessingInstruction,
QDomText,
QXmlAttributes,
QXmlContentHandler,
QXmlDTDHandler,
QXmlDeclHandler,
QXmlDefaultHandler,
QXmlEntityResolver,
QXmlErrorHandler,
QXmlInputSource,
QXmlLexicalHandler,
QXmlLocator,
QXmlNamespaceSupport,
QXmlParseException,
QXmlReader,
QXmlSimpleReader,
) anyqt-0.2.0/AnyQt/_backport/QtXmlPatterns.py 0000664 0000000 0000000 00000000567 14272202670 0021017 0 ustar 00root root 0000000 0000000 from PyQt5.QtXmlPatterns import (
QAbstractMessageHandler,
QAbstractUriResolver,
QAbstractXmlNodeModel,
QAbstractXmlReceiver,
QSimpleXmlNodeModel,
QSourceLocation,
QXmlFormatter,
QXmlItem,
QXmlName,
QXmlNamePool,
QXmlNodeModelIndex,
QXmlQuery,
QXmlResultItems,
QXmlSchema,
QXmlSchemaValidator,
QXmlSerializer,
) anyqt-0.2.0/AnyQt/_backport/__init__.py 0000664 0000000 0000000 00000000000 14272202670 0017746 0 ustar 00root root 0000000 0000000 anyqt-0.2.0/AnyQt/_backport/_utils.py 0000664 0000000 0000000 00000001245 14272202670 0017522 0 ustar 00root root 0000000 0000000 import warnings
def obsolete_rename(oldname, newfunc):
"""
Simple obsolete/removed method decorator
Parameters
----------
oldname : str
The name of the old obsolete name
newfunc : FunctionType
Replacement unbound member function.
"""
newname = newfunc.__name__
def __obsolete(*args, **kwargs):
warnings.warn(
"{oldname} is obsolete and is removed in PyQt5. "
"Use {newname} instead.".format(oldname=oldname, newname=newname),
DeprecationWarning,
stacklevel=2
)
return newfunc(*args, **kwargs)
__obsolete.__name__ = oldname
return __obsolete
anyqt-0.2.0/AnyQt/_backport/uic.py 0000664 0000000 0000000 00000000027 14272202670 0017000 0 ustar 00root root 0000000 0000000 from PyQt5.uic import * anyqt-0.2.0/AnyQt/_compat.py 0000664 0000000 0000000 00000001247 14272202670 0015703 0 ustar 00root root 0000000 0000000 from typing import Union
from functools import lru_cache
from AnyQt.QtCore import QObject, Property
@lru_cache(maxsize=200)
def _converter(type_: Union[type, str]):
class Obj(QObject):
_f = None
def _set(self, val):
self._f = val
def _get(self):
return self._f
prop = Property(type_, _get, _set)
def convert(value):
inst = Obj()
ok = inst.setProperty('prop', value)
if ok:
return inst.property('prop')
else:
return None
return convert
def qvariant_cast(value, type_: Union[type, str]):
converter = _converter(type_)
return converter(value)
anyqt-0.2.0/AnyQt/_ctypes.py 0000664 0000000 0000000 00000004526 14272202670 0015732 0 ustar 00root root 0000000 0000000 import os
from itertools import chain
from typing import Iterable
import glob
import sys
import sysconfig
import ctypes.util
from AnyQt.QtCore import QLibraryInfo, QT_VERSION
def shlib_ext():
"""
Return possible platform shared library extension.
"""
extensions = []
if sys.platform == "win32":
extensions += [".dll"]
elif sys.platform == "darwin":
extensions += ["", ".dylib"]
else:
extensions += [".so"]
confv = sysconfig.get_config_vars()
so_ext = confv.get("SO", None)
if so_ext is not None and so_ext not in extensions:
extensions += [so_ext]
return extensions
#
# NOTE: posix dlsym resolves references over linked libs
# `LoadLibrary(QtGui.__file__)` is sufficient. Windows?
# No. Only referenced lib is searched (LoadLibrary and GetProcAddress).
# But LoadLibrary("Qt5Gui.dll") might just do the trick.
#
def find_library(name, path) -> Iterable[str]:
if sys.platform == "darwin":
test = [
name,
name + ".so",
name + ".dylib"
"{name}.framework/{name}".format(name=name),
"{name}.framework/Versions/Current/{name}".format(name=name),
"{name}.framework/Versions/*/{name}".format(name=name),
]
elif sys.platform == "win32":
test = [name, name + ".dll"]
else:
test = [
name,
name + ".so",
"lib{name}.so".format(name=name),
"lib{name}.so.*".format(name=name)
]
for suffix in test:
yield from glob.iglob(os.path.join(path, suffix))
# try:
# return next(glob.iglob(os.path.join(path, suffix)))
# except StopIteration:
# pass
def find_qtlib(name) -> Iterable[str]:
qtlibpath = QLibraryInfo.path(QLibraryInfo.LibrariesPath)
major_version = (QT_VERSION >> 16)
paths = find_library(name, qtlibpath)
if name.startswith("Qt"):
# common case for Qt builds on windows
name_extra = "Qt{}{}".format(major_version, name[2:])
extra = find_library(name_extra, qtlibpath)
else:
extra = []
return chain(paths, extra, (name, *((name_extra,) if extra else ())))
def load_qtlib(name):
for path in find_qtlib(name):
try:
return ctypes.cdll.LoadLibrary(path)
except OSError:
pass
return None
anyqt-0.2.0/AnyQt/_fixes.py 0000664 0000000 0000000 00000024557 14272202670 0015547 0 ustar 00root root 0000000 0000000 import os
import enum
import warnings
from typing import Type, Dict, Any
def fix_pyqt5_QGraphicsItem_itemChange():
"""
Attempt to remedy:
https://www.riverbankcomputing.com/pipermail/pyqt/2016-February/037015.html
"""
from PyQt5.QtWidgets import QGraphicsObject, QGraphicsItem
class Obj(QGraphicsObject):
def itemChange(self, change, value):
return QGraphicsObject.itemChange(self, change, value)
obj = Obj()
parent = Obj()
obj.setParentItem(parent)
if obj.parentItem() is None:
# There was probably already some signal defined using QObject's
# subclass from QtWidgets.
# We will monkey patch the QGraphicsItem.itemChange and explicitly
# sip.cast all input and output QGraphicsItem instances
import sip
QGraphicsItem_itemChange_old = QGraphicsItem.itemChange
# All the QGraphicsItem.ItemChange flags which accept/return
# a QGraphicsItem
changeset = {
QGraphicsItem.ItemParentChange,
QGraphicsItem.ItemParentHasChanged,
QGraphicsItem.ItemChildAddedChange,
QGraphicsItem.ItemChildRemovedChange,
}
def QGraphicsItem_itemChange(self, change, value):
if change in changeset:
if isinstance(value, QGraphicsItem):
value = sip.cast(value, QGraphicsItem)
rval = QGraphicsItem_itemChange_old(self, change, value)
if isinstance(rval, QGraphicsItem):
rval = sip.cast(rval, QGraphicsItem)
return rval
else:
return QGraphicsItem_itemChange_old(self, change, value)
QGraphicsItem.itemChange = QGraphicsItem_itemChange
warnings.warn("Monkey patching QGraphicsItem.itemChange",
RuntimeWarning)
def fix_pyqt6_qtgui_qaction_menu(namespace):
if namespace.get("__name__") != "AnyQt.QtGui":
return
import ctypes
from ._ctypes import load_qtlib
qtgui = load_qtlib("QtGui")
if os.name == "posix": # assuming gcc compatible compiler
_QAction_setMenuObject = qtgui['_ZN7QAction13setMenuObjectEP7QObject']
_QAction_menuObject = qtgui['_ZNK7QAction10menuObjectEv']
elif os.name == "nt":
_QAction_setMenuObject = qtgui['?setMenuObject@QAction@@AEAAXPEAVQObject@@@Z']
_QAction_menuObject = qtgui['?menuObject@QAction@@AEBAPEAVQObject@@XZ']
else:
return
_QAction_menuObject.argtypes = [ctypes.c_void_p]
_QAction_menuObject.restype = ctypes.c_void_p
_QAction_setMenuObject.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
from PyQt6.QtGui import QAction
from PyQt6.sip import isdeleted, unwrapinstance, wrapinstance
try:
from PyQt6.QtWidgets import QMenu
except ImportError:
return # No QtWidgets then no setMenu
if hasattr(QAction, "setMenu"):
return
def QAction_setMenu(self, menu):
if menu is not None and not isinstance(menu, QMenu):
raise TypeError()
if menu is not None and isdeleted(menu):
raise RuntimeError()
if isdeleted(self):
raise RuntimeError()
self.__QAction_menu = menu
_QAction_setMenuObject(
unwrapinstance(self),
unwrapinstance(menu) if menu is not None else 0
)
def QAction_menu(self):
if isdeleted(self):
raise RuntimeError()
ptr = _QAction_menuObject(unwrapinstance(self))
if ptr is None:
return None
menu = wrapinstance(ptr, QMenu)
return menu
QAction.setMenu = QAction_setMenu
QAction.menu = QAction_menu
def fix_pyqt6_unscoped_enum(namespace: Dict[str, Any]):
"""
Lift all PyQt6 enum members up to class level.
i.e. Qt.ItemFlags.DisplayRole -> Qt.DisplayRole
"""
from PyQt6 import sip
def members(enum: Type[enum.Enum]):
return ((name, enum[name]) for name in enum.__members__)
def lift_enum_namespace(type_, enum: Type[enum.Enum]):
for name, value in members(enum):
setattr(type_, name, value)
def is_unscoped_enum(value):
return isinstance(value, type) and issubclass(value, enum.Enum)
def can_lift(type_, enum: Type[enum.Enum]):
namespace = type_.__dict__
return not any(name in namespace and namespace[name] is not value
for name, value in members(enum))
for _, class_ in list(namespace.items()):
if isinstance(class_, (sip.simplewrapper, sip.wrappertype)):
for name, value in list(class_.__dict__.items()):
if is_unscoped_enum(value):
if can_lift(class_, value):
lift_enum_namespace(class_, value)
def fix_pyqt5_missing_enum_members(namespace: Dict[str, Any]):
import enum
from AnyQt import sip
def is_pyqt_enum_type(value):
return (isinstance(value, type)
and issubclass(value, int)
and value is not int
and "." in value.__qualname__
and not issubclass(value, enum.Enum))
for _, class_ in list(namespace.items()):
if isinstance(class_, (sip.simplewrapper, sip.wrappertype)):
enum_types = {}
for name, value in list(class_.__dict__.items()):
if is_pyqt_enum_type(value):
enum_types[value.__qualname__] = value
types_ = tuple(enum_types.values())
for name, value in list(class_.__dict__.items()):
if type(value) in types_:
type_ = enum_types[type(value).__qualname__]
if hasattr(type_, name) and (
getattr(type_, name) != value and
type_.__qualname__ != "QKeySequence.StandardKey"
):
warnings.warn(
f"{type_} {name} is already present and is not "
f"{value}", RuntimeWarning
)
elif not hasattr(type_, name):
setattr(type_, name, value)
def fix_pyside_QActionEvent_action(namespace):
if namespace.get("__name__") != "AnyQt.QtGui":
return
import ctypes
try:
from PySide2 import shiboken2 # PySide2 < 5.12.0
except ImportError:
import shiboken2
from AnyQt.QtGui import QActionEvent
from AnyQt.QtWidgets import QAction
class _QActionEvent(ctypes.Structure):
_fields_ = [
("vtable", ctypes.c_void_p),
# QEvent
("d", ctypes.c_void_p), # private data ptr
("t", ctypes.c_ushort), # type
("_flags", ctypes.c_ushort), # various flags
# QActionEvent
("act", ctypes.c_void_p), # QAction *act
("bef", ctypes.c_void_p), # QAction *bef
]
def action(self):
return from_address(self.act, QAction)
def before(self):
return from_address(self.bef, QAction)
@classmethod
def from_event(cls, event: QActionEvent):
p, = shiboken2.getCppPointer(event)
return cls.from_address(p)
def from_address(address: int, type_):
if address:
return shiboken2.wrapInstance(address, type_)
else:
return None
def action(self):
ev = _QActionEvent.from_event(self)
return ev.action()
def before(self):
ev = _QActionEvent.from_event(self)
return ev.before()
if not hasattr(QActionEvent, "action"):
QActionEvent.action = action
if not hasattr(QActionEvent, "before"):
QActionEvent.before = before
def fix_pyside_exec(namespace):
if namespace.get("__name__") == "AnyQt.QtWidgets":
from PySide2.QtWidgets import QApplication, QDialog, QMenu
if "exec" not in QApplication.__dict__:
QApplication.exec = lambda self: QApplication.exec_()
if not hasattr(QDialog, "exec"):
QDialog.exec = lambda self: QDialog.exec_(self)
if not hasattr(QMenu, "exec"):
QMenu.exec = lambda self: QMenu.exec_(self)
if namespace.get("__name__") == "AnyQt.QtGui":
from PySide2.QtGui import QGuiApplication, QDrag
if "exec" not in QGuiApplication.__dict__:
QGuiApplication.exec = lambda self: QGuiApplication.exec_()
if not hasattr(QDrag, "exec"):
QDrag.exec = (
lambda self, *args, **kwargs: QDrag.exec_(self, *args, **kwargs)
)
elif namespace.get("__name__") == "AnyQt.QtCore":
from PySide2.QtCore import QCoreApplication, QEventLoop, QThread
if not hasattr(QCoreApplication, "exec"):
QCoreApplication.exec = lambda self: QCoreApplication.exec_()
if not hasattr(QEventLoop, "exec"):
QEventLoop.exec = (
lambda self, *args, **kwargs:
QEventLoop.exec_(self, *args, **kwargs)
)
if not hasattr(QThread, "exec"):
QThread.exec = lambda self: QThread.exec_(self)
elif namespace.get("__name__") == "AnyQt.QtPrintSupport":
from PySide2.QtPrintSupport import QPageSetupDialog, QPrintDialog
if "exec" not in QPageSetupDialog.__dict__:
QPageSetupDialog.exec = lambda self: QPageSetupDialog.exec_(self)
if "exec" not in QPrintDialog.__dict__:
QPrintDialog.exec = lambda self: QPrintDialog.exec_(self)
def fix_qstandarditem_insert_row(namespace):
if namespace.get("__name__") == "AnyQt.QtGui":
QStandardItem = namespace["QStandardItem"]
__QStandardItem_insertRow = QStandardItem.insertRow
def QStandardItem_insertRow(self, row, items):
if isinstance(items, QStandardItem):
# PYSIDE-237
__QStandardItem_insertRow(self, row, [items])
else:
__QStandardItem_insertRow(self, row, items)
QStandardItem.insertRow = QStandardItem_insertRow
GLOBAL_FIXES = {
"pyqt6": [
fix_pyqt6_unscoped_enum,
fix_pyqt6_qtgui_qaction_menu,
],
"pyqt5": [
fix_pyqt5_missing_enum_members,
],
"pyside2": [
fix_pyside_QActionEvent_action,
fix_pyside_exec,
fix_qstandarditem_insert_row,
],
}
def global_fixes(namespace):
from AnyQt import _api
fixes = GLOBAL_FIXES.get(_api.USED_API, [])
for fixer in fixes:
fixer(namespace)
anyqt-0.2.0/AnyQt/importhooks.py 0000664 0000000 0000000 00000006524 14272202670 0016642 0 ustar 00root root 0000000 0000000 import sys
import warnings
import importlib.util
from importlib.abc import MetaPathFinder, Loader
from ._api import (
USED_API, QT_API_PYQT4, QT_API_PYQT5, QT_API_PYSIDE
)
class _FinderLoader(MetaPathFinder, Loader):
pass
class ImportHookBackport(_FinderLoader):
"""
A python import hook (PEP-302) substituting Qt4 module imports, replacing
them with a back compatible shim.
"""
def __init__(self, whichapi):
self.whichapi = whichapi
def find_spec(self, fullname, path=None, target=None):
if USED_API != QT_API_PYQT5:
return
toplevel = fullname.split(".", 1)[0]
if toplevel == "PyQt4" and self.whichapi == QT_API_PYQT4:
return importlib.util.spec_from_loader(fullname, self)
elif toplevel == "PySide" and self.whichapi == QT_API_PYSIDE:
return importlib.util.spec_from_loader(fullname, self)
else:
return
def create_module(self, spec):
pkgpath = spec.name.split(".")
toplevel = pkgpath[0]
subpkg = pkgpath[1] if len(pkgpath) > 1 else None
assert toplevel.lower() == self.whichapi
backportpkg = "AnyQt._backport"
if subpkg is not None:
backportpkg += "." + subpkg
module = __import__(backportpkg, fromlist=["_"])
warnings.warn(
"Loaded module {} as a substitute for {}"
.format(module.__name__, spec.name),
RuntimeWarning, stacklevel=2,
)
return module
def exec_module(self, module):
return module
class ImportHookDeny(_FinderLoader):
"""
A python import hook (PEP-302) preventing imports of a Qt api.
Parameters
----------
whichapi : str
The Qt api whose import should be prevented.
"""
def __init__(self, whichapi):
self.whichapi = whichapi
def find_spec(self, fullname, path=None, target=None):
toplevel = fullname.split(".")[0]
if self.whichapi == QT_API_PYQT5 and toplevel == "PyQt5" or \
self.whichapi == QT_API_PYQT4 and toplevel == "PyQt4" or \
self.whichapi == QT_API_PYSIDE and toplevel == "PySide":
return importlib.util.spec_from_loader(fullname, self)
else:
return None
def create_module(self, spec):
raise ImportError("Import of {} is denied.".format(spec.name))
def exec_module(self, module) -> None:
raise ImportError
def install_backport_hook(api):
"""
Install a backport import hook for Qt4 api
Parameters
----------
api : str
The Qt4 api whose structure should be intercepted
('pyqt4' or 'pyside').
Example
-------
>>> install_backport_hook("pyqt4")
>>> import PyQt4
Loaded module AnyQt._backport as a substitute for PyQt4
"""
if api == USED_API:
raise ValueError
sys.meta_path.insert(0, ImportHookBackport(api))
def install_deny_hook(api):
"""
Install a deny import hook for Qt api.
Parameters
----------
api : str
The Qt api whose import should be prevented
Example
-------
>>> install_deny_import("pyqt4")
>>> import PyQt4
Traceback (most recent call last):...
ImportError: Import of PyQt4 is denied.
"""
if api == USED_API:
raise ValueError
sys.meta_path.insert(0, ImportHookDeny(api))
anyqt-0.2.0/AnyQt/sip.py 0000664 0000000 0000000 00000000611 14272202670 0015046 0 ustar 00root root 0000000 0000000 import sys
import AnyQt._api as _api
if _api.USED_API == _api.QT_API_PYQT5:
try:
from PyQt5 import sip as __sip
except ImportError:
import sip as __sip
elif _api.USED_API == _api.QT_API_PYQT6:
from PyQt6 import sip as __sip
elif _api.USED_API == _api.QT_API_PYQT4:
import sip as __sip
else:
raise ImportError("AnyQt.sip")
sys.modules["AnyQt.sip"] = __sip
anyqt-0.2.0/AnyQt/uic.py 0000664 0000000 0000000 00000000634 14272202670 0015040 0 ustar 00root root 0000000 0000000 from . import _api
if _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.uic import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.uic import *
elif _api.USED_API == _api.QT_API_PYSIDE:
# This will fail with an ImportError (as it should)
from PySide.uic import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
# This will fail with an ImportError (as it should)
from PySide2.uic import *
anyqt-0.2.0/LICENSE.txt 0000664 0000000 0000000 00000104513 14272202670 0014476 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
anyqt-0.2.0/MANIFEST.in 0000664 0000000 0000000 00000000071 14272202670 0014403 0 ustar 00root root 0000000 0000000
recursive-include AnyQt *.py
include *.txt
include *.py
anyqt-0.2.0/README.txt 0000664 0000000 0000000 00000001256 14272202670 0014351 0 ustar 00root root 0000000 0000000 AnyQt
-----
PyQt/PySide compatibility layer.
Features:
* At the top level AnyQt exports a Qt5 compatible module namespace along with
some minimal renames to better support portability between different
versions
* Which Qt api/backend is chosen can be controlled by a QT_API env variable
* The api can be chosen/forced programmatically (as long as no
PyQt4/PyQt5/PySide/PySide2 was already imported)
* provides an optional compatibility import hook, that denys imports from
conflicting Qt api, or intercepts and fakes a Qt4 api imports, to use a Qt5
compatible API (some monkey patching is involved).
The documentation is hosted at https://anyqt.readthedocs.io/en/stable/
anyqt-0.2.0/conda-recipe/ 0000775 0000000 0000000 00000000000 14272202670 0015200 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/conda-recipe/meta.yaml 0000664 0000000 0000000 00000001245 14272202670 0017014 0 ustar 00root root 0000000 0000000 {% set data = load_setup_py_data() %}
package:
name: anyqt
version: {{ data['version'] }}
source:
git_url: ../
build:
number: 0
script:
- python setup.py install --single-version-externally-managed --record record.txt
requirements:
build:
- python
- setuptools
run:
- python
- pyqt
test:
imports:
- AnyQt.QtCore
- AnyQt.QtGui
- AnyQt.QtWidgets
- AnyQt.QtNetwork
- AnyQt.QtSvg
about:
home: https://github.com/ales-erjavec/anyqt/
license: GPL-3.0
license_family: GPL3
summary: PyQt4/PyQt5 compatibility layer.
doc_url: http://anyqt.readthedocs.io/en/latest
dev_url: https//github.com/ales-erjavec/anyqt
anyqt-0.2.0/docs/ 0000775 0000000 0000000 00000000000 14272202670 0013577 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/docs/Makefile 0000664 0000000 0000000 00000016755 14272202670 0015255 0 ustar 00root root 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/AnyQt.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/AnyQt.qhc"
.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/AnyQt"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/AnyQt"
@echo "# devhelp"
.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
anyqt-0.2.0/docs/make.bat 0000664 0000000 0000000 00000016130 14272202670 0015205 0 ustar 00root root 0000000 0000000 @ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
set I18NSPHINXOPTS=%SPHINXOPTS% source
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^` where ^ is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. coverage to run coverage check of the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 1>NUL 2>NUL
if errorlevel 9009 goto sphinx_python
goto sphinx_ok
:sphinx_python
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
:sphinx_ok
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\AnyQt.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\AnyQt.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "coverage" (
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
if errorlevel 1 exit /b 1
echo.
echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end
anyqt-0.2.0/docs/source/ 0000775 0000000 0000000 00000000000 14272202670 0015077 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/docs/source/anyqt.rst 0000664 0000000 0000000 00000033762 14272202670 0017000 0 ustar 00root root 0000000 0000000 .. module:: AnyQt
:mod:`AnyQt`
============
.. autofunction:: availableapi
.. autofunction:: setpreferredapi
.. autofunction:: selectapi
.. autodata:: USED_API
:mod:`AnyQt.QtCore`
-------------------
Export a Qt5 compatible QtCore module.
* PyQt5: Full :mod:`PyQt5.QtCore` module is reexported
* PyQt4: Full :mod:`PyQt4.QtCore` module is reexported and in addition
`QAbstractProxyModel`, `QIdentityProxyModel`, `QItemSelection`,
`QItemSelectionModel`, `QItemSelectionRange`, `QSortFilterProxyModel`,
`QStringListModel`, are imported from :mod:`PyQt4.QtGui`
.. note::
The folowing are not available when using :mod:`PyQt5`:
* 'QAbstractFileEngine'
* 'QAbstractFileEngineHandler'
* 'QAbstractFileEngineIterator'
* 'QFSFileEngine'
* 'QPyNullVariant'
* 'QSystemLocale'
* 'SIGNAL'
* 'SLOT'
* 'qInstallMsgHandler'
* 'qSwap'
.. note::
QUrl in Qt5 has a different interface (some functionality was split into
QUrlParse). No attempt is made to taper over the differences.
* :class:`QSignalMapper` imported from this module has `mappedInt`,
`mappedString`, `mappedObject` and `mappedWidget` signals defined even
when not present in Qt < 5.15. Use these instead of deprecated `mapped`
overloads for forward compatibility with Qt6
.. note:: A subclass of the real QSignalMapper is used.
* A forward compatible :func:`QLibraryInfo.path` is available (new in Qt6
replaces :func:`QLibrartInfo.location`)
Use `AnyQt.QtCore.QT_VERSION` to check if a feature is present.
:mod:`AnyQt.QtGui`
------------------
Export a Qt5 compatible QtGui module.
* PyQt5: Full :mod:`PyQt5.QtGui` module is reexported
* PyQt4: The following members are imported from :mod:`PyQt4.QtGui`:
* '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'
* 'QIntValidator'
* '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'
* 'QRawFont'
* 'QRegExpValidator'
* 'QRegion'
* 'QResizeEvent'
* 'QSessionManager'
* 'QShortcutEvent'
* 'QShowEvent'
* 'QStandardItem'
* 'QStandardItemModel'
* 'QStaticText'
* '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'
* 'QTouchEvent'
* 'QTransform'
* 'QValidator'
* 'QVector2D'
* 'QVector3D'
* 'QVector4D'
* 'QWhatsThisClickedEvent'
* 'QWheelEvent'
* 'QWindowStateChangeEvent'
* 'qAlpha'
* 'qBlue'
* 'qFuzzyCompare'
* 'qGray'
* 'qGreen'
* 'qIsGray'
* 'qRed'
* 'qRgb'
* 'qRgba'
* When using a Qt4 API, the :class:`QWheelEvent` gains a Qt5 compatible
:func:`angleDelta` method.
* A backported QGuiApplication.screenAt static method is added if not
implemented by Qt5
* A QFontMetrics(F).horizontalAdvance method is made available if not present
in Qt (<5.11)
* An missing QPdfWriter.setPageSize(QPageSize) overload for PyQt5 is added.
* All members of :class:`QFontDatabase` can be called as static methods the
same way as in Qt 6.
* :class:`QAction` has ctypes based :func:`menu()` and :func:`setMenu()`
members if/when not present in PyQt6
:mod:`AnyQt.QtWidgets`
----------------------
Export a Qt5 compatible QtWidgets module
* PyQt5: Full :mod:`PyQt5.QtWidgets` module is reexported
* PyQt4: The following members from PyQt4.QtGui are exported:
* 'QAbstractButton'
* 'QAbstractGraphicsShapeItem'
* 'QAbstractItemDelegate'
* 'QAbstractItemView'
* 'QAbstractScrollArea'
* 'QAbstractSlider'
* 'QAbstractSpinBox'
* 'QAction'
* 'QActionGroup'
* 'QApplication'
* 'QBoxLayout'
* 'QButtonGroup'
* 'QCalendarWidget'
* 'QCheckBox'
* 'QColorDialog'
* 'QColumnView'
* 'QComboBox'
* 'QCommandLinkButton'
* 'QCommonStyle'
* 'QCompleter'
* 'QDataWidgetMapper'
* 'QDateEdit'
* 'QDateTimeEdit'
* 'QDesktopWidget'
* 'QDial'
* 'QDialog'
* 'QDialogButtonBox'
* 'QDirModel'
* 'QDockWidget'
* 'QDoubleSpinBox'
* 'QErrorMessage'
* 'QFileDialog'
* 'QFileIconProvider'
* 'QFileSystemModel'
* 'QFocusFrame'
* 'QFontComboBox'
* 'QFontDialog'
* 'QFormLayout'
* 'QFrame'
* 'QGesture'
* 'QGestureEvent'
* 'QGestureRecognizer'
* 'QGraphicsAnchor'
* 'QGraphicsAnchorLayout'
* 'QGraphicsBlurEffect'
* 'QGraphicsColorizeEffect'
* 'QGraphicsDropShadowEffect'
* 'QGraphicsEffect'
* 'QGraphicsEllipseItem'
* 'QGraphicsGridLayout'
* 'QGraphicsItem'
* 'QGraphicsItemGroup'
* 'QGraphicsLayout'
* 'QGraphicsLayoutItem'
* 'QGraphicsLineItem'
* 'QGraphicsLinearLayout'
* 'QGraphicsObject'
* 'QGraphicsOpacityEffect'
* 'QGraphicsPathItem'
* 'QGraphicsPixmapItem'
* 'QGraphicsPolygonItem'
* 'QGraphicsProxyWidget'
* 'QGraphicsRectItem'
* 'QGraphicsRotation'
* 'QGraphicsScale'
* 'QGraphicsScene'
* 'QGraphicsSceneContextMenuEvent'
* 'QGraphicsSceneDragDropEvent'
* 'QGraphicsSceneEvent'
* 'QGraphicsSceneHelpEvent'
* 'QGraphicsSceneHoverEvent'
* 'QGraphicsSceneMouseEvent'
* 'QGraphicsSceneMoveEvent'
* 'QGraphicsSceneResizeEvent'
* 'QGraphicsSceneWheelEvent'
* 'QGraphicsSimpleTextItem'
* 'QGraphicsTextItem'
* 'QGraphicsTransform'
* 'QGraphicsView'
* 'QGraphicsWidget'
* 'QGridLayout'
* 'QGroupBox'
* 'QHBoxLayout'
* 'QHeaderView'
* 'QInputDialog'
* 'QItemDelegate'
* 'QItemEditorCreatorBase'
* 'QItemEditorFactory'
* 'QKeyEventTransition'
* 'QLCDNumber'
* 'QLabel'
* 'QLayout'
* 'QLayoutItem'
* 'QLineEdit'
* 'QListView'
* 'QListWidget'
* 'QListWidgetItem'
* 'QMacCocoaViewContainer'
* 'QMainWindow'
* 'QMdiArea'
* 'QMdiSubWindow'
* 'QMenu'
* 'QMenuBar'
* 'QMessageBox'
* 'QMouseEventTransition'
* 'QPanGesture'
* 'QPinchGesture'
* 'QPlainTextDocumentLayout'
* 'QPlainTextEdit'
* 'QProgressBar'
* 'QProgressDialog'
* 'QPushButton'
* 'QRadioButton'
* 'QRubberBand'
* 'QScrollArea'
* 'QScrollBar'
* 'QShortcut'
* 'QSizeGrip'
* 'QSizePolicy'
* 'QSlider'
* 'QSpacerItem'
* 'QSpinBox'
* 'QSplashScreen'
* 'QSplitter'
* 'QSplitterHandle'
* 'QStackedLayout'
* 'QStackedWidget'
* 'QStatusBar'
* 'QStyle'
* 'QStyleFactory'
* 'QStyleHintReturn'
* 'QStyleHintReturnMask'
* 'QStyleHintReturnVariant'
* 'QStyleOption'
* 'QStyleOptionButton'
* 'QStyleOptionComboBox'
* 'QStyleOptionComplex'
* 'QStyleOptionDockWidget'
* 'QStyleOptionFocusRect'
* 'QStyleOptionFrame'
* 'QStyleOptionGraphicsItem'
* 'QStyleOptionGroupBox'
* 'QStyleOptionHeader'
* 'QStyleOptionMenuItem'
* 'QStyleOptionProgressBar'
* 'QStyleOptionRubberBand'
* 'QStyleOptionSizeGrip'
* 'QStyleOptionSlider'
* 'QStyleOptionSpinBox'
* 'QStyleOptionTab'
* 'QStyleOptionTabBarBase'
* 'QStyleOptionTabWidgetFrame'
* 'QStyleOptionTitleBar'
* 'QStyleOptionToolBar'
* 'QStyleOptionToolBox'
* 'QStyleOptionToolButton'
* 'QStyleOptionViewItem'
* 'QStylePainter'
* 'QStyledItemDelegate'
* 'QSwipeGesture'
* 'QSystemTrayIcon'
* 'QTabBar'
* 'QTabWidget'
* 'QTableView'
* 'QTableWidget'
* 'QTableWidgetItem'
* 'QTableWidgetSelectionRange'
* 'QTapAndHoldGesture'
* 'QTapGesture'
* 'QTextBrowser'
* 'QTextEdit'
* 'QTimeEdit'
* 'QToolBar'
* 'QToolBox'
* 'QToolButton'
* 'QToolTip'
* 'QTreeView'
* 'QTreeWidget'
* 'QTreeWidgetItem'
* 'QTreeWidgetItemIterator'
* 'QUndoCommand'
* 'QUndoGroup'
* 'QUndoStack'
* 'QUndoView'
* 'QVBoxLayout'
* 'QWIDGETSIZE_MAX'
* 'QWhatsThis'
* 'QWidget'
* 'QWidgetAction'
* 'QWidgetItem'
* 'QWizard'
* 'QWizardPage'
* 'qApp'
* 'qDrawBorderPixmap'
* 'qDrawPlainRect'
* 'qDrawShadeLine'
* 'qDrawShadePanel'
* 'qDrawShadeRect'
* 'qDrawWinButton'
* 'qDrawWinPanel'
..
Known unavailable in PyQt4
* 'QKeySequenceEdit',
* 'QOpenGLWidget',
* 'QProxyStyle',
* 'QScroller',
* 'QScrollerProperties',
* :class:`QFileDialog`\'s get{Open,Save}Filename provide a consistent PyQt5
compatible interface (i.e. they return `(filename: str, format: str)` tuple.
* :class:`QHeaderView` provides a consistent forward compatible methods:
* :func:`QHeaderView.setSectionResizeMode`
* :func:`QHeaderView.sectionResizeMode`
* :func:`QHeaderView.sectionsClickable`
* :func:`QHeaderView.setSectionsClickable`
* :func:`QHeaderView.sectionsMovable`
* :func:`QHeaderView.setSectionsMovable`
* The versioned :class:`QStyleOption` subclasses in :mod:`PyQt4.QtGui` are
renamed to their unversioned conterpart (e.g. the
:class:`QStyleOptionViewItemV4` is exported as
:class:`QStyleOptionViewItem`
* A forward compatible :func:`QWidget.grab` method is made available when
using a Qt4 backend.
* A backward compatible :func:`QAbstractItemView.viewOptions` method is made
available when using a Qt6 backend.
* A forward compatible :func:`QAbstractItemView.itemDelegateForIndex` method
is made available (new in Qt 6.0). Use this instead of deprecated
:func:`QAbstractItemView.itemDelegate(QModelIndex)` overload.
* A :func:`QWidget.screen` method is made available when not present in
Qt5 (<5.14).
* :class:`QButtonGroup` imported from this module has `idClicked`, `idPressed`,
`idReleased` and `idToggled` signals defined even when not present in
Qt < 5.15. Use these instead of `clicked[int]`, `pressed[int]` and
`toggled[int]` overloads for compatibility with Qt6 where they are
removed.
.. note:: A subclass of the real QGroupBox is used.
* :class:`QComboBox` imported from this module has `textActivated` and
`textHighlighted` signals defined even when not present in Qt < 5.14.
Use these instead of `activated[int]` and `highlighted[int]` overloads
for compatibility with Qt6 where they are removed.
.. note:: A subclass of the real QComboBox is used.
* :func:`QTextEdit.setTabStopDistance`, `QTextEdit.tabStopDistance`
:func:`QPlainTextEdit.setTabStopDistance` :func:`QTextPlainEdit.setTabStopDistance`
are made available if not present Qt5 (<5.10). Use these instead of the obsolete
`setTabStopWidth` ...
:mod:`AnyQt.QtMultimedia`
-------------------------
:mod:`AnyQt.QtMultimediaWidgets`
--------------------------------
Qt5-only QtMultimediaWidgets module.
:mod:`AnyQt.QtNetwork`
----------------------
:mod:`AnyQt.QtPrintSupport`
---------------------------
Export a Qt5 compatible QtPrintSupport module.
:mod:`AnyQt.Qml`
----------------
Qt5-only Qml module.
:mod:`AnyQt.QtQuick`
--------------------
Qt5-only QtQuick module.
:mod:`AnyQt.QtSql`
------------------
:mod:`AnyQt.QtSvg`
------------------
:mod:`AnyQt.QtSvgWidgets`
-------------------------
A Qt6 compatible QtSvgWidgets module
:mod:`AnyQt.QtTest`
-------------------
A PyQt5 API compatible QSignalSpy class is provided when using PyQt4 backend
:mod:`AnyQt.QtDBus`
-------------------
:mod:`AnyQt.QtDesigner`
-----------------------
:mod:`AnyQt.QtHelp`
-------------------
:mod:`AnyQt.QtMacExtras`
------------------------
* PyQt5: Full :mod:`PyQt5.QtMacExtras` is reexported
* PyQt4: :class:`QMacPasteboardMime` is imported from :mod:`PyQt4.QtGui`
:mod:`AnyQt.QtOpenGL`
---------------------
:mod:`AnyQt.QtWebChannel`
-------------------------------
Export a Qt5 compatible QtWebChannel module.
:mod:`AnyQt.QtWebEngineWidgets`
-------------------------------
Qt5-only QtWebEngineWidgets module.
:mod:`AnyQt.QtWebKit`
---------------------
Export a Qt5 compatible QtWebKit module.
:mod:`AnyQt.QtWebKitWidgets`
----------------------------
Export a Qt5 compatible QtWebKitWidgets module.
:mod:`AnyQt.QtWebSockets`
-------------------------------
Qt5-only QtWebSockets module.
:mod:`AnyQt.QtWinExtras`
------------------------
Qt5-only QtWinExtras module.
:mod:`AnyQt.QtX11Extras`
------------------------
* Qt5: Full :mod:`QtX11Extras` is reexported
* Qt4: :class:`QX11Info` is imported from :mod:`QtGui`
:mod:`AnyQt.QtXml`
------------------
:mod:`AnyQt.QtXmlPatterns`
--------------------------
:mod:`AnyQt.sip`
----------------
When using a PyQt4/5 then this is an alias for the corresponding sip module
anyqt-0.2.0/docs/source/conf.py 0000664 0000000 0000000 00000026210 14272202670 0016377 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# AnyQt documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 6 10:32:15 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'AnyQt'
copyright = u'2016, Aleš Erjavec'
author = u'Aleš Erjavec'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.0.2'
# The full version, including alpha/beta/rc tags.
release = '0.0.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
#html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'AnyQtdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'AnyQt.tex', 'AnyQt Documentation',
u'Aleš Erjavec', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'anyqt', 'AnyQt Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'AnyQt', 'AnyQt Documentation',
author, 'AnyQt', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
# -- Options for Epub output ----------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
epub_author = author
epub_publisher = author
epub_copyright = copyright
# The basename for the epub file. It defaults to the project name.
#epub_basename = project
# The HTML theme for the epub output. Since the default themes are not
# optimized for small screen space, using the same theme for HTML and epub
# output is usually not wise. This defaults to 'epub', a theme designed to save
# visual space.
#epub_theme = 'epub'
# The language of the text. It defaults to the language option
# or 'en' if the language is not set.
#epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''
# A unique identification for the text.
#epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
#epub_guide = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# HTML files that should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# Allow duplicate toc entries.
#epub_tocdup = True
# Choose between 'default' and 'includehidden'.
#epub_tocscope = 'default'
# Fix unsupported image types using the Pillow.
#epub_fix_images = False
# Scale large images.
#epub_max_image_width = 0
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#epub_show_urls = 'inline'
# If false, no index is generated.
#epub_use_index = True
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
anyqt-0.2.0/docs/source/index.rst 0000664 0000000 0000000 00000002070 14272202670 0016737 0 ustar 00root root 0000000 0000000 .. AnyQt documentation master file, created by
sphinx-quickstart on Wed Apr 6 10:32:15 2016.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to AnyQt's documentation!
=================================
AnyQt is a PyQt4/PyQt5 compatibility layer intended as a stepping stone to
full PyQt5 support while still providing support for PyQt4.
The idea is to use use a forward compatible module structure that mimics that
of Qt5, even when using Qt4
By default PyQt5 is used if available, but that can be changed by a QT_API env
variable (which can take either 'pyqt4' or 'pyqt5' values), or setting the
preferred api using the :func:`AnyQt.setpreferredapi`. However if any of the
Qt apis is already imported (listed in `sys.modules`) then it is used instead.
.. note::
The final choice of api is delayed until the first AnyQt.Qt* module
is imported
Contents:
.. toctree::
:maxdepth: 2
anyqt
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
anyqt-0.2.0/setup.cfg 0000664 0000000 0000000 00000000361 14272202670 0014470 0 ustar 00root root 0000000 0000000 [bumpversion]
current_version = 0.2.0
commit = True
tag = True
tag_name = {new_version}
[build_sphinx]
source-dir = docs/source
build-dir = docs/build
warning-is-error = 1
[metadata]
license_file = LICENSE.txt
[bumpversion:file:setup.py]
anyqt-0.2.0/setup.py 0000775 0000000 0000000 00000002565 14272202670 0014374 0 ustar 00root root 0000000 0000000 #! /usr/bin/env python
# encoding: utf-8
import io
from setuptools import setup, find_packages
NAME = "AnyQt"
VERSION = "0.2.0"
AUTHOR = "Aleš Erjavec"
AUTHOR_EMAIL = "ales.erjavec@fri.uni-lj.si"
URL = "https://github.com/ales-erjavec/anyqt"
PACKAGES = find_packages(".", include="AnyQt*")
DESCRIPTION = "PyQt5/PyQt6 compatibility layer."
with io.open("README.txt", encoding="utf-8") as f:
README = f.read()
LICENSE = "GPLv3"
CLASSIFIERS = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
]
KEYWORDS = [
"GUI", "PyQt4", "PyQt5", "PySide", "PySide2", "compatibility"
]
PROJECT_URLS = {
"Bug Reports": "https://github.com/ales-erjavec/anyqt/issues",
"Source": URL,
"Documentation": "https://anyqt.readthedocs.io/en/stable/"
}
if __name__ == "__main__":
setup(
name=NAME,
version=VERSION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
description=DESCRIPTION,
long_description=README,
license=LICENSE,
keywords=KEYWORDS,
classifiers=CLASSIFIERS,
packages=PACKAGES,
project_urls=PROJECT_URLS,
python_requires=">=3.6",
)
anyqt-0.2.0/test/ 0000775 0000000 0000000 00000000000 14272202670 0013626 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/test/test_import.py 0000664 0000000 0000000 00000003435 14272202670 0016556 0 ustar 00root root 0000000 0000000 import subprocess
import sys
apis = {
'pyqt4': 'PyQt4',
'pyqt5': 'PyQt5',
'pyside': 'PySide',
'pyside2': 'PySide2',
'pyqt6:': "PyQt6"
}
submodules_common = [
'QtCore',
'QtGui',
'QtHelp',
'QtMultimedia',
'QtNetwork',
'QtOpenGL',
'QtPrintSupport',
'QtSql',
'QtSvg',
'QtTest',
'QtWidgets',
'QtXml',
]
submodules_qt4 = [
'QtXmlPatterns'
]
submodules_qt5 = [
'QtMultimediaWidgets',
'QtWebChannel',
'QtWebEngineWidgets',
'QtWebEngineCore',
'QtWebSockets',
'QtQml',
'QtXmlPatterns',
]
submodules_qt6 = [
"QtSvgWidgets",
]
def get_qt_version(modname):
cmd = [sys.executable, '-c', 'import '+modname+';from AnyQt.QtCore import QT_VERSION_STR; print(QT_VERSION_STR)']
return subprocess.check_output(cmd)
def try_import(modname):
cmd = [sys.executable, '-c', 'import '+modname]
ret = subprocess.call(cmd)
return ret == 0
def try_import_anyqt(modname, submodule):
cmd = [sys.executable, '-c', 'import '+modname+'; import AnyQt.'+submodule]
ret = subprocess.call(cmd)
return ret == 0
for api in apis:
modname = apis[api]
if try_import(modname):
qt_version = get_qt_version(modname).decode()
print('-- Found', modname, 'Qt=', qt_version)
submodules = list(submodules_common)
if qt_version[0] == '4':
submodules.extend(submodules_qt4)
if qt_version[0] == '5':
submodules.extend(submodules_qt5)
if qt_version[0] == '6':
submodules.extend(submodules_qt6)
for submodule in submodules:
if try_import_anyqt(modname, submodule):
print(submodule, 'Ok')
else:
print(submodule, 'FAIL')
else:
print(modname, '-- not found')
anyqt-0.2.0/tests/ 0000775 0000000 0000000 00000000000 14272202670 0014011 5 ustar 00root root 0000000 0000000 anyqt-0.2.0/tests/test_enums.py 0000664 0000000 0000000 00000000200 14272202670 0016541 0 ustar 00root root 0000000 0000000 from AnyQt.QtCore import Qt
def test_common_enums():
Qt.DisplayRole
Qt.EditRole
Qt.DecorationRole
Qt.UserRole
anyqt-0.2.0/tests/test_qabstractitemview.py 0000664 0000000 0000000 00000002732 14272202670 0021164 0 ustar 00root root 0000000 0000000 import unittest
import warnings
from AnyQt.QtCore import QStringListModel
from AnyQt.QtWidgets import QApplication, QTableView, QStyledItemDelegate, \
QStyleOptionViewItem
class Test_QAbstractItemView_itemDelegate(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
app = QApplication.instance()
if app is None:
app = QApplication([])
cls.app = app
@classmethod
def tearDownClass(cls) -> None:
cls.app = None
super().tearDownClass()
def test_qabstratitemview_item_delegate_for_index(self):
view = QTableView()
model = QStringListModel()
model.setStringList(["AA", "BB"])
view.setModel(model)
idx1 = model.index(0, 0)
idx2 = model.index(1, 0)
delegate = QStyledItemDelegate()
view.setItemDelegate(delegate)
with warnings.catch_warnings(record=True):
self.assertIs(view.itemDelegate(idx1), delegate)
self.assertIs(view.itemDelegate(idx2), delegate)
def test_qabstractitemview_view_options(self):
view = QTableView()
with warnings.catch_warnings(record=True):
opt1 = view.viewOptions()
self.assertIs(opt1.widget, view)
self.assertTrue(opt1.showDecorationSelected)
opt2 = QStyleOptionViewItem()
view.initViewItemOption(opt2)
self.assertIs(opt2.widget, view)
self.assertTrue(opt2.showDecorationSelected)
anyqt-0.2.0/tests/test_qaction_set_menu.py 0000664 0000000 0000000 00000001501 14272202670 0020754 0 ustar 00root root 0000000 0000000 import unittest
from AnyQt.QtTest import QSignalSpy
from AnyQt.QtWidgets import QMenu, QApplication
from AnyQt.QtGui import QAction
from AnyQt.QtCore import delete
class TestQAction_setMenu(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
app = QApplication.instance()
if app is None:
app = QApplication([])
cls.app = app
@classmethod
def tearDownClass(cls) -> None:
cls.app = None
super().tearDownClass()
def test(self):
ac = QAction()
menu = QMenu()
ac.setMenu(menu)
self.assertIs(ac.menu(), menu)
ac.setMenu(None)
self.assertIs(ac.menu(), None)
spy = QSignalSpy(menu.destroyed)
delete(menu)
del menu
self.assertEqual(len(spy), 1)
anyqt-0.2.0/tests/test_qactionevent_action.py 0000664 0000000 0000000 00000002042 14272202670 0021455 0 ustar 00root root 0000000 0000000 import unittest
from AnyQt.QtGui import QAction
from AnyQt.QtWidgets import QWidget, QApplication
class TestQActionEvent_action(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
app = QApplication.instance()
if app is None:
app = QApplication([])
cls.app = app
@classmethod
def tearDownClass(cls) -> None:
cls.app = None
super().tearDownClass()
def test_action(self):
a = QAction()
b = QAction()
class Widget(QWidget):
def test(self, event):
pass
def actionEvent(self, event):
super().actionEvent(event)
self.test(event)
widget = Widget()
def test(ev):
assert ev.action() is b
widget.test = test
widget.addAction(b)
def test(ev):
assert ev.action() is a
assert ev.before() is b
widget.test = test
widget.insertAction(b, a)
del widget.test
anyqt-0.2.0/tests/test_qfontdatabase_static.py 0000664 0000000 0000000 00000001271 14272202670 0021606 0 ustar 00root root 0000000 0000000 import unittest
from AnyQt.QtGui import QFontDatabase
from AnyQt.QtWidgets import QApplication
class TestQFontDatabase(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
app = QApplication.instance()
if app is None:
app = QApplication([])
cls.app = app
@classmethod
def tearDownClass(cls) -> None:
# cls.app = None
super().tearDownClass()
def test_qfontdatabase_static(self):
families = QFontDatabase.families()
styles = QFontDatabase.styles(families[0])
systems = QFontDatabase.writingSystems()
systems = QFontDatabase.writingSystems(families[0])
anyqt-0.2.0/tests/test_qpainter_draw_pixmap_fragments.py 0000664 0000000 0000000 00000003635 14272202670 0023715 0 ustar 00root root 0000000 0000000 import unittest
import AnyQt
from AnyQt.QtCore import Qt, QPointF, QRectF
from AnyQt.QtGui import QPainter, QPixmap, QImage, QGuiApplication, QColor
from AnyQt.QtWidgets import QApplication
class TestDrawPixmapFragments(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
app = QApplication.instance()
if app is None:
app = QApplication([])
cls.app = app
@classmethod
def tearDownClass(cls) -> None:
cls.app = None
super().tearDownClass()
def test(self):
img = QImage(100, 100, QImage.Format_ARGB32)
img.fill(Qt.green)
p = QPainter(img)
pix = QPixmap(10, 10)
pix.fill(Qt.red)
frgmts = [
QPainter.PixmapFragment.create(
QPointF(25, 25),
QRectF(0, 0, 10, 10),
5., 5.,
),
QPainter.PixmapFragment.create(
QPointF(75, 75),
QRectF(0, 0, 10, 10),
5., 5.,
)
]
p.drawPixmapFragments(frgmts, pix)
p.end()
self.assertEqual(QColor(img.pixel(10, 10)), QColor(Qt.red))
self.assertEqual(QColor(img.pixel(80, 80)), QColor(Qt.red))
self.assertEqual(QColor(img.pixel(90, 10)), QColor(Qt.green))
self.assertEqual(QColor(img.pixel(10, 90)), QColor(Qt.green))
@unittest.skipIf(not AnyQt.USED_API.lower().startswith("pyside"), "PySide only")
def test_pyside(self):
img = QImage(100, 100, QImage.Format_ARGB32)
img.fill(Qt.green)
p = QPainter(img)
pix = QPixmap(10, 10)
pix.fill(Qt.red)
frgmt = QPainter.PixmapFragment.create(
QPointF(25, 25),
QRectF(0, 0, 10, 10),
5., 5.,
)
p.drawPixmapFragments(frgmt, 1, pix)
p.end()
self.assertEqual(QColor(img.pixel(10, 10)), QColor(Qt.red)) anyqt-0.2.0/tests/test_qpdfwriter_setpagesize.py 0000664 0000000 0000000 00000000544 14272202670 0022217 0 ustar 00root root 0000000 0000000 import unittest
from AnyQt.QtCore import QBuffer, QSizeF
from AnyQt.QtGui import QPdfWriter, QPageSize
class TestQPDFWriter(unittest.TestCase):
def test(self):
b = QBuffer()
w = QPdfWriter(b)
size = QPageSize(QSizeF(10, 10), QPageSize.Millimeter)
_ = w.setPageSize(size)
self.assertTrue(w.setPageSize(size)) anyqt-0.2.0/tests/test_qsettings.py 0000664 0000000 0000000 00000001613 14272202670 0017444 0 ustar 00root root 0000000 0000000 import unittest
from AnyQt.QtCore import QSettings, QStandardPaths
class TestQSettings(unittest.TestCase):
def setUp(self) -> None:
super().setUp()
QStandardPaths.setTestModeEnabled(True)
QSettings.setDefaultFormat(QSettings.IniFormat)
def tearDown(self) -> None:
QStandardPaths.setTestModeEnabled(False)
QSettings.setDefaultFormat(QSettings.NativeFormat)
super().tearDown()
def test_qsettings(self):
s = QSettings()
s.setValue("one", 1)
s.setValue("one-half", 0.5)
s.setValue("empty", "")
s.setValue("true", True)
s.sync()
del s
s = QSettings()
self.assertEqual(s.value("one", type=int), 1)
self.assertEqual(s.value("one-half", type=float), 0.5)
self.assertEqual(s.value("empty", type=str), "")
self.assertEqual(s.value("true", type=bool), True) anyqt-0.2.0/tests/test_qstandarditem_insertrow.py 0000664 0000000 0000000 00000001306 14272202670 0022376 0 ustar 00root root 0000000 0000000 import unittest
import gc
from AnyQt.QtGui import QStandardItem, QStandardItemModel
class TestQStandardItem(unittest.TestCase):
def test(self):
model = QStandardItemModel()
item_parent = QStandardItem("parent")
item_child = QStandardItem("child")
model.insertRow(0, item_parent)
item_parent.insertRow(0, item_child)
self.assertEqual(model.index(0, 0).data(), "parent")
self.assertEqual(model.index(0, 0, model.index(0, 0)).data(), "child")
del item_child
del item_parent
gc.collect()
self.assertEqual(model.index(0, 0).data(), "parent")
self.assertEqual(model.index(0, 0, model.index(0, 0)).data(), "child")
anyqt-0.2.0/tests/test_qtest.py 0000664 0000000 0000000 00000001740 14272202670 0016564 0 ustar 00root root 0000000 0000000 import unittest
from itertools import count
from AnyQt.QtCore import QObject, isdeleted
from AnyQt.QtWidgets import QApplication
from AnyQt.QtTest import QTest
class TestQtTest(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
app = QApplication.instance()
if app is None:
app = QApplication([])
cls.app = app
@classmethod
def tearDownClass(cls) -> None:
cls.app = None
super().tearDownClass()
def test_qwait(self):
obj = QObject()
obj.deleteLater()
QTest.qWait(0)
self.assertTrue(isdeleted(obj))
def test_qwaitfor(self):
counter = count()
current = 0
def pred():
nonlocal current
current = next(counter)
return current > 4
self.assertTrue(QTest.qWaitFor(pred, 100000))
self.assertTrue(current == 5)
self.assertFalse(QTest.qWaitFor(lambda: False, 10))