← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/futures into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/futures into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Refactor renderer to do outline correctly
Add removal of footer for blank screens
Fix song edit bug allowing preview to be triggered.

-- 
https://code.launchpad.net/~trb143/openlp/futures/+merge/21138
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2010-03-09 19:43:11 +0000
+++ openlp/core/lib/renderer.py	2010-03-11 12:57:19 +0000
@@ -466,38 +466,9 @@
                     self._get_extent_and_render(line, footer,
                         tlcorner=(x + display_shadow_size, y + display_shadow_size),
                         draw=True, color = self._theme.display_shadow_color)
-                if self._theme.display_outline:
-                    self._get_extent_and_render(line, footer,
-                        (x + display_outline_size, y), draw=True,
-                        color = self._theme.display_outline_color)
-                    self._get_extent_and_render(line, footer,
-                        (x, y + display_outline_size), draw=True,
-                        color = self._theme.display_outline_color)
-                    self._get_extent_and_render(line, footer,
-                        (x, y - display_outline_size), draw=True,
-                        color = self._theme.display_outline_color)
-                    self._get_extent_and_render(line, footer,
-                        (x - display_outline_size, y), draw=True,
-                        color = self._theme.display_outline_color)
-                    if display_outline_size > 1:
-                        self._get_extent_and_render(line, footer,
-                            (x + display_outline_size, y + display_outline_size),
-                            draw=True,
-                            color = self._theme.display_outline_color)
-                        self._get_extent_and_render(line, footer,
-                            (x - display_outline_size, y + display_outline_size),
-                            draw=True,
-                            color = self._theme.display_outline_color)
-                        self._get_extent_and_render(line, footer,
-                            (x + display_outline_size, y - display_outline_size),
-                            draw=True,
-                            color = self._theme.display_outline_color)
-                        self._get_extent_and_render(line, footer,
-                            (x - display_outline_size, y - display_outline_size),
-                            draw=True,
-                            color = self._theme.display_outline_color)
-                self._get_extent_and_render(line, footer,tlcorner=(x, y),
-                    draw=True)
+                self._get_extent_and_render(line, footer, tlcorner=(x, y), draw=True,
+                        outline_size=display_outline_size,
+                        outline_color=self._theme.display_outline_color)
             y += h
             if linenum == 0:
                 self._first_line_right_extent = rightextent
@@ -535,7 +506,7 @@
         self.mainFont.setPixelSize(self._theme.font_main_proportion)
 
     def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False,
-        color=None):
+        color=None, outline_size=None, outline_color=None):
         """
         Find bounding box of text - as render_single_line. If draw is set,
         actually draw the text to the current DC as well return width and
@@ -561,31 +532,37 @@
             font = self.footerFont
         else:
             font = self.mainFont
-        self.painter.setFont(font)
-        if color is None:
-            if footer:
-                self.painter.setPen(QtGui.QColor(self._theme.font_footer_color))
-            else:
-                self.painter.setPen(QtGui.QColor(self._theme.font_main_color))
-        else:
-            self.painter.setPen(QtGui.QColor(color))
-        x, y = tlcorner
         metrics = QtGui.QFontMetrics(font)
         w = metrics.width(line)
         h = metrics.height()
         if draw:
-            self.painter.drawText(x, y + metrics.ascent(), line)
-        if self._theme.display_slideTransition:
-            # Print 2nd image with 70% weight
-            self.painter2.setFont(font)
+            self.painter.setFont(font)
             if color is None:
                 if footer:
-                    self.painter2.setPen(QtGui.QColor(self._theme.font_footer_color))
+                    pen = QtGui.QColor(self._theme.font_footer_color)
                 else:
-                    self.painter2.setPen(QtGui.QColor(self._theme.font_main_color))
+                    pen = QtGui.QColor(self._theme.font_main_color)
             else:
-                self.painter2.setPen(QtGui.QColor(color))
-            if draw:
+                pen = QtGui.QColor(color)
+            x, y = tlcorner
+            if outline_size:
+                path = QtGui.QPainterPath()
+                path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line)
+                self.painter.setBrush(self.painter.pen().brush())
+                self.painter.setPen(QtGui.QPen(QtGui.QColor(outline_color), outline_size))
+                self.painter.drawPath(path)
+            self.painter.setPen(pen)
+            self.painter.drawText(x, y + metrics.ascent(), line)
+            if self._theme.display_slideTransition:
+                # Print 2nd image with 70% weight
+                if outline_size:
+                    path = QtGui.QPainterPath()
+                    path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line)
+                    self.painter2.setBrush(self.painter2.pen().brush())
+                    self.painter2.setPen(QtGui.QPen(QtGui.QColor(outline_color), outline_size))
+                    self.painter2.drawPath(path)
+                self.painter2.setFont(font)
+                self.painter2.setPen(pen)
                 self.painter2.drawText(x, y + metrics.ascent(), line)
         return (w, h)
 

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2010-03-02 19:44:55 +0000
+++ openlp/core/lib/serviceitem.py	2010-03-11 12:57:19 +0000
@@ -134,8 +134,12 @@
         else:
             self.RenderManager.set_override_theme(self.theme)
         format = self._display_frames[row][u'text'].split(u'\n')
-        frame = self.RenderManager.generate_slide(format,
-                        self.raw_footer)
+        #if screen blank then do not display footer
+        if format[0]:
+            frame = self.RenderManager.generate_slide(format,
+                            self.raw_footer)
+        else:
+            frame = self.RenderManager.generate_slide(format,u'')
         return frame
 
     def add_from_image(self, path, title, image):

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2010-03-10 23:00:48 +0000
+++ openlp/core/ui/slidecontroller.py	2010-03-11 12:57:19 +0000
@@ -452,8 +452,10 @@
                     #If verse handle verse number else tag only
                     if bits[0] == self.trUtf8('Verse'):
                         tag = u'%s%s' % (bits[0][0], bits[1][0:] )
+                        row = bits[1][0:]
                     else:
                         tag = bits[0]
+                        row = bits[0][0:1]
                     try:
                         test = self.slideList[tag]
                     except:

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2010-02-27 09:55:44 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2010-03-11 12:57:19 +0000
@@ -169,6 +169,8 @@
         self.loadAuthors()
         self.loadTopics()
         self.loadBooks()
+        #it's a new song to preview is not possible
+        self.previewButton.setVisible(False)
 
     def loadSong(self, id, preview):
         log.debug(u'Load Song')


Follow ups