diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index fdc81092f..05ce36ad1 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -357,12 +357,12 @@ class MediaManagerItem(QtGui.QWidget): Validates to see if the file still exists or thumbnail is up to date """ - filedate = os.stat(file).st_mtime - thumbdate = os.stat(thumb).st_mtime - #if file updated rebuild icon - if filedate > thumbdate: - self.IconFromFile(file, thumb) if os.path.exists(file): + filedate = os.stat(file).st_mtime + thumbdate = os.stat(thumb).st_mtime + #if file updated rebuild icon + if filedate > thumbdate: + self.IconFromFile(file, thumb) return True return False diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 79c8600f0..c58345eda 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -28,7 +28,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, BaseListWithDnD +from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon from openlp.plugins.presentations.lib import MessageListener log = logging.getLogger(__name__) @@ -103,6 +103,10 @@ class PresentationMediaItem(MediaManagerItem): self.PageLayout.addWidget(self.PresentationWidget) def initialise(self): + self.servicePath = os.path.join( + self.parent.config.get_data_path(), u'.thumbnails') + if not os.path.exists(self.servicePath): + os.mkdir(self.servicePath) list = self.parent.config.load_list(u'presentations') self.loadList(list) for item in self.controllers: @@ -128,8 +132,23 @@ class PresentationMediaItem(MediaManagerItem): 'A presentation with that filename already exists.'), QtGui.QMessageBox.Ok) else: + icon = None + for controller in self.controllers: + thumb = os.path.join(self.parent.config.get_data_path(), controller, filename, u'slide1.png') + preview = os.path.join(self.parent.config.get_data_path(), controller, u'thumbnails', filename, u'slide1.png') + if os.path.exists(preview): + if os.path.exists(thumb): + if self.validate(preview, thumb): + icon = build_icon(thumb) + else: + icon = build_icon(u':/general/general_delete.png') + else: + icon = self.IconFromFile(preview, thumb) + if not icon: + icon = build_icon(u':/general/general_delete.png') item_name = QtGui.QListWidgetItem(filename) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) + item_name.setIcon(icon) self.ListView.addItem(item_name) def onDeleteClick(self): diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 00a83fe4b..a2d01b1a5 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -58,7 +58,6 @@ class PresentationPlugin(Plugin): if self.controllers[controller].enabled: presentation_types.append({u'%s' % controller : self.controllers[controller].supports}) self.controllers[controller].start_process() - Receiver.send_message( u'presentation types', presentation_types)