Fix image error text

Add Guard to video background.
Use new event method to display message
Add Fix for theme editor start up bug.

bzr-revno: 1190
Fixes: https://launchpad.net/bugs/697405
This commit is contained in:
Tim Bentley 2011-01-05 19:29:09 +00:00
commit 4c74cf4594
4 changed files with 27 additions and 12 deletions

View File

@ -435,6 +435,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
Background style Combo box has changed. Background style Combo box has changed.
""" """
# do not allow updates when screen is building for the first time.
if self.updateThemeAllowed:
self.theme.background_type = BackgroundType.to_string(index) self.theme.background_type = BackgroundType.to_string(index)
self.setBackgroundPageValues() self.setBackgroundPageValues()

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
context_menu_action, ItemCapabilities, SettingsManager, translate, \ context_menu_action, ItemCapabilities, SettingsManager, translate, \
check_item_selected check_item_selected, Receiver
from openlp.core.utils import AppLocation, get_images_filter from openlp.core.utils import AppLocation, get_images_filter
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -208,6 +208,9 @@ class ImageMediaItem(MediaManagerItem):
self.parent.liveController.display.resetImage() self.parent.liveController.display.resetImage()
def onReplaceClick(self): def onReplaceClick(self):
"""
Called to replace Live backgound with the video selected
"""
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem', translate('ImagePlugin.MediaItem',
'You must select an image to replace the background with.')): 'You must select an image to replace the background with.')):
@ -218,11 +221,12 @@ class ImageMediaItem(MediaManagerItem):
(path, name) = os.path.split(filename) (path, name) = os.path.split(filename)
self.parent.liveController.display.directImage(name, filename) self.parent.liveController.display.directImage(name, filename)
else: else:
QtGui.QMessageBox.critical(self, Receiver.send_message(u'openlp_error_message', {
translate('ImagePlugin.MediaItem', 'Live Background Could ' u'title': translate('ImagePlugin.MediaItem',
'Not Be Replaced'), 'Live Background Error'),
unicode(translate('ImagePlugin.MediaItem', u'message': unicode(translate('ImagePlugin.MediaItem',
'The image %s no longer exists.')) % filename) 'There was a problem replacing your background, '
'the image file %s no longer exists.')) % filename})
self.resetButton.setVisible(True) self.resetButton.setVisible(True)
def onPreviewClick(self): def onPreviewClick(self):

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager, translate, check_item_selected, \ ItemCapabilities, SettingsManager, translate, check_item_selected, \
context_menu_action context_menu_action, Receiver
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -108,11 +108,20 @@ class MediaMediaItem(MediaManagerItem):
def onReplaceClick(self): def onReplaceClick(self):
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem', translate('MediaPlugin.MediaItem',
'You must select a media file to replace the background with.')): 'You must select a media file to replace the background with.')):
item = self.listView.currentItem() item = self.listView.currentItem()
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = unicode(item.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename):
(path, name) = os.path.split(filename)
self.parent.liveController.display.video(filename, 0, True) self.parent.liveController.display.video(filename, 0, True)
else:
Receiver.send_message(u'openlp_error_message', {
u'title': translate('MediaPlugin.MediaItem',
'Live Background Error'),
u'message': unicode(translate('MediaPlugin.MediaItem',
'There was a problem replacing your background, '
'the media file %s no longer exists.')) % filename})
self.resetButton.setVisible(True) self.resetButton.setVisible(True)
def generateSlideData(self, service_item, item=None, xmlVersion=False): def generateSlideData(self, service_item, item=None, xmlVersion=False):

View File

@ -79,7 +79,7 @@ class MediaPlugin(Plugin):
return MediaTab(self.name) return MediaTab(self.name)
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object.
return MediaMediaItem(self, self, self.icon) return MediaMediaItem(self, self, self.icon)
def about(self): def about(self):