diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 99b8f624f..f7d576913 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -172,9 +172,18 @@ class ImageMediaItem(MediaManagerItem): for item in items: bitem = self.listView.item(item.row()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) - (path, name) = os.path.split(filename) - service_item.add_from_image(filename, name) - return True + if os.path.exists(filename): + (path, name) = os.path.split(filename) + service_item.add_from_image(filename, name) + return True + else: + # File is no longer present + QtGui.QMessageBox.critical( + self, translate('ImagePlugin.MediaItem', + 'Missing Image'), + unicode(translate('ImagePlugin.MediaItem', + 'The Image %s no longer exists.')) % filename) + return False else: return False diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index d6719970f..a8bb6456b 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -122,15 +122,24 @@ class MediaMediaItem(MediaManagerItem): if item is None: return False filename = unicode(item.data(QtCore.Qt.UserRole).toString()) - service_item.title = unicode( - translate('MediaPlugin.MediaItem', 'Media')) - service_item.add_capability(ItemCapabilities.RequiresMedia) - # force a nonexistent theme - service_item.theme = -1 - frame = u':/media/image_clapperboard.png' - (path, name) = os.path.split(filename) - service_item.add_from_command(path, name, frame) - return True + if os.path.exists(filename): + service_item.title = unicode( + translate('MediaPlugin.MediaItem', 'Media')) + service_item.add_capability(ItemCapabilities.RequiresMedia) + # force a nonexistent theme + service_item.theme = -1 + frame = u':/media/image_clapperboard.png' + (path, name) = os.path.split(filename) + service_item.add_from_command(path, name, frame) + return True + else: + # File is no longer present + QtGui.QMessageBox.critical( + self, translate('MediaPlugin.MediaItem', + 'Missing Media File'), + unicode(translate('MediaPlugin.MediaItem', + 'The file %s no longer exists.')) % filename) + return False def initialise(self): self.listView.setSelectionMode( diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index acd82d4f7..4176fd58e 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -272,10 +272,15 @@ class PresentationMediaItem(MediaManagerItem): i = i + 1 img = doc.get_thumbnail_path(i, True) doc.close_presentation() + return True else: # File is no longer present + QtGui.QMessageBox.critical( + self, translate('PresentationPlugin.MediaItem', + 'Missing Presentation'), + unicode(translate('PresentationPlugin.MediaItem', + 'The Presentation %s no longer exists.')) % filename) return False - return True else: return False