From cc1e174d6246a56eed19944bbe0c1ede43fca4ae Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 20 Aug 2011 14:21:25 +0100 Subject: [PATCH] Updates --- openlp/core/lib/imagemanager.py | 16 ++++++++++++++++ openlp/core/ui/themewizard.py | 3 --- openlp/plugins/images/imageplugin.py | 12 +++++++++++- openlp/plugins/images/lib/mediaitem.py | 4 ++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index a4a60b2f4..3de1ff532 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -173,6 +173,22 @@ class ImageManager(QtCore.QObject): image.image_bytes = None self._conversion_queue.put((image.priority, image)) + def update_images(self, background): + """ + Screen has changed size so rebuild the cache to new size. + """ + 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 == u'images': + 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): """ Flush the queue to updated any data to update diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 805ce876b..12fc70760 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -64,7 +64,6 @@ class Ui_ThemeWizard(object): self.backgroundStack.setObjectName(u'BackgroundStack') self.colorWidget = QtGui.QWidget(self.backgroundPage) self.colorWidget.setObjectName(u'ColorWidget') - self.colorLayout = QtGui.QFormLayout(self.colorWidget) self.colorLayout.setMargin(0) self.colorLayout.setObjectName(u'ColorLayout') @@ -74,7 +73,6 @@ class Ui_ThemeWizard(object): self.colorButton.setObjectName(u'ColorButton') self.colorLayout.addRow(self.colorLabel, self.colorButton) self.colorLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer) - self.backgroundStack.addWidget(self.colorWidget) self.gradientWidget = QtGui.QWidget(self.backgroundPage) self.gradientWidget.setObjectName(u'GradientWidget') @@ -102,7 +100,6 @@ class Ui_ThemeWizard(object): self.gradientComboBox) self.gradientLayout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer) self.backgroundStack.addWidget(self.gradientWidget) - self.imageWidget = QtGui.QWidget(self.backgroundPage) self.imageWidget.setObjectName(u'ImageWidget') self.imageLayout = QtGui.QFormLayout(self.imageWidget) diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index aeeee5c5d..1d1ef46ee 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -25,9 +25,12 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +from PyQt4 import QtCore, QtGui + import logging -from openlp.core.lib import Plugin, StringContent, build_icon, translate +from openlp.core.lib import Plugin, StringContent, build_icon, translate, \ + Receiver from openlp.plugins.images.lib import ImageMediaItem, ImageTab log = logging.getLogger(__name__) @@ -41,6 +44,8 @@ class ImagePlugin(Plugin): self.weight = -7 self.icon_path = u':/plugins/plugin_images.png' self.icon = build_icon(self.icon_path) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'image_updated'), self.image_updated) def about(self): about_text = translate('ImagePlugin', 'Image Plugin' @@ -82,3 +87,8 @@ class ImagePlugin(Plugin): 'Add the selected image to the service.') } self.setPluginUiTextStrings(tooltips) + + def image_updated(self): + background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection + + u'/background color', QtCore.QVariant(u'#000000'))) + self.liveController.imageManager.update_images(background) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index d88cf47e7..d00b8c9f0 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -140,8 +140,8 @@ class ImageMediaItem(MediaManagerItem): self.plugin.formparent.finishedProgressBar() def generateSlideData(self, service_item, item=None, xmlVersion=False): - background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection + - u'/background color', QtCore.QVariant(u'#000000'))) + background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection + + u'/background color', QtCore.QVariant(u'#000000'))) if item: items = [item] else: