forked from openlp/openlp
Show powerpoint slide thumbnails in slidecontroller
This commit is contained in:
parent
5e79fc3399
commit
bb619ce325
|
@ -167,7 +167,7 @@ class ServiceItem(object):
|
|||
self.service_frames.append(
|
||||
{u'title': frame_title, u'raw_slide': raw_slide})
|
||||
|
||||
def add_from_command(self, path, frame_title):
|
||||
def add_from_command(self, path, frame_title, image):
|
||||
"""
|
||||
Add a slide from a command.
|
||||
|
||||
|
@ -180,7 +180,7 @@ class ServiceItem(object):
|
|||
self.service_item_type = ServiceType.Command
|
||||
self.service_item_path = path
|
||||
self.service_frames.append(
|
||||
{u'title': frame_title, u'command': None})
|
||||
{u'title': frame_title, u'command': None, u'text':None, u'image': image})
|
||||
|
||||
def get_service_repr(self):
|
||||
"""
|
||||
|
|
|
@ -250,8 +250,7 @@ class SlideController(QtGui.QWidget):
|
|||
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
||||
[item.shortname, item.service_item_path,
|
||||
item.service_frames[0][u'title']])
|
||||
else:
|
||||
self.displayServiceManagerItems(item, 0)
|
||||
self.displayServiceManagerItems(item, 0)
|
||||
|
||||
def addServiceManagerItem(self, item, slideno):
|
||||
"""
|
||||
|
@ -270,8 +269,7 @@ class SlideController(QtGui.QWidget):
|
|||
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
||||
[item.shortname, item.service_item_path,
|
||||
item.service_frames[0][u'title'], slideno])
|
||||
else:
|
||||
self.displayServiceManagerItems(item, slideno)
|
||||
self.displayServiceManagerItems(item, slideno)
|
||||
|
||||
def displayServiceManagerItems(self, serviceitem, slideno):
|
||||
"""
|
||||
|
|
|
@ -129,9 +129,6 @@ class ImpressController(PresentationController):
|
|||
0, properties)
|
||||
self.presentation = self.document.getPresentation()
|
||||
self.presentation.Display = self.plugin.render_manager.current_display + 1
|
||||
self.presentation.start()
|
||||
self.controller = \
|
||||
desktop.getCurrentComponent().Presentation.getController()
|
||||
except:
|
||||
log.exception(u'Failed to load presentation')
|
||||
return
|
||||
|
@ -279,5 +276,9 @@ class ImpressController(PresentationController):
|
|||
``slide_no``
|
||||
The slide an image is required for, starting at 1
|
||||
"""
|
||||
return os.path.join(self.thumbnailpath,
|
||||
path = os.path.join(self.thumbnailpath,
|
||||
self.thumbnailprefix + unicode(slide_no) + u'.png')
|
||||
if os.path.isfile(path):
|
||||
return path
|
||||
else:
|
||||
return None
|
||||
|
|
|
@ -132,9 +132,18 @@ class PresentationMediaItem(MediaManagerItem):
|
|||
return False
|
||||
service_item.title = unicode(self.DisplayTypeComboBox.currentText())
|
||||
service_item.shortname = unicode(self.DisplayTypeComboBox.currentText())
|
||||
cont = self.controllers[service_item.shortname]
|
||||
for item in items:
|
||||
bitem = self.ListView.item(item.row())
|
||||
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_command(path, name)
|
||||
cont.store_filename(filename)
|
||||
if cont.get_slide_preview_file(1) is None:
|
||||
cont.load_presentation(filename)
|
||||
i = 1
|
||||
img = cont.get_slide_preview_file(i)
|
||||
while img is not None:
|
||||
service_item.add_from_command(path, name, img)
|
||||
i = i + 1
|
||||
img = cont.get_slide_preview_file(i)
|
||||
return True
|
||||
|
|
|
@ -66,6 +66,7 @@ class MessageListener(object):
|
|||
if self.controller.is_loaded():
|
||||
self.shutdown(None)
|
||||
self.controller.load_presentation(file)
|
||||
self.controller.start_presentation()
|
||||
self.controller.slidenumber = 0
|
||||
|
||||
def activate(self):
|
||||
|
|
|
@ -127,7 +127,6 @@ class PowerpointController(PresentationController):
|
|||
return
|
||||
self.presentation = self.process.Presentations(self.process.Presentations.Count)
|
||||
self.create_thumbnails()
|
||||
self.start_presentation()
|
||||
|
||||
def create_thumbnails(self):
|
||||
"""
|
||||
|
@ -250,5 +249,9 @@ class PowerpointController(PresentationController):
|
|||
``slide_no``
|
||||
The slide an image is required for, starting at 1
|
||||
"""
|
||||
return os.path.join(self.thumbnailpath,
|
||||
path = os.path.join(self.thumbnailpath,
|
||||
self.thumbnailprefix + unicode(slide_no) + u'.png')
|
||||
if os.path.isfile(path):
|
||||
return path
|
||||
else:
|
||||
return None
|
||||
|
|
|
@ -112,6 +112,7 @@ class PptviewController(PresentationController):
|
|||
try:
|
||||
self.pptid = self.process.OpenPPT(filepath, None, rect,
|
||||
str(os.path.join(self.thumbnailpath, self.thumbnailprefix)))
|
||||
self.stop_presentation()
|
||||
except:
|
||||
log.exception(u'Failed to load presentation')
|
||||
|
||||
|
@ -201,6 +202,10 @@ class PptviewController(PresentationController):
|
|||
``slide_no``
|
||||
The slide an image is required for, starting at 1
|
||||
"""
|
||||
return os.path.join(self.thumbnailpath,
|
||||
path = os.path.join(self.thumbnailpath,
|
||||
self.thumbnailprefix + unicode(slide_no) + u'.bmp')
|
||||
if os.path.isfile(path):
|
||||
return path
|
||||
else:
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in New Issue