Skip to content

Commit

Permalink
Add QtPdf
Browse files Browse the repository at this point in the history
Closes #381
  • Loading branch information
jschueller committed Oct 27, 2022
1 parent 1030f98 commit 7eb9194
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
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

0 comments on commit 7eb9194

Please sign in to comment.