diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 789854c78..8078b5868 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -420,7 +420,11 @@ class ServiceItem(object): self._raw_frames.append(slide) elif self.service_item_type == ServiceItemType.Image: settings_section = serviceitem['serviceitem']['header']['name'] - background = QtGui.QColor(Settings().value(settings_section + '/background color')) + background = None + try: + background = QtGui.QColor(Settings().value(settings_section + '/background color')) + except Exception: + pass if path: self.has_original_files = False for text_image in serviceitem['serviceitem']['data']: diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 043838f36..dbf095e48 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -438,7 +438,7 @@ class SlideController(DisplayController): # "V1" was the slide we wanted to go. self.preview_widget.change_slide(self.slideList[self.current_shortcut]) self.slide_selected() - # Reset the shortcut. + # Reset the shortcut. self.current_shortcut = '' def set_live_hotkeys(self, parent=None): @@ -733,7 +733,7 @@ class SlideController(DisplayController): if old_item and self.is_live and old_item.is_capable(ItemCapabilities.ProvidesOwnDisplay): self._reset_blank() Registry().execute( - '%s_start' % service_item.name.lower(), [service_item, self.is_live, self.hide_mode(), slideno]) + '%s_start' % service_item.name.lower(), [self.service_item, self.is_live, self.hide_mode(), slideno]) self.slideList = {} if self.is_live: self.song_menu.menu().clear() diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index a89877ac6..be48c10f6 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -238,7 +238,7 @@ class PresentationMediaItem(MediaManagerItem): Settings().setValue(self.settings_section + '/presentations files', self.get_file_list()) def generate_slide_data(self, service_item, item=None, xml_version=False, - remote=False, context=ServiceItemContext.Service): + remote=False, context=ServiceItemContext.Service, presentation_file=None): """ Load the relevant information for displaying the presentation in the slidecontroller. In the case of powerpoints, an image for each slide. @@ -249,7 +249,9 @@ class PresentationMediaItem(MediaManagerItem): items = self.list_view.selectedItems() if len(items) > 1: return False - filename = items[0].data(QtCore.Qt.UserRole) + filename = presentation_file + if filename is None: + filename = items[0].data(QtCore.Qt.UserRole) file_type = os.path.splitext(filename)[1][1:] if not self.display_type_combo_box.currentText(): return False @@ -261,7 +263,9 @@ class PresentationMediaItem(MediaManagerItem): # force a nonexistent theme service_item.theme = -1 for bitem in items: - filename = bitem.data(QtCore.Qt.UserRole) + filename = presentation_file + if filename is None: + filename = bitem.data(QtCore.Qt.UserRole) (path, name) = os.path.split(filename) service_item.title = name if os.path.exists(filename): @@ -298,7 +302,7 @@ class PresentationMediaItem(MediaManagerItem): (path, name) = os.path.split(filename) service_item.title = name if os.path.exists(filename): - if service_item.processor == self.Automatic: + if service_item.processor == self.automatic: service_item.processor = self.findControllerByType(filename) if not service_item.processor: return False diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index fba9c8b4d..68b7641cc 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -33,7 +33,7 @@ from PyQt4 import QtCore from openlp.core.lib import Registry from openlp.core.ui import HideMode -from openlp.core.lib import ServiceItemContext +from openlp.core.lib import ServiceItemContext, ServiceItem log = logging.getLogger(__name__) @@ -318,14 +318,26 @@ class MessageListener(object): hide_mode = message[2] file = item.get_frame_path() self.handler = item.processor - #self.media_item.generate_slide_data(self, service_item, item=None, xml_version=False,remote=False, context=ServiceItemContext.Service) + # When starting presentation from the servicemanager/slidecontroller we convert + # PDF/XPS-serviceitems into image-serviceitems. When started from the mediamanager + # the conversion has already been done. if file.endswith('.pdf') or file.endswith('.xps'): - log.debug('Trying to convert from pdf to images for service-item') + log.debug('Converting from pdf/xps to images for serviceitem with file %s', file) + # Create a new image-serviceitem which will overwrite the old one + new_item = ServiceItem() + new_item.name = 'images' if is_live: - self.media_item.generate_slide_data(self, item, None, False, False, ServiceItemContext.Live) + self.media_item.generate_slide_data(new_item, item, False, False, ServiceItemContext.Live, file) else: - self.media_item.generate_slide_data(self, item, None, False, False, ServiceItemContext.Preview) - + self.media_item.generate_slide_data(new_item, item, False, False, ServiceItemContext.Preview, file) + # We need to overwrite the current serviceitem to make the slidecontroller + # present the images, so we do some copying + service_repr = {'serviceitem': new_item.get_service_repr(True) } + item.set_from_service(service_repr) + item._raw_frames = new_item._raw_frames + # When presenting PDF or XPS, we are using the image presentation code, + # so handler & processor is set to None, and we skip adding the handler. + self.handler = None if self.handler == self.media_item.automatic: self.handler = self.media_item.findControllerByType(file) if not self.handler: @@ -334,9 +346,8 @@ class MessageListener(object): controller = self.live_handler else: controller = self.preview_handler - # when presenting PDF, we're using the image presentation code, + # When presenting PDF or XPS, we are using the image presentation code, # so handler & processor is set to None, and we skip adding the handler. - log.debug('file: %s' % file) if self.handler == None: self.controller = controller else: