Skip to content

Commit

Permalink
Expose more Qt modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed May 24, 2024
1 parent 6a509a8 commit cc32662
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 2 deletions.
16 changes: 16 additions & 0 deletions AnyQt/QtCharts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from . import _api

if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtCharts import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtCharts import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtCharts import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtCharts import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtCharts import *
elif _api.USED_API == _api.QT_API_PYSIDE6:
from PySide6.QtCharts import *

_api.apply_global_fixes(globals())
16 changes: 16 additions & 0 deletions AnyQt/QtDataVisualization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from . import _api

if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtDataVisualization import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtDataVisualization import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtDataVisualization import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtDataVisualization import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtDataVisualization import *
elif _api.USED_API == _api.QT_API_PYSIDE6:
from PySide6.QtDataVisualization import *

_api.apply_global_fixes(globals())
16 changes: 16 additions & 0 deletions AnyQt/QtLocation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from . import _api

if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtLocation import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtLocation import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtLocation import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtLocation import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtLocation import *
elif _api.USED_API == _api.QT_API_PYSIDE6:
from PySide6.QtLocation import *

_api.apply_global_fixes(globals())
16 changes: 16 additions & 0 deletions AnyQt/QtNetworkAuth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from . import _api

if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtNetworkAuth import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtNetworkAuth import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtNetworkAuth import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtNetworkAuth import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtNetworkAuth import *
elif _api.USED_API == _api.QT_API_PYSIDE6:
from PySide6.QtNetworkAuth import *

_api.apply_global_fixes(globals())
16 changes: 16 additions & 0 deletions AnyQt/QtPdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from . import _api

if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtPdf import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtPdf import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtPdf import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtPdf import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtPdf import *
elif _api.USED_API == _api.QT_API_PYSIDE6:
from PySide6.QtPdf import *

_api.apply_global_fixes(globals())
16 changes: 16 additions & 0 deletions AnyQt/QtPdfWidgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from . import _api

if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtPdfWidgets import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtPdfWidgets import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtPdfWidgets import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtPdfWidgets import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtPdfWidgets import *
elif _api.USED_API == _api.QT_API_PYSIDE6:
from PySide6.QtPdfWidgets import *

_api.apply_global_fixes(globals())
16 changes: 16 additions & 0 deletions AnyQt/QtPositioning.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from . import _api

if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtPositioning import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtPositioning import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtPositioning import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtPositioning import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtPositioning import *
elif _api.USED_API == _api.QT_API_PYSIDE6:
from PySide6.QtPositioning import *

_api.apply_global_fixes(globals())
16 changes: 16 additions & 0 deletions AnyQt/QtRemoteObjects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from . import _api

if _api.USED_API == _api.QT_API_PYQT6:
from PyQt6.QtRemoteObjects import *
elif _api.USED_API == _api.QT_API_PYQT5:
from PyQt5.QtRemoteObjects import *
elif _api.USED_API == _api.QT_API_PYQT4:
from PyQt4.QtRemoteObjects import *
elif _api.USED_API == _api.QT_API_PYSIDE:
from PySide.QtRemoteObjects import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtRemoteObjects import *
elif _api.USED_API == _api.QT_API_PYSIDE6:
from PySide6.QtRemoteObjects import *

_api.apply_global_fixes(globals())
2 changes: 2 additions & 0 deletions AnyQt/QtSvg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
from PySide.QtSvg import *
elif _api.USED_API == _api.QT_API_PYSIDE2:
from PySide2.QtSvg import *
elif _api.USED_API == _api.QT_API_PYSIDE6:
from PySide6.QtSvg import *

_api.apply_global_fixes(globals())
12 changes: 10 additions & 2 deletions test/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
submodules_qt4 = [
'QtXmlPatterns'
]

submodules_common_qt56 = [
"QtPositioning",
"QtRemoteObjects",
]

submodules_qt5 = [
'QtMultimediaWidgets',
'QtWebChannel',
Expand All @@ -35,10 +41,12 @@
'QtWebSockets',
'QtQml',
'QtXmlPatterns',
"QtLocation",
]

submodules_qt6 = [
"QtSvgWidgets",
"QtPdfWidgets",
]


Expand Down Expand Up @@ -68,9 +76,9 @@ def try_import_anyqt(modname, submodule):
if qt_version[0] == '4':
submodules.extend(submodules_qt4)
if qt_version[0] == '5':
submodules.extend(submodules_qt5)
submodules.extend(submodules_qt5 + submodules_common_qt56)
if qt_version[0] == '6':
submodules.extend(submodules_qt6)
submodules.extend(submodules_qt6 + submodules_common_qt56)
for submodule in submodules:
if try_import_anyqt(modname, submodule):
print(submodule, 'Ok')
Expand Down

0 comments on commit cc32662

Please sign in to comment.