def start(self): self.network = QNetworkAccessManager() self.network.authenticationRequired.connect(self.auth) self.readyToRunCheck.connect(self.run_check) self.pending_book_ids = self.book_ids self.count = 0 self.books_count = 0 self.valid_ids = [] self.fetch_limits()
def test_qt(self): from PyQt5.Qt import QImageReader, QNetworkAccessManager, QFontDatabase from calibre.utils.img import image_from_data, image_to_data, test # Ensure that images can be read before QApplication is constructed. # Note that this requires QCoreApplication.libraryPaths() to return the # path to the Qt plugins which it always does in the frozen build, # because the QT_PLUGIN_PATH env var is set. On non-frozen builds, # it should just work because the hard-coded paths of the Qt # installation should work. If they do not, then it is a distro # problem. fmts = set( map(lambda x: x.data().decode('utf-8'), QImageReader.supportedImageFormats())) testf = {'jpg', 'png', 'svg', 'ico', 'gif'} self.assertEqual( testf.intersection(fmts), testf, "Qt doesn't seem to be able to load some of its image plugins. Available plugins: %s" % fmts) data = P('images/blank.png', allow_user_override=False, data=True) img = image_from_data(data) image_from_data( P('catalog/mastheadImage.gif', allow_user_override=False, data=True)) for fmt in 'png bmp jpeg'.split(): d = image_to_data(img, fmt=fmt) image_from_data(d) # Run the imaging tests test() from calibre.gui2 import Application os.environ.pop('DISPLAY', None) has_headless = isosx or islinux app = Application([], headless=has_headless) self.assertGreaterEqual( len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig' ) if has_headless: from calibre.ebooks.covers import create_cover create_cover('xxx', ['yyy']) na = QNetworkAccessManager() self.assertTrue(hasattr(na, 'sslErrors'), 'Qt not compiled with openssl') from PyQt5.QtWebKitWidgets import QWebView if iswindows: from PyQt5.Qt import QtWin QtWin QWebView() del QWebView del na del app
def test_qt(): from calibre.gui2 import Application from PyQt5.Qt import (QImageReader, QNetworkAccessManager, QFontDatabase) from PyQt5.QtWebKitWidgets import QWebView os.environ.pop('DISPLAY', None) app = Application([], headless=islinux) if len(QFontDatabase().families()) < 5: raise RuntimeError('The QPA headless plugin is not able to locate enough system fonts via fontconfig') fmts = set(map(unicode, QImageReader.supportedImageFormats())) testf = set(['jpg', 'png', 'mng', 'svg', 'ico', 'gif']) if testf.intersection(fmts) != testf: raise RuntimeError( "Qt doesn't seem to be able to load its image plugins") QWebView() del QWebView na = QNetworkAccessManager() if not hasattr(na, 'sslErrors'): raise RuntimeError('Qt not compiled with openssl') del na del app print ('Qt OK!')
def start(self): self.network = QNetworkAccessManager() self.network.authenticationRequired.connect(self.auth) self.readyForNext.emit(self.index)