From 834ed570cee03b32beb16110a90f2da86bec353c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 20 Sep 2011 16:23:29 +0100 Subject: [PATCH 1/2] 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, From 47b7379967a1bb10e83cc93ab3fd63d377dfe42f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 20 Sep 2011 16:41:04 +0100 Subject: [PATCH 2/2] Fix spelling and remove print statement --- openlp/core/lib/imagemanager.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 14444a8a8..0dcc2246b 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -215,7 +215,7 @@ 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 + # make sure we are running and if not give it a kick self.process_updates() while image.image is None: log.debug(u'get_image - waiting') @@ -237,7 +237,7 @@ 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 + # make sure we are running and if not give it a kick self.process_updates() while image.image_bytes is None: log.debug(u'get_image_bytes - waiting') @@ -283,7 +283,6 @@ 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,