mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -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,
|
from __future__ import (unicode_literals, division, absolute_import,
|
||||||
print_function)
|
print_function)
|
||||||
from future_builtins import map
|
|
||||||
import os, subprocess, errno, shutil, tempfile, sys
|
import os, subprocess, errno, shutil, tempfile, sys
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from threading import Thread
|
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 import fit_image, force_unicode
|
||||||
from calibre.constants import iswindows, plugins, get_version
|
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
|
# Ensure that Qt can load the imageformat plugins
|
||||||
|
|
||||||
if QCoreApplication.instance() is None:
|
if QCoreApplication.instance() is None:
|
||||||
# Normally constructing a QCoreApplication takes care of this, but if we
|
# We need a QCoreApplication() in order to load imageformat plugins
|
||||||
# are being used without a QCoreApplication, then we have to do it manually
|
_core_app = QCoreApplication()
|
||||||
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)
|
|
||||||
|
|
||||||
# Utilities {{{
|
# Utilities {{{
|
||||||
imageops, imageops_err = plugins['imageops']
|
imageops, imageops_err = plugins['imageops']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user