From f4eec76a0964c44defbe3d690e673ab527dc2d9c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 Jan 2022 22:40:35 +0530 Subject: [PATCH] pyqt6: Fix QPrinter::pageSize no longer present in pyqt6 --- src/calibre/gui2/widgets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index 264872fcc3..4a4e0941c0 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -10,7 +10,7 @@ QCursor, QColor, QWidget, QPixmap, QSplitterHandle, QToolButton, Qt, pyqtSignal, QSize, QSplitter, QPainter, QPageSize, QPrinter, QLineEdit, QComboBox, QPen, QGraphicsScene, QMenu, QStringListModel, QKeySequence, - QCompleter, QTimer, QRect, QGraphicsView, QPagedPaintDevice, QPalette, QClipboard) + QCompleter, QTimer, QRect, QGraphicsView, QPalette, QClipboard) from calibre.constants import iswindows, ismacos from calibre.gui2 import (error_dialog, pixmap_to_data, gprefs, @@ -1268,7 +1268,7 @@ def initialize(self, choices=None): if iswindows or ismacos: # On Linux, this can cause Qt to load the system cups plugin # which can crash: https://bugs.launchpad.net/calibre/+bug/1861741 - PaperSizes.system_default_paper_size = 'letter' if QPrinter().pageSize() == QPagedPaintDevice.PageSize.Letter else 'a4' + PaperSizes.system_default_paper_size = 'letter' if QPrinter().pageLayout().pageSize().id() == QPageSize.PageSizeId.Letter else 'a4' if not choices: from calibre.ebooks.conversion.plugins.pdf_output import PAPER_SIZES choices = PAPER_SIZES