Theme fix

This commit is contained in:
Tim Bentley 2011-08-21 06:33:07 +01:00
parent 76c0881559
commit 21bf34c436
2 changed files with 19 additions and 3 deletions

View File

@ -175,7 +175,7 @@ class ImageManager(QtCore.QObject):
def update_images(self, image_type, background):
"""
Screen has changed size so rebuild the cache to new size.
Border has changed so update all the images affected.
"""
log.debug(u'update_images')
# Mark the images as dirty for a rebuild by setting the image and byte
@ -189,6 +189,22 @@ class ImageManager(QtCore.QObject):
image.image_bytes = None
self._conversion_queue.put((image.priority, image))
def update_image(self, name, image_type, background):
"""
Border has changed so update the image affected.
"""
log.debug(u'update_images')
# Mark the images as dirty for a rebuild by setting the image and byte
# stream to None.
self._conversion_queue = PriorityQueue()
for key, image in self._cache.iteritems():
if image.source == image_type and image.name == name:
image.background = background
image.priority = Priority.Normal
image.image = None
image.image_bytes = None
self._conversion_queue.put((image.priority, image))
def process_updates(self):
"""
Flush the queue to updated any data to update

View File

@ -612,8 +612,8 @@ class ThemeManager(QtGui.QWidget):
self._writeTheme(theme, imageFrom, imageTo)
if theme.background_type == \
BackgroundType.to_string(BackgroundType.Image):
self.mainwindow.imageManager.update_images(u'theme',
QtGui.QColor(theme.background_border_color))
self.mainwindow.imageManager.update_image(theme.theme_name,
u'theme', QtGui.QColor(theme.background_border_color))
self.mainwindow.imageManager.process_updates()
self.loadThemes()