From 834ed570cee03b32beb16110a90f2da86bec353c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 20 Sep 2011 16:23:29 +0100 Subject: [PATCH] Fix bug where string is added to image instead of QColor. Fix issue where queue has records to process but it is not running. Fixes: https://launchpad.net/bugs/854171 --- openlp/core/lib/__init__.py | 2 +- openlp/core/lib/imagemanager.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 2c0b53a95..1454f877e 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -185,7 +185,7 @@ def resize_image(image_path, width, height, background): new_image = QtGui.QImage(width, height, QtGui.QImage.Format_ARGB32_Premultiplied) painter = QtGui.QPainter(new_image) - painter.fillRect(new_image.rect(), background) + painter.fillRect(new_image.rect(), QtGui.QColor(background)) painter.drawImage((width - realw) / 2, (height - realh) / 2, preview) return new_image diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 4d6c90078..14444a8a8 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -215,6 +215,8 @@ class ImageManager(QtCore.QObject): image = self._cache[name] if image.image is None: self._conversion_queue.modify_priority(image, Priority.High) + # make sure we are runnning and if not give it a kick + self.process_updates() while image.image is None: log.debug(u'get_image - waiting') time.sleep(0.1) @@ -235,6 +237,8 @@ class ImageManager(QtCore.QObject): image = self._cache[name] if image.image_bytes is None: self._conversion_queue.modify_priority(image, Priority.Urgent) + # make sure we are runnning and if not give it a kick + self.process_updates() while image.image_bytes is None: log.debug(u'get_image_bytes - waiting') time.sleep(0.1) @@ -279,6 +283,7 @@ class ImageManager(QtCore.QObject): """ log.debug(u'_process_cache') image = self._conversion_queue.get()[1] + print image # Generate the QImage for the image. if image.image is None: image.image = resize_image(image.path, self.width, self.height,