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
This commit is contained in:
Tim Bentley 2011-09-20 16:23:29 +01:00
parent 088b5070e0
commit 834ed570ce
2 changed files with 6 additions and 1 deletions

View File

@ -185,7 +185,7 @@ def resize_image(image_path, width, height, background):
new_image = QtGui.QImage(width, height, new_image = QtGui.QImage(width, height,
QtGui.QImage.Format_ARGB32_Premultiplied) QtGui.QImage.Format_ARGB32_Premultiplied)
painter = QtGui.QPainter(new_image) 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) painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
return new_image return new_image

View File

@ -215,6 +215,8 @@ class ImageManager(QtCore.QObject):
image = self._cache[name] image = self._cache[name]
if image.image is None: if image.image is None:
self._conversion_queue.modify_priority(image, Priority.High) 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: while image.image is None:
log.debug(u'get_image - waiting') log.debug(u'get_image - waiting')
time.sleep(0.1) time.sleep(0.1)
@ -235,6 +237,8 @@ class ImageManager(QtCore.QObject):
image = self._cache[name] image = self._cache[name]
if image.image_bytes is None: if image.image_bytes is None:
self._conversion_queue.modify_priority(image, Priority.Urgent) 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: while image.image_bytes is None:
log.debug(u'get_image_bytes - waiting') log.debug(u'get_image_bytes - waiting')
time.sleep(0.1) time.sleep(0.1)
@ -279,6 +283,7 @@ class ImageManager(QtCore.QObject):
""" """
log.debug(u'_process_cache') log.debug(u'_process_cache')
image = self._conversion_queue.get()[1] image = self._conversion_queue.get()[1]
print image
# Generate the QImage for the image. # Generate the QImage for the image.
if image.image is None: if image.image is None:
image.image = resize_image(image.path, self.width, self.height, image.image = resize_image(image.path, self.width, self.height,