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 QtPdf and QtPdfWidgets #382

Merged
merged 1 commit into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions qtpy/QtPdf.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 QtPdf classes and functions."""

from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
QtBindingsNotFoundError,
QtBindingMissingModuleError,
)

if PYQT5:
raise QtBindingMissingModuleError(name='QtPdf')
elif PYQT6:
from PyQt6.QtPdf import *
elif PYSIDE2:
raise QtBindingMissingModuleError(name='QtPdf')
elif PYSIDE6:
from PySide6.QtPdf import *
else:
raise QtBindingsNotFoundError()
28 changes: 28 additions & 0 deletions qtpy/QtPdfWidgets.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 QtPdfWidgets classes and functions."""

from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
QtBindingsNotFoundError,
QtBindingMissingModuleError,
)

if PYQT5:
raise QtBindingMissingModuleError(name='QtPdfWidgets')
elif PYQT6:
from PyQt6.QtPdfWidgets import *
elif PYSIDE2:
raise QtBindingMissingModuleError(name='QtPdfWidgets')
elif PYSIDE6:
from PySide6.QtPdfWidgets import *
else:
raise QtBindingsNotFoundError()
10 changes: 10 additions & 0 deletions qtpy/tests/test_qtpdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import 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
8 changes: 8 additions & 0 deletions qtpy/tests/test_qtpdfwidgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest


def test_qtpdfwidgets():
"""Test the qtpy.QtPdfWidgets namespace"""
QtPdfWidgets = pytest.importorskip("qtpy.QtPdfWidgets")

assert QtPdfWidgets.QPdfView is not None