diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 52ebe99c8..8fb02a5ba 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -223,16 +223,20 @@ def image_to_byte(image): ``image`` The image to converted. """ - log.debug(u'image_to_byte') + log.debug(u'image_to_byte - start') byte_array = QtCore.QByteArray() # use buffer to store pixmap into byteArray buffie = QtCore.QBuffer(byte_array) buffie.open(QtCore.QIODevice.WriteOnly) - if isinstance(image, QtGui.QImage): - pixmap = QtGui.QPixmap.fromImage(image) - else: - pixmap = QtGui.QPixmap(image) - pixmap.save(buffie, "PNG") +# if isinstance(image, QtGui.QImage): +# log.debug(u'image_to_byte - image') +# #pixmap = QtGui.QPixmap.fromImage(image) +# pixmap = image +# else: +# log.debug(u'image_to_byte - pixmap') +# pixmap = QtGui.QPixmap(image) + image.save(buffie, "PNG") + log.debug(u'image_to_byte - end') # convert to base64 encoding so does not get missed! return byte_array.toBase64() @@ -253,8 +257,11 @@ def resize_image(image, width, height, background=QtCore.Qt.black): The background colour defaults to black. """ - log.debug(u'resize_image') - preview = QtGui.QImage(image) + log.debug(u'resize_image - start') + if isinstance(image, QtGui.QImage): + preview = image + else: + preview = QtGui.QImage(image) if not preview.isNull(): # Only resize if different size if preview.width() == width and preview.height == height: @@ -263,6 +270,7 @@ def resize_image(image, width, height, background=QtCore.Qt.black): QtCore.Qt.SmoothTransformation) image_cache_key = u'%s%s%s' % (image, unicode(width), unicode(height)) if image_cache_key in image_cache: + log.debug(u'resize_image - end cache') return image_cache[image_cache_key] realw = preview.width() realh = preview.height() @@ -273,6 +281,7 @@ def resize_image(image, width, height, background=QtCore.Qt.black): painter = QtGui.QPainter(new_image) painter.drawImage((width - realw) / 2, (height - realh) / 2, preview) image_cache[image_cache_key] = new_image + log.debug(u'resize_image - end') return new_image def check_item_selected(list_widget, message): diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 96764b7fe..0c9d8734f 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -184,7 +184,7 @@ class MainDisplay(DisplayWidget): `slide` The slide text to be displayed """ - log.debug(u'text') + log.debug(u'text to display') # Wait for the webview to update before displayiong text. while not self.loaded: Receiver.send_message(u'openlp_process_events') @@ -199,7 +199,7 @@ class MainDisplay(DisplayWidget): `slide` The slide text to be displayed """ - log.debug(u'alert') + log.debug(u'alert to display') if self.height() != self.screen[u'size'].height() \ or not self.isVisible() or self.videoWidget.isVisible(): shrink = True @@ -219,7 +219,7 @@ class MainDisplay(DisplayWidget): shrinkItem.setVisible(True) else: shrinkItem.setVisible(False) - shrinkItem.resize(self.screen[u'size'].width(), + shrinkItem.resize(self.screen[u'size'].width(), self.screen[u'size'].height()) def image(self, image): @@ -230,7 +230,7 @@ class MainDisplay(DisplayWidget): `Image` The Image to be displayed can be QImage or QPixmap """ - log.debug(u'image') + log.debug(u'image to display') image = resize_image(image, self.screen[u'size'].width(), self.screen[u'size'].height()) self.resetVideo() diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index b7be980cc..12d2199c4 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -179,23 +179,23 @@ class SlideController(QtGui.QWidget): self.HideMenu.setMenu(QtGui.QMenu( translate('OpenLP.SlideController', 'Hide'), self.Toolbar)) self.BlankScreen = QtGui.QAction(QtGui.QIcon( - u':/slides/slide_blank.png'), - translate('OpenLP.SlideController', + u':/slides/slide_blank.png'), + translate('OpenLP.SlideController', 'Blank Screen'), self.HideMenu) self.BlankScreen.setCheckable(True) QtCore.QObject.connect(self.BlankScreen, QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay) self.ThemeScreen = QtGui.QAction(QtGui.QIcon( - u':/slides/slide_theme.png'), - translate('OpenLP.SlideController', + u':/slides/slide_theme.png'), + translate('OpenLP.SlideController', 'Blank to Theme'), self.HideMenu) self.ThemeScreen.setCheckable(True) QtCore.QObject.connect(self.ThemeScreen, QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay) if self.screens.display_count > 1: self.DesktopScreen = QtGui.QAction(QtGui.QIcon( - u':/slides/slide_desktop.png'), - translate('OpenLP.SlideController', + u':/slides/slide_desktop.png'), + translate('OpenLP.SlideController', 'Show Desktop'), self.HideMenu) self.DesktopScreen.setCheckable(True) QtCore.QObject.connect(self.DesktopScreen, @@ -214,7 +214,7 @@ class SlideController(QtGui.QWidget): self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarButton( u'Edit Song', u':/general/general_edit.png', - translate('OpenLP.SlideController', + translate('OpenLP.SlideController', 'Edit and reload song preview'), self.onEditSong) if isLive: @@ -584,11 +584,11 @@ class SlideController(QtGui.QWidget): else: label = QtGui.QLabel() label.setMargin(4) - pixmap = resize_image(frame[u'image'], - self.parent.RenderManager.width, - self.parent.RenderManager.height) +# pixmap = resize_image(frame[u'image'], +# self.parent.RenderManager.width, +# self.parent.RenderManager.height) label.setScaledContents(True) - label.setPixmap(QtGui.QPixmap.fromImage(pixmap)) + label.setPixmap(QtGui.QPixmap.fromImage(frame[u'image'])) self.PreviewListWidget.setCellWidget(framenumber, 0, label) slideHeight = width * self.parent.RenderManager.screen_ratio row += 1 @@ -985,7 +985,7 @@ class SlideController(QtGui.QWidget): self.video.hide() self.SlidePreview.clear() self.SlidePreview.show() - + def onMediaClose(self): """ Respond to a request to close the Video