update preview when live background is replaaced

This commit is contained in:
Andreas Preikschat 2011-01-16 18:42:26 +01:00
parent 378c1f1542
commit 471de78bfe
2 changed files with 21 additions and 3 deletions

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager, translate, check_item_selected, \
check_directory_exists
check_directory_exists, Receiver
from openlp.core.ui import criticalErrorMessageBox
from openlp.core.utils import AppLocation, delete_file, get_images_filter
@ -187,12 +187,17 @@ class ImageMediaItem(MediaManagerItem):
return False
def onResetClick(self):
"""
Called to reset the Live backgound with the image selected,
"""
self.resetAction.setVisible(False)
self.parent.liveController.display.resetImage()
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
def onReplaceClick(self):
"""
Called to replace Live backgound with the video selected
Called to replace Live backgound with the image selected.
"""
if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem',
@ -204,6 +209,8 @@ class ImageMediaItem(MediaManagerItem):
(path, name) = os.path.split(filename)
self.parent.liveController.display.directImage(name, filename)
self.resetAction.setVisible(True)
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
else:
criticalErrorMessageBox(
translate('ImagePlugin.MediaItem', 'Live Background Error'),

View File

@ -30,7 +30,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager, translate, check_item_selected
ItemCapabilities, SettingsManager, translate, check_item_selected, Receiver
from openlp.core.ui import criticalErrorMessageBox
log = logging.getLogger(__name__)
@ -40,6 +40,7 @@ class MediaListView(BaseListWithDnD):
self.PluginName = u'Media'
BaseListWithDnD.__init__(self, parent)
class MediaMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Media Slides.
@ -92,10 +93,18 @@ class MediaMediaItem(MediaManagerItem):
self.resetAction.setVisible(False)
def onResetClick(self):
"""
Called to reset the Live backgound with the media selected,
"""
self.resetAction.setVisible(False)
self.parent.liveController.display.resetVideo()
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
def onReplaceClick(self):
"""
Called to replace Live backgound with the media selected.
"""
if check_item_selected(self.listView,
translate('MediaPlugin.MediaItem',
'You must select a media file to replace the background with.')):
@ -105,6 +114,8 @@ class MediaMediaItem(MediaManagerItem):
(path, name) = os.path.split(filename)
self.parent.liveController.display.video(filename, 0, True)
self.resetAction.setVisible(True)
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
else:
criticalErrorMessageBox(translate('MediaPlugin.MediaItem',
'Live Background Error'),