diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index ed5b89dcbb..f2c55472c4 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -14,6 +14,7 @@ from PyQt5.Qt import (QIcon, QFont, QLabel, QListWidget, QAction, QLineEdit, QComboBox, QPen, QGraphicsScene, QMenu, QStringListModel, QCompleter, QTimer, QRect, QGraphicsView, QPagedPaintDevice) +from calibre.constants import iswindows, isosx from calibre.gui2 import (error_dialog, pixmap_to_data, gprefs, warning_dialog) from calibre.gui2.filename_pattern_ui import Ui_Form @@ -1243,7 +1244,11 @@ class PaperSizes(QComboBox): # {{{ def initialize(self, choices=None): from calibre.utils.icu import numeric_sort_key if self.system_default_paper_size is None: - QComboBox.system_default_paper_size = 'letter' if QPrinter().pageSize() == QPagedPaintDevice.Letter else 'a4' + PaperSizes.system_default_paper_size = 'a4' + if iswindows or isosx: + # 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.Letter else 'a4' if not choices: from calibre.ebooks.conversion.plugins.pdf_output import PAPER_SIZES choices = PAPER_SIZES @@ -1260,7 +1265,7 @@ class PaperSizes(QComboBox): # {{{ @get_value_for_config.setter def set_value_for_config(self, val): - idx = self.findData(val or self.system_default_paper_size) + idx = self.findData(val or PaperSizes.system_default_paper_size) if idx == -1: idx = self.findData('a4') self.setCurrentIndex(idx)