forked from openlp/openlp
Presentation icons
This commit is contained in:
parent
4c8c3b7b1c
commit
8242bac82f
@ -357,12 +357,12 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
Validates to see if the file still exists or
|
Validates to see if the file still exists or
|
||||||
thumbnail is up to date
|
thumbnail is up to date
|
||||||
"""
|
"""
|
||||||
|
if os.path.exists(file):
|
||||||
filedate = os.stat(file).st_mtime
|
filedate = os.stat(file).st_mtime
|
||||||
thumbdate = os.stat(thumb).st_mtime
|
thumbdate = os.stat(thumb).st_mtime
|
||||||
#if file updated rebuild icon
|
#if file updated rebuild icon
|
||||||
if filedate > thumbdate:
|
if filedate > thumbdate:
|
||||||
self.IconFromFile(file, thumb)
|
self.IconFromFile(file, thumb)
|
||||||
if os.path.exists(file):
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
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
|
from openlp.plugins.presentations.lib import MessageListener
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -103,6 +103,10 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
self.PageLayout.addWidget(self.PresentationWidget)
|
self.PageLayout.addWidget(self.PresentationWidget)
|
||||||
|
|
||||||
def initialise(self):
|
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')
|
list = self.parent.config.load_list(u'presentations')
|
||||||
self.loadList(list)
|
self.loadList(list)
|
||||||
for item in self.controllers:
|
for item in self.controllers:
|
||||||
@ -128,8 +132,23 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
'A presentation with that filename already exists.'),
|
'A presentation with that filename already exists.'),
|
||||||
QtGui.QMessageBox.Ok)
|
QtGui.QMessageBox.Ok)
|
||||||
else:
|
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 = QtGui.QListWidgetItem(filename)
|
||||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||||
|
item_name.setIcon(icon)
|
||||||
self.ListView.addItem(item_name)
|
self.ListView.addItem(item_name)
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
|
@ -58,7 +58,6 @@ class PresentationPlugin(Plugin):
|
|||||||
if self.controllers[controller].enabled:
|
if self.controllers[controller].enabled:
|
||||||
presentation_types.append({u'%s' % controller : self.controllers[controller].supports})
|
presentation_types.append({u'%s' % controller : self.controllers[controller].supports})
|
||||||
self.controllers[controller].start_process()
|
self.controllers[controller].start_process()
|
||||||
|
|
||||||
Receiver.send_message(
|
Receiver.send_message(
|
||||||
u'presentation types', presentation_types)
|
u'presentation types', presentation_types)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user