From 3c17af592dc75940b367e93d693087ef1c453a71 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 20 Aug 2011 16:02:57 +0100 Subject: [PATCH] Fix autoupdates --- openlp/core/lib/imagemanager.py | 8 ++++---- openlp/core/ui/themeform.py | 2 +- openlp/core/ui/thememanager.py | 5 +++++ openlp/plugins/images/imageplugin.py | 7 ++++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 3de1ff532..87501602e 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -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 """ diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index b56b68b5b..dc3c23d0d 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -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()) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 69c229532..40b39b7fd 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -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): diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 1d1ef46ee..4b5a6f3c0 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -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)