← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bug-1071893 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bug-1071893 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1071893 in OpenLP: "Video media manager does not show red crosses against missing files"
  https://bugs.launchpad.net/openlp/+bug/1071893

For more details, see:
https://code.launchpad.net/~trb143/openlp/bug-1071893/+merge/132804

Check the media files exist on load and set the icon correctly

-- 
https://code.launchpad.net/~trb143/openlp/bug-1071893/+merge/132804
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bug-1071893 into lp:openlp.
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2012-10-21 14:07:57 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2012-11-04 14:40:28 +0000
@@ -47,6 +47,7 @@
 VIDEO = QtGui.QImage(u':/media/media_video.png')
 AUDIO = QtGui.QImage(u':/media/media_audio.png')
 DVD_ICON = QtGui.QImage(u':/media/media_video.png')
+ERROR = QtGui.QImage(u':/general/general_delete.png')
 
 class MediaMediaItem(MediaManagerItem):
     """
@@ -292,7 +293,12 @@
             key=lambda filename: os.path.split(unicode(filename))[1])
         for track in media:
             track_info = QtCore.QFileInfo(track)
-            if track_info.isFile():
+            if not os.path.exists(track):
+                filename = os.path.split(unicode(track))[1]
+                item_name = QtGui.QListWidgetItem(filename)
+                item_name.setIcon(build_icon(ERROR))
+                item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
+            elif track_info.isFile():
                 filename = os.path.split(unicode(track))[1]
                 item_name = QtGui.QListWidgetItem(filename)
                 item_name.setIcon(build_icon(VIDEO))