openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00242
[Merge] lp:~trb143/openlp/bugfixes into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/bugfixes into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Speed up rendering in slidecontroller
Fix slide if last slide has one space only.
Problems with last merge
--
https://code.launchpad.net/~trb143/openlp/bugfixes/+merge/11144
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2009-09-02 01:44:09 +0000
+++ openlp/core/lib/renderer.py 2009-09-03 17:46:46 +0000
@@ -218,7 +218,7 @@
if len(page) == page_length:
split_pages.append(page)
page = []
- if len(page) > 0:
+ if len(page) > 0 and page != u' ':
split_pages.append(page)
return split_pages
@@ -440,7 +440,7 @@
rightextent = x + w
# shift right from last line's rh edge
if self._theme.display_wrapStyle == 1 and linenum != 0:
- rightextent = self._first_line_right_extent +
+ rightextent = self._first_line_right_extent + \
self._right_margin
if rightextent > maxx:
rightextent = maxx
=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py 2009-09-02 01:44:09 +0000
+++ openlp/core/lib/rendermanager.py 2009-09-03 17:46:46 +0000
@@ -209,7 +209,7 @@
self.renderer.set_frame_dest(self.width, self.height)
return self.renderer.generate_frame_from_lines(main_text, footer_text)
- def resize_image(self, image):
+ def resize_image(self, image, width = 0, height = 0):
"""
Resize an image to fit on the current screen.
@@ -217,8 +217,12 @@
The image to resize.
"""
preview = QtGui.QImage(image)
- w = self.width
- h = self.height
+ if width == 0:
+ w = self.width
+ h = self.height
+ else:
+ w = width
+ h = height
preview = preview.scaled(w, h, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation)
realw = preview.width();
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2009-09-02 01:44:09 +0000
+++ openlp/core/lib/serviceitem.py 2009-09-03 17:46:46 +0000
@@ -100,7 +100,7 @@
self.frames = self.service_frames
elif self.service_item_type == ServiceType.Image:
for slide in self.service_frames:
- slide[u'image'] =
+ slide[u'image'] = \
self.RenderManager.resize_image(slide[u'image'])
self.frames = self.service_frames
else:
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-08-31 14:04:00 +0000
+++ openlp/core/ui/slidecontroller.py 2009-09-03 04:41:30 +0000
@@ -21,7 +21,7 @@
import os
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver, ServiceType
+from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver, ServiceType, RenderManager
class SlideList(QtGui.QTableWidget):
"""
@@ -250,20 +250,21 @@
"""
log.debug(u'displayServiceManagerItems Start')
self.serviceitem = serviceitem
- slide_pixmap = QtGui.QPixmap.fromImage(self.serviceitem.frames[0][u'image'])
+ slide_image = self.serviceitem.frames[0][u'image']
+ size = slide_image.size()
slide_width = 300
- slide_height = slide_width * slide_pixmap.height() / slide_pixmap.width()
+ slide_height = slide_width * size.height() / size.width()
self.PreviewListWidget.clear()
self.PreviewListWidget.setRowCount(0)
self.PreviewListWidget.setColumnWidth(0, slide_width)
for framenumber, frame in enumerate(self.serviceitem.frames):
self.PreviewListWidget.setRowCount(self.PreviewListWidget.rowCount() + 1)
- pixmap = QtGui.QPixmap.fromImage(frame[u'image'])
+ pixmap = self.parent.RenderManager.resize_image(frame[u'image'], slide_width, slide_height)
item = QtGui.QTableWidgetItem()
label = QtGui.QLabel()
label.setMargin(8)
label.setScaledContents(True)
- label.setPixmap(pixmap)
+ label.setPixmap(QtGui.QPixmap.fromImage(pixmap))
self.PreviewListWidget.setCellWidget(framenumber, 0, label)
self.PreviewListWidget.setItem(framenumber, 0, item)
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
Follow ups