Linux binary: Fix calibre not starting on systems where QT_QPA_PLATFORM is set to use wayland

This commit is contained in:
Kovid Goyal 2017-11-10 08:46:13 +05:30
parent 025fd69202
commit 66aac30872
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -9,7 +9,7 @@ from PyQt5.Qt import (
QFileInfo, QObject, QBuffer, Qt, QByteArray, QTranslator, QSocketNotifier,
QCoreApplication, QThread, QEvent, QTimer, pyqtSignal, QDateTime, QFontMetrics,
QDesktopServices, QFileDialog, QFileIconProvider, QSettings, QIcon, QStringListModel,
QApplication, QDialog, QUrl, QFont, QFontDatabase, QLocale, QFontInfo)
QApplication, QDialog, QUrl, QFont, QFontDatabase, QLocale, QFontInfo, QT_VERSION)
from calibre import prints, as_unicode
from calibre.constants import (islinux, iswindows, isbsd, isfrozen, isosx, is_running_from_develop,
@ -785,6 +785,8 @@ class Application(QApplication):
def __init__(self, args, force_calibre_style=False, override_program_name=None, headless=False, color_prefs=gprefs):
self.file_event_hook = None
if isfrozen and QT_VERSION <= 0x050700 and 'wayland' in os.environ.get('QT_QPA_PLATFORM', ''):
os.environ['QT_QPA_PLATFORM'] = 'xcb'
if override_program_name:
args = [override_program_name] + args[1:]
if headless: