mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Just use QCoreApplication
This commit is contained in:
parent
a182438cba
commit
cfbf1d0f06
@ -4,12 +4,11 @@
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import,
|
||||
print_function)
|
||||
from future_builtins import map
|
||||
import os, subprocess, errno, shutil, tempfile, sys
|
||||
from io import BytesIO
|
||||
from threading import Thread
|
||||
|
||||
from PyQt5.Qt import QImage, QByteArray, QBuffer, Qt, QImageReader, QColor, QImageWriter, QTransform, QCoreApplication, QProcessEnvironment
|
||||
from PyQt5.Qt import QImage, QByteArray, QBuffer, Qt, QImageReader, QColor, QImageWriter, QTransform, QCoreApplication
|
||||
|
||||
from calibre import fit_image, force_unicode
|
||||
from calibre.constants import iswindows, plugins, get_version
|
||||
@ -19,13 +18,8 @@ from calibre.utils.filenames import atomic_rename
|
||||
# Ensure that Qt can load the imageformat plugins
|
||||
|
||||
if QCoreApplication.instance() is None:
|
||||
# Normally constructing a QCoreApplication takes care of this, but if we
|
||||
# are being used without a QCoreApplication, then we have to do it manually
|
||||
if len(set(b'jpeg gif png'.split(b' ')).intersection(set(map(bytes, QImageReader.supportedImageFormats())))) != 3:
|
||||
qpp = QProcessEnvironment.systemEnvironment().value('QT_PLUGIN_PATH')
|
||||
if qpp:
|
||||
for path in qpp.split(os.pathsep):
|
||||
QCoreApplication.addLibraryPath(path)
|
||||
# We need a QCoreApplication() in order to load imageformat plugins
|
||||
_core_app = QCoreApplication()
|
||||
|
||||
# Utilities {{{
|
||||
imageops, imageops_err = plugins['imageops']
|
||||
|
Loading…
x
Reference in New Issue
Block a user