Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Add missing imports and modules #344

Merged
merged 41 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3d00342
Add missing PySide6 import
DaelonSuzuka May 1, 2022
cecb9fc
Add missing imports
DaelonSuzuka May 15, 2022
b784f03
Partial implementation of test improvements
DaelonSuzuka May 15, 2022
8b13376
Remove WebKit checks
DaelonSuzuka May 16, 2022
33764c8
Add new error types suggested by @CAM-Gerlach
DaelonSuzuka May 16, 2022
f3886cb
Implement QtModuleNotInstalledError and update tests
DaelonSuzuka May 16, 2022
c7d739f
Implement first QtBindingMissingModuleError and add tests for QtAxCon…
DaelonSuzuka May 16, 2022
3f0c4e2
Fix failing MacOS test
DaelonSuzuka May 16, 2022
805ed63
Inherit context from original error in all re-raised exceptions
DaelonSuzuka May 16, 2022
0041ed7
Removed uneccesary `missing_package` argument
DaelonSuzuka May 16, 2022
d012178
Replace generic PythonQtError with QtModuleNotInstalledError
DaelonSuzuka May 16, 2022
bf14241
Fix QtModuleNotFoundError internal argument passing
DaelonSuzuka May 16, 2022
eae7272
Replace `platform.system()` with `sys.platform`
DaelonSuzuka May 16, 2022
d05da14
Fix GitHub's automated commit inserting a backtick instead of a singl…
DaelonSuzuka May 16, 2022
d85fa82
Fix docstrings and standardize document headers
DaelonSuzuka May 19, 2022
34d280d
Standardize import and API branch order
DaelonSuzuka May 19, 2022
afe2ae6
Make Qt errors automatically determine binding and implement remainin…
DaelonSuzuka May 19, 2022
67874c7
Add QtBindingsNotFoundError to potentially replace most common Python…
DaelonSuzuka May 19, 2022
b41c5b8
Fix QtDBus import conditions, hopefully
DaelonSuzuka May 19, 2022
8421052
Fix QtPurchasing importing the wrong module
DaelonSuzuka May 28, 2022
0d404da
Implement remaining tests
DaelonSuzuka May 28, 2022
8edb602
Fix failing tests
DaelonSuzuka May 28, 2022
e027cff
Add EOL newline
DaelonSuzuka May 28, 2022
02df403
Standardize sip module
DaelonSuzuka May 28, 2022
368e66f
Add shiboken module and associated tests
DaelonSuzuka May 28, 2022
31292e0
Add tests for sip module
DaelonSuzuka May 28, 2022
0d27458
Fix order of imports
DaelonSuzuka May 30, 2022
b79d758
Remove unused skips, per code review
DaelonSuzuka May 30, 2022
d33f131
Apply suggestions from code review
DaelonSuzuka May 30, 2022
0ea93d3
Replace common use of PythonQtError with QtBindingsNotFoundError
DaelonSuzuka May 30, 2022
d16ad78
Add missing EOF newlines
DaelonSuzuka May 31, 2022
781f54e
Switch last PythonQtError to QtBindingsNotFoundError
DaelonSuzuka May 31, 2022
d9dce6f
Fix wrong module name in error message
DaelonSuzuka May 31, 2022
6d3ad62
Add QtModuleNotInOSError and QtModuleNotInQtVersionError
DaelonSuzuka Jun 1, 2022
038362a
Add placeholder test file for QtX11Extras
DaelonSuzuka Jun 1, 2022
8c37d94
Implement QtX11Extras test
DaelonSuzuka Jun 3, 2022
2e92fc9
Apply code review suggestions to modules
DaelonSuzuka Jun 6, 2022
ce6932f
Apply formatting suggestions to tests
DaelonSuzuka Jun 6, 2022
08dded4
Rearrange asserts per suggestion from @dalthviz
DaelonSuzuka Jun 9, 2022
9c01187
Add missing line after standard library imports
DaelonSuzuka Jun 9, 2022
f5786ab
Fix typo
DaelonSuzuka Jun 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions qtpy/Qt3DAnimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,45 @@
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------

"""Provides Qt3DAnimation classes and functions."""

# Local imports
from . import PYQT5, PYSIDE2, PythonQtError, PYSIDE_VERSION
from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
QtBindingsNotFoundError,
QtModuleNotInstalledError,
)

if PYQT5:
from PyQt5.Qt3DAnimation import *
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 PySide2.Qt3DAnimation as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DAnimation):
globals()[__name[0]] = __name[1]
elif PYSIDE6:
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
import PySide6.Qt3DAnimation as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DAnimation):
globals()[__name[0]] = __name[1]
else:
raise PythonQtError('No Qt bindings could be found')
raise QtBindingsNotFoundError()
37 changes: 30 additions & 7 deletions qtpy/Qt3DCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,45 @@
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------

"""Provides Qt3DCore classes and functions."""

# Local imports
from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError
from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
QtBindingsNotFoundError,
QtModuleNotInstalledError,
)

if PYQT5:
from PyQt5.Qt3DCore import *
try:
from PyQt5.Qt3DCore import *
except ModuleNotFoundError as error:
raise QtModuleNotInstalledError(
name='Qt3DCore', missing_package='PyQt3D'
) from error
elif PYQT6:
from PyQt6.Qt3DCore import *
elif PYSIDE6:
from PySide6.Qt3DCore.Qt3DCore import *
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 PySide2.Qt3DCore as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DCore):
globals()[__name[0]] = __name[1]
elif PYSIDE6:
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
import PySide6.Qt3DCore as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DCore):
globals()[__name[0]] = __name[1]
else:
raise PythonQtError('No Qt bindings could be found')
raise QtBindingsNotFoundError()
37 changes: 30 additions & 7 deletions qtpy/Qt3DExtras.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,45 @@
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------

"""Provides Qt3DExtras classes and functions."""

# Local imports
from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError
from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
QtBindingsNotFoundError,
QtModuleNotInstalledError,
)

if PYQT5:
from PyQt5.Qt3DExtras import *
try:
from PyQt5.Qt3DExtras import *
except ModuleNotFoundError as error:
raise QtModuleNotInstalledError(
name='Qt3DExtras', missing_package='PyQt3D'
) from error
elif PYQT6:
from PyQt6.Qt3DExtras import *
elif PYSIDE6:
from PySide6.Qt3DExtras.Qt3DExtras import *
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 PySide2.Qt3DExtras as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DExtras):
globals()[__name[0]] = __name[1]
elif PYSIDE6:
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
import PySide6.Qt3DExtras as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DExtras):
globals()[__name[0]] = __name[1]
else:
raise PythonQtError('No Qt bindings could be found')
raise QtBindingsNotFoundError()
37 changes: 30 additions & 7 deletions qtpy/Qt3DInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,45 @@
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------

"""Provides Qt3DInput classes and functions."""

# Local imports
from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError
from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
QtBindingsNotFoundError,
QtModuleNotInstalledError,
)

if PYQT5:
from PyQt5.Qt3DInput import *
try:
from PyQt5.Qt3DInput import *
except ModuleNotFoundError as error:
raise QtModuleNotInstalledError(
name='Qt3DInput', missing_package='PyQt3D'
) from error
elif PYQT6:
from PyQt6.Qt3DInput import *
elif PYSIDE6:
from PySide6.Qt3DInput.Qt3DInput import *
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 PySide2.Qt3DInput as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DInput):
globals()[__name[0]] = __name[1]
elif PYSIDE6:
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
import PySide6.Qt3DInput as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DInput):
globals()[__name[0]] = __name[1]
else:
raise PythonQtError('No Qt bindings could be found')
raise QtBindingsNotFoundError()
37 changes: 30 additions & 7 deletions qtpy/Qt3DLogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,45 @@
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------

"""Provides Qt3DLogic classes and functions."""

# Local imports
from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError
from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
QtBindingsNotFoundError,
QtModuleNotInstalledError,
)

if PYQT5:
from PyQt5.Qt3DLogic import *
try:
from PyQt5.Qt3DLogic import *
except ModuleNotFoundError as error:
raise QtModuleNotInstalledError(
name='Qt3DLogic', missing_package='PyQt3D'
) from error
elif PYQT6:
from PyQt6.Qt3DLogic import *
elif PYSIDE6:
from PySide6.Qt3DLogic.Qt3DLogic import *
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 PySide2.Qt3DLogic as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DLogic):
globals()[__name[0]] = __name[1]
elif PYSIDE6:
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
import PySide6.Qt3DLogic as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DLogic):
globals()[__name[0]] = __name[1]
else:
raise PythonQtError('No Qt bindings could be found')
raise QtBindingsNotFoundError()
37 changes: 30 additions & 7 deletions qtpy/Qt3DRender.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,45 @@
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------

"""Provides Qt3DRender classes and functions."""

# Local imports
from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, PythonQtError
from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
QtBindingsNotFoundError,
QtModuleNotInstalledError,
)

if PYQT5:
from PyQt5.Qt3DRender import *
elif PYSIDE6:
from PySide6.Qt3DRender.Qt3DRender import *
try:
from PyQt5.Qt3DRender import *
except ModuleNotFoundError as error:
raise QtModuleNotInstalledError(
name='Qt3DRender', missing_package='PyQt3D'
) from error
elif PYQT6:
from PyQt6.Qt3DRender import *
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 PySide2.Qt3DRender as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DRender):
globals()[__name[0]] = __name[1]
elif PYSIDE6:
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
import PySide6.Qt3DRender as __temp
import inspect

for __name in inspect.getmembers(__temp.Qt3DRender):
globals()[__name[0]] = __name[1]
else:
raise PythonQtError('No Qt bindings could be found')
raise QtBindingsNotFoundError()
28 changes: 28 additions & 0 deletions qtpy/QtAxContainer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -----------------------------------------------------------------------------
# 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,
QtBindingsNotFoundError,
QtBindingMissingModuleError,
)

if PYQT5:
raise QtBindingMissingModuleError(name='QtAxContainer')
elif PYQT6:
raise QtBindingMissingModuleError(name='QtAxContainer')
elif PYSIDE2:
from PySide2.QtAxContainer import *
elif PYSIDE6:
from PySide6.QtAxContainer import *
else:
raise QtBindingsNotFoundError()
28 changes: 28 additions & 0 deletions qtpy/QtBluetooth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -----------------------------------------------------------------------------
# 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,
QtBindingsNotFoundError,
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 *
else:
raise QtBindingsNotFoundError()
Loading