← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/assertbug into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/assertbug into lp:openlp.

Requested reviews:
    Tim Bentley (trb143)

Fixed a couple of Martin's errors.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/assertbug/+merge/7950
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/baselistwithdnd.py'
--- openlp/core/lib/baselistwithdnd.py	2009-06-25 20:01:02 +0000
+++ openlp/core/lib/baselistwithdnd.py	2009-06-26 16:17:55 +0000
@@ -20,14 +20,20 @@
 import types
 
 from PyQt4 import QtCore, QtGui
+
 from openlp.core.lib.toolbar import *
 from openlp.core.lib import translate
 
 class BaseListWithDnD(QtGui.QListView):
+    """
+    Please put a short description of what this class does in here.
+    """
 
     def __init__(self,parent = None):
         QtGui.QListView.__init__(self,parent)
-        assert (self.PluginName) # this must be set by the class which is inheriting
+        # this must be set by the class which is inheriting
+        assert(self.PluginName)
+
     def mouseMoveEvent(self, event):
         """
         Drag and drop event does not care what data is selected
@@ -44,4 +50,3 @@
         if dropAction == QtCore.Qt.CopyAction:
             self.close()
 
-

=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2009-06-25 20:03:41 +0000
+++ openlp/core/lib/mediamanageritem.py	2009-06-26 16:17:55 +0000
@@ -20,10 +20,12 @@
 import types
 
 from PyQt4 import QtCore, QtGui
+
 from openlp.core.lib.toolbar import *
 from openlp.core.lib import translate
 from listwithpreviews import ListWithPreviews
 from serviceitem import ServiceItem
+
 class MediaManagerItem(QtGui.QWidget):
     """
     MediaManagerItem is a helper widget for plugins.
@@ -106,7 +108,7 @@
         QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
         return action
 
-####################################################################################################
+    ###########################################################################
     ### None of the following *need* to be used, feel free to override
     ### them cmopletely in your plugin's implementation.  Alternatively, call them from your
     ### plugin before or after you've done etra things that you need to.
@@ -126,12 +128,12 @@
     # "text with an icon" then all this will help
     # even for plugins of another sort, the setup of the right-click menu, common toolbar
     # will help to keep things consistent and ease the creation of new plugins
-    
+
     # also a set of completely consistent action anesm then exist
     # (onPreviewClick() is always called that, rather than having the
     # name of the plugin added in as well... I regard that as a
     # feature, I guess others might differ!)
-    
+
     def setupUi(self):
         # Add a toolbar
         self.addToolbar()
@@ -219,7 +221,7 @@
         self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
 
     def generateSlideData(self):
-        assert (0, 'This fn needs to be defined by the plugin');
+        raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
 
     def onPreviewClick(self):
         log.debug(self.PluginTextShort+u'Preview Requested')

=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2009-06-20 10:44:12 +0000
+++ openlp/core/lib/renderer.py	2009-06-26 16:17:55 +0000
@@ -129,14 +129,12 @@
         """
         Render a set of lines according to the theme, return bounding box
          """
-        #print "########## Generate frame from lines ##################"
         log.debug(u'generate_frame_from_lines - Start')
         #print "Render Lines ", lines
         bbox = self._render_lines_unaligned(lines, False)
         if footer_lines is not None:
             bbox1 = self._render_lines_unaligned(footer_lines, True)
         # reset the frame. first time do not worry about what you paint on.
-        # reset the frame. first time do not worry about what you paint on.
         self._frame = QtGui.QImage(self._bg_frame)
         x, y = self._correctAlignment(self._rect, bbox)
         bbox = self._render_lines_unaligned(lines, False,  (x, y), True)
@@ -158,18 +156,22 @@
         painter.begin(self._bg_frame)
         if self._theme.background_type == u'solid':
             painter.fillRect(self._frame.rect(), QtGui.QColor(self._theme.background_color))
-        elif self._theme.background_type == u'gradient' : # gradient
+        elif self._theme.background_type == u'gradient':
+            # gradient
             gradient = None
             if self._theme.background_direction == u'horizontal':
                 w = int(self._frame.width()) / 2
-                gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height()) # vertical
+                # vertical
+                gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height())
             elif self._theme.background_direction == u'vertical':
                 h = int(self._frame.height()) / 2
-                gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h)   # Horizontal
+                # Horizontal
+                gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h)
             else:
                 w = int(self._frame.width()) / 2
                 h = int(self._frame.height()) / 2
-                gradient = QtGui.QRadialGradient(w, h, w) # Circular
+                # Circular
+                gradient = QtGui.QRadialGradient(w, h, w)
             gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor))
             gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor))
             painter.setBrush(QtGui.QBrush(gradient))
@@ -182,7 +184,8 @@
             rectPath.lineTo(max_x, 0)
             rectPath.closeSubpath()
             painter.drawPath(rectPath)
-        elif self._theme.background_type== u'image': # image
+        elif self._theme.background_type== u'image':
+            # image
             painter.fillRect(self._frame.rect(), QtCore.Qt.black)
             if self.bg_image is not None:
                 painter.drawImage(0 ,0 , self.bg_image)
@@ -252,11 +255,14 @@
 
     def _correctAlignment(self, rect, bbox):
         x = rect.left()
-        if int(self._theme.display_verticalAlign) == 0: # top align
+        if int(self._theme.display_verticalAlign) == 0:
+            # top align
             y = rect.top()
-        elif int(self._theme.display_verticalAlign) == 2: # bottom align
+        elif int(self._theme.display_verticalAlign) == 2:
+            # bottom align
             y = rect.bottom() - bbox.height()
-        elif int(self._theme.display_verticalAlign) == 1: # centre align
+        elif int(self._theme.display_verticalAlign) == 1:
+            # centre align
             y = rect.top() + (rect.height() - bbox.height()) / 2
         else:
             log.error(u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign)


References