Presentation icons

This commit is contained in:
Tim Bentley 2010-04-19 19:20:44 +01:00
parent 4c8c3b7b1c
commit 8242bac82f
3 changed files with 25 additions and 7 deletions

View File

@ -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

View File

@ -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):

View File

@ -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)