This commit is contained in:
Tim Bentley 2011-08-20 14:21:25 +01:00
parent 9e6d05098b
commit cc1e174d62
4 changed files with 29 additions and 6 deletions

View File

@ -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

View File

@ -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)

View File

@ -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', '<strong>Image Plugin</strong>'
@ -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)

View File

@ -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: