forked from openlp/openlp
Compress Impress previews
This commit is contained in:
parent
f5a9f9ed89
commit
e934c7e623
@ -387,7 +387,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to '
|
||||
u'be defined by the plugin')
|
||||
|
||||
def generateSlideData(self, item, item1):
|
||||
def generateSlideData(self, service_item, item):
|
||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
|
||||
u'to be defined by the plugin')
|
||||
|
||||
|
@ -121,7 +121,6 @@ class ImageMediaItem(MediaManagerItem):
|
||||
|
||||
def loadList(self, list):
|
||||
for file in list:
|
||||
print file
|
||||
(path, filename) = os.path.split(unicode(file))
|
||||
thumb = os.path.join(self.servicePath, filename)
|
||||
if os.path.exists(thumb):
|
||||
|
@ -37,6 +37,8 @@ import logging
|
||||
import os
|
||||
import time
|
||||
|
||||
from openlp.core.lib import resize_image
|
||||
|
||||
if os.name == u'nt':
|
||||
from win32com.client import Dispatch
|
||||
else:
|
||||
@ -239,17 +241,22 @@ class ImpressDocument(PresentationDocument):
|
||||
for idx in range(pages.getCount()):
|
||||
page = pages.getByIndex(idx)
|
||||
doc.getCurrentController().setCurrentPage(page)
|
||||
path = u'%s/%s%s.png'% (thumbdir, self.controller.thumbnailprefix,
|
||||
path = u'%s/%s%s.png' % (thumbdir, self.controller.thumbnailprefix,
|
||||
unicode(idx + 1))
|
||||
try:
|
||||
doc.storeToURL(path , props)
|
||||
preview = resize_image(path, 640, 480)
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
preview.save(path, u'png')
|
||||
except:
|
||||
log.exception(u'%s\nUnable to store preview' % path)
|
||||
log.exception(u'%s - Unable to store openoffice preview' % path)
|
||||
|
||||
def create_property(self, name, value):
|
||||
log.debug(u'create property OpenOffice')
|
||||
if os.name == u'nt':
|
||||
prop = self.controller.manager.Bridge_GetStruct(u'com.sun.star.beans.PropertyValue')
|
||||
prop = self.controller.manager.\
|
||||
Bridge_GetStruct(u'com.sun.star.beans.PropertyValue')
|
||||
else:
|
||||
prop = PropertyValue()
|
||||
prop.Name = name
|
||||
@ -356,7 +363,8 @@ class ImpressDocument(PresentationDocument):
|
||||
|
||||
def get_slide_preview_file(self, slide_no):
|
||||
"""
|
||||
Returns an image path containing a preview for the requested slide
|
||||
Returns an image path containing a preview for theimpresscontroller.py
|
||||
requested slide
|
||||
|
||||
``slide_no``
|
||||
The slide an image is required for, starting at 1
|
||||
|
@ -140,10 +140,13 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
self.parent.config.set_list(
|
||||
self.ConfigSection, self.getFileList())
|
||||
filepath = unicode((item.data(QtCore.Qt.UserRole)).toString())
|
||||
#not sure of this has errors
|
||||
#John please can you look at .
|
||||
for cidx in self.controllers:
|
||||
doc = self.controllers[cidx].add_doc(filepath)
|
||||
doc.presentation_deleted()
|
||||
doc.close_presentation()
|
||||
if self.controllers[cidx].enabled:
|
||||
self.controllers[cidx].remove_doc(filepath)
|
||||
self.controllers[cidx].presentation_deleted()
|
||||
self.controllers[cidx].close_presentation()
|
||||
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
items = self.ListView.selectedIndexes()
|
||||
|
@ -138,13 +138,15 @@ class PresentationController(object):
|
||||
self.docs.append(doc)
|
||||
return doc
|
||||
|
||||
def remove_doc(self, doc):
|
||||
def remove_doc(self, doc=None):
|
||||
"""
|
||||
Called to remove an open document from the collection
|
||||
"""
|
||||
log.debug(u'remove_doc Presentation')
|
||||
self.docs.remove(doc)
|
||||
|
||||
if doc is None:
|
||||
return
|
||||
if doc in self.docs:
|
||||
self.docs.remove(doc)
|
||||
|
||||
class PresentationDocument(object):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user