Fix missing files in presentations

This commit is contained in:
Tim Bentley 2012-11-05 06:05:44 +00:00
parent a66f68d0df
commit 9ba9b9605d
1 changed files with 47 additions and 36 deletions

View File

@ -43,6 +43,8 @@ from openlp.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
ERROR = QtGui.QImage(u':/general/general_delete.png')
class PresentationMediaItem(MediaManagerItem): class PresentationMediaItem(MediaManagerItem):
""" """
This is the Presentation media manager item for Presentation Items. This is the Presentation media manager item for Presentation Items.
@ -180,19 +182,28 @@ class PresentationMediaItem(MediaManagerItem):
if currlist.count(file) > 0: if currlist.count(file) > 0:
continue continue
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
if not os.path.exists(file):
item_name = QtGui.QListWidgetItem(filename)
item_name.setIcon(build_icon(ERROR))
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
item_name.setToolTip(file)
self.listView.addItem(item_name)
else:
if titles.count(filename) > 0: if titles.count(filename) > 0:
if not initialLoad: if not initialLoad:
critical_error_message_box( critical_error_message_box(
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'File Exists'), 'File Exists'),
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'A presentation with that filename already exists.')) 'A presentation with that filename already exists.')
)
continue continue
controller_name = self.findControllerByType(filename) controller_name = self.findControllerByType(filename)
if controller_name: if controller_name:
controller = self.controllers[controller_name] controller = self.controllers[controller_name]
doc = controller.add_document(unicode(file)) doc = controller.add_document(unicode(file))
thumb = os.path.join(doc.get_thumbnail_folder(), u'icon.png') thumb = os.path.join(doc.get_thumbnail_folder(),
u'icon.png')
preview = doc.get_thumbnail_path(1, True) preview = doc.get_thumbnail_path(1, True)
if not preview and not initialLoad: if not preview and not initialLoad:
doc.load_presentation() doc.load_presentation()