././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1698105160.416587 QtPy-2.4.1/0000777000000000000000000000000014515603510007345 5ustar00././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1638558318.0 QtPy-2.4.1/AUTHORS.md0000666000000000000000000000146014152465156011026 0ustar00# Authors ## Original Authors * [pyqode.qt](https://github.com/pyQode/pyqode.qt): Colin Duquesnoy ([@ColinDuquesnoy](https://github.com/ColinDuquesnoy)) * [spyderlib.qt](https://github.com/spyder-ide/spyder/commits/2.3/spyderlib/qt): Pierre Raybaut ([@PierreRaybaut](https://github.com/PierreRaybaut)) * [qt-helpers](https://github.com/glue-viz/qt-helpers): Thomas Robitaille ([@astrofrog](https://www.github.com/astrofrog)) ## Current Maintainers * Daniel Althviz ([@dalthviz](https://github.com/dalthviz)) * Carlos Cordoba ([@ccordoba12](https://github.com/ccordoba12)) * C.A.M. Gerlach ([@CAM-Gerlach](https://github.com/CAM-Gerlach)) * Spyder Development Team ([Spyder-IDE](https://github.com/spyder-ide)) ## Contributors * [The QtPy Contributors](https://github.com/spyder-ide/qtpy/graphs/contributors) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698104940.0 QtPy-2.4.1/CHANGELOG.md0000666000000000000000000016654514515603154011203 0ustar00# History of changes ## Version 2.4.1 (2023-10-23) ### Issues Closed * [Issue 462](https://github.com/spyder-ide/qtpy/issues/462) - Release QtPy 2.4.1 * [Issue 458](https://github.com/spyder-ide/qtpy/issues/458) - Typo causes failed QWebEngineScript with PySide6 In this release 2 issues were closed. ### Pull Requests Merged * [PR 459](https://github.com/spyder-ide/qtpy/pull/459) - [pre-commit.ci] pre-commit autoupdate, by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci) * [PR 456](https://github.com/spyder-ide/qtpy/pull/456) - [pre-commit.ci] pre-commit autoupdate, by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci) * [PR 455](https://github.com/spyder-ide/qtpy/pull/455) - PR: Fix bug when importing from `PySide6.QtWebEngineCore/QtWebEngineWidgets` (`QWebEngineScrip` vs `QWebEngineScript`) , by [@damonlynch](https://github.com/damonlynch) In this release 3 pull requests were closed. ---- ## Version 2.4.0 (2023-08-29) ### Issues Closed * [Issue 453](https://github.com/spyder-ide/qtpy/issues/453) - Release QtPy 2.4.0 * [Issue 447](https://github.com/spyder-ide/qtpy/issues/447) - Type hints not working for `qtpy` specific imports ([PR 450](https://github.com/spyder-ide/qtpy/pull/450) by [@wkrasnicki](https://github.com/wkrasnicki)) * [Issue 442](https://github.com/spyder-ide/qtpy/issues/442) - Some compatibility issues when using latest PyQt6 or PySide6 (6.5+) ([PR 448](https://github.com/spyder-ide/qtpy/pull/448) by [@dalthviz](https://github.com/dalthviz)) * [Issue 439](https://github.com/spyder-ide/qtpy/issues/439) - qtpy.uic.loadUiType failing for PySide6 ([PR 440](https://github.com/spyder-ide/qtpy/pull/440) by [@JaRoSchm](https://github.com/JaRoSchm)) * [Issue 432](https://github.com/spyder-ide/qtpy/issues/432) - Add compatibility layer for keywords arguments of `QFileDialog ` `get*` class methods ([PR 433](https://github.com/spyder-ide/qtpy/pull/433) by [@Czaki](https://github.com/Czaki)) * [Issue 423](https://github.com/spyder-ide/qtpy/issues/423) - Fix flaky importlib error on Ubuntu Python 3.7 conda CI job ([PR 425](https://github.com/spyder-ide/qtpy/pull/425) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 383](https://github.com/spyder-ide/qtpy/issues/383) - Add extra packages available for PyQt to CI for testing ([PR 446](https://github.com/spyder-ide/qtpy/pull/446) by [@dalthviz](https://github.com/dalthviz)) * [Issue 345](https://github.com/spyder-ide/qtpy/issues/345) - Use pre-commit to automatically format code with Black and imports with isort ([PR 451](https://github.com/spyder-ide/qtpy/pull/451) by [@Czaki](https://github.com/Czaki)) In this release 8 issues were closed. ### Pull Requests Merged * [PR 451](https://github.com/spyder-ide/qtpy/pull/451) - PR: Setup pre-commit and format all code with Black, by [@Czaki](https://github.com/Czaki) ([345](https://github.com/spyder-ide/qtpy/issues/345)) * [PR 450](https://github.com/spyder-ide/qtpy/pull/450) - PR: Update README with information on Pyright/Pylance integration and add CLI subcommand to help generate the related config, by [@wkrasnicki](https://github.com/wkrasnicki) ([447](https://github.com/spyder-ide/qtpy/issues/447)) * [PR 449](https://github.com/spyder-ide/qtpy/pull/449) - PR: Improve enum to flags aliasing for PyQt6 and PySide6 > 6.3 and `QFileDialog` static methods kwarg compatibility, by [@dalthviz](https://github.com/dalthviz) * [PR 448](https://github.com/spyder-ide/qtpy/pull/448) - PR: Restore `QtWidgets.QFileDialog.Options` access as `QtWidgets.QFileDialog.Option` alias (PyQt6), by [@dalthviz](https://github.com/dalthviz) ([442](https://github.com/spyder-ide/qtpy/issues/442)) * [PR 446](https://github.com/spyder-ide/qtpy/pull/446) - PR: Test using `PyQt` extra packages, by [@dalthviz](https://github.com/dalthviz) ([383](https://github.com/spyder-ide/qtpy/issues/383)) * [PR 445](https://github.com/spyder-ide/qtpy/pull/445) - PR: Add mappings for deprecated `QDropEvent` `pos` and `posF` methods, by [@dalthviz](https://github.com/dalthviz) * [PR 444](https://github.com/spyder-ide/qtpy/pull/444) - PR: Restore `Qt.ItemFlags` access as `Qt.ItemFlag` alias (PyQt6), by [@dalthviz](https://github.com/dalthviz) * [PR 443](https://github.com/spyder-ide/qtpy/pull/443) - PR: Update bindings upper bound version to 6.5 and ignore `DeprecationWarning` (CI), by [@dalthviz](https://github.com/dalthviz) * [PR 440](https://github.com/spyder-ide/qtpy/pull/440) - PR: Replace custom implementation with loadUiType from PySide6, by [@JaRoSchm](https://github.com/JaRoSchm) ([439](https://github.com/spyder-ide/qtpy/issues/439)) * [PR 438](https://github.com/spyder-ide/qtpy/pull/438) - PR: Make `exec()` for PySide2, by [@StSav012](https://github.com/StSav012) * [PR 437](https://github.com/spyder-ide/qtpy/pull/437) - PR: Make `QMenu.addAction` and `QToolBar.addAction` compatible with Qt6 arguments' order, by [@StSav012](https://github.com/StSav012) * [PR 434](https://github.com/spyder-ide/qtpy/pull/434) - PR: Enable more tests on CI, by [@Czaki](https://github.com/Czaki) * [PR 433](https://github.com/spyder-ide/qtpy/pull/433) - PR: Add wrapers to fix argument name in `QFileDialog` `get*`methods, by [@Czaki](https://github.com/Czaki) ([432](https://github.com/spyder-ide/qtpy/issues/432)) * [PR 431](https://github.com/spyder-ide/qtpy/pull/431) - PR: Rename `utils.py` to `_utils.py` to make it private, by [@StSav012](https://github.com/StSav012) * [PR 425](https://github.com/spyder-ide/qtpy/pull/425) - PR: Make CI jobs much faster & less flaky w/Mamba, 1-pass solve & other tweaks, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([423](https://github.com/spyder-ide/qtpy/issues/423)) * [PR 424](https://github.com/spyder-ide/qtpy/pull/424) - PR: Add `QEnum` macro for PyQt bindings, by [@phil65](https://github.com/phil65) * [PR 422](https://github.com/spyder-ide/qtpy/pull/422) - PR: Use static calls of `exec_` elsewhere where needed, and test them, by [@StSav012](https://github.com/StSav012) * [PR 421](https://github.com/spyder-ide/qtpy/pull/421) - PR: Symmetrize `QDateTime.toPython` and `toPyDateTime`, etc., by [@StSav012](https://github.com/StSav012) * [PR 420](https://github.com/spyder-ide/qtpy/pull/420) - PR: Symmetrize `path` and `location` of `QLibraryInfo`, by [@StSav012](https://github.com/StSav012) * [PR 419](https://github.com/spyder-ide/qtpy/pull/419) - PR: Add missing issue closed for v2.3.1 changelog entry, by [@dalthviz](https://github.com/dalthviz) * [PR 387](https://github.com/spyder-ide/qtpy/pull/387) - PR: Improve import modularity between `QtGui`, `QtWidgets` and `QtOpenGL*` related modules, by [@DaelonSuzuka](https://github.com/DaelonSuzuka) In this release 21 pull requests were closed. ---- ## Version 2.3.1 (2023-03-28) ### Issues Closed * [Issue 416](https://github.com/spyder-ide/qtpy/issues/416) - Release QtPy 2.3.1 * [Issue 412](https://github.com/spyder-ide/qtpy/issues/412) - How to catch QtBindingsNotFoundError ([PR 413](https://github.com/spyder-ide/qtpy/pull/413) by [@cbrnr](https://github.com/cbrnr)) * [Issue 405](https://github.com/spyder-ide/qtpy/issues/405) - Remove patch that "may be limited to `PySide-5.11a1` only" * [Issue 402](https://github.com/spyder-ide/qtpy/issues/402) - `QTextStreamManipulator` has no `exec` method on PyQt5/6 * [Issue 394](https://github.com/spyder-ide/qtpy/issues/394) - Differences in QEvent subclass APIs in PyQt6 cause attribute and/or type errors * [Issue 390](https://github.com/spyder-ide/qtpy/issues/390) - QtBindingsNotFoundError is not raised correctly (from None) in __init__ ([PR 391](https://github.com/spyder-ide/qtpy/pull/391) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 389](https://github.com/spyder-ide/qtpy/issues/389) - Make `QtWidgets` and `QtGui` modules compatible with `PySide6`/`PyQt6` import locations for `PySide2`/`PyQt5` ([PR 410](https://github.com/spyder-ide/qtpy/pull/410) by [@StSav012](https://github.com/StSav012)) * [Issue 386](https://github.com/spyder-ide/qtpy/issues/386) - Add official support for Python 3.11 ([PR 392](https://github.com/spyder-ide/qtpy/pull/392) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) In this release 8 issues were closed. ### Pull Requests Merged * [PR 417](https://github.com/spyder-ide/qtpy/pull/417) - PR: Add compatibility mappings between bindings for all children of `QSinglePointEvent`, by [@StSav012](https://github.com/StSav012) * [PR 414](https://github.com/spyder-ide/qtpy/pull/414) - PR: Skip QtPositioning tests on Conda Qt >=6.4.3 where its not included, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) * [PR 413](https://github.com/spyder-ide/qtpy/pull/413) - PR: Make `QtBindingsNotFoundError` also inherit from `ImportError`, by [@cbrnr](https://github.com/cbrnr) ([412](https://github.com/spyder-ide/qtpy/issues/412)) * [PR 410](https://github.com/spyder-ide/qtpy/pull/410) - PR: Improve compatibility for `QtWidgets` and `QtGui` modules between Qt5 and Qt6 bindings, by [@StSav012](https://github.com/StSav012) * [PR 408](https://github.com/spyder-ide/qtpy/pull/408) - PR: Add mappings for QMouseEvent methods, by [@StSav012](https://github.com/StSav012) * [PR 407](https://github.com/spyder-ide/qtpy/pull/407) - PR: Remove patch that may be limited to PySide-5.11a1 only, by [@StSav012](https://github.com/StSav012) * [PR 404](https://github.com/spyder-ide/qtpy/pull/404) - PR: Don't make `QTextStreamManipulator.exec_` on PyQt5/6, by [@StSav012](https://github.com/StSav012) * [PR 401](https://github.com/spyder-ide/qtpy/pull/401) - PR: Unskip PySide2 5.15 on Python 3.11 with Conda on CIs, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) * [PR 398](https://github.com/spyder-ide/qtpy/pull/398) - PR: Make warning usage consistant and refine messages, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) * [PR 397](https://github.com/spyder-ide/qtpy/pull/397) - Simplify CI script following Qt 5.15.6 feedstock update, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) * [PR 393](https://github.com/spyder-ide/qtpy/pull/393) - PR: Fix `LibraryLocation` -> `LibraryPath` renaming due to deprecation with Qt6, by [@StSav012](https://github.com/StSav012) * [PR 392](https://github.com/spyder-ide/qtpy/pull/392) - PR: Add Python 3.11 to CIs/tags & overhaul CI config, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([386](https://github.com/spyder-ide/qtpy/issues/386)) * [PR 391](https://github.com/spyder-ide/qtpy/pull/391) - PR: Use raise from None when raising QtBindingsNotFoundError in __init__, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([390](https://github.com/spyder-ide/qtpy/issues/390)) In this release 13 pull requests were closed. ---- ## Version 2.3.0 (2022-11-07) ### Issues Closed * [Issue 384](https://github.com/spyder-ide/qtpy/issues/384) - Release QtPy 2.3.0 * [Issue 381](https://github.com/spyder-ide/qtpy/issues/381) - Add QtPdf, QtPdfWidgets ([PR 382](https://github.com/spyder-ide/qtpy/pull/382) by [@jschueller](https://github.com/jschueller)) * [Issue 375](https://github.com/spyder-ide/qtpy/issues/375) - Test PySide6 6.4.x ([PR 376](https://github.com/spyder-ide/qtpy/pull/376) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 373](https://github.com/spyder-ide/qtpy/issues/373) - PySide6 6.4.0 support - `AttributeError: Cannot reassign members` when aliasing enum values ([PR 374](https://github.com/spyder-ide/qtpy/pull/374) by [@astrofrog](https://github.com/astrofrog)) * [Issue 367](https://github.com/spyder-ide/qtpy/issues/367) - Import behaviour if no Qt bindings are installed ([PR 379](https://github.com/spyder-ide/qtpy/pull/379) by [@dalthviz](https://github.com/dalthviz)) * [Issue 134](https://github.com/spyder-ide/qtpy/issues/134) - QScintilla Support ([PR 372](https://github.com/spyder-ide/qtpy/pull/372) by [@dgoeries](https://github.com/dgoeries)) In this release 6 issues were closed. ### Pull Requests Merged * [PR 382](https://github.com/spyder-ide/qtpy/pull/382) - PR: Add `QtPdf` and `QtPdfWidgets`, by [@jschueller](https://github.com/jschueller) ([381](https://github.com/spyder-ide/qtpy/issues/381)) * [PR 380](https://github.com/spyder-ide/qtpy/pull/380) - PR: Enable more qt6 tests, by [@jschueller](https://github.com/jschueller) * [PR 379](https://github.com/spyder-ide/qtpy/pull/379) - PR: Raise error when no bindings are found at `__init__`, by [@dalthviz](https://github.com/dalthviz) ([367](https://github.com/spyder-ide/qtpy/issues/367)) * [PR 378](https://github.com/spyder-ide/qtpy/pull/378) - PR: Try PySide6 on conda, by [@jschueller](https://github.com/jschueller) * [PR 376](https://github.com/spyder-ide/qtpy/pull/376) - PR: Expand the CI test matrix with Qt/bindings 6.4 and fix tests with PyQt 5.9, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([375](https://github.com/spyder-ide/qtpy/issues/375)) * [PR 374](https://github.com/spyder-ide/qtpy/pull/374) - Don't re-assign Qt.MouseButton.MiddleButton on PySide6, by [@astrofrog](https://github.com/astrofrog) ([373](https://github.com/spyder-ide/qtpy/issues/373)) * [PR 372](https://github.com/spyder-ide/qtpy/pull/372) - PR: Add `Qsci` to the imports, by [@dgoeries](https://github.com/dgoeries) ([134](https://github.com/spyder-ide/qtpy/issues/134)) In this release 7 pull requests were closed. ---- ## Version 2.2.1 (2022-10-03) ### Issues Closed * [Issue 369](https://github.com/spyder-ide/qtpy/issues/369) - Release QtPy 2.2.1 * [Issue 365](https://github.com/spyder-ide/qtpy/issues/365) - Additions needed for PySide6/PyQt6 support (`QFontMetricsF.width`, `QLineEdit.getTextMargins` and `QtWidgets.QUndoCommand`) ([PR 366](https://github.com/spyder-ide/qtpy/pull/366) by [@random-developer](https://github.com/random-developer)) In this release 2 issues were closed. ### Pull Requests Merged * [PR 368](https://github.com/spyder-ide/qtpy/pull/368) - PR: Add missing `self` for `QtBindingsNotFoundError` definition, by [@dalthviz](https://github.com/dalthviz) * [PR 366](https://github.com/spyder-ide/qtpy/pull/366) - PR: Aliased `QUndoCommand`, provided `QLineEdit.getTextMargins()` and `QFontMetricsF.width()`, by [@random-developer](https://github.com/random-developer) ([365](https://github.com/spyder-ide/qtpy/issues/365)) * [PR 363](https://github.com/spyder-ide/qtpy/pull/363) - PR: Fix typo in Qt flags in Readme, by [@Czaki](https://github.com/Czaki) * [PR 362](https://github.com/spyder-ide/qtpy/pull/362) - PR: Fix various minor typos found with Codespell, by [@luzpaz](https://github.com/luzpaz) * [PR 361](https://github.com/spyder-ide/qtpy/pull/361) - PR: toPython helpers for QDate and QTime, by [@bob-schumaker](https://github.com/bob-schumaker) * [PR 360](https://github.com/spyder-ide/qtpy/pull/360) - CI: Ensure conda-forge channel usage when testing with conda, by [@dalthviz](https://github.com/dalthviz) In this release 6 pull requests were closed. ---- ## Version 2.2.0 (2022-08-10) ### Issues Closed * [Issue 359](https://github.com/spyder-ide/qtpy/issues/359) - Release QtPy 2.2.0 * [Issue 352](https://github.com/spyder-ide/qtpy/issues/352) - Deprecation Warning for Enum Access ([PR 353](https://github.com/spyder-ide/qtpy/pull/353) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 351](https://github.com/spyder-ide/qtpy/issues/351) - `PySide6.QtSvgWidgets` not exposed * [Issue 302](https://github.com/spyder-ide/qtpy/issues/302) - Compat shiboken and sip like Qt.py ([PR 354](https://github.com/spyder-ide/qtpy/pull/354) by [@zjp](https://github.com/zjp)) * [Issue 61](https://github.com/spyder-ide/qtpy/issues/61) - Add documentation for methods or helpers that are specific to qtpy ([PR 357](https://github.com/spyder-ide/qtpy/pull/357) by [@dalthviz](https://github.com/dalthviz)) In this release 5 issues were closed. ### Pull Requests Merged * [PR 358](https://github.com/spyder-ide/qtpy/pull/358) - PR: Fix PyQt6 typing import for Qt, by [@tlambert03](https://github.com/tlambert03) * [PR 357](https://github.com/spyder-ide/qtpy/pull/357) - PR: Add initial `Methods, helpers and QtPy namespace specifics` section to the README, by [@dalthviz](https://github.com/dalthviz) ([61](https://github.com/spyder-ide/qtpy/issues/61)) * [PR 354](https://github.com/spyder-ide/qtpy/pull/354) - PR: Add wrapper around sip/shiboken isdeleted/isvalid (compat.py), by [@zjp](https://github.com/zjp) ([302](https://github.com/spyder-ide/qtpy/issues/302)) * [PR 353](https://github.com/spyder-ide/qtpy/pull/353) - PR: Add note to readme about use with Pyright, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([352](https://github.com/spyder-ide/qtpy/issues/352)) * [PR 350](https://github.com/spyder-ide/qtpy/pull/350) - PR: Restore `WEBENGINE` constant in `QtWebEngineWidgets`, by [@ccordoba12](https://github.com/ccordoba12) * [PR 346](https://github.com/spyder-ide/qtpy/pull/346) - PR: Add workaround for `mode` argument in QTextCursor.movePosition (PySide6), by [@rear1019](https://github.com/rear1019) * [PR 344](https://github.com/spyder-ide/qtpy/pull/344) - PR: Add missing imports and modules, by [@DaelonSuzuka](https://github.com/DaelonSuzuka) In this release 7 pull requests were closed. ---- ## Version 2.1.0 (2022-05-02) ### New features * New CLI to get mypy arguments and check QtPy version ### Important fixes * Remove Python 3.6 support * Fix `QT_API` environmental variable handling so new processes get the correct value when `Qt_API` is not initially set * Change try order for bindings in case the `QT_API` environmental variable is not set i.e `PyQt5 - PySide2 - PyQt6 - PySide6` ### Issues Closed * [Issue 342](https://github.com/spyder-ide/qtpy/issues/342) - Change bindings `try order` to follow QtPy `v1.x` convention ([PR 343](https://github.com/spyder-ide/qtpy/pull/343) by [@dalthviz](https://github.com/dalthviz)) * [Issue 338](https://github.com/spyder-ide/qtpy/issues/338) - Release QtPy 2.1.0 * [Issue 336](https://github.com/spyder-ide/qtpy/issues/336) - Segfaulting tests on PyQt6 + Windows on both Py3.7 and 3.10 (no conda) probably due to PyQt 6.3.0 ([PR 335](https://github.com/spyder-ide/qtpy/pull/335) by [@dalthviz](https://github.com/dalthviz)) * [Issue 332](https://github.com/spyder-ide/qtpy/issues/332) - Remove `QHeaderView` patch ([PR 334](https://github.com/spyder-ide/qtpy/pull/334) by [@dalthviz](https://github.com/dalthviz)) * [Issue 327](https://github.com/spyder-ide/qtpy/issues/327) - Missing `QtCore.Qt.MidButton` alias for `QtCore.Qt.MouseButton.MiddleButton` with PyQt6 ([PR 328](https://github.com/spyder-ide/qtpy/pull/328) by [@dalthviz](https://github.com/dalthviz)) * [Issue 323](https://github.com/spyder-ide/qtpy/issues/323) - Fix test suite failing at collection on Python 3.10 in Pytest 7.x ([PR 324](https://github.com/spyder-ide/qtpy/pull/324) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 297](https://github.com/spyder-ide/qtpy/issues/297) - Drop Python 3.6 support ([PR 329](https://github.com/spyder-ide/qtpy/pull/329) by [@dalthviz](https://github.com/dalthviz)) * [Issue 265](https://github.com/spyder-ide/qtpy/issues/265) - Investigate and (hopefully) resolve segfaults and other issues in UIC tests ([PR 335](https://github.com/spyder-ide/qtpy/pull/335) by [@dalthviz](https://github.com/dalthviz)) * [Issue 216](https://github.com/spyder-ide/qtpy/issues/216) - Support type hints and mypy ([PR 337](https://github.com/spyder-ide/qtpy/pull/337) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) In this release 9 issues were closed. ### Pull Requests Merged * [PR 343](https://github.com/spyder-ide/qtpy/pull/343) - PR: Change bindings `try order` to be `PyQt5, PySide2, PyQt6, PySide6`, by [@dalthviz](https://github.com/dalthviz) ([342](https://github.com/spyder-ide/qtpy/issues/342)) * [PR 341](https://github.com/spyder-ide/qtpy/pull/341) - PR: Add workaround for `mode` argument in QTextCursor.movePosition (Pyside2), by [@rear1019](https://github.com/rear1019) * [PR 340](https://github.com/spyder-ide/qtpy/pull/340) - PR: Fix bug with environ handling, by [@larsoner](https://github.com/larsoner) * [PR 337](https://github.com/spyder-ide/qtpy/pull/337) - PR: Add command line support for Mypy, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([217](https://github.com/spyder-ide/qtpy/issues/217), [216](https://github.com/spyder-ide/qtpy/issues/216)) * [PR 335](https://github.com/spyder-ide/qtpy/pull/335) - PR: Fix uic skipped tests and PyQt 6.3.0 segfaulting tests, by [@dalthviz](https://github.com/dalthviz) ([336](https://github.com/spyder-ide/qtpy/issues/336), [265](https://github.com/spyder-ide/qtpy/issues/265)) * [PR 334](https://github.com/spyder-ide/qtpy/pull/334) - PR: Remove `QHeaderView` patch related files, by [@dalthviz](https://github.com/dalthviz) ([332](https://github.com/spyder-ide/qtpy/issues/332)) * [PR 333](https://github.com/spyder-ide/qtpy/pull/333) - PR: Skip import of QOpenGLTime* on architectures where not available, by [@juliangilbey](https://github.com/juliangilbey) * [PR 331](https://github.com/spyder-ide/qtpy/pull/331) - PR: Use QFileDialog.Option to be compatiable with Qt6, by [@frmdstryr](https://github.com/frmdstryr) * [PR 330](https://github.com/spyder-ide/qtpy/pull/330) - PR: Fix typo in constant name, by [@eyllanesc](https://github.com/eyllanesc) * [PR 329](https://github.com/spyder-ide/qtpy/pull/329) - PR: Drop support for Python 3.6, by [@dalthviz](https://github.com/dalthviz) ([297](https://github.com/spyder-ide/qtpy/issues/297)) * [PR 328](https://github.com/spyder-ide/qtpy/pull/328) - PR: Add missing `Qt.MidButton` on PyQt6, by [@dalthviz](https://github.com/dalthviz) ([327](https://github.com/spyder-ide/qtpy/issues/327)) * [PR 326](https://github.com/spyder-ide/qtpy/pull/326) - PR: Add missing `QWebEngineScript` support for PyQt5/6 and PySide2/6, by [@EasyIsrael](https://github.com/EasyIsrael) * [PR 325](https://github.com/spyder-ide/qtpy/pull/325) - PR: Monkey patch `pyside2uic` `UIParser.readResources` for Python 3.9 compatibility, by [@n-elie](https://github.com/n-elie) * [PR 324](https://github.com/spyder-ide/qtpy/pull/324) - PR: Restrict broken Pytest versions to those not affected by the Pytest 7.0.0 import-mode=importlib behavior regression, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([323](https://github.com/spyder-ide/qtpy/issues/323)) In this release 14 pull requests were closed. ---- ## Version 2.0.1 (2022-02-02) ### Issues Closed * [Issue 320](https://github.com/spyder-ide/qtpy/issues/320) - Release QtPy 2.0.1 * [Issue 316](https://github.com/spyder-ide/qtpy/issues/316) - Tests for instance methods alias mapping fix (exec_ vs exec and others) ([PR 317](https://github.com/spyder-ide/qtpy/pull/317) by [@dalthviz](https://github.com/dalthviz)) * [Issue 311](https://github.com/spyder-ide/qtpy/issues/311) - `QtCore.Qt.mightBeRichText` undefined in PySide ([PR 313](https://github.com/spyder-ide/qtpy/pull/313) by [@dalthviz](https://github.com/dalthviz)) * [Issue 306](https://github.com/spyder-ide/qtpy/issues/306) - Qt6: missing unscoped enum values ([PR 314](https://github.com/spyder-ide/qtpy/pull/314) by [@dalthviz](https://github.com/dalthviz)) * [Issue 305](https://github.com/spyder-ide/qtpy/issues/305) - Qt6: exec_ vs. exec ([PR 308](https://github.com/spyder-ide/qtpy/pull/308) by [@kumattau](https://github.com/kumattau)) * [Issue 304](https://github.com/spyder-ide/qtpy/issues/304) - Qt6: QtCharts namespace incompatibility ([PR 315](https://github.com/spyder-ide/qtpy/pull/315) by [@dalthviz](https://github.com/dalthviz)) In this release 6 issues were closed. ### Pull Requests Merged * [PR 319](https://github.com/spyder-ide/qtpy/pull/319) - PR: Promote enum aliases, by [@MatthieuDartiailh](https://github.com/MatthieuDartiailh) * [PR 317](https://github.com/spyder-ide/qtpy/pull/317) - PR: Add missing tests for aliased methods, by [@dalthviz](https://github.com/dalthviz) ([316](https://github.com/spyder-ide/qtpy/issues/316)) * [PR 315](https://github.com/spyder-ide/qtpy/pull/315) - PR: Add `QtCharts` alias for backward compatibility with 1.x, by [@dalthviz](https://github.com/dalthviz) ([304](https://github.com/spyder-ide/qtpy/issues/304)) * [PR 314](https://github.com/spyder-ide/qtpy/pull/314) - PR: Add mapping for missing enum values aliases on `QtCore.Qt`, by [@dalthviz](https://github.com/dalthviz) ([306](https://github.com/spyder-ide/qtpy/issues/306)) * [PR 313](https://github.com/spyder-ide/qtpy/pull/313) - PR: Add missing `QtGui` utility function to `QtCore.Qt` for PySide bindings, by [@dalthviz](https://github.com/dalthviz) ([311](https://github.com/spyder-ide/qtpy/issues/311)) * [PR 312](https://github.com/spyder-ide/qtpy/pull/312) - PR: Add "New features" section for version 2.0 to changelog, by [@ccordoba12](https://github.com/ccordoba12) * [PR 309](https://github.com/spyder-ide/qtpy/pull/309) - PR: Set CI job's timeout to 10 min to force a stalled test to terminate, by [@kumattau](https://github.com/kumattau) * [PR 308](https://github.com/spyder-ide/qtpy/pull/308) - PR: Fix mappings of instance method and slot alias (PyQt6 and PySide6), by [@kumattau](https://github.com/kumattau) ([305](https://github.com/spyder-ide/qtpy/issues/305)) * [PR 307](https://github.com/spyder-ide/qtpy/pull/307) - PR: Add missing imports in QtOpenGL, by [@renefritze](https://github.com/renefritze) In this release 9 pull requests were closed. ---- ## Version 2.0.0 (2021-12-22) ### New features * Add support for PyQt6 and PySide6 with Qt 6 >= 6.2.0 * Add support for QtTextToSpeech. * Drop support for PyQt4, PySide and Python 2. ### Issues Closed * [Issue 300](https://github.com/spyder-ide/qtpy/issues/300) - Release QtPy 2.0.0 * [Issue 286](https://github.com/spyder-ide/qtpy/issues/286) - PySide6 DeprecationWarning of exec_ ([PR 287](https://github.com/spyder-ide/qtpy/pull/287) by [@kumattau](https://github.com/kumattau)) * [Issue 274](https://github.com/spyder-ide/qtpy/issues/274) - SignalInstance, Slot, and Property for Qt6 QtCore * [Issue 270](https://github.com/spyder-ide/qtpy/issues/270) - Port packaging from deprecated legacy builder to current PEP 517 standards ([PR 272](https://github.com/spyder-ide/qtpy/pull/272) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 269](https://github.com/spyder-ide/qtpy/issues/269) - Add CI testing and official support for Python 3.10 ([PR 296](https://github.com/spyder-ide/qtpy/pull/296) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 267](https://github.com/spyder-ide/qtpy/issues/267) - Coveralls shows 0 coverage despite coverage report and runner output looking fine ([PR 268](https://github.com/spyder-ide/qtpy/pull/268) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 258](https://github.com/spyder-ide/qtpy/issues/258) - Compatibility with `QtWidgets.QOpenGLWidget` vs `QtOpenGLWidgets.QOpenGLWidget` ([PR 259](https://github.com/spyder-ide/qtpy/pull/259) by [@kumattau](https://github.com/kumattau)) * [Issue 257](https://github.com/spyder-ide/qtpy/issues/257) - Check import behavior for QtCharts module ([PR 260](https://github.com/spyder-ide/qtpy/pull/260) by [@dalthviz](https://github.com/dalthviz)) * [Issue 253](https://github.com/spyder-ide/qtpy/issues/253) - Declare and test support up to Python 3.9 and PyQt6 ([PR 262](https://github.com/spyder-ide/qtpy/pull/262) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 250](https://github.com/spyder-ide/qtpy/issues/250) - Drop Python 2 support ([PR 251](https://github.com/spyder-ide/qtpy/pull/251) by [@dalthviz](https://github.com/dalthviz)) * [Issue 234](https://github.com/spyder-ide/qtpy/issues/234) - distutils.LooseVersion is being deprecated ([PR 266](https://github.com/spyder-ide/qtpy/pull/266) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 233](https://github.com/spyder-ide/qtpy/issues/233) - PyQt6 support ([PR 294](https://github.com/spyder-ide/qtpy/pull/294) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 232](https://github.com/spyder-ide/qtpy/issues/232) - Add support for `QtTextToSpeech` * [Issue 197](https://github.com/spyder-ide/qtpy/issues/197) - QtTest imports are incomplete ([PR 290](https://github.com/spyder-ide/qtpy/pull/290) by [@kumattau](https://github.com/kumattau)) * [Issue 70](https://github.com/spyder-ide/qtpy/issues/70) - Add QHeaderView.setSectionResize for Qt4 layer * [Issue 66](https://github.com/spyder-ide/qtpy/issues/66) - Add documentation for how to run tests ([PR 277](https://github.com/spyder-ide/qtpy/pull/277) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 62](https://github.com/spyder-ide/qtpy/issues/62) - Add to the readme the importance of qtpy when migrating an application ([PR 301](https://github.com/spyder-ide/qtpy/pull/301) by [@dalthviz](https://github.com/dalthviz)) In this release 17 issues were closed. ### Pull Requests Merged * [PR 303](https://github.com/spyder-ide/qtpy/pull/303) - PR: Fix QFileSystemModel for PyQt6, by [@almarklein](https://github.com/almarklein) * [PR 301](https://github.com/spyder-ide/qtpy/pull/301) - PR: Update README.md adding a line for QtPy usefulness when migrating between Qt bindings/versions, by [@dalthviz](https://github.com/dalthviz) ([62](https://github.com/spyder-ide/qtpy/issues/62)) * [PR 299](https://github.com/spyder-ide/qtpy/pull/299) - PR: 'width' needed for PyQt6, by [@stonebig](https://github.com/stonebig) * [PR 298](https://github.com/spyder-ide/qtpy/pull/298) - PR: Make QLibraryInfo.location work for PyQt6, by [@stonebig](https://github.com/stonebig) * [PR 296](https://github.com/spyder-ide/qtpy/pull/296) - PR: Add support for Python 3.10 on CIs and packaging, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([269](https://github.com/spyder-ide/qtpy/issues/269)) * [PR 294](https://github.com/spyder-ide/qtpy/pull/294) - PR: Add minimum version check for Qt6 >=6.2.0, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([233](https://github.com/spyder-ide/qtpy/issues/233)) * [PR 292](https://github.com/spyder-ide/qtpy/pull/292) - PR: Define Qt/binding versions at top level, fix warnings if versions not found, and fix test dir on CIs, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) * [PR 291](https://github.com/spyder-ide/qtpy/pull/291) - PR: Add QtTextToSpeech Module, by [@kumattau](https://github.com/kumattau) * [PR 290](https://github.com/spyder-ide/qtpy/pull/290) - PR: Import all classes in QtTest module., by [@kumattau](https://github.com/kumattau) ([197](https://github.com/spyder-ide/qtpy/issues/197)) * [PR 287](https://github.com/spyder-ide/qtpy/pull/287) - PR: Map exec_ to their non-deprecated alternatives, by [@kumattau](https://github.com/kumattau) ([286](https://github.com/spyder-ide/qtpy/issues/286)) * [PR 282](https://github.com/spyder-ide/qtpy/pull/282) - PR: Update README sponsors section, by [@dalthviz](https://github.com/dalthviz) * [PR 279](https://github.com/spyder-ide/qtpy/pull/279) - PR: Add back legacy PYQT4 and PYSIDE package-level constants for compat, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) * [PR 278](https://github.com/spyder-ide/qtpy/pull/278) - PR: Update gitignore, gitattributes, license, authors and security policy, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) * [PR 277](https://github.com/spyder-ide/qtpy/pull/277) - PR: Add Contributing Guide based on other Spyder projects, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([66](https://github.com/spyder-ide/qtpy/issues/66)) * [PR 276](https://github.com/spyder-ide/qtpy/pull/276) - PR: Fix regression in FORCE_QT_API behavior from merging PySide6 support, by [@tlambert03](https://github.com/tlambert03) * [PR 273](https://github.com/spyder-ide/qtpy/pull/273) - PR: Avoid future deprecations and decrease general technical debt, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) * [PR 272](https://github.com/spyder-ide/qtpy/pull/272) - PR: Upgrade packaging to avoid legacy/deprecated behavior and follow PEP 517, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([270](https://github.com/spyder-ide/qtpy/issues/270)) * [PR 271](https://github.com/spyder-ide/qtpy/pull/271) - PR: Unscoped enums access for PyQt6 and other missing PyQt6 compatibility changes, by [@dalthviz](https://github.com/dalthviz) * [PR 268](https://github.com/spyder-ide/qtpy/pull/268) - PR: Fix and improve Coveralls reporting, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([267](https://github.com/spyder-ide/qtpy/issues/267)) * [PR 266](https://github.com/spyder-ide/qtpy/pull/266) - PR: Use modern packaging instead of deprecated distutils for version parse, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([235](https://github.com/spyder-ide/qtpy/issues/235), [234](https://github.com/spyder-ide/qtpy/issues/234)) * [PR 264](https://github.com/spyder-ide/qtpy/pull/264) - PR: [PyQt6] Add missing tabStopWidth/setTabStopWidth same as PySide6, by [@kumattau](https://github.com/kumattau) * [PR 263](https://github.com/spyder-ide/qtpy/pull/263) - PR: Remove accidentally-duplicated lines of code in QtCore, by [@kumattau](https://github.com/kumattau) * [PR 262](https://github.com/spyder-ide/qtpy/pull/262) - PR: Unify and cleanup CI infra, improve robustness and test Python 3.9 and PyQt6, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([253](https://github.com/spyder-ide/qtpy/issues/253)) * [PR 260](https://github.com/spyder-ide/qtpy/pull/260) - PR: Reorganize `QtCharts` module import and add missing skip validation for `QtNetworkAuth` test with `PyQt6`, by [@dalthviz](https://github.com/dalthviz) ([257](https://github.com/spyder-ide/qtpy/issues/257)) * [PR 259](https://github.com/spyder-ide/qtpy/pull/259) - PR: [PyQt6] Add exec_/print_, and add QOpenGLWidget/QShortcut to QtWidgets, by [@kumattau](https://github.com/kumattau) ([258](https://github.com/spyder-ide/qtpy/issues/258)) * [PR 256](https://github.com/spyder-ide/qtpy/pull/256) - PR: Fix fallback API, by [@benoit-pierre](https://github.com/benoit-pierre) * [PR 255](https://github.com/spyder-ide/qtpy/pull/255) - PR: Add additional Qt modules and more support and tests for PyQt6/PySide6, by [@jschueller](https://github.com/jschueller) * [PR 254](https://github.com/spyder-ide/qtpy/pull/254) - PR: Add QShortcut class to QtWidgets module, by [@kumattau](https://github.com/kumattau) * [PR 252](https://github.com/spyder-ide/qtpy/pull/252) - PR: Remove Qt4 support, by [@jschueller](https://github.com/jschueller) * [PR 251](https://github.com/spyder-ide/qtpy/pull/251) - PR: Drop Python 2, by [@dalthviz](https://github.com/dalthviz) ([250](https://github.com/spyder-ide/qtpy/issues/250)) * [PR 225](https://github.com/spyder-ide/qtpy/pull/225) - PR: Add support for PySide6, by [@jschueller](https://github.com/jschueller) In this release 31 pull requests were closed. ---- ## Version 1.11.3 (2021/12/03) ### Issues Closed * [Issue 284](https://github.com/spyder-ide/qtpy/issues/284) - Warn if using a deprecated and/or unsupported Qt 5 version ([PR 289](https://github.com/spyder-ide/qtpy/pull/289) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) * [Issue 280](https://github.com/spyder-ide/qtpy/issues/280) - import qtpy raise except when only have PyQt4 ([PR 281](https://github.com/spyder-ide/qtpy/pull/281) by [@dalthviz](https://github.com/dalthviz)) * [Issue 261](https://github.com/spyder-ide/qtpy/issues/261) - Add a deprecation warning for unsupported `Qt` versions and bindings (at least `Qt4`: `PyQt4` and `PySide`) ([PR 283](https://github.com/spyder-ide/qtpy/pull/283) by [@CAM-Gerlach](https://github.com/CAM-Gerlach)) In this release 3 issues were closed. ### Pull Requests Merged * [PR 293](https://github.com/spyder-ide/qtpy/pull/293) - PR: Update RELEASE.md for 1.x version, by [@dalthviz](https://github.com/dalthviz) * [PR 289](https://github.com/spyder-ide/qtpy/pull/289) - PR: Add warning for deprecated/EoL Qt5 & PyQt5/PySide2 versions to fix #284, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([284](https://github.com/spyder-ide/qtpy/issues/284)) * [PR 285](https://github.com/spyder-ide/qtpy/pull/285) - PR: Import Callable and MutableMapping in py3compat for Python 2 compat, by [@davvid](https://github.com/davvid) * [PR 283](https://github.com/spyder-ide/qtpy/pull/283) - PR: Add a warning for developers still running legacy Qt4-based APIs, by [@CAM-Gerlach](https://github.com/CAM-Gerlach) ([261](https://github.com/spyder-ide/qtpy/issues/261)) * [PR 281](https://github.com/spyder-ide/qtpy/pull/281) - PR: Catch `PythonQtError` when trying to do alias for `QtDataVisualization` and dev version correction, by [@dalthviz](https://github.com/dalthviz) ([280](https://github.com/spyder-ide/qtpy/issues/280)) In this release 5 pull requests were closed. ---- ## Version 1.11.2 (2021-09-23) ### Issues Closed * [Issue 248](https://github.com/spyder-ide/qtpy/issues/248) - Missing QtDataVisualization ([PR 249](https://github.com/spyder-ide/qtpy/pull/249) by [@dalthviz](https://github.com/dalthviz)) In this release 1 issue was closed. ### Pull Requests Merged * [PR 249](https://github.com/spyder-ide/qtpy/pull/249) - PR: Add handling for QtDataVisualization when missing, by [@dalthviz](https://github.com/dalthviz) ([248](https://github.com/spyder-ide/qtpy/issues/248)) In this release 1 pull request was closed. ---- ## Version 1.11.1 (2021-09-13) ### Issues Closed * [Issue 245](https://github.com/spyder-ide/qtpy/issues/245) - Importing `qtpy.uic` raises an exception ([PR 246](https://github.com/spyder-ide/qtpy/pull/246) by [@dalthviz](https://github.com/dalthviz)) In this release 1 issue was closed. ### Pull Requests Merged * [PR 246](https://github.com/spyder-ide/qtpy/pull/246) - PR: Wrap `pysideuic` and `pyside2uic` imports since they could be unavailable, by [@dalthviz](https://github.com/dalthviz) ([245](https://github.com/spyder-ide/qtpy/issues/245)) * [PR 244](https://github.com/spyder-ide/qtpy/pull/244) - qtpy/tests/test_uic.py: skip if pyside2uic not installed, by [@AndrewAmmerlaan](https://github.com/AndrewAmmerlaan) In this release 2 pull requests were closed. ---- ## Version 1.11.0 (2021-09-03) ### Issues Closed * [Issue 201](https://github.com/spyder-ide/qtpy/issues/201) - Missing QWebEngineProfile from QtWebEngineWidgets ([PR 242](https://github.com/spyder-ide/qtpy/pull/242) by [@dalthviz](https://github.com/dalthviz)) In this release 1 issue was closed. ### Pull Requests Merged * [PR 243](https://github.com/spyder-ide/qtpy/pull/243) - PR: `QtDataVisualization` backward compatibility handling on Windows, by [@dalthviz](https://github.com/dalthviz) * [PR 242](https://github.com/spyder-ide/qtpy/pull/242) - PR: Add `QtWebEngineWidgets.QWebEngineProfile` for PyQt5 and PySide2, by [@dalthviz](https://github.com/dalthviz) ([201](https://github.com/spyder-ide/qtpy/issues/201)) * [PR 228](https://github.com/spyder-ide/qtpy/pull/228) - PR: Rename QtDatavisualization to use uppercase v, by [@antlarr](https://github.com/antlarr) * [PR 219](https://github.com/spyder-ide/qtpy/pull/219) - PR: Add support for QStyleOptionFrameV3 from PyQt4, by [@PierreRaybaut](https://github.com/PierreRaybaut) * [PR 218](https://github.com/spyder-ide/qtpy/pull/218) - PR: Add QtWinExtras module, by [@phil65](https://github.com/phil65) * [PR 209](https://github.com/spyder-ide/qtpy/pull/209) - PR: Add support for QtSerialPort add-on, by [@Stanowczo](https://github.com/Stanowczo) * [PR 205](https://github.com/spyder-ide/qtpy/pull/205) - PR: Add support for the QtPositioning module, by [@avalentino](https://github.com/avalentino) * [PR 202](https://github.com/spyder-ide/qtpy/pull/202) - PR: Add loadUiType implementation for PySide2, by [@avalentino](https://github.com/avalentino) In this release 8 pull requests were closed. ---- ## Version 1.10.0 (2021-08-17) ### Issues Closed * [Issue 238](https://github.com/spyder-ide/qtpy/issues/238) - PySide2 and Python3.9: xml.etree.ElementTree.Element' object has no attribute 'getchildren * [Issue 222](https://github.com/spyder-ide/qtpy/issues/222) - Imported modules are not respected * [Issue 220](https://github.com/spyder-ide/qtpy/issues/220) - MNT: Stop using ci-helpers in appveyor.yml * [Issue 206](https://github.com/spyder-ide/qtpy/issues/206) - DeprecationWarning for getchildren ([PR 224](https://github.com/spyder-ide/qtpy/pull/224) by [@irrcombat](https://github.com/irrcombat)) * [Issue 198](https://github.com/spyder-ide/qtpy/issues/198) - PyQt4-sip==4.19.13 not supported In this release 5 issues were closed. ### Pull Requests Merged * [PR 241](https://github.com/spyder-ide/qtpy/pull/241) - PR: Update setup.py classifiers, by [@dalthviz](https://github.com/dalthviz) * [PR 230](https://github.com/spyder-ide/qtpy/pull/230) - PR: Fix imported modules logic if 'FORCE_QT_API' is empty, by [@hiaselhans](https://github.com/hiaselhans) * [PR 224](https://github.com/spyder-ide/qtpy/pull/224) - PR: Support python 3.9 `custom_widgets` iteration, by [@irrcombat](https://github.com/irrcombat) ([206](https://github.com/spyder-ide/qtpy/issues/206)) * [PR 215](https://github.com/spyder-ide/qtpy/pull/215) - PR: Slight typo fix, by [@altendky](https://github.com/altendky) * [PR 214](https://github.com/spyder-ide/qtpy/pull/214) - PR: Handle QtCore.SignalInstance/pyqtBoundSignal, by [@altendky](https://github.com/altendky) * [PR 208](https://github.com/spyder-ide/qtpy/pull/208) - PR: Move CI to Github Actions, by [@goanpeca](https://github.com/goanpeca) * [PR 204](https://github.com/spyder-ide/qtpy/pull/204) - PR: Add Python 3.9 compatibility for `collections.abc` module, by [@tirkarthi](https://github.com/tirkarthi) * [PR 199](https://github.com/spyder-ide/qtpy/pull/199) - PR: Add support to PyQt4-sip 4.19.13, by [@milanmatic](https://github.com/milanmatic) In this release 8 pull requests were closed. ---- ## Version 1.9.0 (2019-07-23) ### New features * Add the FORCE_QT_API environment variable to keep using the Qt bindings selected with the QT_API variable and avoid switching to the currently imported bindings. This allows to have applications that import PySide and PyQt bindings at the same time (which is possible if both bindings are compiled for the same Qt version). ### Issues Closed * [Issue 195](https://github.com/spyder-ide/qtpy/issues/195) - Errors in the Qt3D modules with PySide2 5.12.4+ and Python 2 ([PR 196](https://github.com/spyder-ide/qtpy/pull/196)) * [Issue 192](https://github.com/spyder-ide/qtpy/issues/192) - Binding Selection Logic ([PR 194](https://github.com/spyder-ide/qtpy/pull/194)) In this release 2 issues were closed. ### Pull Requests Merged * [PR 196](https://github.com/spyder-ide/qtpy/pull/196) - PR: Don't load Qt3D modules for buggy versions of PySide2 ([195](https://github.com/spyder-ide/qtpy/issues/195)) * [PR 194](https://github.com/spyder-ide/qtpy/pull/194) - PR: Add FORCE_QT_API environment variable ([192](https://github.com/spyder-ide/qtpy/issues/192)) In this release 2 pull requests were closed. ---- ## Version 1.8.0 (2019-06-12) ### New features * Add support for several Qt 3D modules. ### Issues Closed * [Issue 172](https://github.com/spyder-ide/qtpy/issues/172) - Support for Qt3D ([PR 191](https://github.com/spyder-ide/qtpy/pull/191)) In this release 1 issue was closed. ### Pull Requests Merged * [PR 191](https://github.com/spyder-ide/qtpy/pull/191) - PR: Add Qt 3D bindings ([172](https://github.com/spyder-ide/qtpy/issues/172)) In this release 1 pull request was closed. ---- ## Version 1.7.1 (2019-05-05) ### Pull Requests Merged * [PR 189](https://github.com/spyder-ide/qtpy/pull/189) - PR: Skip testing PyQt4 and PySide in Python 3.5 * [PR 188](https://github.com/spyder-ide/qtpy/pull/188) - PR: Trivial maintenance tweaks * [PR 187](https://github.com/spyder-ide/qtpy/pull/187) - PR: Avoid deprecated "from collections import MutableMapping" In this release 3 pull requests were closed. ---- ## Version 1.7.0 (2019-03-16) ### New features * Add support for QtCharts. ### Pull Requests Merged * [PR 186](https://github.com/spyder-ide/qtpy/pull/186) - PR: Generate PyPI long description from README.md * [PR 183](https://github.com/spyder-ide/qtpy/pull/183) - PR: Add QtCharts module support * [PR 182](https://github.com/spyder-ide/qtpy/pull/182) - PR: Prevent warnings for equivalent APIs * [PR 176](https://github.com/spyder-ide/qtpy/pull/176) - PR: Don't warn about bindings change if user did not specify a binding In this release 4 pull requests were closed. ---- ## Version 1.6 (2019-01-12) ### New features * Add support for QtQuickWidgets. ### Issues Closed * [Issue 178](https://github.com/spyder-ide/qtpy/issues/178) - Error when import QtCore.__version__ in PySide2 ([PR 180](https://github.com/spyder-ide/qtpy/pull/180)) In this release 1 issue was closed. ### Pull Requests Merged * [PR 181](https://github.com/spyder-ide/qtpy/pull/181) - PR: Restore QWebEngineSettings for PySide2 * [PR 180](https://github.com/spyder-ide/qtpy/pull/180) - PR: Add QtCore.__version__ for PySide2 ([178](https://github.com/spyder-ide/qtpy/issues/178)) * [PR 179](https://github.com/spyder-ide/qtpy/pull/179) - PR: Add QtQuickWidgets In this release 3 pull requests were closed. ---- ## Version 1.5.2 (2018-10-20) ### Pull Requests Merged * [PR 175](https://github.com/spyder-ide/qtpy/pull/175) - PR: Fix tests * [PR 174](https://github.com/spyder-ide/qtpy/pull/174) - PR: Add support for PySide2.QtOpenGL In this release 2 pull requests were closed. ---- ## Version 1.5.1 (2018-09-18) ### Issues Closed * [Issue 170](https://github.com/spyder-ide/qtpy/issues/170) - Can't catch PythonQtError ([PR 173](https://github.com/spyder-ide/qtpy/pull/173)) In this release 1 issue was closed. ### Pull Requests Merged * [PR 173](https://github.com/spyder-ide/qtpy/pull/173) - PR: Make PythonQtError inherit from RuntimeError to be easily catchable ([170](https://github.com/spyder-ide/qtpy/issues/170)) In this release 1 pull request was closed. ---- ## Version 1.5 (2018-08-25) ### New features * Add support for QtLocation, QtMultimediaWidgets, QtQml, QtQuick, QtWebChannel, QtWebSockets and QtXmlPatterns. * Raise an error when trying to use the wrong combination of macOS and Qt versions. ### Issues Closed * [Issue 155](https://github.com/spyder-ide/qtpy/issues/155) - Add warnings for Qt 5.9 in macOS 10.9 and Qt 5.11 and macOS 10.11 ([PR 168](https://github.com/spyder-ide/qtpy/pull/168)) * [Issue 153](https://github.com/spyder-ide/qtpy/issues/153) - Shim PyQt5 ToPyDateTime for compatibility with PySide2 ([PR 169](https://github.com/spyder-ide/qtpy/pull/169)) * [Issue 123](https://github.com/spyder-ide/qtpy/issues/123) - Wrap QWebChannel module ([PR 157](https://github.com/spyder-ide/qtpy/pull/157)) In this release 3 issues were closed. ### Pull Requests Merged * [PR 169](https://github.com/spyder-ide/qtpy/pull/169) - PR: Shim PyQt5 QDateTime.toPyDateTime to QDateTime.toPython for compatibility with PySide2 ([153](https://github.com/spyder-ide/qtpy/issues/153)) * [PR 168](https://github.com/spyder-ide/qtpy/pull/168) - PR: Raise error when trying to use the wrong combination of macOS and Qt versions ([155](https://github.com/spyder-ide/qtpy/issues/155)) * [PR 167](https://github.com/spyder-ide/qtpy/pull/167) - PR: Migrate to CircleCI 2.0 * [PR 163](https://github.com/spyder-ide/qtpy/pull/163) - PR: Add QtLocation * [PR 162](https://github.com/spyder-ide/qtpy/pull/162) - PR: Update readme to remove funding appeal, harmonize with other readmes and minor fixes * [PR 161](https://github.com/spyder-ide/qtpy/pull/161) - PR: Fix pyside2 wheels install * [PR 157](https://github.com/spyder-ide/qtpy/pull/157) - PR: Add more Qt modules ([123](https://github.com/spyder-ide/qtpy/issues/123)) In this release 7 pull requests were closed. ---- ## Version 1.4.2 (2018-05-06) ### Issues Closed * [Issue 150](https://github.com/spyder-ide/qtpy/issues/150) - PySide2-5.11 alpha2 compatibility ([PR 151](https://github.com/spyder-ide/qtpy/pull/151)) * [Issue 144](https://github.com/spyder-ide/qtpy/issues/144) - ValueError: API 'QString' has already been set to version 1 at line 141 in __init__.py file. ([PR 152](https://github.com/spyder-ide/qtpy/pull/152)) In this release 2 issues were closed. ### Pull Requests Merged * [PR 152](https://github.com/spyder-ide/qtpy/pull/152) - PR: Catch ValueError when trying to set sip API ([144](https://github.com/spyder-ide/qtpy/issues/144)) * [PR 151](https://github.com/spyder-ide/qtpy/pull/151) - PR: Add a preventive change for PySide-5.11a2 ([150](https://github.com/spyder-ide/qtpy/issues/150)) * [PR 149](https://github.com/spyder-ide/qtpy/pull/149) - PR: Use Qt official wheels to run tests for PySide2 * [PR 148](https://github.com/spyder-ide/qtpy/pull/148) - PR: Remove internal conda recipe In this release 4 pull requests were closed. ---- ## Version 1.4.1 (2018-04-28) ### New features * Show a warning when QT_API is changed automatically by qtpy. ### Issues Closed * [Issue 145](https://github.com/spyder-ide/qtpy/issues/145) - Raise a warning if QT_API value is changed automatically ([PR 146](https://github.com/spyder-ide/qtpy/pull/146)) * [Issue 142](https://github.com/spyder-ide/qtpy/issues/142) - On OSX qtpy applications are forcing discrete graphics ([PR 143](https://github.com/spyder-ide/qtpy/pull/143)) In this release 2 issues were closed. ### Pull Requests Merged * [PR 147](https://github.com/spyder-ide/qtpy/pull/147) - PR: Add better compatibility with PySide2 * [PR 146](https://github.com/spyder-ide/qtpy/pull/146) - PR: Add a warning if API is changed automatically ([145](https://github.com/spyder-ide/qtpy/issues/145)) * [PR 143](https://github.com/spyder-ide/qtpy/pull/143) - PR: Avoid using PyQt5.Qt, which imports unneeded stuff and forces discrete GPU on OSX ([142](https://github.com/spyder-ide/qtpy/issues/142)) In this release 3 pull requests were closed. ---- ## Version 1.4 (2018-03-11) ### New features * Add support for QtHelp and QtSql * Use already imported bindings ### Issues Closed * [Issue 138](https://github.com/spyder-ide/qtpy/issues/138) - If one binding has already been imported, then qtpy should just use it ([PR 139](https://github.com/spyder-ide/qtpy/pull/139)) * [Issue 135](https://github.com/spyder-ide/qtpy/issues/135) - Add Wrapper for QtSql [feature request] ([PR 136](https://github.com/spyder-ide/qtpy/pull/136)) * [Issue 131](https://github.com/spyder-ide/qtpy/issues/131) - Methods missing from QStandardPaths when QT_API=pyqt4 * [Issue 127](https://github.com/spyder-ide/qtpy/issues/127) - Add Wrapper for QtHelp [feature request] ([PR 128](https://github.com/spyder-ide/qtpy/pull/128)) In this release 4 issues were closed. ### Pull Requests Merged * [PR 140](https://github.com/spyder-ide/qtpy/pull/140) - PR: Pin PyQt5 to 5.9.2 in CircleCI because 5.10 is generating segfaults * [PR 139](https://github.com/spyder-ide/qtpy/pull/139) - PR: If a Qt binding is already imported, then use it. ([138](https://github.com/spyder-ide/qtpy/issues/138)) * [PR 136](https://github.com/spyder-ide/qtpy/pull/136) - PR: Add QtSql wrapper (incl. test) ([135](https://github.com/spyder-ide/qtpy/issues/135)) * [PR 132](https://github.com/spyder-ide/qtpy/pull/132) - PR: Changes to QDesktop split * [PR 128](https://github.com/spyder-ide/qtpy/pull/128) - PR: Add QtHelp Wrapper ([127](https://github.com/spyder-ide/qtpy/issues/127)) In this release 5 pull requests were closed. ---- ## Version 1.3.1 (2017-08-21) ### Bugs fixed **Issues** * [Issue 129](https://github.com/spyder-ide/qtpy/issues/129) - Spurious cache files in PyPI tarball * [Issue 119](https://github.com/spyder-ide/qtpy/issues/119) - Importing qtpy should not raise exceptions In this release 2 issues were closed **Pull requests** * [PR 130](https://github.com/spyder-ide/qtpy/pull/130) - PR: No cache files included in the release tarball * [PR 126](https://github.com/spyder-ide/qtpy/pull/126) - PR: Remove Quantified Code badge because the service doesn't exist anymore * [PR 121](https://github.com/spyder-ide/qtpy/pull/121) - PR: Warn if QHeaderView deprecated methods are used In this release 3 pull requests were merged ---- ## Version 1.3 (2017-08-12) ### New features * Add support for PySide2 and PyQt 4.6 ### Bugs fixed **Issues** * [Issue 124](https://github.com/spyder-ide/qtpy/issues/124) - Typo in readme title * [Issue 111](https://github.com/spyder-ide/qtpy/issues/111) - Update Readme for 1.3 release * [Issue 110](https://github.com/spyder-ide/qtpy/issues/110) - Add tests for untested modules * [Issue 101](https://github.com/spyder-ide/qtpy/issues/101) - Missing: QtOpenGL Module * [Issue 89](https://github.com/spyder-ide/qtpy/issues/89) - QDesktopServices split into QDesktopServices and QStandardPaths * [Issue 57](https://github.com/spyder-ide/qtpy/issues/57) - qInstallMessageHandler <-> qInstallMsgHandler * [Issue 15](https://github.com/spyder-ide/qtpy/issues/15) - Feature Request: PySide2 support In this release 7 issues were closed **Pull requests** * [PR 125](https://github.com/spyder-ide/qtpy/pull/125) - PR: Fix typo in Readme. * [PR 117](https://github.com/spyder-ide/qtpy/pull/117) - PR: Add compatibility for the rename of qInstallMsgHandler to qInstallMessageHandler * [PR 115](https://github.com/spyder-ide/qtpy/pull/115) - PR: Update Readme to reflect that we actually use the PySide2 layout * [PR 114](https://github.com/spyder-ide/qtpy/pull/114) - PR: Update Readme to mention that we now support PySide2. * [PR 113](https://github.com/spyder-ide/qtpy/pull/113) - PR: Add tests for Qtdesigner, QtNetwork, QtPrintSupport, QtSvg and QtTest. * [PR 112](https://github.com/spyder-ide/qtpy/pull/112) - PR: Follow QStandardPaths location in Qt5 for PyQt4/PySide * [PR 109](https://github.com/spyder-ide/qtpy/pull/109) - PR: Add a coveragerc file * [PR 106](https://github.com/spyder-ide/qtpy/pull/106) - PR: Add support for PyQt 4.6 * [PR 102](https://github.com/spyder-ide/qtpy/pull/102) - PR: Add a new QtOpenGL module * [PR 84](https://github.com/spyder-ide/qtpy/pull/84) - PR: Add PySide2 support In this release 10 pull requests were merged ---- ## Version 1.2.1 (2017/01/21) ### Bugs fixed **Pull requests** * [PR 98](https://github.com/spyder-ide/qtpy/pull/98) - PR: Don't use Travis to test macOS because it slows down the entire spyder-ide organization * [PR 97](https://github.com/spyder-ide/qtpy/pull/97) - PR: Update Appveyor badge in Readme because of moving to an org account * [PR 94](https://github.com/spyder-ide/qtpy/pull/94) - PR: Include test suite in sdist In this release 3 pull requests were merged ---- ## Version 1.2 (2017/01/08) ### New features * Add support for QtMultimedia * Use relative imports so its vendored more easily ### Bugs fixed **Issues** * [Issue 83](https://github.com/spyder-ide/qtpy/issues/83) - Include core doc files in PyPi releases * [Issue 78](https://github.com/spyder-ide/qtpy/issues/78) - Request for a new bugfix release * [Issue 75](https://github.com/spyder-ide/qtpy/issues/75) - Missing copyright headers * [Issue 67](https://github.com/spyder-ide/qtpy/issues/67) - uic.loadUiType is missing * [Issue 64](https://github.com/spyder-ide/qtpy/issues/64) - QHeaderView.setSectionResizeMode * [Issue 49](https://github.com/spyder-ide/qtpy/issues/49) - QtMultimedia support In this release 6 issues were closed **Pull requests** * [PR 93](https://github.com/spyder-ide/qtpy/pull/93) - Restore uic full namespace for PyQt5 and PyQt4 * [PR 92](https://github.com/spyder-ide/qtpy/pull/92) - Add missing copyright header in _patch/qheaderview.py * [PR 91](https://github.com/spyder-ide/qtpy/pull/91) - Use star imports in QtSvg again instead of direct ones (reverts PR #55) * [PR 88](https://github.com/spyder-ide/qtpy/pull/88) - PR: Add manifest * [PR 74](https://github.com/spyder-ide/qtpy/pull/74) - Move QStringListModel to QtCore * [PR 71](https://github.com/spyder-ide/qtpy/pull/71) - PR: Use relative imports so its vendored more easily * [PR 65](https://github.com/spyder-ide/qtpy/pull/65) - Introduce renamed methods of QHeaderView in PyQt4 and PySide * [PR 59](https://github.com/spyder-ide/qtpy/pull/59) - Don't install qtpy as a conda package in CircleCI * [PR 58](https://github.com/spyder-ide/qtpy/pull/58) - Remove reference to how qtpy is pronounced in README * [PR 55](https://github.com/spyder-ide/qtpy/pull/55) - PR: Add explicit imports to QtSvg module * [PR 50](https://github.com/spyder-ide/qtpy/pull/50) - Add support for QtMultimedia In this release 11 pull requests were merged ---- ## Version 1.1.2 (2016-08-08) ### Bugfixes **Pull requests** * [PR 54](https://github.com/spyder-ide/qtpy/pull/54) - PR: Fix/ci * [PR 53](https://github.com/spyder-ide/qtpy/pull/53) - PR: Move tests to module so they can be run when installed * [PR 52](https://github.com/spyder-ide/qtpy/pull/52) - PR: Update readme * [PR 51](https://github.com/spyder-ide/qtpy/pull/51) - PR: Add circle ci * [PR 47](https://github.com/spyder-ide/qtpy/pull/47) - Remove PyQt variant symbols from QtCore * [PR 46](https://github.com/spyder-ide/qtpy/pull/46) - del QtWidgets.QStyleOptionViewItemV4 * [PR 45](https://github.com/spyder-ide/qtpy/pull/45) - Allow QT_API values that are not completely in lower case In this release 7 pull requests were merged ---- ## Version 1.1.1 (2016-07-01) ### Bugfixes **Pull requests** * [PR 44](https://github.com/spyder-ide/qtpy/pull/44) - Make qtpy to set the QT_API environment variable In this release 1 pull requests were merged --- ## Version 1.1 (2016-06-30) ### New features * Make importing `qtpy` thread-safe * Add a uic module to make loadUI work for PySide * Add QtTest support for PySide ### Bugfixes **Issues** * [Issue 42](https://github.com/spyder-ide/qtpy/issues/42) - Wrong old PyQt4 version check * [Issue 21](https://github.com/spyder-ide/qtpy/issues/21) - Patch QComboBox with PySide? * [Issue 16](https://github.com/spyder-ide/qtpy/issues/16) - Add loadUI functionality In this release 3 issues were closed **Pull requests** * [PR 43](https://github.com/spyder-ide/qtpy/pull/43) - Don't check PyQt version with qtpy's version for old PyQt versions * [PR 41](https://github.com/spyder-ide/qtpy/pull/41) - `qtpy.__version__` should be QtPy version, not Qt version * [PR 40](https://github.com/spyder-ide/qtpy/pull/40) - Mention qt-helpers in README.md, and add myself to AUTHORS.md * [PR 39](https://github.com/spyder-ide/qtpy/pull/39) - Fix remaining segmentation fault that occurs with the patched QComboBox in PySide * [PR 38](https://github.com/spyder-ide/qtpy/pull/38) - QtTest for PySide * [PR 37](https://github.com/spyder-ide/qtpy/pull/37) - Automatically load custom widget classes when using PySide * [PR 33](https://github.com/spyder-ide/qtpy/pull/33) - Ignore case for QT_API env variable in qtpy submodules * [PR 32](https://github.com/spyder-ide/qtpy/pull/32) - Remove QItemSelectionModel from QtWidgets for PyQt4 and PySide * [PR 31](https://github.com/spyder-ide/qtpy/pull/31) - Add compatibility for QItemSelectionModel * [PR 29](https://github.com/spyder-ide/qtpy/pull/29) - Use ci-helpers (from Astropy) for CI and enable AppVeyor * [PR 28](https://github.com/spyder-ide/qtpy/pull/28) - Make tests.py into proper unit test, and add Qt version info to pytest header * [PR 27](https://github.com/spyder-ide/qtpy/pull/27) - Make sure loadUi is available * [PR 25](https://github.com/spyder-ide/qtpy/pull/25) - Add patched version of QComboBox In this release 13 pull requests were merged --- ## Version 1.0.2 (2016-06-02) ### New features * Add a WEBENGINE constant to QtWebEngineWidgets, which is True if Qt 5 comes with the WebEngine module and False otherwise. ### Bugfixes **Pull requests** * [PR 24](https://github.com/spyder-ide/qtpy/pull/24) - Add constant to QtWebEngineWidgets to see if we are using WebEngine or WebKit * [PR 23](https://github.com/spyder-ide/qtpy/pull/23) - Fix "Prefer `format()` over string interpolation operator" issue In this release 2 pull requests were merged --- ## Version 1.0.1 (2016-04-10) ### Bugfixes **Issues** * [Issue 18](https://github.com/spyder-ide/qtpy/issues/18) - QIntValidator left in QtWidgets, should be in QtGui In this release 1 issues were closed **Pull requests** * [PR 19](https://github.com/spyder-ide/qtpy/pull/19) - Import QIntValidator in QtGui and remove it from QtWidgets In this release 1 pull requests were merged ---- ## Version 1.0 (2016-03-22) * Add QtWebEngineWidgets module for Qt 5.6. This module replaces the previous QtWebKit one. * Import the right objects in QtGui, QtWidgets and QtCore * Add a QtPrintSupport module --- ## Version 0.1.3 (2015-12-30) * Add tests and continuous integration ## Version 0.1.2 (2015-03-01) * First release ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698104906.0 QtPy-2.4.1/CHANGELOG.temp0000666000000000000000000000161114515603112011520 0ustar00## Version 2.4.1 (2023-10-23) ### Issues Closed * [Issue 462](https://github.com/spyder-ide/qtpy/issues/462) - Release QtPy 2.4.1 * [Issue 458](https://github.com/spyder-ide/qtpy/issues/458) - Typo causes failed QWebEngineScript with PySide6 In this release 2 issues were closed. ### Pull Requests Merged * [PR 459](https://github.com/spyder-ide/qtpy/pull/459) - [pre-commit.ci] pre-commit autoupdate, by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci) * [PR 456](https://github.com/spyder-ide/qtpy/pull/456) - [pre-commit.ci] pre-commit autoupdate, by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci) * [PR 455](https://github.com/spyder-ide/qtpy/pull/455) - PR: Fix bug when importing from `PySide6.QtWebEngineCore/QtWebEngineWidgets` (`QWebEngineScrip` vs `QWebEngineScript`) , by [@damonlynch](https://github.com/damonlynch) In this release 3 pull requests were closed. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1638558318.0 QtPy-2.4.1/LICENSE.txt0000666000000000000000000000213114152465156011176 0ustar00The MIT License (MIT) Copyright (c) 2011- QtPy contributors and others (see AUTHORS.md) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1651508601.0 QtPy-2.4.1/MANIFEST.in0000666000000000000000000000024714234002571011104 0ustar00include AUTHORS* include CHANGELOG* include LICENSE* include README* include SECURITY* include pytest.ini recursive-include qtpy/tests *.py *.ui include qtpy/py.typed ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1698105160.3834884 QtPy-2.4.1/PKG-INFO0000666000000000000000000003050314515603510010443 0ustar00Metadata-Version: 2.1 Name: QtPy Version: 2.4.1 Summary: Provides an abstraction layer on top of the various Qt bindings (PyQt5/6 and PySide2/6). Home-page: https://github.com/spyder-ide/qtpy Author: Colin Duquesnoy and the Spyder Development Team Author-email: spyder.python@gmail.com Maintainer: Spyder Development Team and QtPy Contributors Maintainer-email: spyder.python@gmail.com License: MIT Project-URL: Github, https://github.com/spyder-ide/qtpy Project-URL: Bug Tracker, https://github.com/spyder-ide/qtpy/issues Project-URL: Parent Project, https://www.spyder-ide.org/ Keywords: qt PyQt5 PyQt6 PySide2 PySide6 Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: MacOS X Classifier: Environment :: Win32 (MS Windows) Classifier: Environment :: X11 Applications :: Qt Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: User Interfaces Classifier: Topic :: Software Development :: Widget Sets Requires-Python: >=3.7 Description-Content-Type: text/markdown License-File: AUTHORS.md License-File: LICENSE.txt Requires-Dist: packaging Provides-Extra: test Requires-Dist: pytest!=7.0.0,!=7.0.1,>=6; extra == "test" Requires-Dist: pytest-cov>=3.0.0; extra == "test" Requires-Dist: pytest-qt; extra == "test" # QtPy: Abstraction layer for PyQt5/PySide2/PyQt6/PySide6 [![license](https://img.shields.io/pypi/l/qtpy.svg)](./LICENSE) [![pypi version](https://img.shields.io/pypi/v/qtpy.svg)](https://pypi.org/project/QtPy/) [![conda version](https://img.shields.io/conda/vn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![download count](https://img.shields.io/conda/dn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![OpenCollective Backers](https://opencollective.com/spyder/backers/badge.svg?color=blue)](#backers) [![Join the chat at https://gitter.im/spyder-ide/public](https://badges.gitter.im/spyder-ide/spyder.svg)](https://gitter.im/spyder-ide/public)
[![PyPI status](https://img.shields.io/pypi/status/qtpy.svg)](https://github.com/spyder-ide/qtpy) [![Github build status](https://github.com/spyder-ide/qtpy/workflows/Tests/badge.svg)](https://github.com/spyder-ide/qtpy/actions) [![Coverage Status](https://coveralls.io/repos/github/spyder-ide/qtpy/badge.svg?branch=master)](https://coveralls.io/github/spyder-ide/qtpy?branch=master) *Copyright © 2009– The Spyder Development Team* ## Description **QtPy** is a small abstraction layer that lets you write applications using a single API call to either PyQt or PySide. It provides support for PyQt5, PySide2, PyQt6 and PySide6 using the Qt5 layout (where the QtGui module has been split into QtGui and QtWidgets). Basically, you can write your code as if you were using PyQt or PySide directly, but import Qt modules from `qtpy` instead of `PyQt5`, `PySide2`, `PyQt6` or `PySide6`. Accordingly, when porting code between different Qt bindings (PyQt vs PySide) or Qt versions (Qt5 vs Qt6), QtPy makes this much more painless, and allows you to easily and incrementally transition between them. QtPy handles incompatibilities and differences between bindings or Qt versions for you while keeping your project running, so you can focus more on your own code and less on keeping track of supporting every Qt version and binding. Furthermore, when you do want to upgrade or support new bindings, it allows you to update your project module by module rather than all at once. You can check out examples of this approach in projects using QtPy, like [git-cola](https://github.com/git-cola/git-cola/issues/232). ### Attribution and acknowledgments This project is based on the [pyqode.qt](https://github.com/pyQode/pyqode.qt) project and the [spyderlib.qt](https://github.com/spyder-ide/spyder/tree/2.3/spyderlib/qt) module from the [Spyder](https://github.com/spyder-ide/spyder) project, and also includes contributions adapted from [qt-helpers](https://github.com/glue-viz/qt-helpers), developed as part of the [glue](http://glueviz.org) project. Unlike `pyqode.qt` this is not a namespace package, so it is not tied to a particular project or namespace. ### License This project is released under the [MIT license](LICENSE.txt). ### Requirements You need PyQt5, PySide2, PyQt6 or PySide6 installed in your system to make use of QtPy. If several of these packages are found, PyQt5 is used by default unless you set the `QT_API` environment variable. `QT_API` can take the following values: * `pyqt5` (to use PyQt5). * `pyside2` (to use PySide2). * `pyqt6` (to use PyQt6). * `pyside6` (to use PySide6). ### Module aliases and constants * `QtCore.pyqtSignal`, `QtCore.pyqtSlot` and `QtCore.pyqtProperty` (available on PyQt5/6) are instead exposed as `QtCore.Signal`, `QtCore.Slot` and `QtCore.Property`, respectively, following the Qt5 module layout. * The Qt version being used can be checked with `QtCore.__version__` (instead of `QtCore.QT_VERSION_STR`) as well as from `qtpy.QT_VERSION`. * For PyQt6 enums, unscoped enum access was added by promoting the enums of the `QtCore`, `QtGui`, `QtTest` and `QtWidgets` modules. * Compatibility is added between the `QtGui` and `QtOpenGL` modules for the `QOpenGL*` classes. * To check the current binding version, you can use `qtpy.PYSIDE_VERSION` for PySide2/6 and `qtpy.PYQT_VERSION` for PyQt5/6. If the respective binding is not being used, the value of its attribute will be `None`. * To check the current selected binding, you can use `qtpy.API_NAME` * There are boolean values to check if Qt5/6, PyQt5/6 or PySide2/6 are being used: `qtpy.QT5`, `qtpy.QT6`, `qtpy.PYQT5`, `qtpy.PYQT6`, `qtpy.PYSIDE2` and `qtpy.PYSIDE6`. `True` if currently being used, `False` otherwise. #### Compat module In the `qtpy.compat` module, you can find wrappers for `QFileDialog` static methods and SIP/Shiboken functions, such as: * `QFileDialog.getExistingDirectory` wrapped with `qtpy.compat.getexistingdirectory` * `QFileDialog.getOpenFileName` wrapped with `qtpy.compat.getopenfilename` * `QFileDialog.getOpenFileNames` wrapped with `qtpy.compat.getopenfilenames` * `QFileDialog.getSaveFileName` wrapped with `qtpy.compat.getsavefilename` * `sip.isdeleted` and `shiboken.isValid` wrapped with `qtpy.compat.isalive` ### Installation ```bash pip install qtpy ``` or ```bash conda install qtpy ``` ### Type checker integration Type checkers have no knowledge of installed packages, so these tools require additional configuration. A Command Line Interface (CLI) is offered to help with usage of QtPy (to get MyPy and Pyright/Pylance args/configurations). #### Mypy The `mypy-args` command helps you to generate command line arguments for Mypy that will enable it to process the QtPy source files with the same API as QtPy itself would have selected. If you run ```bash qtpy mypy-args ``` QtPy will output a string of Mypy CLI args that will reflect the currently selected Qt API. For example, in an environment where PyQt5 is installed and selected (or the default fallback, if no binding can be found in the environment), this would output the following: ```text --always-true=PYQT5 --always-false=PYSIDE2 --always-false=PYQT6 --always-false=PYSIDE6 ``` Using Bash or a similar shell, this can be injected into the Mypy command line invocation as follows: ```bash mypy --package mypackage $(qtpy mypy-args) ``` #### Pyright/Pylance In the case of Pyright, instead of runtime arguments, it is required to create a config file for the project, called `pyrightconfig.json` or a `pyright` section in `pyproject.toml`. See [here](https://github.com/microsoft/pyright/blob/main/docs/configuration.md) for reference. In order to set this configuration, QtPy offers the `pyright-config` command for guidance. If you run ```bash qtpy pyright-config ``` you will get the necessary configs to be included in your project files. If you don't have them, it is recommended to create the latter. For example, in an environment where PyQt5 is installed and selected (or the default fallback, if no binding can be found in the environment), this would output the following: ```text pyrightconfig.json: {"defineConstant": {"PYQT5": true, "PYSIDE2": false, "PYQT6": false, "PYSIDE6": false}} pyproject.toml: [tool.pyright.defineConstant] PYQT5 = true PYSIDE2 = false PYQT6 = false PYSIDE6 = false ``` **Note**: These configurations are necessary for the correct usage of the default VSCode's type checking feature while using QtPy in your source code. ## Testing matrix Currently, QtPy runs tests for different bindings on Linux, Windows and macOS, using Python 3.7 and 3.11, and installing those bindings with `conda` and `pip`. For the PyQt bindings, we also check the installation of extra packages via `pip`. Following this, the current test matrix looks something like this: | | Python | 3.7 | | 3.11 | | |---------|-----------------|--------------------------------------------|------|--------------------|----------------------------| | OS | Binding / manager | conda | pip | conda | pip | | Linux | PyQt5 | 5.12 | 5.15 | 5.15 | 5.15 (with extras) | | | PyQt6 | skip (unavailable) | 6.3 | skip (unavailable) | 6.5 (with extras) | | | PySide2 | 5.13 | 5.12 | 5.15 | skip (no wheels available) | | | PySide6 | 6.4 | 6.3 | 6.5 | 6.5 | | Windows | PyQt5 | 5.9 | 5.15 | 5.15 | 5.15 (with extras) | | | PyQt6 | skip (unavailable) | 6.2 | skip (unavailable) | 6.5 (with extras) | | | PySide2 | 5.13 | 5.12 | 5.15 | skip (no wheels available) | | | PySide6 | skip (test hang with 6.4. 6.5 unavailable) | 6.2 | 6.5 | 6.5 | | MacOS | PyQt5 | 5.12 | 5.15 | 5.15 | 5.15 (with extras) | | | PyQt6 | skip (unavailable) | 6.3 | skip (unavailable) | 6.5 (with extras) | | | PySide2 | 5.13 | 5.12 | 5.15 | skip (no wheels available) | | | PySide6 | 6.4 | 6.3 | 6.5 | 6.5 | **Note**: The mentioned extra packages for the PyQt bindings are the following: * `PyQt3D` and `PyQt6-3D` * `PyQtChart` and `PyQt6-Charts` * `PyQtDataVisualization` and `PyQt6-DataVisualization` * `PyQtNetworkAuth` and `PyQt6-NetworkAuth` * `PyQtPurchasing` * `PyQtWebEngine` and `PyQt6-WebEngine` * `QScintilla` and `PyQt6-QScintilla` ## Contributing Everyone is welcome to contribute! See our [Contributing guide](CONTRIBUTING.md) for more details. ## Sponsors QtPy is funded thanks to the generous support of [![Quansight](https://user-images.githubusercontent.com/16781833/142477716-53152d43-99a0-470c-a70b-c04bbfa97dd4.png)](https://www.quansight.com/)[![Numfocus](https://i2.wp.com/numfocus.org/wp-content/uploads/2017/07/NumFocus_LRG.png?fit=320%2C148&ssl=1)](https://numfocus.org/) and the donations we have received from our users around the world through [Open Collective](https://opencollective.com/spyder/): [![Sponsors](https://opencollective.com/spyder/sponsors.svg)](https://opencollective.com/spyder#support) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1698105152.113424 QtPy-2.4.1/QtPy.egg-info/0000777000000000000000000000000014515603500011733 5ustar00././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698105150.0 QtPy-2.4.1/QtPy.egg-info/PKG-INFO0000666000000000000000000003050314515603476013045 0ustar00Metadata-Version: 2.1 Name: QtPy Version: 2.4.1 Summary: Provides an abstraction layer on top of the various Qt bindings (PyQt5/6 and PySide2/6). Home-page: https://github.com/spyder-ide/qtpy Author: Colin Duquesnoy and the Spyder Development Team Author-email: spyder.python@gmail.com Maintainer: Spyder Development Team and QtPy Contributors Maintainer-email: spyder.python@gmail.com License: MIT Project-URL: Github, https://github.com/spyder-ide/qtpy Project-URL: Bug Tracker, https://github.com/spyder-ide/qtpy/issues Project-URL: Parent Project, https://www.spyder-ide.org/ Keywords: qt PyQt5 PyQt6 PySide2 PySide6 Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: MacOS X Classifier: Environment :: Win32 (MS Windows) Classifier: Environment :: X11 Applications :: Qt Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: User Interfaces Classifier: Topic :: Software Development :: Widget Sets Requires-Python: >=3.7 Description-Content-Type: text/markdown License-File: AUTHORS.md License-File: LICENSE.txt Requires-Dist: packaging Provides-Extra: test Requires-Dist: pytest!=7.0.0,!=7.0.1,>=6; extra == "test" Requires-Dist: pytest-cov>=3.0.0; extra == "test" Requires-Dist: pytest-qt; extra == "test" # QtPy: Abstraction layer for PyQt5/PySide2/PyQt6/PySide6 [![license](https://img.shields.io/pypi/l/qtpy.svg)](./LICENSE) [![pypi version](https://img.shields.io/pypi/v/qtpy.svg)](https://pypi.org/project/QtPy/) [![conda version](https://img.shields.io/conda/vn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![download count](https://img.shields.io/conda/dn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![OpenCollective Backers](https://opencollective.com/spyder/backers/badge.svg?color=blue)](#backers) [![Join the chat at https://gitter.im/spyder-ide/public](https://badges.gitter.im/spyder-ide/spyder.svg)](https://gitter.im/spyder-ide/public)
[![PyPI status](https://img.shields.io/pypi/status/qtpy.svg)](https://github.com/spyder-ide/qtpy) [![Github build status](https://github.com/spyder-ide/qtpy/workflows/Tests/badge.svg)](https://github.com/spyder-ide/qtpy/actions) [![Coverage Status](https://coveralls.io/repos/github/spyder-ide/qtpy/badge.svg?branch=master)](https://coveralls.io/github/spyder-ide/qtpy?branch=master) *Copyright © 2009– The Spyder Development Team* ## Description **QtPy** is a small abstraction layer that lets you write applications using a single API call to either PyQt or PySide. It provides support for PyQt5, PySide2, PyQt6 and PySide6 using the Qt5 layout (where the QtGui module has been split into QtGui and QtWidgets). Basically, you can write your code as if you were using PyQt or PySide directly, but import Qt modules from `qtpy` instead of `PyQt5`, `PySide2`, `PyQt6` or `PySide6`. Accordingly, when porting code between different Qt bindings (PyQt vs PySide) or Qt versions (Qt5 vs Qt6), QtPy makes this much more painless, and allows you to easily and incrementally transition between them. QtPy handles incompatibilities and differences between bindings or Qt versions for you while keeping your project running, so you can focus more on your own code and less on keeping track of supporting every Qt version and binding. Furthermore, when you do want to upgrade or support new bindings, it allows you to update your project module by module rather than all at once. You can check out examples of this approach in projects using QtPy, like [git-cola](https://github.com/git-cola/git-cola/issues/232). ### Attribution and acknowledgments This project is based on the [pyqode.qt](https://github.com/pyQode/pyqode.qt) project and the [spyderlib.qt](https://github.com/spyder-ide/spyder/tree/2.3/spyderlib/qt) module from the [Spyder](https://github.com/spyder-ide/spyder) project, and also includes contributions adapted from [qt-helpers](https://github.com/glue-viz/qt-helpers), developed as part of the [glue](http://glueviz.org) project. Unlike `pyqode.qt` this is not a namespace package, so it is not tied to a particular project or namespace. ### License This project is released under the [MIT license](LICENSE.txt). ### Requirements You need PyQt5, PySide2, PyQt6 or PySide6 installed in your system to make use of QtPy. If several of these packages are found, PyQt5 is used by default unless you set the `QT_API` environment variable. `QT_API` can take the following values: * `pyqt5` (to use PyQt5). * `pyside2` (to use PySide2). * `pyqt6` (to use PyQt6). * `pyside6` (to use PySide6). ### Module aliases and constants * `QtCore.pyqtSignal`, `QtCore.pyqtSlot` and `QtCore.pyqtProperty` (available on PyQt5/6) are instead exposed as `QtCore.Signal`, `QtCore.Slot` and `QtCore.Property`, respectively, following the Qt5 module layout. * The Qt version being used can be checked with `QtCore.__version__` (instead of `QtCore.QT_VERSION_STR`) as well as from `qtpy.QT_VERSION`. * For PyQt6 enums, unscoped enum access was added by promoting the enums of the `QtCore`, `QtGui`, `QtTest` and `QtWidgets` modules. * Compatibility is added between the `QtGui` and `QtOpenGL` modules for the `QOpenGL*` classes. * To check the current binding version, you can use `qtpy.PYSIDE_VERSION` for PySide2/6 and `qtpy.PYQT_VERSION` for PyQt5/6. If the respective binding is not being used, the value of its attribute will be `None`. * To check the current selected binding, you can use `qtpy.API_NAME` * There are boolean values to check if Qt5/6, PyQt5/6 or PySide2/6 are being used: `qtpy.QT5`, `qtpy.QT6`, `qtpy.PYQT5`, `qtpy.PYQT6`, `qtpy.PYSIDE2` and `qtpy.PYSIDE6`. `True` if currently being used, `False` otherwise. #### Compat module In the `qtpy.compat` module, you can find wrappers for `QFileDialog` static methods and SIP/Shiboken functions, such as: * `QFileDialog.getExistingDirectory` wrapped with `qtpy.compat.getexistingdirectory` * `QFileDialog.getOpenFileName` wrapped with `qtpy.compat.getopenfilename` * `QFileDialog.getOpenFileNames` wrapped with `qtpy.compat.getopenfilenames` * `QFileDialog.getSaveFileName` wrapped with `qtpy.compat.getsavefilename` * `sip.isdeleted` and `shiboken.isValid` wrapped with `qtpy.compat.isalive` ### Installation ```bash pip install qtpy ``` or ```bash conda install qtpy ``` ### Type checker integration Type checkers have no knowledge of installed packages, so these tools require additional configuration. A Command Line Interface (CLI) is offered to help with usage of QtPy (to get MyPy and Pyright/Pylance args/configurations). #### Mypy The `mypy-args` command helps you to generate command line arguments for Mypy that will enable it to process the QtPy source files with the same API as QtPy itself would have selected. If you run ```bash qtpy mypy-args ``` QtPy will output a string of Mypy CLI args that will reflect the currently selected Qt API. For example, in an environment where PyQt5 is installed and selected (or the default fallback, if no binding can be found in the environment), this would output the following: ```text --always-true=PYQT5 --always-false=PYSIDE2 --always-false=PYQT6 --always-false=PYSIDE6 ``` Using Bash or a similar shell, this can be injected into the Mypy command line invocation as follows: ```bash mypy --package mypackage $(qtpy mypy-args) ``` #### Pyright/Pylance In the case of Pyright, instead of runtime arguments, it is required to create a config file for the project, called `pyrightconfig.json` or a `pyright` section in `pyproject.toml`. See [here](https://github.com/microsoft/pyright/blob/main/docs/configuration.md) for reference. In order to set this configuration, QtPy offers the `pyright-config` command for guidance. If you run ```bash qtpy pyright-config ``` you will get the necessary configs to be included in your project files. If you don't have them, it is recommended to create the latter. For example, in an environment where PyQt5 is installed and selected (or the default fallback, if no binding can be found in the environment), this would output the following: ```text pyrightconfig.json: {"defineConstant": {"PYQT5": true, "PYSIDE2": false, "PYQT6": false, "PYSIDE6": false}} pyproject.toml: [tool.pyright.defineConstant] PYQT5 = true PYSIDE2 = false PYQT6 = false PYSIDE6 = false ``` **Note**: These configurations are necessary for the correct usage of the default VSCode's type checking feature while using QtPy in your source code. ## Testing matrix Currently, QtPy runs tests for different bindings on Linux, Windows and macOS, using Python 3.7 and 3.11, and installing those bindings with `conda` and `pip`. For the PyQt bindings, we also check the installation of extra packages via `pip`. Following this, the current test matrix looks something like this: | | Python | 3.7 | | 3.11 | | |---------|-----------------|--------------------------------------------|------|--------------------|----------------------------| | OS | Binding / manager | conda | pip | conda | pip | | Linux | PyQt5 | 5.12 | 5.15 | 5.15 | 5.15 (with extras) | | | PyQt6 | skip (unavailable) | 6.3 | skip (unavailable) | 6.5 (with extras) | | | PySide2 | 5.13 | 5.12 | 5.15 | skip (no wheels available) | | | PySide6 | 6.4 | 6.3 | 6.5 | 6.5 | | Windows | PyQt5 | 5.9 | 5.15 | 5.15 | 5.15 (with extras) | | | PyQt6 | skip (unavailable) | 6.2 | skip (unavailable) | 6.5 (with extras) | | | PySide2 | 5.13 | 5.12 | 5.15 | skip (no wheels available) | | | PySide6 | skip (test hang with 6.4. 6.5 unavailable) | 6.2 | 6.5 | 6.5 | | MacOS | PyQt5 | 5.12 | 5.15 | 5.15 | 5.15 (with extras) | | | PyQt6 | skip (unavailable) | 6.3 | skip (unavailable) | 6.5 (with extras) | | | PySide2 | 5.13 | 5.12 | 5.15 | skip (no wheels available) | | | PySide6 | 6.4 | 6.3 | 6.5 | 6.5 | **Note**: The mentioned extra packages for the PyQt bindings are the following: * `PyQt3D` and `PyQt6-3D` * `PyQtChart` and `PyQt6-Charts` * `PyQtDataVisualization` and `PyQt6-DataVisualization` * `PyQtNetworkAuth` and `PyQt6-NetworkAuth` * `PyQtPurchasing` * `PyQtWebEngine` and `PyQt6-WebEngine` * `QScintilla` and `PyQt6-QScintilla` ## Contributing Everyone is welcome to contribute! See our [Contributing guide](CONTRIBUTING.md) for more details. ## Sponsors QtPy is funded thanks to the generous support of [![Quansight](https://user-images.githubusercontent.com/16781833/142477716-53152d43-99a0-470c-a70b-c04bbfa97dd4.png)](https://www.quansight.com/)[![Numfocus](https://i2.wp.com/numfocus.org/wp-content/uploads/2017/07/NumFocus_LRG.png?fit=320%2C148&ssl=1)](https://numfocus.org/) and the donations we have received from our users around the world through [Open Collective](https://opencollective.com/spyder/): [![Sponsors](https://opencollective.com/spyder/sponsors.svg)](https://opencollective.com/spyder#support) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698105150.0 QtPy-2.4.1/QtPy.egg-info/SOURCES.txt0000666000000000000000000000727414515603476013645 0ustar00AUTHORS.md CHANGELOG.md CHANGELOG.temp LICENSE.txt MANIFEST.in README.md SECURITY.md pyproject.toml pytest.ini setup.cfg setup.py QtPy.egg-info/PKG-INFO QtPy.egg-info/SOURCES.txt QtPy.egg-info/dependency_links.txt QtPy.egg-info/entry_points.txt QtPy.egg-info/not-zip-safe QtPy.egg-info/requires.txt QtPy.egg-info/top_level.txt qtpy/Qsci.py qtpy/Qt3DAnimation.py qtpy/Qt3DCore.py qtpy/Qt3DExtras.py qtpy/Qt3DInput.py qtpy/Qt3DLogic.py qtpy/Qt3DRender.py qtpy/QtAxContainer.py qtpy/QtBluetooth.py qtpy/QtCharts.py qtpy/QtConcurrent.py qtpy/QtCore.py qtpy/QtDBus.py qtpy/QtDataVisualization.py qtpy/QtDesigner.py qtpy/QtGui.py qtpy/QtHelp.py qtpy/QtLocation.py qtpy/QtMacExtras.py qtpy/QtMultimedia.py qtpy/QtMultimediaWidgets.py qtpy/QtNetwork.py qtpy/QtNetworkAuth.py qtpy/QtNfc.py qtpy/QtOpenGL.py qtpy/QtOpenGLWidgets.py qtpy/QtPdf.py qtpy/QtPdfWidgets.py qtpy/QtPositioning.py qtpy/QtPrintSupport.py qtpy/QtPurchasing.py qtpy/QtQml.py qtpy/QtQuick.py qtpy/QtQuick3D.py qtpy/QtQuickControls2.py qtpy/QtQuickWidgets.py qtpy/QtRemoteObjects.py qtpy/QtScxml.py qtpy/QtSensors.py qtpy/QtSerialPort.py qtpy/QtSql.py qtpy/QtStateMachine.py qtpy/QtSvg.py qtpy/QtSvgWidgets.py qtpy/QtTest.py qtpy/QtTextToSpeech.py qtpy/QtUiTools.py qtpy/QtWebChannel.py qtpy/QtWebEngine.py qtpy/QtWebEngineCore.py qtpy/QtWebEngineQuick.py qtpy/QtWebEngineWidgets.py qtpy/QtWebSockets.py qtpy/QtWidgets.py qtpy/QtWinExtras.py qtpy/QtX11Extras.py qtpy/QtXml.py qtpy/QtXmlPatterns.py qtpy/__init__.py qtpy/__main__.py qtpy/_utils.py qtpy/cli.py qtpy/compat.py qtpy/enums_compat.py qtpy/py.typed qtpy/shiboken.py qtpy/sip.py qtpy/uic.py qtpy/tests/__init__.py qtpy/tests/conftest.py qtpy/tests/test.ui qtpy/tests/test_cli.py qtpy/tests/test_compat.py qtpy/tests/test_custom.ui qtpy/tests/test_macos_checks.py qtpy/tests/test_main.py qtpy/tests/test_missing_optional_deps.py qtpy/tests/test_qdesktopservice_split.py qtpy/tests/test_qsci.py qtpy/tests/test_qt3danimation.py qtpy/tests/test_qt3dcore.py qtpy/tests/test_qt3dextras.py qtpy/tests/test_qt3dinput.py qtpy/tests/test_qt3dlogic.py qtpy/tests/test_qt3drender.py qtpy/tests/test_qtaxcontainer.py qtpy/tests/test_qtbluetooth.py qtpy/tests/test_qtcharts.py qtpy/tests/test_qtconcurrent.py qtpy/tests/test_qtcore.py qtpy/tests/test_qtdatavisualization.py qtpy/tests/test_qtdbus.py qtpy/tests/test_qtdesigner.py qtpy/tests/test_qtgui.py qtpy/tests/test_qthelp.py qtpy/tests/test_qtlocation.py qtpy/tests/test_qtmacextras.py qtpy/tests/test_qtmultimedia.py qtpy/tests/test_qtmultimediawidgets.py qtpy/tests/test_qtnetwork.py qtpy/tests/test_qtnetworkauth.py qtpy/tests/test_qtopengl.py qtpy/tests/test_qtopenglwidgets.py qtpy/tests/test_qtpdf.py qtpy/tests/test_qtpdfwidgets.py qtpy/tests/test_qtpositioning.py qtpy/tests/test_qtprintsupport.py qtpy/tests/test_qtpurchasing.py qtpy/tests/test_qtqml.py qtpy/tests/test_qtquick.py qtpy/tests/test_qtquick3d.py qtpy/tests/test_qtquickcontrols2.py qtpy/tests/test_qtquickwidgets.py qtpy/tests/test_qtremoteobjects.py qtpy/tests/test_qtscxml.py qtpy/tests/test_qtsensors.py qtpy/tests/test_qtserialport.py qtpy/tests/test_qtsql.py qtpy/tests/test_qtstatemachine.py qtpy/tests/test_qtsvg.py qtpy/tests/test_qtsvgwidgets.py qtpy/tests/test_qttest.py qtpy/tests/test_qttexttospeech.py qtpy/tests/test_qtuitools.py qtpy/tests/test_qtwebchannel.py qtpy/tests/test_qtwebenginecore.py qtpy/tests/test_qtwebenginequick.py qtpy/tests/test_qtwebenginewidgets.py qtpy/tests/test_qtwebsockets.py qtpy/tests/test_qtwidgets.py qtpy/tests/test_qtwinextras.py qtpy/tests/test_qtx11extras.py qtpy/tests/test_qtxml.py qtpy/tests/test_qtxmlpatterns.py qtpy/tests/test_shiboken.py qtpy/tests/test_sip.py qtpy/tests/test_uic.py qtpy/tests/utils.py qtpy/tests/optional_deps/__init__.py qtpy/tests/optional_deps/optional_dep.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698105150.0 QtPy-2.4.1/QtPy.egg-info/dependency_links.txt0000666000000000000000000000000114515603476016015 0ustar00 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698105150.0 QtPy-2.4.1/QtPy.egg-info/entry_points.txt0000666000000000000000000000005414515603476015244 0ustar00[console_scripts] qtpy = qtpy.__main__:main ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698105149.0 QtPy-2.4.1/QtPy.egg-info/not-zip-safe0000666000000000000000000000000214515603475014175 0ustar00 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698105150.0 QtPy-2.4.1/QtPy.egg-info/requires.txt0000666000000000000000000000011014515603476014337 0ustar00packaging [test] pytest!=7.0.0,!=7.0.1,>=6 pytest-cov>=3.0.0 pytest-qt ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698105150.0 QtPy-2.4.1/QtPy.egg-info/top_level.txt0000666000000000000000000000000514515603476014474 0ustar00qtpy ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/README.md0000666000000000000000000002447314473413726010651 0ustar00# QtPy: Abstraction layer for PyQt5/PySide2/PyQt6/PySide6 [![license](https://img.shields.io/pypi/l/qtpy.svg)](./LICENSE) [![pypi version](https://img.shields.io/pypi/v/qtpy.svg)](https://pypi.org/project/QtPy/) [![conda version](https://img.shields.io/conda/vn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![download count](https://img.shields.io/conda/dn/conda-forge/qtpy.svg)](https://www.anaconda.com/download/) [![OpenCollective Backers](https://opencollective.com/spyder/backers/badge.svg?color=blue)](#backers) [![Join the chat at https://gitter.im/spyder-ide/public](https://badges.gitter.im/spyder-ide/spyder.svg)](https://gitter.im/spyder-ide/public)
[![PyPI status](https://img.shields.io/pypi/status/qtpy.svg)](https://github.com/spyder-ide/qtpy) [![Github build status](https://github.com/spyder-ide/qtpy/workflows/Tests/badge.svg)](https://github.com/spyder-ide/qtpy/actions) [![Coverage Status](https://coveralls.io/repos/github/spyder-ide/qtpy/badge.svg?branch=master)](https://coveralls.io/github/spyder-ide/qtpy?branch=master) *Copyright © 2009– The Spyder Development Team* ## Description **QtPy** is a small abstraction layer that lets you write applications using a single API call to either PyQt or PySide. It provides support for PyQt5, PySide2, PyQt6 and PySide6 using the Qt5 layout (where the QtGui module has been split into QtGui and QtWidgets). Basically, you can write your code as if you were using PyQt or PySide directly, but import Qt modules from `qtpy` instead of `PyQt5`, `PySide2`, `PyQt6` or `PySide6`. Accordingly, when porting code between different Qt bindings (PyQt vs PySide) or Qt versions (Qt5 vs Qt6), QtPy makes this much more painless, and allows you to easily and incrementally transition between them. QtPy handles incompatibilities and differences between bindings or Qt versions for you while keeping your project running, so you can focus more on your own code and less on keeping track of supporting every Qt version and binding. Furthermore, when you do want to upgrade or support new bindings, it allows you to update your project module by module rather than all at once. You can check out examples of this approach in projects using QtPy, like [git-cola](https://github.com/git-cola/git-cola/issues/232). ### Attribution and acknowledgments This project is based on the [pyqode.qt](https://github.com/pyQode/pyqode.qt) project and the [spyderlib.qt](https://github.com/spyder-ide/spyder/tree/2.3/spyderlib/qt) module from the [Spyder](https://github.com/spyder-ide/spyder) project, and also includes contributions adapted from [qt-helpers](https://github.com/glue-viz/qt-helpers), developed as part of the [glue](http://glueviz.org) project. Unlike `pyqode.qt` this is not a namespace package, so it is not tied to a particular project or namespace. ### License This project is released under the [MIT license](LICENSE.txt). ### Requirements You need PyQt5, PySide2, PyQt6 or PySide6 installed in your system to make use of QtPy. If several of these packages are found, PyQt5 is used by default unless you set the `QT_API` environment variable. `QT_API` can take the following values: * `pyqt5` (to use PyQt5). * `pyside2` (to use PySide2). * `pyqt6` (to use PyQt6). * `pyside6` (to use PySide6). ### Module aliases and constants * `QtCore.pyqtSignal`, `QtCore.pyqtSlot` and `QtCore.pyqtProperty` (available on PyQt5/6) are instead exposed as `QtCore.Signal`, `QtCore.Slot` and `QtCore.Property`, respectively, following the Qt5 module layout. * The Qt version being used can be checked with `QtCore.__version__` (instead of `QtCore.QT_VERSION_STR`) as well as from `qtpy.QT_VERSION`. * For PyQt6 enums, unscoped enum access was added by promoting the enums of the `QtCore`, `QtGui`, `QtTest` and `QtWidgets` modules. * Compatibility is added between the `QtGui` and `QtOpenGL` modules for the `QOpenGL*` classes. * To check the current binding version, you can use `qtpy.PYSIDE_VERSION` for PySide2/6 and `qtpy.PYQT_VERSION` for PyQt5/6. If the respective binding is not being used, the value of its attribute will be `None`. * To check the current selected binding, you can use `qtpy.API_NAME` * There are boolean values to check if Qt5/6, PyQt5/6 or PySide2/6 are being used: `qtpy.QT5`, `qtpy.QT6`, `qtpy.PYQT5`, `qtpy.PYQT6`, `qtpy.PYSIDE2` and `qtpy.PYSIDE6`. `True` if currently being used, `False` otherwise. #### Compat module In the `qtpy.compat` module, you can find wrappers for `QFileDialog` static methods and SIP/Shiboken functions, such as: * `QFileDialog.getExistingDirectory` wrapped with `qtpy.compat.getexistingdirectory` * `QFileDialog.getOpenFileName` wrapped with `qtpy.compat.getopenfilename` * `QFileDialog.getOpenFileNames` wrapped with `qtpy.compat.getopenfilenames` * `QFileDialog.getSaveFileName` wrapped with `qtpy.compat.getsavefilename` * `sip.isdeleted` and `shiboken.isValid` wrapped with `qtpy.compat.isalive` ### Installation ```bash pip install qtpy ``` or ```bash conda install qtpy ``` ### Type checker integration Type checkers have no knowledge of installed packages, so these tools require additional configuration. A Command Line Interface (CLI) is offered to help with usage of QtPy (to get MyPy and Pyright/Pylance args/configurations). #### Mypy The `mypy-args` command helps you to generate command line arguments for Mypy that will enable it to process the QtPy source files with the same API as QtPy itself would have selected. If you run ```bash qtpy mypy-args ``` QtPy will output a string of Mypy CLI args that will reflect the currently selected Qt API. For example, in an environment where PyQt5 is installed and selected (or the default fallback, if no binding can be found in the environment), this would output the following: ```text --always-true=PYQT5 --always-false=PYSIDE2 --always-false=PYQT6 --always-false=PYSIDE6 ``` Using Bash or a similar shell, this can be injected into the Mypy command line invocation as follows: ```bash mypy --package mypackage $(qtpy mypy-args) ``` #### Pyright/Pylance In the case of Pyright, instead of runtime arguments, it is required to create a config file for the project, called `pyrightconfig.json` or a `pyright` section in `pyproject.toml`. See [here](https://github.com/microsoft/pyright/blob/main/docs/configuration.md) for reference. In order to set this configuration, QtPy offers the `pyright-config` command for guidance. If you run ```bash qtpy pyright-config ``` you will get the necessary configs to be included in your project files. If you don't have them, it is recommended to create the latter. For example, in an environment where PyQt5 is installed and selected (or the default fallback, if no binding can be found in the environment), this would output the following: ```text pyrightconfig.json: {"defineConstant": {"PYQT5": true, "PYSIDE2": false, "PYQT6": false, "PYSIDE6": false}} pyproject.toml: [tool.pyright.defineConstant] PYQT5 = true PYSIDE2 = false PYQT6 = false PYSIDE6 = false ``` **Note**: These configurations are necessary for the correct usage of the default VSCode's type checking feature while using QtPy in your source code. ## Testing matrix Currently, QtPy runs tests for different bindings on Linux, Windows and macOS, using Python 3.7 and 3.11, and installing those bindings with `conda` and `pip`. For the PyQt bindings, we also check the installation of extra packages via `pip`. Following this, the current test matrix looks something like this: | | Python | 3.7 | | 3.11 | | |---------|-----------------|--------------------------------------------|------|--------------------|----------------------------| | OS | Binding / manager | conda | pip | conda | pip | | Linux | PyQt5 | 5.12 | 5.15 | 5.15 | 5.15 (with extras) | | | PyQt6 | skip (unavailable) | 6.3 | skip (unavailable) | 6.5 (with extras) | | | PySide2 | 5.13 | 5.12 | 5.15 | skip (no wheels available) | | | PySide6 | 6.4 | 6.3 | 6.5 | 6.5 | | Windows | PyQt5 | 5.9 | 5.15 | 5.15 | 5.15 (with extras) | | | PyQt6 | skip (unavailable) | 6.2 | skip (unavailable) | 6.5 (with extras) | | | PySide2 | 5.13 | 5.12 | 5.15 | skip (no wheels available) | | | PySide6 | skip (test hang with 6.4. 6.5 unavailable) | 6.2 | 6.5 | 6.5 | | MacOS | PyQt5 | 5.12 | 5.15 | 5.15 | 5.15 (with extras) | | | PyQt6 | skip (unavailable) | 6.3 | skip (unavailable) | 6.5 (with extras) | | | PySide2 | 5.13 | 5.12 | 5.15 | skip (no wheels available) | | | PySide6 | 6.4 | 6.3 | 6.5 | 6.5 | **Note**: The mentioned extra packages for the PyQt bindings are the following: * `PyQt3D` and `PyQt6-3D` * `PyQtChart` and `PyQt6-Charts` * `PyQtDataVisualization` and `PyQt6-DataVisualization` * `PyQtNetworkAuth` and `PyQt6-NetworkAuth` * `PyQtPurchasing` * `PyQtWebEngine` and `PyQt6-WebEngine` * `QScintilla` and `PyQt6-QScintilla` ## Contributing Everyone is welcome to contribute! See our [Contributing guide](CONTRIBUTING.md) for more details. ## Sponsors QtPy is funded thanks to the generous support of [![Quansight](https://user-images.githubusercontent.com/16781833/142477716-53152d43-99a0-470c-a70b-c04bbfa97dd4.png)](https://www.quansight.com/)[![Numfocus](https://i2.wp.com/numfocus.org/wp-content/uploads/2017/07/NumFocus_LRG.png?fit=320%2C148&ssl=1)](https://numfocus.org/) and the donations we have received from our users around the world through [Open Collective](https://opencollective.com/spyder/): [![Sponsors](https://opencollective.com/spyder/sponsors.svg)](https://opencollective.com/spyder#support) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1638558318.0 QtPy-2.4.1/SECURITY.md0000666000000000000000000000245714152465156011157 0ustar00# Security Policy ## Supported Versions The following summarizes the support status of recent QtPy versions. | Version | Supported | | -------- | ------------------ | | 2.0.x | :heavy_check_mark: | | 1.11.x | :heavy_check_mark: | | <=1.10.x | :x: | ## Reporting a Vulnerability If you believe you've discovered a security vulnerability in Sub Manager, please contact the project maintainers, the Spyder development team, at spyder.python@gmail.com . Please be sure to carefully document the vulnerability, including a summary, describing the impacts, identifying the line(s) of code affected, stating the conditions under which it is exploitable and including a minimal reproducible test case. Further information and advice or patches on how to mitigate it is always welcome. You can usually expect to hear back within 1 week, at which point we'll inform you of our evaluation of the vulnerability and what steps we plan to take, and will reach out if we need further clarification from you. Once its patched, we'll send a followup email letting you know, and are happy to update you on its status should you further inquire. While this is a volunteer project and we don't have financial compensation to offer, we can certainly publicly thank you for your help if you would like. Thanks! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/pyproject.toml0000666000000000000000000000353314473413726012300 0ustar00[build-system] requires = [ "setuptools>=42", ] build-backend = "setuptools.build_meta" [tool.black] target-version = ['py37', 'py38', 'py39', 'py310', 'py311'] skip-string-normalization = true line-length = 79 exclude = ''' ( /( \.eggs | \.git | \.hg | \.mypy_cache | \.tox | \.venv | _build | buck-out | build | dist | examples | vendored | _vendor )/ | napari/resources/qt.py | tools/minreq.py ) ''' [tool.ruff] line-length = 79 select = [ "E", "F", "W", #flake8 "UP", # pyupgrade "I", # isort "YTT", #flake8-2020 "TCH", # flake8-type-checing "BLE", # flake8-blind-exception "B", # flake8-bugbear "A", # flake8-builtins "C4", # flake8-comprehensions "ISC", # flake8-implicit-str-concat "G", # flake8-logging-format "PIE", # flake8-pie "COM", # flake8-commas "SIM", # flake8-simplify "INP", # flake8-no-pep420 "PYI", # flake8-pyi "Q", # flake8-quotes "RSE", # flake8-raise "RET", # flake8-return "TID", # flake8-tidy-imports # replace absolutify import "TRY", # tryceratops "ICN", # flake8-import-conventions "RUF", # ruff specyfic rules ] ignore = [ "F403", # star impoert "E501", # line too long - black will handle it "F405", # star import "F401", # unused import - cannot determine wole list of symbols to export and use in __all__ ] exclude = [ ".bzr", ".direnv", ".eggs", ".git", ".mypy_cache", ".pants.d", ".ruff_cache", ".svn", ".tox", ".venv", "__pypackages__", "_build", "buck-out", "build", "dist", "node_modules", "venv", "*vendored*", "*_vendor*", ] target-version = "py37" fix = true [tool.ruff.per-file-ignores] "qtpy/QtCore.py" = ["F821"] "qtpy/__init__.py" = ["TRY003", "F811"] "qtpy/uic.py" = ["TRY003"] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1638558301.0 QtPy-2.4.1/pytest.ini0000666000000000000000000000055714152465135011413 0ustar00[pytest] addopts = --durations=10 -v -r a --color=yes --code-highlight=yes --strict-config --strict-markers --import-mode=importlib --maxfail 10 --cov=qtpy --cov-report=term-missing empty_parameter_set_mark = fail_at_collect filterwarnings = error log_auto_indent = True log_level = INFO minversion = 6.0 testpaths = qtpy/tests xfail_strict = True ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1698105156.5511844 QtPy-2.4.1/qtpy/0000777000000000000000000000000014515603505010346 5ustar00././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/Qsci.py0000666000000000000000000000174114473413726011631 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qsci classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.Qsci import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qsci", missing_package="QScintilla", ) from error elif PYQT6: try: from PyQt6.Qsci import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qsci", missing_package="PyQt6-QScintilla", ) from error elif PYSIDE2 or PYSIDE6: raise QtBindingMissingModuleError(name="Qsci") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/Qt3DAnimation.py0000666000000000000000000000257714473413726013355 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DAnimation classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.Qt3DAnimation import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DAnimation", missing_package="PyQt3D", ) from error elif PYQT6: try: from PyQt6.Qt3DAnimation import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DAnimation", missing_package="PyQt6-3D", ) from error elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide2.Qt3DAnimation as __temp for __name in inspect.getmembers(__temp.Qt3DAnimation): globals()[__name[0]] = __name[1] elif PYSIDE6: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide6.Qt3DAnimation as __temp for __name in inspect.getmembers(__temp.Qt3DAnimation): globals()[__name[0]] = __name[1] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/Qt3DCore.py0000666000000000000000000000252214473413726012314 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DCore classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.Qt3DCore import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DCore", missing_package="PyQt3D", ) from error elif PYQT6: try: from PyQt6.Qt3DCore import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DCore", missing_package="PyQt6-3D", ) from error elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide2.Qt3DCore as __temp for __name in inspect.getmembers(__temp.Qt3DCore): globals()[__name[0]] = __name[1] elif PYSIDE6: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide6.Qt3DCore as __temp for __name in inspect.getmembers(__temp.Qt3DCore): globals()[__name[0]] = __name[1] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/Qt3DExtras.py0000666000000000000000000000254414473413726012676 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DExtras classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.Qt3DExtras import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DExtras", missing_package="PyQt3D", ) from error elif PYQT6: try: from PyQt6.Qt3DExtras import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DExtras", missing_package="PyQt6-3D", ) from error elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide2.Qt3DExtras as __temp for __name in inspect.getmembers(__temp.Qt3DExtras): globals()[__name[0]] = __name[1] elif PYSIDE6: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide6.Qt3DExtras as __temp for __name in inspect.getmembers(__temp.Qt3DExtras): globals()[__name[0]] = __name[1] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/Qt3DInput.py0000666000000000000000000000253314473413726012525 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DInput classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.Qt3DInput import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DInput", missing_package="PyQt3D", ) from error elif PYQT6: try: from PyQt6.Qt3DInput import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DInput", missing_package="PyQt6-3D", ) from error elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide2.Qt3DInput as __temp for __name in inspect.getmembers(__temp.Qt3DInput): globals()[__name[0]] = __name[1] elif PYSIDE6: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide6.Qt3DInput as __temp for __name in inspect.getmembers(__temp.Qt3DInput): globals()[__name[0]] = __name[1] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/Qt3DLogic.py0000666000000000000000000000253314473413726012463 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DLogic classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.Qt3DLogic import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DLogic", missing_package="PyQt3D", ) from error elif PYQT6: try: from PyQt6.Qt3DLogic import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DLogic", missing_package="PyQt6-3D", ) from error elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide2.Qt3DLogic as __temp for __name in inspect.getmembers(__temp.Qt3DLogic): globals()[__name[0]] = __name[1] elif PYSIDE6: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide6.Qt3DLogic as __temp for __name in inspect.getmembers(__temp.Qt3DLogic): globals()[__name[0]] = __name[1] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/Qt3DRender.py0000666000000000000000000000254414473413726012647 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DRender classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.Qt3DRender import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DRender", missing_package="PyQt3D", ) from error elif PYQT6: try: from PyQt6.Qt3DRender import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="Qt3DRender", missing_package="PyQt6-3D", ) from error elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide2.Qt3DRender as __temp for __name in inspect.getmembers(__temp.Qt3DRender): globals()[__name[0]] = __name[1] elif PYSIDE6: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide6.Qt3DRender as __temp for __name in inspect.getmembers(__temp.Qt3DRender): globals()[__name[0]] = __name[1] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtAxContainer.py0000666000000000000000000000116614473413726013453 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtAxContainer classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5 or PYQT6: raise QtBindingMissingModuleError(name="QtAxContainer") elif PYSIDE2: from PySide2.QtAxContainer import * elif PYSIDE6: from PySide6.QtAxContainer import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtBluetooth.py0000666000000000000000000000122314473413726013177 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtBluetooth classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: from PyQt5.QtBluetooth import * elif PYQT6: from PyQt6.QtBluetooth import * elif PYSIDE2: raise QtBindingMissingModuleError(name="QtBluetooth") elif PYSIDE6: from PySide6.QtBluetooth import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtCharts.py0000666000000000000000000000246214473413726012464 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2019- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtChart classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5 import QtChart as QtCharts from PyQt5.QtChart import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtCharts", missing_package="PyQtChart", ) from error elif PYQT6: try: from PyQt6 import QtCharts from PyQt6.QtCharts import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtCharts", missing_package="PyQt6-Charts", ) from error elif PYSIDE2: import inspect # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import PySide2.QtCharts as __temp from PySide2.QtCharts import * for __name in inspect.getmembers(__temp.QtCharts): globals()[__name[0]] = __name[1] elif PYSIDE6: from PySide6 import QtCharts from PySide6.QtCharts import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtConcurrent.py0000666000000000000000000000116214473413726013356 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtConcurrent classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5 or PYQT6: raise QtBindingMissingModuleError(name="QtConcurrent") elif PYSIDE2: from PySide2.QtConcurrent import * elif PYSIDE6: from PySide6.QtConcurrent import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtCore.py0000666000000000000000000001451214473413726012127 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtCore classes and functions.""" import contextlib from typing import TYPE_CHECKING from packaging.version import parse from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 from . import QT_VERSION as _qt_version from ._utils import possibly_static_exec, possibly_static_exec_ if PYQT5: from PyQt5.QtCore import * from PyQt5.QtCore import pyqtBoundSignal as SignalInstance from PyQt5.QtCore import pyqtProperty as Property from PyQt5.QtCore import pyqtSignal as Signal from PyQt5.QtCore import pyqtSlot as Slot try: from PyQt5.QtCore import Q_ENUM as QEnum del Q_ENUM except ImportError: # fallback for Qt5.9 from PyQt5.QtCore import Q_ENUMS as QEnum del Q_ENUMS from PyQt5.QtCore import QT_VERSION_STR as __version__ # Those are imported from `import *` del pyqtSignal, pyqtBoundSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR elif PYQT6: from PyQt6 import QtCore from PyQt6.QtCore import * from PyQt6.QtCore import QT_VERSION_STR as __version__ from PyQt6.QtCore import pyqtBoundSignal as SignalInstance from PyQt6.QtCore import pyqtEnum as QEnum from PyQt6.QtCore import pyqtProperty as Property from PyQt6.QtCore import pyqtSignal as Signal from PyQt6.QtCore import pyqtSlot as Slot # For issue #311 # Seems like there is an error with sip. Without first # trying to import `PyQt6.QtGui.Qt`, some functions like # `PyQt6.QtCore.Qt.mightBeRichText` are missing. if not TYPE_CHECKING: with contextlib.suppress(ImportError): from PyQt6.QtGui import Qt # Map missing methods QCoreApplication.exec_ = lambda *args, **kwargs: possibly_static_exec( QCoreApplication, *args, **kwargs, ) QEventLoop.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QThread.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) # Those are imported from `import *` del ( pyqtSignal, pyqtBoundSignal, pyqtSlot, pyqtProperty, pyqtEnum, QT_VERSION_STR, ) # Allow unscoped access for enums inside the QtCore module from .enums_compat import promote_enums promote_enums(QtCore) del QtCore # Alias deprecated ItemDataRole enum values removed in Qt6 Qt.BackgroundColorRole = ( Qt.ItemDataRole.BackgroundColorRole ) = Qt.BackgroundRole Qt.TextColorRole = Qt.ItemDataRole.TextColorRole = Qt.ForegroundRole # Alias for MiddleButton removed in PyQt6 but available in PyQt5, PySide2 and PySide6 Qt.MidButton = Qt.MiddleButton # Add removed definition for `Qt.ItemFlags` as an alias of `Qt.ItemFlag` # passing as default value 0 in the same way PySide6 6.5+ does. # Note that for PyQt5 and PySide2 those definitions are two different classes # (one is the flag definition and the other the enum definition) Qt.ItemFlags = lambda value=0: Qt.ItemFlag(value) elif PYSIDE2: import PySide2.QtCore from PySide2.QtCore import * __version__ = PySide2.QtCore.__version__ # Missing QtGui utility functions on Qt if getattr(Qt, "mightBeRichText", None) is None: try: from PySide2.QtGui import Qt as guiQt Qt.mightBeRichText = guiQt.mightBeRichText del guiQt except ImportError: # Fails with PySide2 5.12.0 pass QCoreApplication.exec = lambda *args, **kwargs: possibly_static_exec_( QCoreApplication, *args, **kwargs, ) QEventLoop.exec = lambda self, *args, **kwargs: self.exec_(*args, **kwargs) QThread.exec = lambda self, *args, **kwargs: self.exec_(*args, **kwargs) QTextStreamManipulator.exec = lambda self, *args, **kwargs: self.exec_( *args, **kwargs, ) elif PYSIDE6: import PySide6.QtCore from PySide6.QtCore import * __version__ = PySide6.QtCore.__version__ # Missing QtGui utility functions on Qt if getattr(Qt, "mightBeRichText", None) is None: from PySide6.QtGui import Qt as guiQt Qt.mightBeRichText = guiQt.mightBeRichText del guiQt # Alias deprecated ItemDataRole enum values removed in Qt6 Qt.BackgroundColorRole = ( Qt.ItemDataRole.BackgroundColorRole ) = Qt.BackgroundRole Qt.TextColorRole = Qt.ItemDataRole.TextColorRole = Qt.ForegroundRole Qt.MidButton = Qt.MiddleButton # Map DeprecationWarning methods QCoreApplication.exec_ = lambda *args, **kwargs: possibly_static_exec( QCoreApplication, *args, **kwargs, ) QEventLoop.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QThread.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QTextStreamManipulator.exec_ = lambda self, *args, **kwargs: self.exec( *args, **kwargs, ) # Passing as default value 0 in the same way PySide6 6.3.2 does for the `Qt.ItemFlags` definition. if parse(_qt_version) > parse("6.3"): Qt.ItemFlags = lambda value=0: Qt.ItemFlag(value) # For issue #153 and updated for issue #305 if PYQT5 or PYQT6: QDate.toPython = lambda self, *args, **kwargs: self.toPyDate( *args, **kwargs, ) QDateTime.toPython = lambda self, *args, **kwargs: self.toPyDateTime( *args, **kwargs, ) QTime.toPython = lambda self, *args, **kwargs: self.toPyTime( *args, **kwargs, ) if PYSIDE2 or PYSIDE6: QDate.toPyDate = lambda self, *args, **kwargs: self.toPython( *args, **kwargs, ) QDateTime.toPyDateTime = lambda self, *args, **kwargs: self.toPython( *args, **kwargs, ) QTime.toPyTime = lambda self, *args, **kwargs: self.toPython( *args, **kwargs, ) # Mirror https://github.com/spyder-ide/qtpy/pull/393 if PYQT5 or PYSIDE2: QLibraryInfo.path = QLibraryInfo.location QLibraryInfo.LibraryPath = QLibraryInfo.LibraryLocation if PYQT6 or PYSIDE6: QLibraryInfo.location = QLibraryInfo.path QLibraryInfo.LibraryLocation = QLibraryInfo.LibraryPath ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtDBus.py0000666000000000000000000000140014473413726012064 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtDBus classes and functions.""" import sys from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, QtModuleNotInOSError, ) if PYQT5: from PyQt5.QtDBus import * elif PYQT6: from PyQt6.QtDBus import * elif PYSIDE2: raise QtBindingMissingModuleError(name="QtDBus") elif PYSIDE6: if sys.platform != "win32": from PySide6.QtDBus import * else: raise QtModuleNotInOSError(name="QtDBus") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtDataVisualization.py0000666000000000000000000000241614473413726014672 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtDataVisualization classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.QtDataVisualization import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtDataVisualization", missing_package="PyQtDataVisualization", ) from error elif PYQT6: try: from PyQt6.QtDataVisualization import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtDataVisualization", missing_package="PyQt6-DataVisualization", ) from error elif PYSIDE2: # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026 import inspect import PySide2.QtDataVisualization as __temp for __name in inspect.getmembers(__temp.QtDataVisualization): globals()[__name[0]] = __name[1] elif PYSIDE6: from PySide6.QtDataVisualization import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtDesigner.py0000666000000000000000000000120614473413726012773 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtDesigner classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: from PyQt5.QtDesigner import * elif PYQT6: from PyQt6.QtDesigner import * elif PYSIDE2: raise QtBindingMissingModuleError(name="QtDesigner") elif PYSIDE6: from PySide6.QtDesigner import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtGui.py0000666000000000000000000002066014473413726011764 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtGui classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError from ._utils import getattr_missing_optional_dep, possibly_static_exec _missing_optional_names = {} _QTOPENGL_NAMES = { "QOpenGLBuffer", "QOpenGLContext", "QOpenGLContextGroup", "QOpenGLDebugLogger", "QOpenGLDebugMessage", "QOpenGLFramebufferObject", "QOpenGLFramebufferObjectFormat", "QOpenGLPixelTransferOptions", "QOpenGLShader", "QOpenGLShaderProgram", "QOpenGLTexture", "QOpenGLTextureBlitter", "QOpenGLVersionProfile", "QOpenGLVertexArrayObject", "QOpenGLWindow", } def __getattr__(name): """Custom getattr to chain and wrap errors due to missing optional deps.""" raise getattr_missing_optional_dep( name, module_name=__name__, optional_names=_missing_optional_names, ) if PYQT5: from PyQt5.QtGui import * # Backport items moved to QtGui in Qt6 from PyQt5.QtWidgets import ( QAction, QActionGroup, QFileSystemModel, QShortcut, QUndoCommand, ) elif PYQT6: from PyQt6 import QtGui from PyQt6.QtGui import * # Attempt to import QOpenGL* classes, but if that fails, # don't raise an exception until the name is explicitly accessed. # See https://github.com/spyder-ide/qtpy/pull/387/ try: from PyQt6.QtOpenGL import * except ImportError as error: for name in _QTOPENGL_NAMES: _missing_optional_names[name] = { "name": "PyQt6.QtOpenGL", "missing_package": "pyopengl", "import_error": error, } QFontMetrics.width = lambda self, *args, **kwargs: self.horizontalAdvance( *args, **kwargs, ) QFontMetricsF.width = lambda self, *args, **kwargs: self.horizontalAdvance( *args, **kwargs, ) # Map missing/renamed methods QDrag.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QGuiApplication.exec_ = lambda *args, **kwargs: possibly_static_exec( QGuiApplication, *args, **kwargs, ) QTextDocument.print_ = lambda self, *args, **kwargs: self.print( *args, **kwargs, ) # Allow unscoped access for enums inside the QtGui module from .enums_compat import promote_enums promote_enums(QtGui) del QtGui elif PYSIDE2: from PySide2.QtGui import * # Backport items moved to QtGui in Qt6 from PySide2.QtWidgets import ( QAction, QActionGroup, QFileSystemModel, QShortcut, QUndoCommand, ) if hasattr(QFontMetrics, "horizontalAdvance"): # Needed to prevent raising a DeprecationWarning when using QFontMetrics.width QFontMetrics.width = ( lambda self, *args, **kwargs: self.horizontalAdvance( *args, **kwargs, ) ) elif PYSIDE6: from PySide6.QtGui import * # Attempt to import QOpenGL* classes, but if that fails, # don't raise an exception until the name is explicitly accessed. # See https://github.com/spyder-ide/qtpy/pull/387/ try: from PySide6.QtOpenGL import * except ImportError as error: for name in _QTOPENGL_NAMES: _missing_optional_names[name] = { "name": "PySide6.QtOpenGL", "missing_package": "pyopengl", "import_error": error, } # Backport `QFileSystemModel` moved to QtGui in Qt6 from PySide6.QtWidgets import QFileSystemModel QFontMetrics.width = lambda self, *args, **kwargs: self.horizontalAdvance( *args, **kwargs, ) QFontMetricsF.width = lambda self, *args, **kwargs: self.horizontalAdvance( *args, **kwargs, ) # Map DeprecationWarning methods QDrag.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QGuiApplication.exec_ = lambda *args, **kwargs: possibly_static_exec( QGuiApplication, *args, **kwargs, ) if PYSIDE2 or PYSIDE6: # PySide{2,6} do not accept the `mode` keyword argument in # QTextCursor.movePosition() even though it is a valid optional argument # as per C++ API. Fix this by monkeypatching. # # Notes: # # * The `mode` argument is called `arg__2` in PySide{2,6} as per # QTextCursor.movePosition.__doc__ and __signature__. Using `arg__2` as # keyword argument works as intended, so does using a positional # argument. Tested with PySide2 5.15.0, 5.15.2.1 and 5.15.3 and PySide6 # 6.3.0; older version, down to PySide 1, are probably affected as well [1]. # # * PySide2 5.15.0 and 5.15.2.1 silently ignore invalid keyword arguments, # i.e. passing the `mode` keyword argument has no effect and doesn`t # raise an exception. Older versions, down to PySide 1, are probably # affected as well [1]. At least PySide2 5.15.3 and PySide6 6.3.0 raise an # exception when `mode` or any other invalid keyword argument is passed. # # [1] https://bugreports.qt.io/browse/PYSIDE-185 movePosition = QTextCursor.movePosition def movePositionPatched( self, operation: QTextCursor.MoveOperation, mode: QTextCursor.MoveMode = QTextCursor.MoveAnchor, n: int = 1, ) -> bool: return movePosition(self, operation, mode, n) QTextCursor.movePosition = movePositionPatched if PYQT5 or PYSIDE2: # Part of the fix for https://github.com/spyder-ide/qtpy/issues/394 from qtpy.QtCore import QPointF as __QPointF QNativeGestureEvent.x = lambda self: self.localPos().toPoint().x() QNativeGestureEvent.y = lambda self: self.localPos().toPoint().y() QNativeGestureEvent.position = lambda self: self.localPos() QNativeGestureEvent.globalX = lambda self: self.globalPos().x() QNativeGestureEvent.globalY = lambda self: self.globalPos().y() QNativeGestureEvent.globalPosition = lambda self: __QPointF( float(self.globalPos().x()), float(self.globalPos().y()), ) QEnterEvent.position = lambda self: self.localPos() QEnterEvent.globalPosition = lambda self: __QPointF( float(self.globalX()), float(self.globalY()), ) QTabletEvent.position = lambda self: self.posF() QTabletEvent.globalPosition = lambda self: self.globalPosF() QHoverEvent.x = lambda self: self.pos().x() QHoverEvent.y = lambda self: self.pos().y() QHoverEvent.position = lambda self: self.posF() # No `QHoverEvent.globalPosition`, `QHoverEvent.globalX`, # nor `QHoverEvent.globalY` in the Qt5 docs. QMouseEvent.position = lambda self: self.localPos() QMouseEvent.globalPosition = lambda self: __QPointF( float(self.globalX()), float(self.globalY()), ) # Follow similar approach for `QDropEvent` and child classes QDropEvent.position = lambda self: self.posF() if PYQT6 or PYSIDE6: # Part of the fix for https://github.com/spyder-ide/qtpy/issues/394 for _class in ( QNativeGestureEvent, QEnterEvent, QTabletEvent, QHoverEvent, QMouseEvent, ): for _obsolete_function in ( "pos", "x", "y", "globalPos", "globalX", "globalY", ): if hasattr(_class, _obsolete_function): delattr(_class, _obsolete_function) QSinglePointEvent.pos = lambda self: self.position().toPoint() QSinglePointEvent.posF = lambda self: self.position() QSinglePointEvent.localPos = lambda self: self.position() QSinglePointEvent.x = lambda self: self.position().toPoint().x() QSinglePointEvent.y = lambda self: self.position().toPoint().y() QSinglePointEvent.globalPos = lambda self: self.globalPosition().toPoint() QSinglePointEvent.globalX = ( lambda self: self.globalPosition().toPoint().x() ) QSinglePointEvent.globalY = ( lambda self: self.globalPosition().toPoint().y() ) # Follow similar approach for `QDropEvent` and child classes QDropEvent.pos = lambda self: self.position().toPoint() QDropEvent.posF = lambda self: self.position() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857309.0 QtPy-2.4.1/qtpy/QtHelp.py0000666000000000000000000000103114332275635012116 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """QtHelp Wrapper.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtHelp import * elif PYQT6: from PyQt6.QtHelp import * elif PYSIDE2: from PySide2.QtHelp import * elif PYSIDE6: from PySide6.QtHelp import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtLocation.py0000666000000000000000000000124414473413726013005 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtLocation classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: from PyQt5.QtLocation import * elif PYQT6: raise QtBindingMissingModuleError(name="QtLocation") elif PYSIDE2: from PySide2.QtLocation import * elif PYSIDE6: raise QtBindingMissingModuleError(name="QtLocation") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtMacExtras.py0000666000000000000000000000154414473413726013127 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides classes and functions specific to macOS and iOS operating systems""" import sys from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInOSError, QtModuleNotInQtVersionError, ) if sys.platform == "darwin": if PYQT5: from PyQt5.QtMacExtras import * elif PYQT6: raise QtModuleNotInQtVersionError(name="QtMacExtras") elif PYSIDE2: from PySide2.QtMacExtras import * elif PYSIDE6: raise QtModuleNotInQtVersionError(name="QtMacExtras") else: raise QtModuleNotInOSError(name="QtMacExtras") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857309.0 QtPy-2.4.1/qtpy/QtMultimedia.py0000666000000000000000000000111614332275635013324 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides low-level multimedia functionality.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtMultimedia import * elif PYQT6: from PyQt6.QtMultimedia import * elif PYSIDE2: from PySide2.QtMultimedia import * elif PYSIDE6: from PySide6.QtMultimedia import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857309.0 QtPy-2.4.1/qtpy/QtMultimediaWidgets.py0000666000000000000000000000116114332275635014653 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtMultimediaWidgets classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtMultimediaWidgets import * elif PYQT6: from PyQt6.QtMultimediaWidgets import * elif PYSIDE2: from PySide2.QtMultimediaWidgets import * elif PYSIDE6: from PySide6.QtMultimediaWidgets import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857309.0 QtPy-2.4.1/qtpy/QtNetwork.py0000666000000000000000000000115014332275635012661 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtNetwork classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtNetwork import * elif PYQT6: from PyQt6.QtNetwork import * elif PYSIDE2: from PySide2.QtNetwork import * elif PYSIDE6: from PySide6.QtNetwork import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtNetworkAuth.py0000666000000000000000000000211014473413726013501 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtNetworkAuth classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.QtNetworkAuth import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtNetworkAuth", missing_package="PyQtNetworkAuth", ) from error elif PYQT6: try: from PyQt6.QtNetworkAuth import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtNetworkAuth", missing_package="PyQt6-NetworkAuth", ) from error elif PYSIDE2: raise QtBindingMissingModuleError(name="QtNetworkAuth") elif PYSIDE6: from PySide6.QtNetworkAuth import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtNfc.py0000666000000000000000000000116514473413726011745 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtNfc classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: from PyQt5.QtNfc import * elif PYQT6: from PyQt6.QtNfc import * elif PYSIDE2: raise QtBindingMissingModuleError(name="QtNfc") elif PYSIDE6: from PySide6.QtNfc import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtOpenGL.py0000666000000000000000000000376014473413726012366 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtOpenGL classes and functions.""" import contextlib from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtGui import ( QOpenGLBuffer, QOpenGLContext, QOpenGLContextGroup, QOpenGLDebugLogger, QOpenGLDebugMessage, QOpenGLFramebufferObject, QOpenGLFramebufferObjectFormat, QOpenGLPixelTransferOptions, QOpenGLShader, QOpenGLShaderProgram, QOpenGLTexture, QOpenGLTextureBlitter, QOpenGLVersionProfile, QOpenGLVertexArrayObject, QOpenGLWindow, ) from PyQt5.QtOpenGL import * # These are not present on some architectures such as armhf with contextlib.suppress(ImportError): from PyQt5.QtGui import QOpenGLTimeMonitor, QOpenGLTimerQuery elif PYQT6: from PyQt6.QtGui import QOpenGLContext, QOpenGLContextGroup from PyQt6.QtOpenGL import * elif PYSIDE6: from PySide6.QtGui import QOpenGLContext, QOpenGLContextGroup from PySide6.QtOpenGL import * elif PYSIDE2: from PySide2.QtGui import ( QOpenGLBuffer, QOpenGLContext, QOpenGLContextGroup, QOpenGLDebugLogger, QOpenGLDebugMessage, QOpenGLFramebufferObject, QOpenGLFramebufferObjectFormat, QOpenGLPixelTransferOptions, QOpenGLShader, QOpenGLShaderProgram, QOpenGLTexture, QOpenGLTextureBlitter, QOpenGLVersionProfile, QOpenGLVertexArrayObject, QOpenGLWindow, ) from PySide2.QtOpenGL import * # These are not present on some architectures such as armhf with contextlib.suppress(ImportError): from PySide2.QtGui import QOpenGLTimeMonitor, QOpenGLTimerQuery ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtOpenGLWidgets.py0000666000000000000000000000127514473413726013714 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtOpenGLWidgets classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: raise QtBindingMissingModuleError(name="QtOpenGLWidgets") elif PYQT6: from PyQt6.QtOpenGLWidgets import * elif PYSIDE2: raise QtBindingMissingModuleError(name="QtOpenGLWidgets") elif PYSIDE6: from PySide6.QtOpenGLWidgets import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtPdf.py0000666000000000000000000000132514473413726011746 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtPdf classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: raise QtBindingMissingModuleError(name="QtPdf") elif PYQT6: # Available with version >=6.4.0 from PyQt6.QtPdf import * elif PYSIDE2: raise QtBindingMissingModuleError(name="QtPdf") elif PYSIDE6: # Available with version >=6.4.0 from PySide6.QtPdf import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtPdfWidgets.py0000666000000000000000000000137014473413726013275 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtPdfWidgets classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: raise QtBindingMissingModuleError(name="QtPdfWidgets") elif PYQT6: # Available with version >=6.4.0 from PyQt6.QtPdfWidgets import * elif PYSIDE2: raise QtBindingMissingModuleError(name="QtPdfWidgets") elif PYSIDE6: # Available with version >=6.4.0 from PySide6.QtPdfWidgets import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857310.0 QtPy-2.4.1/qtpy/QtPositioning.py0000666000000000000000000000110514332275636013533 0ustar00# ----------------------------------------------------------------------------- # Copyright 2020 Antonio Valentino # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtPositioning classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtPositioning import * elif PYQT6: from PyQt6.QtPositioning import * elif PYSIDE2: from PySide2.QtPositioning import * elif PYSIDE6: from PySide6.QtPositioning import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtPrintSupport.py0000666000000000000000000000223514473413726013727 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtPrintSupport classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtPrintSupport import * elif PYQT6: from PyQt6.QtPrintSupport import * QPageSetupDialog.exec_ = lambda self, *args, **kwargs: self.exec( *args, **kwargs, ) QPrintDialog.exec_ = lambda self, *args, **kwargs: self.exec( *args, **kwargs, ) QPrintPreviewWidget.print_ = lambda self, *args, **kwargs: self.print( *args, **kwargs, ) elif PYSIDE6: from PySide6.QtPrintSupport import * # Map DeprecationWarning methods QPageSetupDialog.exec_ = lambda self, *args, **kwargs: self.exec( *args, **kwargs, ) QPrintDialog.exec_ = lambda self, *args, **kwargs: self.exec( *args, **kwargs, ) elif PYSIDE2: from PySide2.QtPrintSupport import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtPurchasing.py0000666000000000000000000000145014473413726013337 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtPurchasing classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.QtPurchasing import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtPurchasing", missing_package="PyQtPurchasing", ) from error elif PYQT6 or PYSIDE2 or PYSIDE6: raise QtBindingMissingModuleError(name="QtPurchasing") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857310.0 QtPy-2.4.1/qtpy/QtQml.py0000666000000000000000000000105314332275636011764 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQml classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtQml import * elif PYQT6: from PyQt6.QtQml import * elif PYSIDE6: from PySide6.QtQml import * elif PYSIDE2: from PySide2.QtQml import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtQuick.py0000666000000000000000000000106514473413726012312 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQuick classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtQuick import * elif PYQT6: from PyQt6.QtQuick import * elif PYSIDE6: from PySide6.QtQuick import * elif PYSIDE2: from PySide2.QtQuick import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtQuick3D.py0000666000000000000000000000121114473413726012472 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQuick3D classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: from PyQt5.QtQuick3D import * elif PYQT6: from PyQt6.QtQuick3D import * elif PYSIDE2: raise QtBindingMissingModuleError(name="QtQuick3D") elif PYSIDE6: from PySide6.QtQuick3D import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtQuickControls2.py0000666000000000000000000000120214473413726014111 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQuickControls2 classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5 or PYQT6: raise QtBindingMissingModuleError(name="QtQuickControls2") elif PYSIDE2: from PySide2.QtQuickControls2 import * elif PYSIDE6: from PySide6.QtQuickControls2 import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtQuickWidgets.py0000666000000000000000000000113014473413726013632 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQuickWidgets classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtQuickWidgets import * elif PYQT6: from PyQt6.QtQuickWidgets import * elif PYSIDE6: from PySide6.QtQuickWidgets import * elif PYSIDE2: from PySide2.QtQuickWidgets import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857310.0 QtPy-2.4.1/qtpy/QtRemoteObjects.py0000666000000000000000000000113514332275636014001 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtRemoteObjects classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtRemoteObjects import * elif PYQT6: from PyQt6.QtRemoteObjects import * elif PYSIDE6: from PySide6.QtRemoteObjects import * elif PYSIDE2: from PySide2.QtRemoteObjects import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtScxml.py0000666000000000000000000000113614473413726012323 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtScxml classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5 or PYQT6: raise QtBindingMissingModuleError(name="QtScxml") elif PYSIDE2: from PySide2.QtScxml import * elif PYSIDE6: from PySide6.QtScxml import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857310.0 QtPy-2.4.1/qtpy/QtSensors.py0000666000000000000000000000107714332275636012675 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtSensors classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtSensors import * elif PYQT6: from PyQt6.QtSensors import * elif PYSIDE6: from PySide6.QtSensors import * elif PYSIDE2: from PySide2.QtSensors import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857310.0 QtPy-2.4.1/qtpy/QtSerialPort.py0000666000000000000000000000115714332275636013324 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2020 Marcin Stano # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtSerialPort classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtSerialPort import * elif PYQT6: from PyQt6.QtSerialPort import * elif PYSIDE6: from PySide6.QtSerialPort import * elif PYSIDE2: from PySide2.QtSerialPort import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtSql.py0000666000000000000000000000214214473413726011772 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtSql classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtSql import * elif PYQT6: from PyQt6.QtSql import * QSqlDatabase.exec_ = lambda self, *args, **kwargs: self.exec( *args, **kwargs, ) QSqlQuery.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QSqlResult.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) elif PYSIDE6: from PySide6.QtSql import * # Map DeprecationWarning methods QSqlDatabase.exec_ = lambda self, *args, **kwargs: self.exec( *args, **kwargs, ) QSqlQuery.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QSqlResult.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) elif PYSIDE2: from PySide2.QtSql import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtStateMachine.py0000666000000000000000000000111614473413726013600 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtStateMachine classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5 or PYQT6 or PYSIDE2: raise QtBindingMissingModuleError(name="QtStateMachine") elif PYSIDE6: from PySide6.QtStateMachine import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857310.0 QtPy-2.4.1/qtpy/QtSvg.py0000666000000000000000000000105314332275636011772 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtSvg classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtSvg import * elif PYQT6: from PyQt6.QtSvg import * elif PYSIDE2: from PySide2.QtSvg import * elif PYSIDE6: from PySide6.QtSvg import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtSvgWidgets.py0000666000000000000000000000125614473413726013326 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtSvgWidgets classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: raise QtBindingMissingModuleError(name="QtSvgWidgets") elif PYQT6: from PyQt6.QtSvgWidgets import * elif PYSIDE2: raise QtBindingMissingModuleError(name="QtSvgWidgets") elif PYSIDE6: from PySide6.QtSvgWidgets import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtTest.py0000666000000000000000000000140314473413726012151 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtTest and functions""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtTest import * elif PYQT6: from PyQt6 import QtTest from PyQt6.QtTest import * # Allow unscoped access for enums inside the QtTest module from .enums_compat import promote_enums promote_enums(QtTest) del QtTest elif PYSIDE2: from PySide2.QtTest import * elif PYSIDE6: from PySide6.QtTest import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtTextToSpeech.py0000666000000000000000000000127014473413726013613 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtTextToSpeech classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: from PyQt5.QtTextToSpeech import * elif PYQT6: raise QtBindingMissingModuleError(name="QtTextToSpeech") elif PYSIDE2: from PySide2.QtTextToSpeech import * elif PYSIDE6: raise QtBindingMissingModuleError(name="QtTextToSpeech") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtUiTools.py0000666000000000000000000000114614473413726012634 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtUiTools classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5 or PYQT6: raise QtBindingMissingModuleError(name="QtUiTools") elif PYSIDE2: from PySide2.QtUiTools import * elif PYSIDE6: from PySide6.QtUiTools import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857310.0 QtPy-2.4.1/qtpy/QtWebChannel.py0000666000000000000000000000111614332275636013241 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtWebChannel classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtWebChannel import * elif PYQT6: from PyQt6.QtWebChannel import * elif PYSIDE2: from PySide2.QtWebChannel import * elif PYSIDE6: from PySide6.QtWebChannel import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtWebEngine.py0000666000000000000000000000166214473413726013104 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtWebEngine classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInQtVersionError, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.QtWebEngine import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtWebEngine", missing_package="PyQtWebEngine", ) from error elif PYQT6: raise QtModuleNotInQtVersionError(name="QtWebEngine") elif PYSIDE2: from PySide2.QtWebEngine import * elif PYSIDE6: raise QtModuleNotInQtVersionError(name="QtWebEngine") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtWebEngineCore.py0000666000000000000000000000203514473413726013710 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtWebEngineCore classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) if PYQT5: try: from PyQt5.QtWebEngineCore import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtWebEngineCore", missing_package="PyQtWebEngine", ) from error elif PYQT6: try: from PyQt6.QtWebEngineCore import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtWebEngineCore", missing_package="PyQt6-WebEngine", ) from error elif PYSIDE2: from PySide2.QtWebEngineCore import * elif PYSIDE6: from PySide6.QtWebEngineCore import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtWebEngineQuick.py0000666000000000000000000000165114473413726014077 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtWebEngineQuick classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, QtModuleNotInstalledError, ) if PYQT5: raise QtBindingMissingModuleError(name="QtWebEngineQuick") elif PYQT6: try: from PyQt6.QtWebEngineQuick import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtWebEngineQuick", missing_package="PyQt6-WebEngine", ) from error elif PYSIDE2: raise QtBindingMissingModuleError(name="QtWebEngineQuick") elif PYSIDE6: from PySide6.QtWebEngineQuick import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698104827.0 QtPy-2.4.1/qtpy/QtWebEngineWidgets.py0000666000000000000000000000377414515602773014440 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtWebEngineWidgets classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInstalledError, ) # To test if we are using WebEngine or WebKit # NOTE: This constant is imported by other projects (e.g. Spyder), so please # don't remove it. WEBENGINE = True if PYQT5: try: # Based on the work at https://github.com/spyder-ide/qtpy/pull/203 from PyQt5.QtWebEngineWidgets import ( QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineSettings, QWebEngineView, ) except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtWebEngineWidgets", missing_package="PyQtWebEngine", ) from error elif PYQT6: try: from PyQt6.QtWebEngineCore import ( QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineSettings, ) from PyQt6.QtWebEngineWidgets import * except ModuleNotFoundError as error: raise QtModuleNotInstalledError( name="QtWebEngineWidgets", missing_package="PyQt6-WebEngine", ) from error elif PYSIDE2: # Based on the work at https://github.com/spyder-ide/qtpy/pull/203 from PySide2.QtWebEngineWidgets import ( QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineSettings, QWebEngineView, ) elif PYSIDE6: from PySide6.QtWebEngineCore import ( QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineSettings, ) from PySide6.QtWebEngineWidgets import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857310.0 QtPy-2.4.1/qtpy/QtWebSockets.py0000666000000000000000000000111614332275636013304 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtWebSockets classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtWebSockets import * elif PYQT6: from PyQt6.QtWebSockets import * elif PYSIDE2: from PySide2.QtWebSockets import * elif PYSIDE6: from PySide6.QtWebSockets import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtWidgets.py0000666000000000000000000001563414473413726012653 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides widget classes and functions.""" from functools import partialmethod from packaging.version import parse from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 from . import QT_VERSION as _qt_version from ._utils import ( add_action, getattr_missing_optional_dep, possibly_static_exec, static_method_kwargs_wrapper, ) _missing_optional_names = {} def __getattr__(name): """Custom getattr to chain and wrap errors due to missing optional deps.""" raise getattr_missing_optional_dep( name, module_name=__name__, optional_names=_missing_optional_names, ) if PYQT5: from PyQt5.QtWidgets import * elif PYQT6: from PyQt6 import QtWidgets from PyQt6.QtGui import ( QAction, QActionGroup, QFileSystemModel, QShortcut, QUndoCommand, ) from PyQt6.QtWidgets import * # Attempt to import QOpenGLWidget, but if that fails, # don't raise an exception until the name is explicitly accessed. # See https://github.com/spyder-ide/qtpy/pull/387/ try: from PyQt6.QtOpenGLWidgets import QOpenGLWidget except ImportError as error: _missing_optional_names["QOpenGLWidget"] = { "name": "PyQt6.QtOpenGLWidgets", "missing_package": "pyopengl", "import_error": error, } # Map missing/renamed methods QTextEdit.setTabStopWidth = ( lambda self, *args, **kwargs: self.setTabStopDistance(*args, **kwargs) ) QTextEdit.tabStopWidth = ( lambda self, *args, **kwargs: self.tabStopDistance(*args, **kwargs) ) QTextEdit.print_ = lambda self, *args, **kwargs: self.print( *args, **kwargs, ) QPlainTextEdit.setTabStopWidth = ( lambda self, *args, **kwargs: self.setTabStopDistance(*args, **kwargs) ) QPlainTextEdit.tabStopWidth = ( lambda self, *args, **kwargs: self.tabStopDistance(*args, **kwargs) ) QPlainTextEdit.print_ = lambda self, *args, **kwargs: self.print( *args, **kwargs, ) QApplication.exec_ = lambda *args, **kwargs: possibly_static_exec( QApplication, *args, **kwargs, ) QDialog.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QMenu.exec_ = lambda *args, **kwargs: possibly_static_exec( QMenu, *args, **kwargs, ) QLineEdit.getTextMargins = lambda self: ( self.textMargins().left(), self.textMargins().top(), self.textMargins().right(), self.textMargins().bottom(), ) # Add removed definition for `QFileDialog.Options` as an alias of `QFileDialog.Option` # passing as default value 0 in the same way PySide6 6.5+ does. # Note that for PyQt5 and PySide2 those definitions are two different classes # (one is the flag definition and the other the enum definition) QFileDialog.Options = lambda value=0: QFileDialog.Option(value) # Allow unscoped access for enums inside the QtWidgets module from .enums_compat import promote_enums promote_enums(QtWidgets) del QtWidgets elif PYSIDE2: from PySide2.QtWidgets import * elif PYSIDE6: from PySide6.QtGui import QAction, QActionGroup, QShortcut, QUndoCommand from PySide6.QtWidgets import * # Attempt to import QOpenGLWidget, but if that fails, # don't raise an exception until the name is explicitly accessed. # See https://github.com/spyder-ide/qtpy/pull/387/ try: from PySide6.QtOpenGLWidgets import QOpenGLWidget except ImportError as error: _missing_optional_names["QOpenGLWidget"] = { "name": "PySide6.QtOpenGLWidgets", "missing_package": "pyopengl", "import_error": error, } # Map missing/renamed methods QTextEdit.setTabStopWidth = ( lambda self, *args, **kwargs: self.setTabStopDistance(*args, **kwargs) ) QTextEdit.tabStopWidth = ( lambda self, *args, **kwargs: self.tabStopDistance(*args, **kwargs) ) QPlainTextEdit.setTabStopWidth = ( lambda self, *args, **kwargs: self.setTabStopDistance(*args, **kwargs) ) QPlainTextEdit.tabStopWidth = ( lambda self, *args, **kwargs: self.tabStopDistance(*args, **kwargs) ) QLineEdit.getTextMargins = lambda self: ( self.textMargins().left(), self.textMargins().top(), self.textMargins().right(), self.textMargins().bottom(), ) # Map DeprecationWarning methods QApplication.exec_ = lambda *args, **kwargs: possibly_static_exec( QApplication, *args, **kwargs, ) QDialog.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QMenu.exec_ = lambda *args, **kwargs: possibly_static_exec( QMenu, *args, **kwargs, ) # Passing as default value 0 in the same way PySide6 < 6.3.2 does for the `QFileDialog.Options` definition. if parse(_qt_version) > parse("6.3"): QFileDialog.Options = lambda value=0: QFileDialog.Option(value) if PYSIDE2 or PYSIDE6: # Make PySide2/6 `QFileDialog` static methods accept the `directory` kwarg as `dir` QFileDialog.getExistingDirectory = static_method_kwargs_wrapper( QFileDialog.getExistingDirectory, "directory", "dir", ) QFileDialog.getOpenFileName = static_method_kwargs_wrapper( QFileDialog.getOpenFileName, "directory", "dir", ) QFileDialog.getOpenFileNames = static_method_kwargs_wrapper( QFileDialog.getOpenFileNames, "directory", "dir", ) QFileDialog.getSaveFileName = static_method_kwargs_wrapper( QFileDialog.getSaveFileName, "directory", "dir", ) else: # Make PyQt5/6 `QFileDialog` static methods accept the `dir` kwarg as `directory` QFileDialog.getExistingDirectory = static_method_kwargs_wrapper( QFileDialog.getExistingDirectory, "dir", "directory", ) QFileDialog.getOpenFileName = static_method_kwargs_wrapper( QFileDialog.getOpenFileName, "dir", "directory", ) QFileDialog.getOpenFileNames = static_method_kwargs_wrapper( QFileDialog.getOpenFileNames, "dir", "directory", ) QFileDialog.getSaveFileName = static_method_kwargs_wrapper( QFileDialog.getSaveFileName, "dir", "directory", ) # Make `addAction` compatible with Qt6 >= 6.3 if PYQT5 or PYSIDE2 or parse(_qt_version) < parse("6.3"): QMenu.addAction = partialmethod(add_action, old_add_action=QMenu.addAction) QToolBar.addAction = partialmethod( add_action, old_add_action=QToolBar.addAction, ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtWinExtras.py0000666000000000000000000000147414473413726013166 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Windows-specific utilities""" import sys from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInOSError, QtModuleNotInQtVersionError, ) if sys.platform == "win32": if PYQT5: from PyQt5.QtWinExtras import * elif PYQT6: raise QtModuleNotInQtVersionError(name="QtWinExtras") elif PYSIDE2: from PySide2.QtWinExtras import * elif PYSIDE6: raise QtModuleNotInQtVersionError(name="QtWinExtras") else: raise QtModuleNotInOSError(name="QtWinExtras") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtX11Extras.py0000666000000000000000000000147214473413726013000 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Linux-specific utilities""" import sys from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtModuleNotInOSError, QtModuleNotInQtVersionError, ) if sys.platform == "linux": if PYQT5: from PyQt5.QtX11Extras import * elif PYQT6: raise QtModuleNotInQtVersionError(name="QtX11Extras") elif PYSIDE2: from PySide2.QtX11Extras import * elif PYSIDE6: raise QtModuleNotInQtVersionError(name="QtX11Extras") else: raise QtModuleNotInOSError(name="QtX11Extras") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667857310.0 QtPy-2.4.1/qtpy/QtXml.py0000666000000000000000000000105314332275636011773 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtXml classes and functions.""" from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6 if PYQT5: from PyQt5.QtXml import * elif PYQT6: from PyQt6.QtXml import * elif PYSIDE2: from PySide2.QtXml import * elif PYSIDE6: from PySide6.QtXml import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/QtXmlPatterns.py0000666000000000000000000000126314473413726013517 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtXmlPatterns classes and functions.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: from PyQt5.QtXmlPatterns import * elif PYQT6: raise QtBindingMissingModuleError(name="QtXmlPatterns") elif PYSIDE2: from PySide2.QtXmlPatterns import * elif PYSIDE6: raise QtBindingMissingModuleError(name="QtXmlPatterns") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698105018.0 QtPy-2.4.1/qtpy/__init__.py0000666000000000000000000002416414515603272012467 0ustar00# # Copyright © 2009- The Spyder Development Team # Copyright © 2014-2015 Colin Duquesnoy # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ **QtPy** is a shim over the various Python Qt bindings. It is used to write Qt binding independent libraries or applications. If one of the APIs has already been imported, then it will be used. Otherwise, the shim will automatically select the first available API (PyQt5, PySide2, PyQt6 and PySide6); in that case, you can force the use of one specific bindings (e.g. if your application is using one specific bindings and you need to use library that use QtPy) by setting up the ``QT_API`` environment variable. PyQt5 ===== For PyQt5, you don't have to set anything as it will be used automatically:: >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) PySide2 ====== Set the QT_API environment variable to 'pyside2' before importing other packages:: >>> import os >>> os.environ['QT_API'] = 'pyside2' >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) PyQt6 ===== >>> import os >>> os.environ['QT_API'] = 'pyqt6' >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) PySide6 ======= >>> import os >>> os.environ['QT_API'] = 'pyside6' >>> from qtpy import QtGui, QtWidgets, QtCore >>> print(QtWidgets.QWidget) """ import contextlib import os import platform import sys import warnings from packaging.version import parse # Version of QtPy __version__ = "2.4.1" class PythonQtError(RuntimeError): """Generic error superclass for QtPy.""" class PythonQtWarning(RuntimeWarning): """Warning class for QtPy.""" class PythonQtValueError(ValueError): """Error raised if an invalid QT_API is specified.""" class QtBindingsNotFoundError(PythonQtError, ImportError): """Error raised if no bindings could be selected.""" _msg = "No Qt bindings could be found" def __init__(self): super().__init__(self._msg) class QtModuleNotFoundError(ModuleNotFoundError, PythonQtError): """Raised when a Python Qt binding submodule is not installed/supported.""" _msg = "The {name} module was not found." _msg_binding = "{binding}" _msg_extra = "" def __init__(self, *, name, msg=None, **msg_kwargs): global API_NAME binding = self._msg_binding.format(binding=API_NAME) msg = msg or f"{self._msg} {self._msg_extra}".strip() msg = msg.format(name=name, binding=binding, **msg_kwargs) super().__init__(msg, name=name) class QtModuleNotInOSError(QtModuleNotFoundError): """Raised when a module is not supported on the current operating system.""" _msg = "{name} does not exist on this operating system." class QtModuleNotInQtVersionError(QtModuleNotFoundError): """Raised when a module is not implemented in the current Qt version.""" _msg = "{name} does not exist in {version}." def __init__(self, *, name, msg=None, **msg_kwargs): global QT5, QT6 version = "Qt5" if QT5 else "Qt6" super().__init__(name=name, version=version) class QtBindingMissingModuleError(QtModuleNotFoundError): """Raised when a module is not supported by a given binding.""" _msg_extra = "It is not currently implemented in {binding}." class QtModuleNotInstalledError(QtModuleNotFoundError): """Raise when a module is supported by the binding, but not installed.""" _msg_extra = "It must be installed separately" def __init__(self, *, missing_package=None, **superclass_kwargs): self.missing_package = missing_package if missing_package is not None: self._msg_extra += " as {missing_package}." super().__init__(missing_package=missing_package, **superclass_kwargs) # Qt API environment variable name QT_API = "QT_API" # Names of the expected PyQt5 api PYQT5_API = ["pyqt5"] PYQT6_API = ["pyqt6"] # Names of the expected PySide2 api PYSIDE2_API = ["pyside2"] # Names of the expected PySide6 api PYSIDE6_API = ["pyside6"] # Minimum supported versions of Qt and the bindings QT5_VERSION_MIN = PYQT5_VERSION_MIN = "5.9.0" PYSIDE2_VERSION_MIN = "5.12.0" QT6_VERSION_MIN = PYQT6_VERSION_MIN = PYSIDE6_VERSION_MIN = "6.2.0" QT_VERSION_MIN = QT5_VERSION_MIN PYQT_VERSION_MIN = PYQT5_VERSION_MIN PYSIDE_VERSION_MIN = PYSIDE2_VERSION_MIN # Detecting if a binding was specified by the user binding_specified = QT_API in os.environ API_NAMES = { "pyqt5": "PyQt5", "pyside2": "PySide2", "pyqt6": "PyQt6", "pyside6": "PySide6", } API = os.environ.get(QT_API, "pyqt5").lower() initial_api = API if API not in API_NAMES: raise PythonQtValueError( f"Specified QT_API={QT_API.lower()!r} is not in valid options: " f"{API_NAMES}", ) is_old_pyqt = is_pyqt46 = False QT5 = PYQT5 = True QT4 = QT6 = PYQT4 = PYQT6 = PYSIDE = PYSIDE2 = PYSIDE6 = False PYQT_VERSION = None PYSIDE_VERSION = None QT_VERSION = None # Unless `FORCE_QT_API` is set, use previously imported Qt Python bindings if not os.environ.get("FORCE_QT_API"): if "PyQt5" in sys.modules: API = initial_api if initial_api in PYQT5_API else "pyqt5" elif "PySide2" in sys.modules: API = initial_api if initial_api in PYSIDE2_API else "pyside2" elif "PyQt6" in sys.modules: API = initial_api if initial_api in PYQT6_API else "pyqt6" elif "PySide6" in sys.modules: API = initial_api if initial_api in PYSIDE6_API else "pyside6" if API in PYQT5_API: try: from PyQt5.QtCore import ( PYQT_VERSION_STR as PYQT_VERSION, ) from PyQt5.QtCore import ( QT_VERSION_STR as QT_VERSION, ) QT5 = PYQT5 = True if sys.platform == "darwin": macos_version = parse(platform.mac_ver()[0]) qt_ver = parse(QT_VERSION) if macos_version < parse("10.10") and qt_ver >= parse("5.9"): raise PythonQtError( "Qt 5.9 or higher only works in " "macOS 10.10 or higher. Your " "program will fail in this " "system.", ) elif macos_version < parse("10.11") and qt_ver >= parse("5.11"): raise PythonQtError( "Qt 5.11 or higher only works in " "macOS 10.11 or higher. Your " "program will fail in this " "system.", ) del macos_version del qt_ver except ImportError: API = "pyside2" else: os.environ[QT_API] = API if API in PYSIDE2_API: try: from PySide2 import __version__ as PYSIDE_VERSION # analysis:ignore from PySide2.QtCore import __version__ as QT_VERSION # analysis:ignore PYQT5 = False QT5 = PYSIDE2 = True if sys.platform == "darwin": macos_version = parse(platform.mac_ver()[0]) qt_ver = parse(QT_VERSION) if macos_version < parse("10.11") and qt_ver >= parse("5.11"): raise PythonQtError( "Qt 5.11 or higher only works in " "macOS 10.11 or higher. Your " "program will fail in this " "system.", ) del macos_version del qt_ver except ImportError: API = "pyqt6" else: os.environ[QT_API] = API if API in PYQT6_API: try: from PyQt6.QtCore import ( PYQT_VERSION_STR as PYQT_VERSION, ) from PyQt6.QtCore import ( QT_VERSION_STR as QT_VERSION, ) QT5 = PYQT5 = False QT6 = PYQT6 = True except ImportError: API = "pyside6" else: os.environ[QT_API] = API if API in PYSIDE6_API: try: from PySide6 import __version__ as PYSIDE_VERSION # analysis:ignore from PySide6.QtCore import __version__ as QT_VERSION # analysis:ignore QT5 = PYQT5 = False QT6 = PYSIDE6 = True except ImportError: raise QtBindingsNotFoundError from None else: os.environ[QT_API] = API # If a correct API name is passed to QT_API and it could not be found, # switches to another and informs through the warning if initial_api != API and binding_specified: warnings.warn( f"Selected binding {initial_api!r} could not be found; " f"falling back to {API!r}", PythonQtWarning, stacklevel=2, ) # Set display name of the Qt API API_NAME = API_NAMES[API] with contextlib.suppress(ImportError, PythonQtError): # QtDataVisualization backward compatibility (QtDataVisualization vs. QtDatavisualization) # Only available for Qt5 bindings > 5.9 on Windows from . import QtDataVisualization as QtDatavisualization # analysis:ignore def _warn_old_minor_version(name, old_version, min_version): """Warn if using a Qt or binding version no longer supported by QtPy.""" warning_message = ( f"{name} version {old_version} is not supported by QtPy. " "To ensure your application works correctly with QtPy, " f"please upgrade to {name} {min_version} or later." ) warnings.warn(warning_message, PythonQtWarning, stacklevel=2) # Warn if using an End of Life or unsupported Qt API/binding minor version if QT_VERSION: if QT5 and (parse(QT_VERSION) < parse(QT5_VERSION_MIN)): _warn_old_minor_version("Qt5", QT_VERSION, QT5_VERSION_MIN) elif QT6 and (parse(QT_VERSION) < parse(QT6_VERSION_MIN)): _warn_old_minor_version("Qt6", QT_VERSION, QT6_VERSION_MIN) if PYQT_VERSION: if PYQT5 and (parse(PYQT_VERSION) < parse(PYQT5_VERSION_MIN)): _warn_old_minor_version("PyQt5", PYQT_VERSION, PYQT5_VERSION_MIN) elif PYQT6 and (parse(PYQT_VERSION) < parse(PYQT6_VERSION_MIN)): _warn_old_minor_version("PyQt6", PYQT_VERSION, PYQT6_VERSION_MIN) elif PYSIDE_VERSION: if PYSIDE2 and (parse(PYSIDE_VERSION) < parse(PYSIDE2_VERSION_MIN)): _warn_old_minor_version("PySide2", PYSIDE_VERSION, PYSIDE2_VERSION_MIN) elif PYSIDE6 and (parse(PYSIDE_VERSION) < parse(PYSIDE6_VERSION_MIN)): _warn_old_minor_version("PySide6", PYSIDE_VERSION, PYSIDE6_VERSION_MIN) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1651508601.0 QtPy-2.4.1/qtpy/__main__.py0000666000000000000000000000071514234002571012435 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The QtPy Contributors # # Released under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Dev CLI entry point for QtPy, a compat layer for the Python Qt bindings.""" import qtpy.cli def main(): return qtpy.cli.main() if __name__ == "__main__": main() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/_utils.py0000666000000000000000000001210314473413726012223 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2023- The Spyder Development Team # # Released under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides utility functions for use by QtPy itself.""" from functools import wraps from typing import TYPE_CHECKING import qtpy if TYPE_CHECKING: from qtpy.QtWidgets import QAction def _wrap_missing_optional_dep_error( attr_error, *, import_error, wrapper=qtpy.QtModuleNotInstalledError, **wrapper_kwargs, ): """Create a __cause__-chained wrapper error for a missing optional dep.""" qtpy_error = wrapper(**wrapper_kwargs) import_error.__cause__ = attr_error qtpy_error.__cause__ = import_error return qtpy_error def getattr_missing_optional_dep(name, module_name, optional_names): """Wrap AttributeError in a special error if it matches.""" attr_error = AttributeError( f"module {module_name!r} has no attribute {name!r}", ) if name in optional_names: return _wrap_missing_optional_dep_error( attr_error, **optional_names[name], ) return attr_error def possibly_static_exec(cls, *args, **kwargs): """Call `self.exec` when `self` is given or a static method otherwise.""" if not args and not kwargs: # A special case (`cls.exec_()`) to avoid the function resolving error return cls.exec() if isinstance(args[0], cls): if len(args) == 1 and not kwargs: # A special case (`self.exec_()`) to avoid the function resolving error return args[0].exec() return args[0].exec(*args[1:], **kwargs) return cls.exec(*args, **kwargs) def possibly_static_exec_(cls, *args, **kwargs): """Call `self.exec` when `self` is given or a static method otherwise.""" if not args and not kwargs: # A special case (`cls.exec()`) to avoid the function resolving error return cls.exec_() if isinstance(args[0], cls): if len(args) == 1 and not kwargs: # A special case (`self.exec()`) to avoid the function resolving error return args[0].exec_() return args[0].exec_(*args[1:], **kwargs) return cls.exec_(*args, **kwargs) def add_action(self, *args, old_add_action): """Re-order arguments of `addAction` to backport compatibility with Qt>=6.3.""" from qtpy.QtCore import QObject from qtpy.QtGui import QIcon, QKeySequence action: QAction icon: QIcon text: str shortcut: QKeySequence | QKeySequence.StandardKey | str | int receiver: QObject member: bytes if all( isinstance(arg, t) for arg, t in zip( args, [ str, (QKeySequence, QKeySequence.StandardKey, str, int), QObject, bytes, ], ) ): if len(args) == 2: text, shortcut = args action = old_add_action(self, text) action.setShortcut(shortcut) elif len(args) == 3: text, shortcut, receiver = args action = old_add_action(self, text, receiver) action.setShortcut(shortcut) elif len(args) == 4: text, shortcut, receiver, member = args action = old_add_action(self, text, receiver, member, shortcut) else: return old_add_action(self, *args) return action if all( isinstance(arg, t) for arg, t in zip( args, [ QIcon, str, (QKeySequence, QKeySequence.StandardKey, str, int), QObject, bytes, ], ) ): if len(args) == 3: icon, text, shortcut = args action = old_add_action(self, icon, text) action.setShortcut(QKeySequence(shortcut)) elif len(args) == 4: icon, text, shortcut, receiver = args action = old_add_action(self, icon, text, receiver) action.setShortcut(QKeySequence(shortcut)) elif len(args) == 5: icon, text, shortcut, receiver, member = args action = old_add_action( self, icon, text, receiver, member, QKeySequence(shortcut), ) else: return old_add_action(self, *args) return action return old_add_action(self, *args) def static_method_kwargs_wrapper(func, from_kwarg_name, to_kwarg_name): """ Helper function to manage `from_kwarg_name` to `to_kwarg_name` kwargs name changes in static methods. Makes static methods accept the `from_kwarg_name` kwarg as `to_kwarg_name`. """ @staticmethod @wraps(func) def _from_kwarg_name_to_kwarg_name_(*args, **kwargs): if from_kwarg_name in kwargs: kwargs[to_kwarg_name] = kwargs.pop(from_kwarg_name) return func(*args, **kwargs) return _from_kwarg_name_to_kwarg_name_ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/cli.py0000666000000000000000000001152114473413726011476 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The QtPy Contributors # # Released under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provide a CLI to allow configuring developer settings, including mypy.""" # Standard library imports import argparse import json import textwrap def print_version(): """Print the current version of the package.""" import qtpy print("QtPy version", qtpy.__version__) def get_api_status(): """Get the status of each Qt API usage.""" import qtpy return {name: name == qtpy.API for name in qtpy.API_NAMES} def generate_mypy_args(): """Generate a string with always-true/false args to pass to mypy.""" options = {False: "--always-false", True: "--always-true"} apis_active = get_api_status() return " ".join( f"{options[is_active]}={name.upper()}" for name, is_active in apis_active.items() ) def generate_pyright_config_json(): """Generate Pyright config to be used in `pyrightconfig.json`.""" apis_active = get_api_status() return json.dumps( { "defineConstant": { name.upper(): is_active for name, is_active in apis_active.items() }, }, ) def generate_pyright_config_toml(): """Generate a Pyright config to be used in `pyproject.toml`.""" apis_active = get_api_status() return "[tool.pyright.defineConstant]\n" + "\n".join( f"{name.upper()} = {str(is_active).lower()}" for name, is_active in apis_active.items() ) def print_mypy_args(): """Print the generated mypy args to stdout.""" print(generate_mypy_args()) def print_pyright_config_json(): """Print the generated Pyright JSON config to stdout.""" print(generate_pyright_config_json()) def print_pyright_config_toml(): """Print the generated Pyright TOML config to stdout.""" print(generate_pyright_config_toml()) def print_pyright_configs(): """Print the generated Pyright configs to stdout.""" print("pyrightconfig.json:") print_pyright_config_json() print() print("pyproject.toml:") print_pyright_config_toml() def generate_arg_parser(): """Generate the argument parser for the dev CLI for QtPy.""" parser = argparse.ArgumentParser( description="Features to support development with QtPy.", ) parser.set_defaults(func=parser.print_help) parser.add_argument( "--version", action="store_const", dest="func", const=print_version, help="If passed, will print the version and exit", ) cli_subparsers = parser.add_subparsers( title="Subcommands", help="Subcommand to run", metavar="Subcommand", ) # Parser for the MyPy args subcommand mypy_args_parser = cli_subparsers.add_parser( name="mypy-args", help="Generate command line arguments for using mypy with QtPy.", formatter_class=argparse.RawTextHelpFormatter, description=textwrap.dedent( """ Generate command line arguments for using mypy with QtPy. This will generate strings similar to the following which help guide mypy through which library QtPy would have used so that mypy can get the proper underlying type hints. --always-false=PYQT5 --always-false=PYQT6 --always-true=PYSIDE2 --always-false=PYSIDE6 It can be used as follows on Bash or a similar shell: mypy --package mypackage $(qtpy mypy-args) """, ), ) mypy_args_parser.set_defaults(func=print_mypy_args) # Parser for the Pyright config subcommand pyright_config_parser = cli_subparsers.add_parser( name="pyright-config", help="Generate Pyright config for using Pyright with QtPy.", formatter_class=argparse.RawTextHelpFormatter, description=textwrap.dedent( """ Generate Pyright config for using Pyright with QtPy. This will generate config sections to be included in a Pyright config file (either `pyrightconfig.json` or `pyproject.toml`) which help guide Pyright through which library QtPy would have used so that Pyright can get the proper underlying type hints. """, ), ) pyright_config_parser.set_defaults(func=print_pyright_configs) return parser def main(args=None): """Run the development CLI for QtPy.""" parser = generate_arg_parser() parsed_args = parser.parse_args(args=args) reserved_params = {"func"} cleaned_args = { key: value for key, value in vars(parsed_args).items() if key not in reserved_params } parsed_args.func(**cleaned_args) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/compat.py0000666000000000000000000001277014473413726012221 0ustar00# # Copyright © 2009- The Spyder Development Team # Licensed under the terms of the MIT License """ Compatibility functions """ import sys from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, ) from .QtWidgets import QFileDialog TEXT_TYPES = (str,) def is_text_string(obj): """Return True if `obj` is a text string, False if it is anything else, like binary data.""" return isinstance(obj, str) def to_text_string(obj, encoding=None): """Convert `obj` to (unicode) text string""" if encoding is None: return str(obj) if isinstance(obj, str): # In case this function is not used properly, this could happen return obj return str(obj, encoding) # ============================================================================= # QVariant conversion utilities # ============================================================================= PYQT_API_1 = False def to_qvariant(obj=None): # analysis:ignore """Convert Python object to QVariant This is a transitional function from PyQt API#1 (QVariant exist) to PyQt API#2 and Pyside (QVariant does not exist)""" return obj def from_qvariant(qobj=None, pytype=None): # analysis:ignore """Convert QVariant object to Python object This is a transitional function from PyQt API #1 (QVariant exist) to PyQt API #2 and Pyside (QVariant does not exist)""" return qobj # ============================================================================= # Wrappers around QFileDialog static methods # ============================================================================= def getexistingdirectory( parent=None, caption="", basedir="", options=QFileDialog.ShowDirsOnly, ): """Wrapper around QtGui.QFileDialog.getExistingDirectory static method Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0""" # Calling QFileDialog static method if sys.platform == "win32": # On Windows platforms: redirect standard outputs _temp1, _temp2 = sys.stdout, sys.stderr sys.stdout, sys.stderr = None, None try: result = QFileDialog.getExistingDirectory( parent, caption, basedir, options, ) finally: if sys.platform == "win32": # On Windows platforms: restore standard outputs sys.stdout, sys.stderr = _temp1, _temp2 if not is_text_string(result): # PyQt API #1 result = to_text_string(result) return result def _qfiledialog_wrapper( attr, parent=None, caption="", basedir="", filters="", selectedfilter="", options=None, ): if options is None: options = QFileDialog.Option(0) func = getattr(QFileDialog, attr) # Calling QFileDialog static method if sys.platform == "win32": # On Windows platforms: redirect standard outputs _temp1, _temp2 = sys.stdout, sys.stderr sys.stdout, sys.stderr = None, None result = func(parent, caption, basedir, filters, selectedfilter, options) if sys.platform == "win32": # On Windows platforms: restore standard outputs sys.stdout, sys.stderr = _temp1, _temp2 output, selectedfilter = result # Always returns the tuple (output, selectedfilter) return output, selectedfilter def getopenfilename( parent=None, caption="", basedir="", filters="", selectedfilter="", options=None, ): """Wrapper around QtGui.QFileDialog.getOpenFileName static method Returns a tuple (filename, selectedfilter) -- when dialog box is canceled, returns a tuple of empty strings Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0""" return _qfiledialog_wrapper( "getOpenFileName", parent=parent, caption=caption, basedir=basedir, filters=filters, selectedfilter=selectedfilter, options=options, ) def getopenfilenames( parent=None, caption="", basedir="", filters="", selectedfilter="", options=None, ): """Wrapper around QtGui.QFileDialog.getOpenFileNames static method Returns a tuple (filenames, selectedfilter) -- when dialog box is canceled, returns a tuple (empty list, empty string) Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0""" return _qfiledialog_wrapper( "getOpenFileNames", parent=parent, caption=caption, basedir=basedir, filters=filters, selectedfilter=selectedfilter, options=options, ) def getsavefilename( parent=None, caption="", basedir="", filters="", selectedfilter="", options=None, ): """Wrapper around QtGui.QFileDialog.getSaveFileName static method Returns a tuple (filename, selectedfilter) -- when dialog box is canceled, returns a tuple of empty strings Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0""" return _qfiledialog_wrapper( "getSaveFileName", parent=parent, caption=caption, basedir=basedir, filters=filters, selectedfilter=selectedfilter, options=options, ) # ============================================================================= def isalive(obj): """Wrapper around sip.isdeleted and shiboken.isValid which tests whether an object is currently alive.""" if PYQT5 or PYQT6: from . import sip return not sip.isdeleted(obj) if PYSIDE2 or PYSIDE6: from . import shiboken return shiboken.isValid(obj) return None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/enums_compat.py0000666000000000000000000000265614473413726013432 0ustar00# Copyright © 2009- The Spyder Development Team # Copyright © 2012- University of North Carolina at Chapel Hill # Luke Campagnola ('luke.campagnola@%s.com' % 'gmail') # Ogi Moore ('ognyan.moore@%s.com' % 'gmail') # KIU Shueng Chuan ('nixchuan@%s.com' % 'gmail') # Licensed under the terms of the MIT License """ Compatibility functions for scoped and unscoped enum access. """ from . import PYQT6 if PYQT6: import enum from . import sip def promote_enums(module): """ Search enums in the given module and allow unscoped access. Taken from: https://github.com/pyqtgraph/pyqtgraph/blob/pyqtgraph-0.12.1/pyqtgraph/Qt.py#L331-L377 and adapted to also copy enum values aliased under different names. """ class_names = [name for name in dir(module) if name.startswith("Q")] for class_name in class_names: klass = getattr(module, class_name) if not isinstance(klass, sip.wrappertype): continue attrib_names = [name for name in dir(klass) if name[0].isupper()] for attrib_name in attrib_names: attrib = getattr(klass, attrib_name) if not isinstance(attrib, enum.EnumMeta): continue for name, value in attrib.__members__.items(): setattr(klass, name, value) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1651508601.0 QtPy-2.4.1/qtpy/py.typed0000666000000000000000000000000014234002571012025 0ustar00././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/shiboken.py0000666000000000000000000000111014473413726012522 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides access to shiboken.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5 or PYQT6: raise QtBindingMissingModuleError(name="shiboken") elif PYSIDE2: from shiboken2 import * elif PYSIDE6: from shiboken6 import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/sip.py0000666000000000000000000000107614473413726011526 0ustar00# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides access to sip.""" from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingMissingModuleError, ) if PYQT5: from PyQt5.sip import * elif PYQT6: from PyQt6.sip import * elif PYSIDE2 or PYSIDE6: raise QtBindingMissingModuleError(name="sip") ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1698105160.2285287 QtPy-2.4.1/qtpy/tests/0000777000000000000000000000000014515603510011504 5ustar00././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1629183499.0 QtPy-2.4.1/qtpy/tests/__init__.py0000666000000000000000000000000014106657013013606 0ustar00././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/conftest.py0000666000000000000000000000367614473413726013732 0ustar00import os import pytest def pytest_configure(config): """Configure the test environment.""" if "USE_QT_API" in os.environ: os.environ["QT_API"] = os.environ["USE_QT_API"].lower() # We need to import qtpy here to make sure that the API versions get set # straight away. import qtpy def pytest_report_header(config): """Insert a customized header into the test report.""" versions = os.linesep versions += "PyQt5: " try: from PyQt5 import Qt versions += f"PyQt: {Qt.PYQT_VERSION_STR} - Qt: {Qt.QT_VERSION_STR}" except ImportError: versions += "not installed" except AttributeError: versions += "unknown version" versions += os.linesep versions += "PySide2: " try: import PySide2 from PySide2 import QtCore versions += f"PySide: {PySide2.__version__} - Qt: {QtCore.__version__}" except ImportError: versions += "not installed" except AttributeError: versions += "unknown version" versions += os.linesep versions += "PyQt6: " try: from PyQt6 import QtCore versions += ( f"PyQt: {QtCore.PYQT_VERSION_STR} - Qt: {QtCore.QT_VERSION_STR}" ) except ImportError: versions += "not installed" except AttributeError: versions += "unknown version" versions += os.linesep versions += "PySide6: " try: import PySide6 from PySide6 import QtCore versions += f"PySide: {PySide6.__version__} - Qt: {QtCore.__version__}" except ImportError: versions += "not installed" except AttributeError: versions += "unknown version" versions += os.linesep return versions @pytest.fixture def pdf_writer(qtbot): from pathlib import Path from qtpy import QtGui output_path = Path("test.pdf") device = QtGui.QPdfWriter(str(output_path)) yield device, output_path output_path.unlink() ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1698105160.3395286 QtPy-2.4.1/qtpy/tests/optional_deps/0000777000000000000000000000000014515603510014344 5ustar00././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/optional_deps/__init__.py0000666000000000000000000000136314473413726016473 0ustar00"""Package used for testing the deferred import error mechanism.""" # See https://github.com/spyder-ide/qtpy/pull/387/ from qtpy._utils import getattr_missing_optional_dep from .optional_dep import ExampleClass _missing_optional_names = {} try: from .optional_dep import MissingClass except ImportError as error: _missing_optional_names["MissingClass"] = { "name": "optional_dep.MissingClass", "missing_package": "test_package_please_ignore", "import_error": error, } def __getattr__(name): """Custom getattr to chain and wrap errors due to missing optional deps.""" raise getattr_missing_optional_dep( name, module_name=__name__, optional_names=_missing_optional_names, ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/optional_deps/optional_dep.py0000666000000000000000000000014214473413726017403 0ustar00"""Test module with an optional dependency that may be missing.""" class ExampleClass: pass ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1629183499.0 QtPy-2.4.1/qtpy/tests/test.ui0000666000000000000000000000156214106657013013031 0ustar00 Form 0 0 400 300 Form Ceci n'est pas un bouton ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_cli.py0000666000000000000000000000761714473413726013712 0ustar00"""Test the QtPy CLI.""" import subprocess import sys import textwrap import pytest import qtpy SUBCOMMANDS = [ [], ["mypy-args"], ] @pytest.mark.parametrize( argnames=["subcommand"], argvalues=[[subcommand] for subcommand in SUBCOMMANDS], ids=[" ".join(subcommand) for subcommand in SUBCOMMANDS], ) def test_cli_help_does_not_fail(subcommand): subprocess.run( [sys.executable, "-m", "qtpy", *subcommand, "--help"], check=True, ) def test_cli_version(): output = subprocess.run( [sys.executable, "-m", "qtpy", "--version"], capture_output=True, check=True, encoding="utf-8", ) assert output.stdout.strip().split()[-1] == qtpy.__version__ def test_cli_mypy_args(): output = subprocess.run( [sys.executable, "-m", "qtpy", "mypy-args"], capture_output=True, check=True, encoding="utf-8", ) if qtpy.PYQT5: expected = " ".join( [ "--always-true=PYQT5", "--always-false=PYSIDE2", "--always-false=PYQT6", "--always-false=PYSIDE6", ], ) elif qtpy.PYSIDE2: expected = " ".join( [ "--always-false=PYQT5", "--always-true=PYSIDE2", "--always-false=PYQT6", "--always-false=PYSIDE6", ], ) elif qtpy.PYQT6: expected = " ".join( [ "--always-false=PYQT5", "--always-false=PYSIDE2", "--always-true=PYQT6", "--always-false=PYSIDE6", ], ) elif qtpy.PYSIDE6: expected = " ".join( [ "--always-false=PYQT5", "--always-false=PYSIDE2", "--always-false=PYQT6", "--always-true=PYSIDE6", ], ) else: pytest.fail("No Qt bindings detected") assert output.stdout.strip() == expected.strip() def test_cli_pyright_config(): output = subprocess.run( [sys.executable, "-m", "qtpy", "pyright-config"], capture_output=True, check=True, encoding="utf-8", ) if qtpy.PYQT5: expected = textwrap.dedent( """ pyrightconfig.json: {"defineConstant": {"PYQT5": true, "PYSIDE2": false, "PYQT6": false, "PYSIDE6": false}} pyproject.toml: [tool.pyright.defineConstant] PYQT5 = true PYSIDE2 = false PYQT6 = false PYSIDE6 = false """, ) elif qtpy.PYSIDE2: expected = textwrap.dedent( """ pyrightconfig.json: {"defineConstant": {"PYQT5": false, "PYSIDE2": true, "PYQT6": false, "PYSIDE6": false}} pyproject.toml: [tool.pyright.defineConstant] PYQT5 = false PYSIDE2 = true PYQT6 = false PYSIDE6 = false """, ) elif qtpy.PYQT6: expected = textwrap.dedent( """ pyrightconfig.json: {"defineConstant": {"PYQT5": false, "PYSIDE2": false, "PYQT6": true, "PYSIDE6": false}} pyproject.toml: [tool.pyright.defineConstant] PYQT5 = false PYSIDE2 = false PYQT6 = true PYSIDE6 = false """, ) elif qtpy.PYSIDE6: expected = textwrap.dedent( """ pyrightconfig.json: {"defineConstant": {"PYQT5": false, "PYSIDE2": false, "PYQT6": false, "PYSIDE6": true}} pyproject.toml: [tool.pyright.defineConstant] PYQT5 = false PYSIDE2 = false PYQT6 = false PYSIDE6 = true """, ) else: pytest.fail("No valid API to test") assert output.stdout.strip() == expected.strip() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_compat.py0000666000000000000000000000121114473413726014406 0ustar00"""Test the compat module.""" import sys import pytest from qtpy import QtWidgets, compat from qtpy.tests.utils import not_using_conda @pytest.mark.skipif( ( (sys.version_info.major == 3 and sys.version_info.minor == 7) and sys.platform.startswith("win") and not not_using_conda() ), reason="sip not included in Python3.7 on Windows", ) def test_isalive(qtbot): """Test compat.isalive""" test_widget = QtWidgets.QWidget() assert compat.isalive(test_widget) is True with qtbot.waitSignal(test_widget.destroyed): test_widget.deleteLater() assert compat.isalive(test_widget) is False ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1629183499.0 QtPy-2.4.1/qtpy/tests/test_custom.ui0000666000000000000000000000206414106657013014421 0ustar00 Form 0 0 400 300 Form Ceci n'est pas un bouton _QComboBoxSubclass QComboBox
qcombobox_subclass
././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_macos_checks.py0000666000000000000000000000556714473413726015567 0ustar00import contextlib import platform import sys from unittest import mock import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(not PYQT5, reason="Targeted to PyQt5") @mock.patch.object(platform, "mac_ver") def test_qt59_exception(mac_ver, monkeypatch): # Remove qtpy to reimport it again with contextlib.suppress(KeyError): del sys.modules["qtpy"] # Patch stdlib to emulate a macOS system monkeypatch.setattr("sys.platform", "darwin") mac_ver.return_value = ("10.9.2",) # Patch Qt version monkeypatch.setattr("PyQt5.QtCore.QT_VERSION_STR", "5.9.1") # This should raise an Exception with pytest.raises(Exception) as e: import qtpy assert "10.10" in str(e.value) assert "5.9" in str(e.value) @pytest.mark.skipif(not PYQT5, reason="Targeted to PyQt5") @mock.patch.object(platform, "mac_ver") def test_qt59_no_exception(mac_ver, monkeypatch): # Remove qtpy to reimport it again with contextlib.suppress(KeyError): del sys.modules["qtpy"] # Patch stdlib to emulate a macOS system monkeypatch.setattr("sys.platform", "darwin") mac_ver.return_value = ("10.10.1",) # Patch Qt version monkeypatch.setattr("PyQt5.QtCore.QT_VERSION_STR", "5.9.5") # This should not raise an Exception try: import qtpy except Exception: # noqa: BLE001 pytest.fail("Error!") @pytest.mark.skipif( not (PYQT5 or PYSIDE2), reason="Targeted to PyQt5 or PySide2", ) @mock.patch.object(platform, "mac_ver") def test_qt511_exception(mac_ver, monkeypatch): # Remove qtpy to reimport it again with contextlib.suppress(KeyError): del sys.modules["qtpy"] # Patch stdlib to emulate a macOS system monkeypatch.setattr("sys.platform", "darwin") mac_ver.return_value = ("10.10.3",) # Patch Qt version if PYQT5: monkeypatch.setattr("PyQt5.QtCore.QT_VERSION_STR", "5.11.1") else: monkeypatch.setattr("PySide2.QtCore.__version__", "5.11.1") # This should raise an Exception with pytest.raises(Exception) as e: import qtpy assert "10.11" in str(e.value) assert "5.11" in str(e.value) @pytest.mark.skipif( not (PYQT5 or PYSIDE2), reason="Targeted to PyQt5 or PySide2", ) @mock.patch.object(platform, "mac_ver") def test_qt511_no_exception(mac_ver, monkeypatch): # Remove qtpy to reimport it again with contextlib.suppress(KeyError): del sys.modules["qtpy"] # Patch stdlib to emulate a macOS system monkeypatch.setattr("sys.platform", "darwin") mac_ver.return_value = ("10.13.2",) # Patch Qt version if PYQT5: monkeypatch.setattr("PyQt5.QtCore.QT_VERSION_STR", "5.11.1") else: monkeypatch.setattr("PySide2.QtCore.__version__", "5.11.1") # This should not raise an Exception try: import qtpy except Exception: # noqa: BLE001 pytest.fail("Error!") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_main.py0000666000000000000000000000731714473413726014064 0ustar00import contextlib import os import subprocess import sys import pytest from qtpy import API_NAMES, QtCore, QtGui, QtWidgets with contextlib.suppress(Exception): # removed in qt 6.0 from qtpy import QtWebEngineWidgets def assert_pyside2(): """ Make sure that we are using PySide """ import PySide2 assert QtCore.QEvent is PySide2.QtCore.QEvent assert QtGui.QPainter is PySide2.QtGui.QPainter assert QtWidgets.QWidget is PySide2.QtWidgets.QWidget assert ( QtWebEngineWidgets.QWebEnginePage is PySide2.QtWebEngineWidgets.QWebEnginePage ) assert os.environ["QT_API"] == "pyside2" def assert_pyside6(): """ Make sure that we are using PySide """ import PySide6 assert QtCore.QEvent is PySide6.QtCore.QEvent assert QtGui.QPainter is PySide6.QtGui.QPainter assert QtWidgets.QWidget is PySide6.QtWidgets.QWidget # Only valid for qt>=6.2 # assert QtWebEngineWidgets.QWebEnginePage is PySide6.QtWebEngineCore.QWebEnginePage assert os.environ["QT_API"] == "pyside6" def assert_pyqt5(): """ Make sure that we are using PyQt5 """ import PyQt5 assert QtCore.QEvent is PyQt5.QtCore.QEvent assert QtGui.QPainter is PyQt5.QtGui.QPainter assert QtWidgets.QWidget is PyQt5.QtWidgets.QWidget assert os.environ["QT_API"] == "pyqt5" def assert_pyqt6(): """ Make sure that we are using PyQt6 """ import PyQt6 assert QtCore.QEvent is PyQt6.QtCore.QEvent assert QtGui.QPainter is PyQt6.QtGui.QPainter assert QtWidgets.QWidget is PyQt6.QtWidgets.QWidget assert os.environ["QT_API"] == "pyqt6" def test_qt_api(): """ If QT_API is specified, we check that the correct Qt wrapper was used """ QT_API = os.environ.get("QT_API", "").lower() if QT_API == "pyqt5": assert_pyqt5() elif QT_API == "pyside2": assert_pyside2() elif QT_API == "pyqt6": assert_pyqt6() elif QT_API == "pyside6": assert_pyside6() else: # If the tests are run locally, USE_QT_API and QT_API may not be # defined, but we still want to make sure qtpy is behaving sensibly. # We should then be loading, in order of decreasing preference, PyQt5, # PySide2, PyQt6 and PySide6. try: import PyQt5 except ImportError: try: import PySide2 except ImportError: try: import PyQt6 except ImportError: import PySide6 assert_pyside6() else: assert_pyqt6() else: assert_pyside2() else: assert_pyqt5() @pytest.mark.parametrize("api", API_NAMES.values()) def test_qt_api_environ(api): """ If no QT_API is specified but some Qt is imported, ensure QT_API is set properly. """ mod = f"{api}.QtCore" pytest.importorskip(mod, reason=f"Requires {api}") # clean env env = os.environ.copy() for key in ("QT_API", "USE_QT_API"): if key in env: del env[key] cmd = f""" import {mod} from qtpy import API import os print(API) print(os.environ['QT_API']) """ output = subprocess.check_output([sys.executable, "-c", cmd], env=env) got_api, env_qt_api = output.strip().decode("utf-8").splitlines() assert got_api == api.lower() assert env_qt_api == api.lower() # Also ensure we raise a nice error env["QT_API"] = "bad" cmd = """ try: import qtpy except ValueError as exc: assert 'Specified QT_API' in str(exc), str(exc) else: raise AssertionError('QtPy imported despite bad QT_API') """ subprocess.check_call([sys.executable, "-Oc", cmd], env=env) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_missing_optional_deps.py0000666000000000000000000000117314473413726017523 0ustar00"""Test the deferred import error mechanism""" # See https://github.com/spyder-ide/qtpy/pull/387/ import pytest from qtpy import QtModuleNotInstalledError def test_missing_optional_deps(): """Test importing a module that uses the deferred import error mechanism""" from . import optional_deps assert optional_deps.ExampleClass is not None with pytest.raises(QtModuleNotInstalledError) as excinfo: from .optional_deps import MissingClass msg = "The optional_dep.MissingClass module was not found. It must be installed separately as test_package_please_ignore." assert msg == str(excinfo.value) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qdesktopservice_split.py0000666000000000000000000000107714473413726017563 0ustar00"""Test QDesktopServices split in Qt5.""" import pytest def test_qstandarpath(): """Test the qtpy.QStandardPaths namespace""" from qtpy.QtCore import QStandardPaths assert QStandardPaths.StandardLocation is not None # Attributes from QDesktopServices shouldn't be in QStandardPaths with pytest.raises(AttributeError): QStandardPaths.setUrlHandler # noqa: B018 def test_qdesktopservice(): """Test the qtpy.QDesktopServices namespace""" from qtpy.QtGui import QDesktopServices assert QDesktopServices.setUrlHandler is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667851260.0 QtPy-2.4.1/qtpy/tests/test_qsci.py0000666000000000000000000000510514332261774014066 0ustar00"""Test Qsci.""" import pytest from qtpy import PYSIDE2, PYSIDE6 from qtpy.tests.utils import using_conda @pytest.mark.skipif( PYSIDE2 or PYSIDE6 or using_conda(), reason="Qsci bindings not available under PySide 2/6 and conda installations", ) def test_qsci(): """Test the qtpy.Qsci namespace""" Qsci = pytest.importorskip("qtpy.Qsci") assert Qsci.QSCINTILLA_VERSION is not None assert Qsci.QSCINTILLA_VERSION_STR is not None assert Qsci.QsciAPIs is not None assert Qsci.QsciAbstractAPIs is not None assert Qsci.QsciCommand is not None assert Qsci.QsciCommandSet is not None assert Qsci.QsciDocument is not None assert Qsci.QsciLexer is not None assert Qsci.QsciLexerAVS is not None assert Qsci.QsciLexerBash is not None assert Qsci.QsciLexerBatch is not None assert Qsci.QsciLexerCMake is not None assert Qsci.QsciLexerCPP is not None assert Qsci.QsciLexerCSS is not None assert Qsci.QsciLexerCSharp is not None assert Qsci.QsciLexerCoffeeScript is not None assert Qsci.QsciLexerCustom is not None assert Qsci.QsciLexerD is not None assert Qsci.QsciLexerDiff is not None assert Qsci.QsciLexerFortran is not None assert Qsci.QsciLexerFortran77 is not None assert Qsci.QsciLexerHTML is not None assert Qsci.QsciLexerIDL is not None assert Qsci.QsciLexerJSON is not None assert Qsci.QsciLexerJava is not None assert Qsci.QsciLexerJavaScript is not None assert Qsci.QsciLexerLua is not None assert Qsci.QsciLexerMakefile is not None assert Qsci.QsciLexerMarkdown is not None assert Qsci.QsciLexerMatlab is not None assert Qsci.QsciLexerOctave is not None assert Qsci.QsciLexerPO is not None assert Qsci.QsciLexerPOV is not None assert Qsci.QsciLexerPascal is not None assert Qsci.QsciLexerPerl is not None assert Qsci.QsciLexerPostScript is not None assert Qsci.QsciLexerProperties is not None assert Qsci.QsciLexerPython is not None assert Qsci.QsciLexerRuby is not None assert Qsci.QsciLexerSQL is not None assert Qsci.QsciLexerSpice is not None assert Qsci.QsciLexerTCL is not None assert Qsci.QsciLexerTeX is not None assert Qsci.QsciLexerVHDL is not None assert Qsci.QsciLexerVerilog is not None assert Qsci.QsciLexerXML is not None assert Qsci.QsciLexerYAML is not None assert Qsci.QsciMacro is not None assert Qsci.QsciPrinter is not None assert Qsci.QsciScintilla is not None assert Qsci.QsciScintillaBase is not None assert Qsci.QsciStyle is not None assert Qsci.QsciStyledText is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qt3danimation.py0000666000000000000000000000173714473413726015713 0ustar00import pytest def test_qt3danimation(): """Test the qtpy.Qt3DAnimation namespace""" Qt3DAnimation = pytest.importorskip("qtpy.Qt3DAnimation") assert Qt3DAnimation.QAnimationController is not None assert Qt3DAnimation.QAdditiveClipBlend is not None assert Qt3DAnimation.QAbstractClipBlendNode is not None assert Qt3DAnimation.QAbstractAnimation is not None assert Qt3DAnimation.QKeyframeAnimation is not None assert Qt3DAnimation.QAbstractAnimationClip is not None assert Qt3DAnimation.QAbstractClipAnimator is not None assert Qt3DAnimation.QClipAnimator is not None assert Qt3DAnimation.QAnimationGroup is not None assert Qt3DAnimation.QLerpClipBlend is not None assert Qt3DAnimation.QMorphingAnimation is not None assert Qt3DAnimation.QAnimationAspect is not None assert Qt3DAnimation.QVertexBlendAnimation is not None assert Qt3DAnimation.QBlendedClipAnimator is not None assert Qt3DAnimation.QMorphTarget is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qt3dcore.py0000666000000000000000000000376214473413726014664 0ustar00import pytest from qtpy import PYQT6, PYSIDE6 @pytest.mark.skipif(PYQT6, reason="Not complete in PyQt6") @pytest.mark.skipif(PYSIDE6, reason="Not complete in PySide6") def test_qt3dcore(): """Test the qtpy.Qt3DCore namespace""" Qt3DCore = pytest.importorskip("qtpy.Qt3DCore") assert Qt3DCore.QPropertyValueAddedChange is not None assert Qt3DCore.QSkeletonLoader is not None assert Qt3DCore.QPropertyNodeRemovedChange is not None assert Qt3DCore.QPropertyUpdatedChange is not None assert Qt3DCore.QAspectEngine is not None assert Qt3DCore.QPropertyValueAddedChangeBase is not None assert Qt3DCore.QStaticPropertyValueRemovedChangeBase is not None assert Qt3DCore.QPropertyNodeAddedChange is not None assert Qt3DCore.QDynamicPropertyUpdatedChange is not None assert Qt3DCore.QStaticPropertyUpdatedChangeBase is not None assert Qt3DCore.ChangeFlags is not None assert Qt3DCore.QAbstractAspect is not None assert Qt3DCore.QBackendNode is not None assert Qt3DCore.QTransform is not None assert Qt3DCore.QPropertyUpdatedChangeBase is not None assert Qt3DCore.QNodeId is not None assert Qt3DCore.QJoint is not None assert Qt3DCore.QSceneChange is not None assert Qt3DCore.QNodeIdTypePair is not None assert Qt3DCore.QAbstractSkeleton is not None assert Qt3DCore.QComponentRemovedChange is not None assert Qt3DCore.QComponent is not None assert Qt3DCore.QEntity is not None assert Qt3DCore.QNodeCommand is not None assert Qt3DCore.QNode is not None assert Qt3DCore.QPropertyValueRemovedChange is not None assert Qt3DCore.QPropertyValueRemovedChangeBase is not None assert Qt3DCore.QComponentAddedChange is not None assert Qt3DCore.QNodeCreatedChangeBase is not None assert Qt3DCore.QNodeDestroyedChange is not None assert Qt3DCore.QArmature is not None assert Qt3DCore.QStaticPropertyValueAddedChangeBase is not None assert Qt3DCore.ChangeFlag is not None assert Qt3DCore.QSkeleton is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qt3dextras.py0000666000000000000000000000402014274763266015234 0ustar00import pytest def test_qt3dextras(): """Test the qtpy.Qt3DExtras namespace""" Qt3DExtras = pytest.importorskip("qtpy.Qt3DExtras") assert Qt3DExtras.QTextureMaterial is not None assert Qt3DExtras.QPhongAlphaMaterial is not None assert Qt3DExtras.QOrbitCameraController is not None assert Qt3DExtras.QAbstractSpriteSheet is not None assert Qt3DExtras.QNormalDiffuseMapMaterial is not None assert Qt3DExtras.QDiffuseSpecularMaterial is not None assert Qt3DExtras.QSphereGeometry is not None assert Qt3DExtras.QCuboidGeometry is not None assert Qt3DExtras.QForwardRenderer is not None assert Qt3DExtras.QPhongMaterial is not None assert Qt3DExtras.QSpriteGrid is not None assert Qt3DExtras.QDiffuseMapMaterial is not None assert Qt3DExtras.QConeGeometry is not None assert Qt3DExtras.QSpriteSheetItem is not None assert Qt3DExtras.QPlaneGeometry is not None assert Qt3DExtras.QSphereMesh is not None assert Qt3DExtras.QNormalDiffuseSpecularMapMaterial is not None assert Qt3DExtras.QCuboidMesh is not None assert Qt3DExtras.QGoochMaterial is not None assert Qt3DExtras.QText2DEntity is not None assert Qt3DExtras.QTorusMesh is not None assert Qt3DExtras.Qt3DWindow is not None assert Qt3DExtras.QPerVertexColorMaterial is not None assert Qt3DExtras.QExtrudedTextGeometry is not None assert Qt3DExtras.QSkyboxEntity is not None assert Qt3DExtras.QAbstractCameraController is not None assert Qt3DExtras.QExtrudedTextMesh is not None assert Qt3DExtras.QCylinderGeometry is not None assert Qt3DExtras.QTorusGeometry is not None assert Qt3DExtras.QMorphPhongMaterial is not None assert Qt3DExtras.QPlaneMesh is not None assert Qt3DExtras.QDiffuseSpecularMapMaterial is not None assert Qt3DExtras.QSpriteSheet is not None assert Qt3DExtras.QConeMesh is not None assert Qt3DExtras.QFirstPersonCameraController is not None assert Qt3DExtras.QMetalRoughMaterial is not None assert Qt3DExtras.QCylinderMesh is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qt3dinput.py0000666000000000000000000000223614274763266015074 0ustar00import pytest def test_qt3dinput(): """Test the qtpy.Qt3DInput namespace""" Qt3DInput = pytest.importorskip("qtpy.Qt3DInput") assert Qt3DInput.QAxisAccumulator is not None assert Qt3DInput.QInputSettings is not None assert Qt3DInput.QAnalogAxisInput is not None assert Qt3DInput.QAbstractAxisInput is not None assert Qt3DInput.QMouseHandler is not None assert Qt3DInput.QButtonAxisInput is not None assert Qt3DInput.QInputSequence is not None assert Qt3DInput.QWheelEvent is not None assert Qt3DInput.QActionInput is not None assert Qt3DInput.QKeyboardDevice is not None assert Qt3DInput.QMouseDevice is not None assert Qt3DInput.QAxis is not None assert Qt3DInput.QInputChord is not None assert Qt3DInput.QMouseEvent is not None assert Qt3DInput.QKeyboardHandler is not None assert Qt3DInput.QKeyEvent is not None assert Qt3DInput.QAbstractActionInput is not None assert Qt3DInput.QInputAspect is not None assert Qt3DInput.QLogicalDevice is not None assert Qt3DInput.QAction is not None assert Qt3DInput.QAbstractPhysicalDevice is not None assert Qt3DInput.QAxisSetting is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qt3dlogic.py0000666000000000000000000000034514274763266015031 0ustar00import pytest def test_qt3dlogic(): """Test the qtpy.Qt3DLogic namespace""" Qt3DLogic = pytest.importorskip("qtpy.Qt3DLogic") assert Qt3DLogic.QLogicAspect is not None assert Qt3DLogic.QFrameAction is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qt3drender.py0000666000000000000000000001306614473413726015211 0ustar00import pytest from qtpy import PYQT6, PYSIDE6 @pytest.mark.skipif(PYQT6, reason="Not complete in PyQt6") @pytest.mark.skipif(PYSIDE6, reason="Not complete in PySide6") def test_qt3drender(): """Test the qtpy.Qt3DRender namespace""" Qt3DRender = pytest.importorskip("qtpy.Qt3DRender") assert Qt3DRender.QPointSize is not None assert Qt3DRender.QFrustumCulling is not None assert Qt3DRender.QPickPointEvent is not None assert Qt3DRender.QRenderPassFilter is not None assert Qt3DRender.QMesh is not None assert Qt3DRender.QRayCaster is not None assert Qt3DRender.QStencilMask is not None assert Qt3DRender.QPickLineEvent is not None assert Qt3DRender.QPickTriangleEvent is not None assert Qt3DRender.QRenderState is not None assert Qt3DRender.QTextureWrapMode is not None assert Qt3DRender.QRenderPass is not None assert Qt3DRender.QGeometryRenderer is not None assert Qt3DRender.QAttribute is not None assert Qt3DRender.QStencilOperation is not None assert Qt3DRender.QScissorTest is not None assert Qt3DRender.QTextureCubeMapArray is not None assert Qt3DRender.QRenderTarget is not None assert Qt3DRender.QStencilTest is not None assert Qt3DRender.QTextureData is not None assert Qt3DRender.QBuffer is not None assert Qt3DRender.QLineWidth is not None assert Qt3DRender.QLayer is not None assert Qt3DRender.QTextureRectangle is not None assert Qt3DRender.QRenderTargetSelector is not None assert Qt3DRender.QPickingSettings is not None assert Qt3DRender.QCullFace is not None assert Qt3DRender.QAbstractFunctor is not None assert Qt3DRender.PropertyReaderInterface is not None assert Qt3DRender.QMaterial is not None assert Qt3DRender.QAlphaCoverage is not None assert Qt3DRender.QClearBuffers is not None assert Qt3DRender.QAlphaTest is not None assert Qt3DRender.QStencilOperationArguments is not None assert Qt3DRender.QTexture2DMultisample is not None assert Qt3DRender.QLevelOfDetailSwitch is not None assert Qt3DRender.QRenderStateSet is not None assert Qt3DRender.QViewport is not None assert Qt3DRender.QObjectPicker is not None assert Qt3DRender.QPolygonOffset is not None assert Qt3DRender.QRenderSettings is not None assert Qt3DRender.QFrontFace is not None assert Qt3DRender.QTexture3D is not None assert Qt3DRender.QTextureBuffer is not None assert Qt3DRender.QTechniqueFilter is not None assert Qt3DRender.QLayerFilter is not None assert Qt3DRender.QFilterKey is not None assert Qt3DRender.QRenderSurfaceSelector is not None assert Qt3DRender.QEnvironmentLight is not None assert Qt3DRender.QMemoryBarrier is not None assert Qt3DRender.QNoDepthMask is not None assert Qt3DRender.QBlitFramebuffer is not None assert Qt3DRender.QGraphicsApiFilter is not None assert Qt3DRender.QAbstractTexture is not None assert Qt3DRender.QRenderCaptureReply is not None assert Qt3DRender.QAbstractLight is not None assert Qt3DRender.QAbstractRayCaster is not None assert Qt3DRender.QDirectionalLight is not None assert Qt3DRender.QDispatchCompute is not None assert Qt3DRender.QBufferDataGenerator is not None assert Qt3DRender.QPointLight is not None assert Qt3DRender.QStencilTestArguments is not None assert Qt3DRender.QTexture1D is not None assert Qt3DRender.QCameraSelector is not None assert Qt3DRender.QProximityFilter is not None assert Qt3DRender.QTexture1DArray is not None assert Qt3DRender.QBlendEquation is not None assert Qt3DRender.QTextureImageDataGenerator is not None assert Qt3DRender.QSpotLight is not None assert Qt3DRender.QEffect is not None assert Qt3DRender.QSeamlessCubemap is not None assert Qt3DRender.QTexture2DMultisampleArray is not None assert Qt3DRender.QComputeCommand is not None assert Qt3DRender.QFrameGraphNode is not None assert Qt3DRender.QSortPolicy is not None assert Qt3DRender.QTextureImageData is not None assert Qt3DRender.QCamera is not None assert Qt3DRender.QGeometry is not None assert Qt3DRender.QScreenRayCaster is not None assert Qt3DRender.QClipPlane is not None assert Qt3DRender.QMultiSampleAntiAliasing is not None assert Qt3DRender.QRayCasterHit is not None assert Qt3DRender.QAbstractTextureImage is not None assert Qt3DRender.QNoDraw is not None assert Qt3DRender.QPickEvent is not None assert Qt3DRender.QRenderCapture is not None assert Qt3DRender.QDepthTest is not None assert Qt3DRender.QParameter is not None assert Qt3DRender.QLevelOfDetail is not None assert Qt3DRender.QGeometryFactory is not None assert Qt3DRender.QTexture2D is not None assert Qt3DRender.QRenderAspect is not None assert Qt3DRender.QPaintedTextureImage is not None assert Qt3DRender.QDithering is not None assert Qt3DRender.QTextureGenerator is not None assert Qt3DRender.QBlendEquationArguments is not None assert Qt3DRender.QLevelOfDetailBoundingSphere is not None assert Qt3DRender.QColorMask is not None assert Qt3DRender.QSceneLoader is not None assert Qt3DRender.QTextureLoader is not None assert Qt3DRender.QShaderProgram is not None assert Qt3DRender.QTextureCubeMap is not None assert Qt3DRender.QTexture2DArray is not None assert Qt3DRender.QTextureImage is not None assert Qt3DRender.QCameraLens is not None assert Qt3DRender.QRenderTargetOutput is not None assert Qt3DRender.QShaderProgramBuilder is not None assert Qt3DRender.QTechnique is not None assert Qt3DRender.QShaderData is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qtaxcontainer.py0000666000000000000000000000036714274763266016024 0ustar00import pytest def test_qtaxcontainer(): """Test the qtpy.QtAxContainer namespace""" QtAxContainer = pytest.importorskip("qtpy.QtAxContainer") assert QtAxContainer.QAxSelect is not None assert QtAxContainer.QAxWidget is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtbluetooth.py0000666000000000000000000000101114473413726015473 0ustar00import pytest def test_qtbluetooth(): """Test the qtpy.QtBluetooth namespace""" QtBluetooth = pytest.importorskip("qtpy.QtBluetooth") assert QtBluetooth.QBluetooth is not None assert QtBluetooth.QBluetoothDeviceInfo is not None assert QtBluetooth.QBluetoothServer is not None assert QtBluetooth.QBluetoothSocket is not None assert QtBluetooth.QBluetoothAddress is not None assert QtBluetooth.QBluetoothUuid is not None assert QtBluetooth.QBluetoothServiceDiscoveryAgent is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtcharts.py0000666000000000000000000000054614473413726014766 0ustar00import pytest from qtpy import PYSIDE2, PYSIDE6 @pytest.mark.skipif( not (PYSIDE2 or PYSIDE6), reason="Only available by default in PySide", ) def test_qtcharts(): """Test the qtpy.QtCharts namespace""" QtCharts = pytest.importorskip("qtpy.QtCharts") assert QtCharts.QChart is not None assert QtCharts.QtCharts.QChart is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtconcurrent.py0000666000000000000000000000106614473413726015662 0ustar00import pytest from packaging.version import parse from qtpy import PYSIDE2, PYSIDE_VERSION def test_qtconcurrent(): """Test the qtpy.QtConcurrent namespace""" QtConcurrent = pytest.importorskip("qtpy.QtConcurrent") assert QtConcurrent.QtConcurrent is not None if PYSIDE2 and parse(PYSIDE_VERSION) >= parse("5.15.2"): assert QtConcurrent.QFutureQString is not None assert QtConcurrent.QFutureVoid is not None assert QtConcurrent.QFutureWatcherQString is not None assert QtConcurrent.QFutureWatcherVoid is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtcore.py0000666000000000000000000001514014473413726014426 0ustar00"""Test QtCore.""" import enum import sys from datetime import date, datetime, time import pytest from packaging.version import parse from qtpy import ( PYQT5, PYQT6, PYQT_VERSION, PYSIDE2, PYSIDE_VERSION, QtCore, ) _now = datetime.now() # Make integer milliseconds; `floor` here, don't `round`! NOW = _now.replace(microsecond=(_now.microsecond // 1000 * 1000)) def test_qtmsghandler(): """Test qtpy.QtMsgHandler""" assert QtCore.qInstallMessageHandler is not None @pytest.mark.parametrize("method", ["toPython", "toPyDateTime"]) def test_QDateTime_toPython_and_toPyDateTime(method): """Test `QDateTime.toPython` and `QDateTime.toPyDateTime`""" q_datetime = QtCore.QDateTime(NOW) py_datetime = getattr(q_datetime, method)() assert isinstance(py_datetime, datetime) assert py_datetime == NOW @pytest.mark.parametrize("method", ["toPython", "toPyDate"]) def test_QDate_toPython_and_toPyDate(method): """Test `QDate.toPython` and `QDate.toPyDate`""" q_date = QtCore.QDateTime(NOW).date() py_date = getattr(q_date, method)() assert isinstance(py_date, date) assert py_date == NOW.date() @pytest.mark.parametrize("method", ["toPython", "toPyTime"]) def test_QTime_toPython_and_toPyTime(method): """Test `QTime.toPython` and `QTime.toPyTime`""" q_time = QtCore.QDateTime(NOW).time() py_time = getattr(q_time, method)() assert isinstance(py_time, time) assert py_time == NOW.time() def test_qeventloop_exec(qtbot): """Test `QEventLoop.exec_` and `QEventLoop.exec`""" assert QtCore.QEventLoop.exec_ is not None assert QtCore.QEventLoop.exec is not None event_loop = QtCore.QEventLoop(None) QtCore.QTimer.singleShot(100, event_loop.quit) event_loop.exec_() QtCore.QTimer.singleShot(100, event_loop.quit) event_loop.exec() def test_qthread_exec(): """Test `QThread.exec_` and `QThread.exec_`""" assert QtCore.QThread.exec_ is not None assert QtCore.QThread.exec is not None @pytest.mark.skipif( PYSIDE2 and parse(PYSIDE_VERSION) < parse("5.15"), reason="QEnum macro doesn't seem to be present on PySide2 <5.15", ) def test_qenum(): """Test QEnum macro""" class EnumTest(QtCore.QObject): class Position(enum.IntEnum): West = 0 North = 1 South = 2 East = 3 QtCore.QEnum(Position) obj = EnumTest() assert obj.metaObject().enumerator(0).name() == "Position" def test_QLibraryInfo_location_and_path(): """Test `QLibraryInfo.location` and `QLibraryInfo.path`""" assert QtCore.QLibraryInfo.location is not None assert ( QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.PrefixPath) is not None ) assert QtCore.QLibraryInfo.path is not None assert QtCore.QLibraryInfo.path(QtCore.QLibraryInfo.PrefixPath) is not None def test_QLibraryInfo_LibraryLocation_and_LibraryPath(): """Test `QLibraryInfo.LibraryLocation` and `QLibraryInfo.LibraryPath`""" assert QtCore.QLibraryInfo.LibraryLocation is not None assert QtCore.QLibraryInfo.LibraryPath is not None def test_QCoreApplication_exec_(qapp): """Test `QtCore.QCoreApplication.exec_`""" assert QtCore.QCoreApplication.exec_ is not None app = QtCore.QCoreApplication.instance() or QtCore.QCoreApplication( [sys.executable, __file__], ) assert app is not None QtCore.QTimer.singleShot(100, QtCore.QCoreApplication.instance().quit) QtCore.QCoreApplication.exec_() app = QtCore.QCoreApplication.instance() or QtCore.QCoreApplication( [sys.executable, __file__], ) assert app is not None QtCore.QTimer.singleShot(100, QtCore.QCoreApplication.instance().quit) app.exec_() def test_QCoreApplication_exec(qapp): """Test `QtCore.QCoreApplication.exec`""" assert QtCore.QCoreApplication.exec is not None app = QtCore.QCoreApplication.instance() or QtCore.QCoreApplication( [sys.executable, __file__], ) assert app is not None QtCore.QTimer.singleShot(100, QtCore.QCoreApplication.instance().quit) QtCore.QCoreApplication.exec() app = QtCore.QCoreApplication.instance() or QtCore.QCoreApplication( [sys.executable, __file__], ) assert app is not None QtCore.QTimer.singleShot(100, QtCore.QCoreApplication.instance().quit) app.exec() @pytest.mark.skipif( PYQT5 or PYQT6, reason="Doesn't seem to be present on PyQt5 and PyQt6", ) def test_qtextstreammanipulator_exec(): """Test `QTextStreamManipulator.exec_` and `QTextStreamManipulator.exec`""" assert QtCore.QTextStreamManipulator.exec_ is not None assert QtCore.QTextStreamManipulator.exec is not None @pytest.mark.skipif( PYSIDE2 or PYQT6, reason="Doesn't seem to be present on PySide2 and PyQt6", ) def test_QtCore_SignalInstance(): class ClassWithSignal(QtCore.QObject): signal = QtCore.Signal() instance = ClassWithSignal() assert isinstance(instance.signal, QtCore.SignalInstance) @pytest.mark.skipif( PYQT5 and PYQT_VERSION.startswith("5.9"), reason="A specific setup with at least sip 4.9.9 is needed for PyQt5 5.9.*" "to work with scoped enum access", ) def test_enum_access(): """Test scoped and unscoped enum access for qtpy.QtCore.*.""" assert ( QtCore.QAbstractAnimation.Stopped == QtCore.QAbstractAnimation.State.Stopped ) assert QtCore.QEvent.ActionAdded == QtCore.QEvent.Type.ActionAdded assert QtCore.Qt.AlignLeft == QtCore.Qt.AlignmentFlag.AlignLeft assert QtCore.Qt.Key_Return == QtCore.Qt.Key.Key_Return assert QtCore.Qt.transparent == QtCore.Qt.GlobalColor.transparent assert QtCore.Qt.Widget == QtCore.Qt.WindowType.Widget assert QtCore.Qt.BackButton == QtCore.Qt.MouseButton.BackButton assert QtCore.Qt.XButton1 == QtCore.Qt.MouseButton.XButton1 assert ( QtCore.Qt.BackgroundColorRole == QtCore.Qt.ItemDataRole.BackgroundColorRole ) assert QtCore.Qt.TextColorRole == QtCore.Qt.ItemDataRole.TextColorRole assert QtCore.Qt.MidButton == QtCore.Qt.MouseButton.MiddleButton @pytest.mark.skipif( PYSIDE2 and PYSIDE_VERSION.startswith("5.12.0"), reason="Utility functions unavailable for PySide2 5.12.0", ) def test_qtgui_namespace_mightBeRichText(): """ Test included elements (mightBeRichText) from module QtGui. See: https://doc.qt.io/qt-5/qt-sub-qtgui.html """ assert QtCore.Qt.mightBeRichText is not None def test_itemflags_typedef(): """ Test existence of `QFlags` typedef `ItemFlags` that was removed from PyQt6 """ assert QtCore.Qt.ItemFlags is not None assert QtCore.Qt.ItemFlags() == QtCore.Qt.ItemFlag(0) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtdatavisualization.py0000666000000000000000000001142514473413726017233 0ustar00import pytest def test_qtdatavisualization(): """Test the qtpy.QtDataVisualization namespace""" # Using import skip here since with Python 3 you need to install another package # besides the base `PyQt5` or `PySide2`. # For example in the case of `PyQt5` you need `PyQtDataVisualization` # QtDataVisualization QtDataVisualization = pytest.importorskip("qtpy.QtDataVisualization") assert QtDataVisualization.QScatter3DSeries is not None assert QtDataVisualization.QSurfaceDataItem is not None assert QtDataVisualization.QSurface3DSeries is not None assert QtDataVisualization.QAbstract3DInputHandler is not None assert QtDataVisualization.QHeightMapSurfaceDataProxy is not None assert QtDataVisualization.QAbstractDataProxy is not None assert QtDataVisualization.Q3DCamera is not None assert QtDataVisualization.QAbstract3DGraph is not None assert QtDataVisualization.QCustom3DVolume is not None assert QtDataVisualization.Q3DInputHandler is not None assert QtDataVisualization.QBarDataProxy is not None assert QtDataVisualization.QSurfaceDataProxy is not None assert QtDataVisualization.QScatterDataItem is not None assert QtDataVisualization.Q3DLight is not None assert QtDataVisualization.QScatterDataProxy is not None assert QtDataVisualization.QValue3DAxis is not None assert QtDataVisualization.Q3DBars is not None assert QtDataVisualization.QBarDataItem is not None assert QtDataVisualization.QItemModelBarDataProxy is not None assert QtDataVisualization.Q3DTheme is not None assert QtDataVisualization.QCustom3DItem is not None assert QtDataVisualization.QItemModelScatterDataProxy is not None assert QtDataVisualization.QValue3DAxisFormatter is not None assert QtDataVisualization.QItemModelSurfaceDataProxy is not None assert QtDataVisualization.Q3DScatter is not None assert QtDataVisualization.QTouch3DInputHandler is not None assert QtDataVisualization.QBar3DSeries is not None assert QtDataVisualization.QAbstract3DAxis is not None assert QtDataVisualization.Q3DScene is not None assert QtDataVisualization.QCategory3DAxis is not None assert QtDataVisualization.QAbstract3DSeries is not None assert QtDataVisualization.Q3DObject is not None assert QtDataVisualization.QCustom3DLabel is not None assert QtDataVisualization.Q3DSurface is not None assert QtDataVisualization.QLogValue3DAxisFormatter is not None # QtDatavisualization # import qtpy to get alias for `QtDataVisualization` with lower `v` qtpy = pytest.importorskip("qtpy") assert qtpy.QtDatavisualization.QScatter3DSeries is not None assert qtpy.QtDatavisualization.QSurfaceDataItem is not None assert qtpy.QtDatavisualization.QSurface3DSeries is not None assert qtpy.QtDatavisualization.QAbstract3DInputHandler is not None assert qtpy.QtDatavisualization.QHeightMapSurfaceDataProxy is not None assert qtpy.QtDatavisualization.QAbstractDataProxy is not None assert qtpy.QtDatavisualization.Q3DCamera is not None assert qtpy.QtDatavisualization.QAbstract3DGraph is not None assert qtpy.QtDatavisualization.QCustom3DVolume is not None assert qtpy.QtDatavisualization.Q3DInputHandler is not None assert qtpy.QtDatavisualization.QBarDataProxy is not None assert qtpy.QtDatavisualization.QSurfaceDataProxy is not None assert qtpy.QtDatavisualization.QScatterDataItem is not None assert qtpy.QtDatavisualization.Q3DLight is not None assert qtpy.QtDatavisualization.QScatterDataProxy is not None assert qtpy.QtDatavisualization.QValue3DAxis is not None assert qtpy.QtDatavisualization.Q3DBars is not None assert qtpy.QtDatavisualization.QBarDataItem is not None assert qtpy.QtDatavisualization.QItemModelBarDataProxy is not None assert qtpy.QtDatavisualization.Q3DTheme is not None assert qtpy.QtDatavisualization.QCustom3DItem is not None assert qtpy.QtDatavisualization.QItemModelScatterDataProxy is not None assert qtpy.QtDatavisualization.QValue3DAxisFormatter is not None assert qtpy.QtDatavisualization.QItemModelSurfaceDataProxy is not None assert qtpy.QtDatavisualization.Q3DScatter is not None assert qtpy.QtDatavisualization.QTouch3DInputHandler is not None assert qtpy.QtDatavisualization.QBar3DSeries is not None assert qtpy.QtDatavisualization.QAbstract3DAxis is not None assert qtpy.QtDatavisualization.Q3DScene is not None assert qtpy.QtDatavisualization.QCategory3DAxis is not None assert qtpy.QtDatavisualization.QAbstract3DSeries is not None assert qtpy.QtDatavisualization.Q3DObject is not None assert qtpy.QtDatavisualization.QCustom3DLabel is not None assert qtpy.QtDatavisualization.Q3DSurface is not None assert qtpy.QtDatavisualization.QLogValue3DAxisFormatter is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtdbus.py0000666000000000000000000000047714473413726014442 0ustar00import pytest def test_qtdbus(): """Test the qtpy.QtDBus namespace""" QtDBus = pytest.importorskip("qtpy.QtDBus") assert QtDBus.QDBusAbstractAdaptor is not None assert QtDBus.QDBusAbstractInterface is not None assert QtDBus.QDBusArgument is not None assert QtDBus.QDBusConnection is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtdesigner.py0000666000000000000000000000263514473413726015303 0ustar00import pytest from qtpy import PYSIDE2 @pytest.mark.skipif(PYSIDE2, reason="QtDesigner is not available in PySide2") def test_qtdesigner(): """Test the qtpy.QtDesigner namespace.""" QtDesigner = pytest.importorskip("qtpy.QtDesigner") assert QtDesigner.QAbstractExtensionFactory is not None assert QtDesigner.QAbstractExtensionManager is not None assert QtDesigner.QDesignerActionEditorInterface is not None assert QtDesigner.QDesignerContainerExtension is not None assert QtDesigner.QDesignerCustomWidgetCollectionInterface is not None assert QtDesigner.QDesignerCustomWidgetInterface is not None assert QtDesigner.QDesignerFormEditorInterface is not None assert QtDesigner.QDesignerFormWindowCursorInterface is not None assert QtDesigner.QDesignerFormWindowInterface is not None assert QtDesigner.QDesignerFormWindowManagerInterface is not None assert QtDesigner.QDesignerMemberSheetExtension is not None assert QtDesigner.QDesignerObjectInspectorInterface is not None assert QtDesigner.QDesignerPropertyEditorInterface is not None assert QtDesigner.QDesignerPropertySheetExtension is not None assert QtDesigner.QDesignerTaskMenuExtension is not None assert QtDesigner.QDesignerWidgetBoxInterface is not None assert QtDesigner.QExtensionFactory is not None assert QtDesigner.QExtensionManager is not None assert QtDesigner.QFormBuilder is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtgui.py0000666000000000000000000001512314473413726014263 0ustar00"""Test QtGui.""" import sys import pytest from qtpy import ( PYQT5, PYQT_VERSION, PYSIDE2, PYSIDE6, QtCore, QtGui, QtWidgets, ) from qtpy.tests.utils import not_using_conda def test_qfontmetrics_width(qtbot): """Test QFontMetrics and QFontMetricsF width""" assert QtGui.QFontMetrics.width is not None assert QtGui.QFontMetricsF.width is not None font = QtGui.QFont("times", 24) font_metrics = QtGui.QFontMetrics(font) font_metricsF = QtGui.QFontMetricsF(font) width = font_metrics.width("Test") widthF = font_metricsF.width("Test") assert width in range(40, 62) assert 39 <= widthF <= 63 def test_qdrag_functions(qtbot): """Test functions mapping for QtGui.QDrag.""" assert QtGui.QDrag.exec_ is not None drag = QtGui.QDrag(None) drag.exec_() def test_QGuiApplication_exec_(): """Test `QtGui.QGuiApplication.exec_`""" assert QtGui.QGuiApplication.exec_ is not None app = QtGui.QGuiApplication.instance() or QtGui.QGuiApplication( [sys.executable, __file__], ) assert app is not None QtCore.QTimer.singleShot(100, QtGui.QGuiApplication.instance().quit) QtGui.QGuiApplication.exec_() app = QtGui.QGuiApplication.instance() or QtGui.QGuiApplication( [sys.executable, __file__], ) assert app is not None QtCore.QTimer.singleShot(100, QtGui.QGuiApplication.instance().quit) app.exec_() def test_what_moved_to_qtgui_in_qt6(): """Test what has been moved to QtGui in Qt6""" assert QtGui.QAction is not None assert QtGui.QActionGroup is not None assert QtGui.QFileSystemModel is not None assert QtGui.QShortcut is not None assert QtGui.QUndoCommand is not None def test_qtextdocument_functions(pdf_writer): """Test functions mapping for QtGui.QTextDocument.""" assert QtGui.QTextDocument.print_ is not None text_document = QtGui.QTextDocument("Test") print_device, output_path = pdf_writer text_document.print_(print_device) assert output_path.exists() @pytest.mark.skipif( PYQT5 and PYQT_VERSION.startswith("5.9"), reason="A specific setup with at least sip 4.9.9 is needed for PyQt5 5.9.*" "to work with scoped enum access", ) def test_enum_access(): """Test scoped and unscoped enum access for qtpy.QtWidgets.*.""" assert QtGui.QColor.Rgb == QtGui.QColor.Spec.Rgb assert QtGui.QFont.AllUppercase == QtGui.QFont.Capitalization.AllUppercase assert QtGui.QIcon.Normal == QtGui.QIcon.Mode.Normal assert QtGui.QImage.Format_Invalid == QtGui.QImage.Format.Format_Invalid @pytest.mark.skipif( sys.platform == "darwin" and sys.version_info[:2] == (3, 7), reason="Stalls on macOS CI with Python 3.7", ) def test_QSomethingEvent_pos_functions(qtbot): """ Test `QMouseEvent.pos` and related functions removed in Qt 6, and `QMouseEvent.position`, etc., missing from Qt 5. """ class Window(QtWidgets.QMainWindow): def mouseDoubleClickEvent(self, event: QtGui.QMouseEvent) -> None: assert event.globalPos() - event.pos() == self.mapToParent( QtCore.QPoint(0, 0), ) assert event.pos().x() == event.x() assert event.pos().y() == event.y() assert event.globalPos().x() == event.globalX() assert event.globalPos().y() == event.globalY() assert event.position().x() == event.pos().x() assert event.position().y() == event.pos().y() assert event.globalPosition().x() == event.globalPos().x() assert event.globalPosition().y() == event.globalPos().y() event.accept() window = Window() window.setMinimumSize(320, 240) # ensure the window is of sufficient size window.show() with qtbot.waitExposed(window): qtbot.mouseMove(window, QtCore.QPoint(42, 6 * 9)) qtbot.mouseDClick(window, QtCore.Qt.LeftButton) # the rest of the functions are not actually tested # QSinglePointEvent (Qt6) child classes checks for _class in ("QNativeGestureEvent", "QEnterEvent", "QTabletEvent"): for _function in ( "pos", "x", "y", "globalPos", "globalX", "globalY", "position", "globalPosition", ): assert hasattr(getattr(QtGui, _class), _function) # QHoverEvent checks for _function in ("pos", "x", "y", "position"): assert hasattr(QtGui.QHoverEvent, _function) # QDropEvent and child classes checks for _class in ("QDropEvent", "QDragMoveEvent", "QDragEnterEvent"): for _function in ("pos", "posF", "position"): assert hasattr(getattr(QtGui, _class), _function) @pytest.mark.skipif( not (PYSIDE2 or PYSIDE6), reason="PySide{2,6} specific test", ) def test_qtextcursor_moveposition(): """Test monkeypatched QTextCursor.movePosition""" doc = QtGui.QTextDocument("foo bar baz") cursor = QtGui.QTextCursor(doc) assert not cursor.movePosition(QtGui.QTextCursor.Start) assert cursor.movePosition( QtGui.QTextCursor.EndOfWord, mode=QtGui.QTextCursor.KeepAnchor, ) assert cursor.selectedText() == "foo" assert cursor.movePosition(QtGui.QTextCursor.Start) assert cursor.movePosition( QtGui.QTextCursor.WordRight, n=2, mode=QtGui.QTextCursor.KeepAnchor, ) assert cursor.selectedText() == "foo bar " assert cursor.movePosition(QtGui.QTextCursor.Start) assert cursor.position() == cursor.anchor() assert cursor.movePosition( QtGui.QTextCursor.NextWord, QtGui.QTextCursor.KeepAnchor, 3, ) assert cursor.selectedText() == "foo bar baz" def test_opengl_imports(): """ Test for presence of QOpenGL* classes. These classes were members of QtGui in Qt5, but moved to QtOpenGL in Qt6. QtPy makes them available in QtGui to maintain compatibility. """ assert QtGui.QOpenGLBuffer is not None assert QtGui.QOpenGLContext is not None assert QtGui.QOpenGLContextGroup is not None assert QtGui.QOpenGLDebugLogger is not None assert QtGui.QOpenGLDebugMessage is not None assert QtGui.QOpenGLFramebufferObject is not None assert QtGui.QOpenGLFramebufferObjectFormat is not None assert QtGui.QOpenGLPixelTransferOptions is not None assert QtGui.QOpenGLShader is not None assert QtGui.QOpenGLShaderProgram is not None assert QtGui.QOpenGLTexture is not None assert QtGui.QOpenGLTextureBlitter is not None assert QtGui.QOpenGLVersionProfile is not None assert QtGui.QOpenGLVertexArrayObject is not None assert QtGui.QOpenGLWindow is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qthelp.py0000666000000000000000000000121414473413726014423 0ustar00"""Test for QtHelp namespace.""" def test_qthelp(): """Test the qtpy.QtHelp namespace.""" from qtpy import QtHelp assert QtHelp.QHelpContentItem is not None assert QtHelp.QHelpContentModel is not None assert QtHelp.QHelpContentWidget is not None assert QtHelp.QHelpEngine is not None assert QtHelp.QHelpEngineCore is not None assert QtHelp.QHelpIndexModel is not None assert QtHelp.QHelpIndexWidget is not None assert QtHelp.QHelpSearchEngine is not None assert QtHelp.QHelpSearchQuery is not None assert QtHelp.QHelpSearchQueryWidget is not None assert QtHelp.QHelpSearchResultWidget is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtlocation.py0000666000000000000000000000432014473413726015304 0ustar00import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif( not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings", ) def test_qtlocation(): """Test the qtpy.QtLocation namespace""" from qtpy import QtLocation if PYSIDE2: assert QtLocation.QGeoServiceProviderFactory is not None assert QtLocation.QGeoCodeReply is not None assert QtLocation.QGeoCodingManager is not None assert QtLocation.QGeoCodingManagerEngine is not None assert QtLocation.QGeoManeuver is not None assert QtLocation.QGeoRoute is not None assert QtLocation.QGeoRouteReply is not None assert QtLocation.QGeoRouteRequest is not None assert QtLocation.QGeoRouteSegment is not None assert QtLocation.QGeoRoutingManager is not None assert QtLocation.QGeoRoutingManagerEngine is not None assert QtLocation.QGeoServiceProvider is not None assert QtLocation.QPlace is not None assert QtLocation.QPlaceAttribute is not None assert QtLocation.QPlaceCategory is not None assert QtLocation.QPlaceContactDetail is not None assert QtLocation.QPlaceContent is not None assert QtLocation.QPlaceContentReply is not None assert QtLocation.QPlaceContentRequest is not None assert QtLocation.QPlaceDetailsReply is not None assert QtLocation.QPlaceEditorial is not None assert QtLocation.QPlaceIcon is not None assert QtLocation.QPlaceIdReply is not None assert QtLocation.QPlaceImage is not None assert QtLocation.QPlaceManager is not None assert QtLocation.QPlaceManagerEngine is not None assert QtLocation.QPlaceMatchReply is not None assert QtLocation.QPlaceMatchRequest is not None assert QtLocation.QPlaceProposedSearchResult is not None assert QtLocation.QPlaceRatings is not None assert QtLocation.QPlaceReply is not None assert QtLocation.QPlaceResult is not None assert QtLocation.QPlaceReview is not None assert QtLocation.QPlaceSearchReply is not None assert QtLocation.QPlaceSearchRequest is not None assert QtLocation.QPlaceSearchResult is not None assert QtLocation.QPlaceSearchSuggestionReply is not None assert QtLocation.QPlaceSupplier is not None assert QtLocation.QPlaceUser is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtmacextras.py0000666000000000000000000000115614473413726015467 0ustar00import sys import pytest from qtpy import PYQT6, PYSIDE6 from qtpy.tests.utils import using_conda @pytest.mark.skipif( PYQT6 or PYSIDE6, reason="Not available on Qt6-based bindings", ) @pytest.mark.skipif( sys.platform != "darwin" or using_conda(), reason="Only available in Qt5 bindings > 5.9 with pip on mac in CIs", ) def test_qtmacextras(): """Test the qtpy.QtMacExtras namespace""" QtMacExtras = pytest.importorskip("qtpy.QtMacExtras") assert QtMacExtras.QMacPasteboardMime is not None assert QtMacExtras.QMacToolBar is not None assert QtMacExtras.QMacToolBarItem is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtmultimedia.py0000666000000000000000000000071014473413726015625 0ustar00import sys import pytest from qtpy import PYQT6, PYSIDE6 def test_qtmultimedia(): """Test the qtpy.QtMultimedia namespace""" from qtpy import QtMultimedia assert QtMultimedia.QAudio is not None assert QtMultimedia.QAudioInput is not None if not (PYSIDE6 or PYQT6): assert QtMultimedia.QAbstractVideoBuffer is not None assert QtMultimedia.QAudioDeviceInfo is not None assert QtMultimedia.QSound is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtmultimediawidgets.py0000666000000000000000000000073114473413726017217 0ustar00"""Test QtMultimediaWidgets.""" from qtpy import PYQT5, PYSIDE2 def test_qtmultimediawidgets(): """Test the qtpy.QtMultimediaWidgets namespace""" from qtpy import QtMultimediaWidgets if PYQT5 or PYSIDE2: assert QtMultimediaWidgets.QCameraViewfinder is not None # assert QtMultimediaWidgets.QVideoWidgetControl is not None assert QtMultimediaWidgets.QGraphicsVideoItem is not None assert QtMultimediaWidgets.QVideoWidget is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtnetwork.py0000666000000000000000000000340714473413726015172 0ustar00from qtpy import PYQT6, PYSIDE2, PYSIDE6, QtNetwork def test_qtnetwork(): """Test the qtpy.QtNetwork namespace""" assert QtNetwork.QAbstractNetworkCache is not None assert QtNetwork.QNetworkCacheMetaData is not None if not PYSIDE2: assert QtNetwork.QHttpMultiPart is not None assert QtNetwork.QHttpPart is not None assert QtNetwork.QNetworkAccessManager is not None assert QtNetwork.QNetworkCookie is not None assert QtNetwork.QNetworkCookieJar is not None assert QtNetwork.QNetworkDiskCache is not None assert QtNetwork.QNetworkReply is not None assert QtNetwork.QNetworkRequest is not None if not (PYSIDE6 or PYQT6): assert QtNetwork.QNetworkConfigurationManager is not None assert QtNetwork.QNetworkConfiguration is not None assert QtNetwork.QNetworkSession is not None assert QtNetwork.QAuthenticator is not None assert QtNetwork.QHostAddress is not None assert QtNetwork.QHostInfo is not None assert QtNetwork.QNetworkAddressEntry is not None assert QtNetwork.QNetworkInterface is not None assert QtNetwork.QNetworkProxy is not None assert QtNetwork.QNetworkProxyFactory is not None assert QtNetwork.QNetworkProxyQuery is not None assert QtNetwork.QAbstractSocket is not None assert QtNetwork.QLocalServer is not None assert QtNetwork.QLocalSocket is not None assert QtNetwork.QTcpServer is not None assert QtNetwork.QTcpSocket is not None assert QtNetwork.QUdpSocket is not None assert QtNetwork.QSslCertificate is not None assert QtNetwork.QSslCipher is not None assert QtNetwork.QSslConfiguration is not None assert QtNetwork.QSslError is not None assert QtNetwork.QSslKey is not None assert QtNetwork.QSslSocket is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtnetworkauth.py0000666000000000000000000000112014473413726016042 0ustar00import pytest from qtpy import PYQT5, PYQT6, PYSIDE2 @pytest.mark.skipif(PYSIDE2, reason="Not available for PySide2") def test_qtnetworkauth(): """Test the qtpy.QtNetworkAuth namespace""" QtNetworkAuth = pytest.importorskip("qtpy.QtNetworkAuth") assert QtNetworkAuth.QAbstractOAuth is not None assert QtNetworkAuth.QAbstractOAuth2 is not None assert QtNetworkAuth.QAbstractOAuthReplyHandler is not None assert QtNetworkAuth.QOAuth1 is not None assert QtNetworkAuth.QOAuth1Signature is not None assert QtNetworkAuth.QOAuth2AuthorizationCodeFlow is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtopengl.py0000666000000000000000000000176314473413726014770 0ustar00def test_qtopengl(): """Test the qtpy.QtOpenGL namespace""" from qtpy import QtOpenGL assert QtOpenGL.QOpenGLBuffer is not None assert QtOpenGL.QOpenGLContext is not None assert QtOpenGL.QOpenGLContextGroup is not None assert QtOpenGL.QOpenGLDebugLogger is not None assert QtOpenGL.QOpenGLDebugMessage is not None assert QtOpenGL.QOpenGLFramebufferObject is not None assert QtOpenGL.QOpenGLFramebufferObjectFormat is not None assert QtOpenGL.QOpenGLPixelTransferOptions is not None assert QtOpenGL.QOpenGLShader is not None assert QtOpenGL.QOpenGLShaderProgram is not None assert QtOpenGL.QOpenGLTexture is not None assert QtOpenGL.QOpenGLTextureBlitter is not None assert QtOpenGL.QOpenGLVersionProfile is not None assert QtOpenGL.QOpenGLVertexArrayObject is not None assert QtOpenGL.QOpenGLWindow is not None # We do not test for QOpenGLTimeMonitor or QOpenGLTimerQuery as # they are not present on some architectures such as armhf ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtopenglwidgets.py0000666000000000000000000000045114473413726016350 0ustar00import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(PYSIDE2 or PYQT5, reason="Not available in PySide2/PyQt5") def test_qtopenglwidgets(): """Test the qtpy.QtOpenGLWidgets namespace""" from qtpy import QtOpenGLWidgets assert QtOpenGLWidgets.QOpenGLWidget is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667851260.0 QtPy-2.4.1/qtpy/tests/test_qtpdf.py0000666000000000000000000000036414332261774014247 0ustar00import pytest def test_qtpdf(): """Test the qtpy.QtPdf namespace""" QtPdf = pytest.importorskip("qtpy.QtPdf") assert QtPdf.QPdfDocument is not None assert QtPdf.QPdfLink is not None assert QtPdf.QPdfSelection is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667851260.0 QtPy-2.4.1/qtpy/tests/test_qtpdfwidgets.py0000666000000000000000000000030214332261774015626 0ustar00import pytest def test_qtpdfwidgets(): """Test the qtpy.QtPdfWidgets namespace""" QtPdfWidgets = pytest.importorskip("qtpy.QtPdfWidgets") assert QtPdfWidgets.QPdfView is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtpositioning.py0000666000000000000000000000256714473413726016051 0ustar00import pytest from qtpy import QT6 from qtpy.tests.utils import using_conda @pytest.mark.skipif( QT6 and using_conda(), reason="QPositioning bindings not included in Conda qt-main >= 6.4.3.", ) def test_qtpositioning(): """Test the qtpy.QtPositioning namespace""" from qtpy import QtPositioning assert QtPositioning.QGeoAddress is not None assert QtPositioning.QGeoAreaMonitorInfo is not None assert QtPositioning.QGeoAreaMonitorSource is not None assert QtPositioning.QGeoCircle is not None assert QtPositioning.QGeoCoordinate is not None assert QtPositioning.QGeoLocation is not None assert QtPositioning.QGeoPath is not None # CI for 3.7 uses Qt 5.9 # assert QtPositioning.QGeoPolygon is not None # New in Qt 5.10 assert QtPositioning.QGeoPositionInfo is not None assert QtPositioning.QGeoPositionInfoSource is not None # QGeoPositionInfoSourceFactory is not available in PyQt # assert QtPositioning.QGeoPositionInfoSourceFactory is not None # New in Qt 5.2 # assert QtPositioning.QGeoPositionInfoSourceFactoryV2 is not None # New in Qt 5.14 assert QtPositioning.QGeoRectangle is not None assert QtPositioning.QGeoSatelliteInfo is not None assert QtPositioning.QGeoSatelliteInfoSource is not None assert QtPositioning.QGeoShape is not None assert QtPositioning.QNmeaPositionInfoSource is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtprintsupport.py0000666000000000000000000000220214473413726016262 0ustar00"""Test QtPrintSupport.""" import sys import pytest from qtpy import QtPrintSupport def test_qtprintsupport(): """Test the qtpy.QtPrintSupport namespace""" assert QtPrintSupport.QAbstractPrintDialog is not None assert QtPrintSupport.QPageSetupDialog is not None assert QtPrintSupport.QPrintDialog is not None assert QtPrintSupport.QPrintPreviewDialog is not None assert QtPrintSupport.QPrintEngine is not None assert QtPrintSupport.QPrinter is not None assert QtPrintSupport.QPrinterInfo is not None assert QtPrintSupport.QPrintPreviewWidget is not None def test_qpagesetupdialog_exec_(): """Test qtpy.QtPrintSupport.QPageSetupDialog exec_""" assert QtPrintSupport.QPageSetupDialog.exec_ is not None def test_qprintdialog_exec_(): """Test qtpy.QtPrintSupport.QPrintDialog exec_""" assert QtPrintSupport.QPrintDialog.exec_ is not None def test_qprintpreviewwidget_print_(qtbot): """Test qtpy.QtPrintSupport.QPrintPreviewWidget print_""" assert QtPrintSupport.QPrintPreviewWidget.print_ is not None preview_widget = QtPrintSupport.QPrintPreviewWidget() preview_widget.print_() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qtpurchasing.py0000666000000000000000000000045514274763266015652 0ustar00import pytest def test_qtpurchasing(): """Test the qtpy.QtPurchasing namespace""" QtPurchasing = pytest.importorskip("qtpy.QtPurchasing") assert QtPurchasing.QInAppProduct is not None assert QtPurchasing.QInAppStore is not None assert QtPurchasing.QInAppTransaction is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtqml.py0000666000000000000000000000241314473413726014266 0ustar00from qtpy import PYSIDE2, PYSIDE6 def test_qtqml(): """Test the qtpy.QtQml namespace""" from qtpy import QtQml assert QtQml.QJSEngine is not None assert QtQml.QJSValue is not None assert QtQml.QJSValueIterator is not None assert QtQml.QQmlAbstractUrlInterceptor is not None assert QtQml.QQmlApplicationEngine is not None assert QtQml.QQmlComponent is not None assert QtQml.QQmlContext is not None assert QtQml.QQmlEngine is not None assert QtQml.QQmlImageProviderBase is not None assert QtQml.QQmlError is not None assert QtQml.QQmlExpression is not None assert QtQml.QQmlExtensionPlugin is not None assert QtQml.QQmlFileSelector is not None assert QtQml.QQmlIncubationController is not None assert QtQml.QQmlIncubator is not None if not (PYSIDE2 or PYSIDE6): # https://wiki.qt.io/Qt_for_Python_Missing_Bindings#QtQml assert QtQml.QQmlListProperty is not None assert QtQml.QQmlListReference is not None assert QtQml.QQmlNetworkAccessManagerFactory is not None assert QtQml.QQmlParserStatus is not None assert QtQml.QQmlProperty is not None assert QtQml.QQmlPropertyValueSource is not None assert QtQml.QQmlScriptString is not None assert QtQml.QQmlPropertyMap is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtquick.py0000666000000000000000000000400514473413726014610 0ustar00from qtpy import PYQT5, PYSIDE2 def test_qtquick(): """Test the qtpy.QtQuick namespace""" from qtpy import QtQuick if PYQT5: assert QtQuick.QQuickCloseEvent is not None assert QtQuick.QSGFlatColorMaterial is not None assert QtQuick.QSGImageNode is not None assert QtQuick.QSGMaterial is not None assert QtQuick.QSGMaterialShader is not None assert QtQuick.QSGOpaqueTextureMaterial is not None assert QtQuick.QSGRectangleNode is not None assert QtQuick.QSGRenderNode is not None assert QtQuick.QSGRendererInterface is not None assert QtQuick.QSGTextureMaterial is not None assert QtQuick.QSGVertexColorMaterial is not None assert QtQuick.QQuickAsyncImageProvider is not None assert QtQuick.QQuickFramebufferObject is not None assert QtQuick.QQuickImageProvider is not None assert QtQuick.QQuickImageResponse is not None assert QtQuick.QQuickItem is not None assert QtQuick.QQuickItemGrabResult is not None assert QtQuick.QQuickPaintedItem is not None assert QtQuick.QQuickRenderControl is not None assert QtQuick.QQuickTextDocument is not None assert QtQuick.QQuickTextureFactory is not None assert QtQuick.QQuickView is not None assert QtQuick.QQuickWindow is not None if PYQT5 or PYSIDE2: assert QtQuick.QSGAbstractRenderer is not None assert QtQuick.QSGEngine is not None assert QtQuick.QSGBasicGeometryNode is not None assert QtQuick.QSGClipNode is not None assert QtQuick.QSGDynamicTexture is not None assert QtQuick.QSGGeometry is not None assert QtQuick.QSGGeometryNode is not None assert QtQuick.QSGMaterialType is not None assert QtQuick.QSGNode is not None assert QtQuick.QSGOpacityNode is not None assert QtQuick.QSGSimpleRectNode is not None assert QtQuick.QSGSimpleTextureNode is not None assert QtQuick.QSGTexture is not None assert QtQuick.QSGTextureProvider is not None assert QtQuick.QSGTransformNode is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qtquick3d.py0000666000000000000000000000042514274763266015047 0ustar00import pytest def test_qtquick3d(): """Test the qtpy.QtQuick3D namespace""" QtQuick3D = pytest.importorskip("qtpy.QtQuick3D") assert QtQuick3D.QQuick3D is not None assert QtQuick3D.QQuick3DGeometry is not None assert QtQuick3D.QQuick3DObject is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qtquickcontrols2.py0000666000000000000000000000033114274763266016462 0ustar00import pytest def test_qtquickcontrols2(): """Test the qtpy.QtQuickControls2 namespace""" QtQuickControls2 = pytest.importorskip("qtpy.QtQuickControls2") assert QtQuickControls2.QQuickStyle is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtquickwidgets.py0000666000000000000000000000024414473413726016200 0ustar00def test_qtquickwidgets(): """Test the qtpy.QtQuickWidgets namespace""" from qtpy import QtQuickWidgets assert QtQuickWidgets.QQuickWidget is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtremoteobjects.py0000666000000000000000000000073614473413726016350 0ustar00import pytest def test_qtremoteobjects(): """Test the qtpy.QtRemoteObjects namespace""" QtRemoteObjects = pytest.importorskip("qtpy.QtRemoteObjects") assert QtRemoteObjects.QRemoteObjectAbstractPersistedStore is not None assert QtRemoteObjects.QRemoteObjectDynamicReplica is not None assert QtRemoteObjects.QRemoteObjectHost is not None assert QtRemoteObjects.QRemoteObjectHostBase is not None assert QtRemoteObjects.QRemoteObjectNode is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qtscxml.py0000666000000000000000000000044614274763266014635 0ustar00import pytest def test_qtscxml(): """Test the qtpy.QtScxml namespace""" QtScxml = pytest.importorskip("qtpy.QtScxml") assert QtScxml.QScxmlCompiler is not None assert QtScxml.QScxmlDynamicScxmlServiceFactory is not None assert QtScxml.QScxmlExecutableContent is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtsensors.py0000666000000000000000000000044614473413726015175 0ustar00import pytest def test_qtsensors(): """Test the qtpy.QtSensors namespace""" QtSensors = pytest.importorskip("qtpy.QtSensors") assert QtSensors.QAccelerometer is not None assert QtSensors.QAccelerometerFilter is not None assert QtSensors.QAccelerometerReading is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtserialport.py0000666000000000000000000000051614473413726015663 0ustar00import pytest from qtpy import PYSIDE2 @pytest.mark.skipif(PYSIDE2, reason="Not available in CI") def test_qtserialport(): """Test the qtpy.QtSerialPort namespace""" QtSerialPort = pytest.importorskip("qtpy.QtSerialPort") assert QtSerialPort.QSerialPort is not None assert QtSerialPort.QSerialPortInfo is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtsql.py0000666000000000000000000000461314473413726014300 0ustar00"""Test QtSql.""" import sys import pytest from qtpy import PYSIDE2, PYSIDE_VERSION, QtSql @pytest.fixture def database_connection(): """Create a database connection""" connection = QtSql.QSqlDatabase.addDatabase("QSQLITE") yield connection connection.close() def test_qtsql(): """Test the qtpy.QtSql namespace""" assert QtSql.QSqlDatabase is not None assert QtSql.QSqlDriverCreatorBase is not None assert QtSql.QSqlDriver is not None assert QtSql.QSqlError is not None assert QtSql.QSqlField is not None assert QtSql.QSqlIndex is not None assert QtSql.QSqlQuery is not None assert QtSql.QSqlRecord is not None assert QtSql.QSqlResult is not None assert QtSql.QSqlQueryModel is not None assert QtSql.QSqlRelationalDelegate is not None assert QtSql.QSqlRelation is not None assert QtSql.QSqlRelationalTableModel is not None assert QtSql.QSqlTableModel is not None # Following modules are not (yet) part of any wrapper: # QSqlDriverCreator, QSqlDriverPlugin @pytest.mark.skipif( sys.platform == "win32" and PYSIDE2 and PYSIDE_VERSION.startswith("5.13"), reason="SQLite driver unavailable on PySide 5.13.2 with Windows", ) def test_qtsql_members_aliases(database_connection): """ Test aliased methods over qtpy.QtSql members including: * qtpy.QtSql.QSqlDatabase.exec_ * qtpy.QtSql.QSqlQuery.exec_ * qtpy.QtSql.QSqlResult.exec_ """ assert QtSql.QSqlDatabase.exec_ is not None assert QtSql.QSqlQuery.exec_ is not None assert QtSql.QSqlResult.exec_ is not None assert database_connection.open() database_connection.setDatabaseName("test.sqlite") QtSql.QSqlDatabase.exec_( database_connection, """ CREATE TABLE test ( id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL, name VARCHAR(40) NOT NULL ) """, ) # Created table 'test' and 'sqlite_sequence' assert len(database_connection.tables()) == 2 insert_table_query = QtSql.QSqlQuery() assert insert_table_query.exec_( """ INSERT INTO test (name) VALUES ( "TESTING" ) """, ) select_table_query = QtSql.QSqlQuery() select_table_query.prepare( """ SELECT * FROM test """, ) select_table_query.exec_() record = select_table_query.record() assert not record.isEmpty() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qtstatemachine.py0000666000000000000000000000120414274763266016145 0ustar00import pytest def test_qtstatemachine(): """Test the qtpy.QtStateMachine namespace""" QtStateMachine = pytest.importorskip("qtpy.QtStateMachine") assert QtStateMachine.QAbstractState is not None assert QtStateMachine.QAbstractTransition is not None assert QtStateMachine.QEventTransition is not None assert QtStateMachine.QFinalState is not None assert QtStateMachine.QHistoryState is not None assert QtStateMachine.QKeyEventTransition is not None assert QtStateMachine.QMouseEventTransition is not None assert QtStateMachine.QSignalTransition is not None assert QtStateMachine.QState is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtsvg.py0000666000000000000000000000055414473413726014300 0ustar00import pytest from qtpy import PYQT6, PYSIDE6 def test_qtsvg(): """Test the qtpy.QtSvg namespace""" QtSvg = pytest.importorskip("qtpy.QtSvg") if not (PYSIDE6 or PYQT6): assert QtSvg.QGraphicsSvgItem is not None assert QtSvg.QSvgWidget is not None assert QtSvg.QSvgGenerator is not None assert QtSvg.QSvgRenderer is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qtsvgwidgets.py0000666000000000000000000000037114274763266015672 0ustar00import pytest def test_qtsvgwidgets(): """Test the qtpy.QtSvgWidgets namespace""" QtSvgWidgets = pytest.importorskip("qtpy.QtSvgWidgets") assert QtSvgWidgets.QGraphicsSvgItem is not None assert QtSvgWidgets.QSvgWidget is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qttest.py0000666000000000000000000000150314473413726014453 0ustar00import pytest from packaging import version from qtpy import PYQT5, PYQT6, PYQT_VERSION, PYSIDE6, QtTest def test_qttest(): """Test the qtpy.QtTest namespace""" assert QtTest.QTest is not None if PYQT5 or PYQT6 or PYSIDE6: assert QtTest.QSignalSpy is not None if ( (PYQT5 and version.parse(PYQT_VERSION) >= version.parse("5.11")) or PYQT6 or PYSIDE6 ): assert QtTest.QAbstractItemModelTester is not None @pytest.mark.skipif( PYQT5 and PYQT_VERSION.startswith("5.9"), reason="A specific setup with at least sip 4.9.9 is needed for PyQt5 5.9.*" "to work with scoped enum access", ) def test_enum_access(): """Test scoped and unscoped enum access for qtpy.QtTest.*.""" assert QtTest.QTest.Click == QtTest.QTest.KeyAction.Click ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qttexttospeech.py0000666000000000000000000000111714473413726016214 0ustar00import pytest from packaging import version from qtpy import PYQT5, PYQT_VERSION, PYSIDE2 @pytest.mark.skipif( not ( (PYQT5 and version.parse(PYQT_VERSION) >= version.parse("5.15.1")) or PYSIDE2 ), reason="Only available in Qt5 bindings (PyQt5 >= 5.15.1 or PySide2)", ) def test_qttexttospeech(): """Test the qtpy.QtTextToSpeech namespace.""" from qtpy import QtTextToSpeech assert QtTextToSpeech.QTextToSpeech is not None assert QtTextToSpeech.QVoice is not None if PYSIDE2: assert QtTextToSpeech.QTextToSpeechEngine is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1660151478.0 QtPy-2.4.1/qtpy/tests/test_qtuitools.py0000666000000000000000000000026414274763266015203 0ustar00import pytest def test_qtuitools(): """Test the qtpy.QtUiTools namespace""" QtUiTools = pytest.importorskip("qtpy.QtUiTools") assert QtUiTools.QUiLoader is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtwebchannel.py0000666000000000000000000000033414473413726015603 0ustar00def test_qtwebchannel(): """Test the qtpy.QtWebChannel namespace""" from qtpy import QtWebChannel assert QtWebChannel.QWebChannel is not None assert QtWebChannel.QWebChannelAbstractTransport is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtwebenginecore.py0000666000000000000000000000033614473413726016313 0ustar00import pytest def test_qtwebenginecore(): """Test the qtpy.QtWebEngineCore namespace""" QtWebEngineCore = pytest.importorskip("qtpy.QtWebEngineCore") assert QtWebEngineCore.QWebEngineHttpRequest is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtwebenginequick.py0000666000000000000000000000061614473413726016500 0ustar00import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(PYQT5 or PYSIDE2, reason="Only available in Qt6 bindings") def test_qtwebenginequick(): """Test the qtpy.QtWebEngineQuick namespace""" QtWebEngineQuick = pytest.importorskip("qtpy.QtWebEngineQuick") assert QtWebEngineQuick.QtWebEngineQuick is not None assert QtWebEngineQuick.QQuickWebEngineProfile is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1698104827.0 QtPy-2.4.1/qtpy/tests/test_qtwebenginewidgets.py0000666000000000000000000000143314515602773017027 0ustar00import pytest from packaging import version from qtpy import PYQT5, PYQT6, PYQT_VERSION, PYSIDE2, PYSIDE6, PYSIDE_VERSION @pytest.mark.skipif( not ( (PYQT6 and version.parse(PYQT_VERSION) >= version.parse("6.2")) or (PYSIDE6 and version.parse(PYSIDE_VERSION) >= version.parse("6.2")) or PYQT5 or PYSIDE2 ), reason="Only available in Qt<6,>=6.2 bindings", ) def test_qtwebenginewidgets(): """Test the qtpy.QtWebEngineWidget namespace""" QtWebEngineWidgets = pytest.importorskip("qtpy.QtWebEngineWidgets") assert QtWebEngineWidgets.QWebEnginePage is not None assert QtWebEngineWidgets.QWebEngineView is not None assert QtWebEngineWidgets.QWebEngineSettings is not None assert QtWebEngineWidgets.QWebEngineScript is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtwebsockets.py0000666000000000000000000000057114473413726015651 0ustar00def test_qtwebsockets(): """Test the qtpy.QtWebSockets namespace""" from qtpy import QtWebSockets assert QtWebSockets.QMaskGenerator is not None assert QtWebSockets.QWebSocket is not None assert QtWebSockets.QWebSocketCorsAuthenticator is not None assert QtWebSockets.QWebSocketProtocol is not None assert QtWebSockets.QWebSocketServer is not None ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1693325270.0 QtPy-2.4.1/qtpy/tests/test_qtwidgets.py0000666000000000000000000002314314473413726015146 0ustar00"""Test QtWidgets.""" import contextlib import sys from time import sleep import pytest from pytestqt.exceptions import TimeoutError from qtpy import ( PYQT5, PYQT6, PYQT_VERSION, PYSIDE2, PYSIDE6, QtCore, QtGui, QtWidgets, ) from qtpy.tests.utils import not_using_conda, using_conda def test_qtextedit_functions(qtbot, pdf_writer): """Test functions mapping for QtWidgets.QTextEdit.""" assert QtWidgets.QTextEdit.setTabStopWidth assert QtWidgets.QTextEdit.tabStopWidth assert QtWidgets.QTextEdit.print_ textedit_widget = QtWidgets.QTextEdit(None) textedit_widget.setTabStopWidth(90) assert textedit_widget.tabStopWidth() == 90 print_device, output_path = pdf_writer textedit_widget.print_(print_device) assert output_path.exists() def test_qlineedit_functions(): """Test functions mapping for QtWidgets.QLineEdit""" assert QtWidgets.QLineEdit.getTextMargins def test_what_moved_to_qtgui_in_qt6(): """Test that we move back what has been moved to QtGui in Qt6""" assert QtWidgets.QAction is not None assert QtWidgets.QActionGroup is not None assert QtWidgets.QFileSystemModel is not None assert QtWidgets.QShortcut is not None assert QtWidgets.QUndoCommand is not None def test_qplaintextedit_functions(qtbot, pdf_writer): """Test functions mapping for QtWidgets.QPlainTextEdit.""" assert QtWidgets.QPlainTextEdit.setTabStopWidth assert QtWidgets.QPlainTextEdit.tabStopWidth assert QtWidgets.QPlainTextEdit.print_ plaintextedit_widget = QtWidgets.QPlainTextEdit(None) plaintextedit_widget.setTabStopWidth(90) assert plaintextedit_widget.tabStopWidth() == 90 print_device, output_path = pdf_writer plaintextedit_widget.print_(print_device) assert output_path.exists() def test_QApplication_exec_(): """Test `QtWidgets.QApplication.exec_`""" assert QtWidgets.QApplication.exec_ is not None app = QtWidgets.QApplication.instance() or QtWidgets.QApplication( [sys.executable, __file__], ) assert app is not None QtCore.QTimer.singleShot(100, QtWidgets.QApplication.instance().quit) QtWidgets.QApplication.exec_() app = QtWidgets.QApplication.instance() or QtWidgets.QApplication( [sys.executable, __file__], ) assert app is not None QtCore.QTimer.singleShot(100, QtWidgets.QApplication.instance().quit) app.exec_() @pytest.mark.skipif( sys.platform == "darwin" and sys.version_info[:2] == (3, 7), reason="Stalls on macOS CI with Python 3.7", ) def test_qdialog_functions(qtbot): """Test functions mapping for QtWidgets.QDialog.""" assert QtWidgets.QDialog.exec_ dialog = QtWidgets.QDialog(None) QtCore.QTimer.singleShot(100, dialog.accept) dialog.exec_() @pytest.mark.skipif( sys.platform == "darwin" and sys.version_info[:2] == (3, 7), reason="Stalls on macOS CI with Python 3.7", ) def test_qdialog_subclass(qtbot): """Test functions mapping for QtWidgets.QDialog when using a subclass""" assert QtWidgets.QDialog.exec_ class CustomDialog(QtWidgets.QDialog): def __init__(self): super().__init__(None) self.setWindowTitle("Testing") assert CustomDialog.exec_ dialog = CustomDialog() QtCore.QTimer.singleShot(100, dialog.accept) dialog.exec_() @pytest.mark.skipif( sys.platform == "darwin" and sys.version_info[:2] == (3, 7), reason="Stalls on macOS CI with Python 3.7", ) def test_QMenu_functions(qtbot): """Test functions mapping for `QtWidgets.QMenu`.""" # A window is required for static calls window = QtWidgets.QMainWindow() menu = QtWidgets.QMenu(window) menu.addAction("QtPy") menu.addAction("QtPy with a shortcut", QtGui.QKeySequence.UnknownKey) menu.addAction( QtGui.QIcon(), "QtPy with an icon and a shortcut", QtGui.QKeySequence.UnknownKey, ) window.show() with qtbot.waitExposed(window): # Call `exec_` of a `QMenu` instance QtCore.QTimer.singleShot(100, menu.close) menu.exec_() # Call static `QMenu.exec_` QtCore.QTimer.singleShot( 100, lambda: qtbot.keyClick( QtWidgets.QApplication.widgetAt(1, 1), QtCore.Qt.Key_Escape, ), ) QtWidgets.QMenu.exec_(menu.actions(), QtCore.QPoint(1, 1)) @pytest.mark.skipif( sys.platform == "darwin" and sys.version_info[:2] == (3, 7), reason="Stalls on macOS CI with Python 3.7", ) def test_QToolBar_functions(qtbot): """Test `QtWidgets.QToolBar.addAction` compatibility with Qt6 arguments' order.""" toolbar = QtWidgets.QToolBar() toolbar.addAction("QtPy with a shortcut", QtGui.QKeySequence.UnknownKey) toolbar.addAction( QtGui.QIcon(), "QtPy with an icon and a shortcut", QtGui.QKeySequence.UnknownKey, ) @pytest.mark.skipif( PYQT5 and PYQT_VERSION.startswith("5.9"), reason="A specific setup with at least sip 4.9.9 is needed for PyQt5 5.9.*" "to work with scoped enum access", ) def test_enum_access(): """Test scoped and unscoped enum access for qtpy.QtWidgets.*.""" assert ( QtWidgets.QFileDialog.AcceptOpen == QtWidgets.QFileDialog.AcceptMode.AcceptOpen ) assert ( QtWidgets.QMessageBox.InvalidRole == QtWidgets.QMessageBox.ButtonRole.InvalidRole ) assert QtWidgets.QStyle.State_None == QtWidgets.QStyle.StateFlag.State_None assert ( QtWidgets.QSlider.TicksLeft == QtWidgets.QSlider.TickPosition.TicksAbove ) assert ( QtWidgets.QStyle.SC_SliderGroove == QtWidgets.QStyle.SubControl.SC_SliderGroove ) def test_opengl_imports(): """ Test for presence of QOpenGLWidget. QOpenGLWidget was a member of QtWidgets in Qt5, but moved to QtOpenGLWidgets in Qt6. QtPy makes QOpenGLWidget available in QtWidgets to maintain compatibility. """ assert QtWidgets.QOpenGLWidget is not None @pytest.mark.skipif( sys.platform == "darwin" and sys.version_info[:2] == (3, 7) and (PYQT5 or PYSIDE2), reason="Crashes on macOS with Python 3.7 with 'Illegal instruction: 4'", ) @pytest.mark.parametrize("keyword", ["dir", "directory"]) @pytest.mark.parametrize("instance", [True, False]) def test_qfiledialog_dir_compat(tmp_path, qtbot, keyword, instance): """ This function is testing if the decorators that renamed the dir/directory keyword are working. It may stop working if the Qt bindings do some overwriting of the methods in constructor. It should not happen, but the PySide team did similar things in the past (like overwriting enum module in PySide6==6.3.2). keyword: str The keyword that should be used in the function call. instance: bool If True, the function is called on the instance of the QFileDialog, otherwise on the class. """ class CloseThread(QtCore.QThread): """ On some implementations the `getExistingDirectory` functions starts own event loop that will not trigger QTimer started before the call. Until the dialog is closed the main event loop will be stopped. Because of this it is required to use the thread to interact with the dialog. """ def run(self, allow_restart=True): sleep(0.5) need_restart = allow_restart app = QtWidgets.QApplication.instance() for dlg in app.topLevelWidgets(): if ( not isinstance(dlg, QtWidgets.QFileDialog) or dlg.isHidden() ): continue # "when implemented this I try to use: # * dlg.close() - On Qt6 it will close the dialog, but it will # not restart the main event loop. # * dlg.accept() - It ends with information thar `accept` and # `reject` of such created dialog can not be called. # * accept dialog with enter - It works, but it cannot be # called to early after dialog is shown qtbot.keyClick(dlg, QtCore.Qt.Key_Enter) need_restart = False sleep(0.1) for dlg in app.topLevelWidgets(): # As described above, it may happen that dialog is not closed after first using enter. # in such case we call `run` function again. The 0.5s sleep is enough for the second enter to close the dialog. if ( not isinstance(dlg, QtWidgets.QFileDialog) or dlg.isHidden() ): continue self.run(allow_restart=False) return if need_restart: self.run() # We need to use the `DontUseNativeDialog` option to be able to interact # with it from code. try: opt = QtWidgets.QFileDialog.Option.DontUseNativeDialog except AttributeError: # old qt5 bindings opt = QtWidgets.QFileDialog.DontUseNativeDialog kwargs = { "caption": "Select a directory", keyword: str(tmp_path), "options": opt, } thr = CloseThread() thr.start() qtbot.waitUntil(thr.isRunning, timeout=1000) dlg = QtWidgets.QFileDialog() if instance else QtWidgets.QFileDialog dlg.getExistingDirectory(**kwargs) qtbot.waitUntil(thr.isFinished, timeout=3000) def test_qfiledialog_flags_typedef(): """ Test existence of `QFlags