Fix autoupdates

This commit is contained in:
Tim Bentley 2011-08-20 16:02:57 +01:00
parent cc1e174d62
commit 3c17af592d
4 changed files with 16 additions and 6 deletions

View File

@ -154,7 +154,7 @@ class ImageManager(QtCore.QObject):
self._imageThread = ImageThread(self)
self._conversion_queue = PriorityQueue()
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.config_updated)
QtCore.SIGNAL(u'config_updated'), self.process_updates)
def update_display(self):
"""
@ -173,7 +173,7 @@ class ImageManager(QtCore.QObject):
image.image_bytes = None
self._conversion_queue.put((image.priority, image))
def update_images(self, background):
def update_images(self, image_type, background):
"""
Screen has changed size so rebuild the cache to new size.
"""
@ -182,14 +182,14 @@ class ImageManager(QtCore.QObject):
# stream to None.
self._conversion_queue = PriorityQueue()
for key, image in self._cache.iteritems():
if image.source == u'images':
if image.source == image_type:
image.background = background
image.priority = Priority.Normal
image.image = None
image.image_bytes = None
self._conversion_queue.put((image.priority, image))
def config_updated(self):
def process_updates(self):
"""
Flush the queue to updated any data to update
"""

View File

@ -576,7 +576,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
def accept(self):
"""
Lets save the them as Finish has been pressed
Lets save the theme as Finish has been pressed
"""
# Save the theme name
self.theme.theme_name = unicode(self.field(u'name').toString())

View File

@ -610,6 +610,11 @@ class ThemeManager(QtGui.QWidget):
and to trigger the reload of the theme list
"""
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.process_updates()
self.loadThemes()
def _writeTheme(self, theme, imageFrom, imageTo):

View File

@ -89,6 +89,11 @@ class ImagePlugin(Plugin):
self.setPluginUiTextStrings(tooltips)
def image_updated(self):
"""
Triggered by saving and changing the image border. Sets the images in
image manager to require updates. Actual update is triggered by the
last part of saving the config.
"""
background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection
+ u'/background color', QtCore.QVariant(u'#000000')))
self.liveController.imageManager.update_images(background)
self.liveController.imageManager.update_images(u'image', background)