mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -78,6 +78,8 @@ class Test(Command):
|
||||
|
||||
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 @@ class BuildTest(unittest.TestCase):
|
||||
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 @@ 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
|
||||
|
||||
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…
x
Reference in New Issue
Block a user