openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00580
[Merge] lp:~j-corwin/openlp/present into lp:openlp
Jonathan Corwin has proposed merging lp:~j-corwin/openlp/present into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Display presentation thumbnails in slide controller.
--
https://code.launchpad.net/~j-corwin/openlp/present/+merge/13525
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2009-10-09 22:46:35 +0000
+++ openlp/core/lib/serviceitem.py 2009-10-17 19:20:23 +0000
@@ -167,7 +167,7 @@
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 @@
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):
"""
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-10-17 16:11:41 +0000
+++ openlp/core/ui/slidecontroller.py 2009-10-17 19:20:23 +0000
@@ -256,8 +256,7 @@
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):
"""
@@ -276,8 +275,7 @@
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):
"""
=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py 2009-10-15 21:49:31 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py 2009-10-17 19:20:23 +0000
@@ -129,9 +129,7 @@
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()
+ self.controller = None
except:
log.exception(u'Failed to load presentation')
return
@@ -219,8 +217,7 @@
self.document = None
def is_loaded(self):
- if self.presentation is None or self.document is None \
- or self.controller is None:
+ if self.presentation is None or self.document is None:
return False
try:
if self.document.getPresentation() is None:
@@ -232,6 +229,8 @@
def is_active(self):
if not self.is_loaded():
return False
+ if self.controller is None:
+ return False
return self.controller.isRunning() and self.controller.isActive()
def unblank_screen(self):
@@ -244,7 +243,7 @@
self.controller.deactivate()
def start_presentation(self):
- if not self.controller.isRunning():
+ if self.controller is None or not self.controller.isRunning():
self.presentation.start()
self.controller = self.desktop.getCurrentComponent().Presentation.getController()
else:
@@ -255,7 +254,7 @@
return self.controller.getCurrentSlideIndex()
def get_slide_count(self):
- return self.controller.getSlideCount()
+ return self.document.getDrawPages().getCount()
def goto_slide(self, slideno):
self.controller.gotoSlideIndex(slideno-1)
@@ -279,5 +278,9 @@
``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
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2009-10-09 22:46:35 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2009-10-17 19:20:23 +0000
@@ -132,9 +132,18 @@
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
=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py 2009-10-11 21:31:27 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py 2009-10-17 19:20:23 +0000
@@ -66,6 +66,7 @@
if self.controller.is_loaded():
self.shutdown(None)
self.controller.load_presentation(file)
+ self.controller.start_presentation()
self.controller.slidenumber = 0
def activate(self):
@@ -81,7 +82,7 @@
def slide(self, message):
self.activate()
if message is not None:
- self.controller.goto_slide(message[0])
+ self.controller.goto_slide(message[0]+1)
self.controller.slidenumber = self.controller.get_slide_number()
def first(self, message):
=== modified file 'openlp/plugins/presentations/lib/powerpointcontroller.py'
--- openlp/plugins/presentations/lib/powerpointcontroller.py 2009-10-15 21:49:31 +0000
+++ openlp/plugins/presentations/lib/powerpointcontroller.py 2009-10-17 19:20:23 +0000
@@ -127,7 +127,6 @@
return
self.presentation = self.process.Presentations(self.process.Presentations.Count)
self.create_thumbnails()
- self.start_presentation()
def create_thumbnails(self):
"""
@@ -250,5 +249,9 @@
``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
=== modified file 'openlp/plugins/presentations/lib/pptviewcontroller.py'
--- openlp/plugins/presentations/lib/pptviewcontroller.py 2009-10-11 21:31:27 +0000
+++ openlp/plugins/presentations/lib/pptviewcontroller.py 2009-10-17 19:20:23 +0000
@@ -112,6 +112,7 @@
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 @@
``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
Follow ups