mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 00:03:26 +02:00
Unfortunately QCoreApplication cannot be promoted to QApplication. So for the moment we back out the change to have img.py work without QApplication. Instead, run ensure_app() in the test loader. Will need to investigate a proper fix at my leisure
This commit is contained in:
parent
b50c005f50
commit
c4cc4b386d
3 changed files with 3 additions and 11 deletions
|
|
@ -78,6 +78,8 @@ def add_options(self, parser):
|
|||
|
||||
def run(self, opts):
|
||||
from calibre.utils.run_tests import run_cli, filter_tests_by_name
|
||||
from calibre.gui2 import ensure_app
|
||||
ensure_app()
|
||||
tests = find_tests(which_tests=frozenset(opts.test_module))
|
||||
if opts.test_name:
|
||||
tests = filter_tests_by_name(tests, *opts.test_name)
|
||||
|
|
|
|||
|
|
@ -101,9 +101,6 @@ def test_apsw(self):
|
|||
conn.close()
|
||||
|
||||
def test_qt(self):
|
||||
# Must be run before QApplication is constructed
|
||||
# Test that the image formats are available without a QApplication being
|
||||
# constructed
|
||||
from PyQt5.Qt import QImageReader, QNetworkAccessManager, QFontDatabase
|
||||
from calibre.utils.img import image_from_data, image_to_data, test
|
||||
fmts = set(map(unicode, QImageReader.supportedImageFormats()))
|
||||
|
|
|
|||
|
|
@ -8,19 +8,12 @@
|
|||
from io import BytesIO
|
||||
from threading import Thread
|
||||
|
||||
from PyQt5.Qt import QImage, QByteArray, QBuffer, Qt, QImageReader, QColor, QImageWriter, QTransform, QCoreApplication
|
||||
|
||||
from PyQt5.Qt import QImage, QByteArray, QBuffer, Qt, QImageReader, QColor, QImageWriter, QTransform
|
||||
from calibre import fit_image, force_unicode
|
||||
from calibre.constants import iswindows, plugins, get_version
|
||||
from calibre.utils.config_base import tweaks
|
||||
from calibre.utils.filenames import atomic_rename
|
||||
|
||||
# Ensure that Qt can load the imageformat plugins
|
||||
|
||||
if QCoreApplication.instance() is None:
|
||||
# We need a QCoreApplication() in order to load imageformat plugins
|
||||
_core_app = QCoreApplication([])
|
||||
|
||||
# Utilities {{{
|
||||
imageops, imageops_err = plugins['imageops']
|
||||
if imageops is None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue