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

Proposed by Raoul Snyman
Status: Merged
Merged at revision: not available
Proposed branch: lp:~raoul-snyman/openlp/assertbug
Merge into: lp:openlp
Diff against target: None lines
To merge this branch: bzr merge lp:~raoul-snyman/openlp/assertbug
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+7950@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Fixed a couple of Martin's errors.

Revision history for this message
Tim Bentley (trb143) wrote :

Approved

review: Approve
Revision history for this message
Martin Thompson (mjthompson) wrote :

Probably a bit too late now, but...

On Fri, Jun 26, 2009 at 04:25:17PM -0000 or thereabouts, Raoul Snyman wrote:
> - elif self._theme.background_type == u'gradient' : # gradient
> + elif self._theme.background_type == u'gradient':
> + # gradient

Now that the background type has a text setting, rather than a number,
we probably don't need that comment?

> 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

Ditto... etc. :)

Cheers,
Martin

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/lib/baselistwithdnd.py'
2--- openlp/core/lib/baselistwithdnd.py 2009-06-25 20:01:02 +0000
3+++ openlp/core/lib/baselistwithdnd.py 2009-06-26 16:17:55 +0000
4@@ -20,14 +20,20 @@
5 import types
6
7 from PyQt4 import QtCore, QtGui
8+
9 from openlp.core.lib.toolbar import *
10 from openlp.core.lib import translate
11
12 class BaseListWithDnD(QtGui.QListView):
13+ """
14+ Please put a short description of what this class does in here.
15+ """
16
17 def __init__(self,parent = None):
18 QtGui.QListView.__init__(self,parent)
19- assert (self.PluginName) # this must be set by the class which is inheriting
20+ # this must be set by the class which is inheriting
21+ assert(self.PluginName)
22+
23 def mouseMoveEvent(self, event):
24 """
25 Drag and drop event does not care what data is selected
26@@ -44,4 +50,3 @@
27 if dropAction == QtCore.Qt.CopyAction:
28 self.close()
29
30-
31
32=== modified file 'openlp/core/lib/mediamanageritem.py'
33--- openlp/core/lib/mediamanageritem.py 2009-06-25 20:03:41 +0000
34+++ openlp/core/lib/mediamanageritem.py 2009-06-26 16:17:55 +0000
35@@ -20,10 +20,12 @@
36 import types
37
38 from PyQt4 import QtCore, QtGui
39+
40 from openlp.core.lib.toolbar import *
41 from openlp.core.lib import translate
42 from listwithpreviews import ListWithPreviews
43 from serviceitem import ServiceItem
44+
45 class MediaManagerItem(QtGui.QWidget):
46 """
47 MediaManagerItem is a helper widget for plugins.
48@@ -106,7 +108,7 @@
49 QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
50 return action
51
52-####################################################################################################
53+ ###########################################################################
54 ### None of the following *need* to be used, feel free to override
55 ### them cmopletely in your plugin's implementation. Alternatively, call them from your
56 ### plugin before or after you've done etra things that you need to.
57@@ -126,12 +128,12 @@
58 # "text with an icon" then all this will help
59 # even for plugins of another sort, the setup of the right-click menu, common toolbar
60 # will help to keep things consistent and ease the creation of new plugins
61-
62+
63 # also a set of completely consistent action anesm then exist
64 # (onPreviewClick() is always called that, rather than having the
65 # name of the plugin added in as well... I regard that as a
66 # feature, I guess others might differ!)
67-
68+
69 def setupUi(self):
70 # Add a toolbar
71 self.addToolbar()
72@@ -219,7 +221,7 @@
73 self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
74
75 def generateSlideData(self):
76- assert (0, 'This fn needs to be defined by the plugin');
77+ raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
78
79 def onPreviewClick(self):
80 log.debug(self.PluginTextShort+u'Preview Requested')
81
82=== modified file 'openlp/core/lib/renderer.py'
83--- openlp/core/lib/renderer.py 2009-06-20 10:44:12 +0000
84+++ openlp/core/lib/renderer.py 2009-06-26 16:17:55 +0000
85@@ -129,14 +129,12 @@
86 """
87 Render a set of lines according to the theme, return bounding box
88 """
89- #print "########## Generate frame from lines ##################"
90 log.debug(u'generate_frame_from_lines - Start')
91 #print "Render Lines ", lines
92 bbox = self._render_lines_unaligned(lines, False)
93 if footer_lines is not None:
94 bbox1 = self._render_lines_unaligned(footer_lines, True)
95 # reset the frame. first time do not worry about what you paint on.
96- # reset the frame. first time do not worry about what you paint on.
97 self._frame = QtGui.QImage(self._bg_frame)
98 x, y = self._correctAlignment(self._rect, bbox)
99 bbox = self._render_lines_unaligned(lines, False, (x, y), True)
100@@ -158,18 +156,22 @@
101 painter.begin(self._bg_frame)
102 if self._theme.background_type == u'solid':
103 painter.fillRect(self._frame.rect(), QtGui.QColor(self._theme.background_color))
104- elif self._theme.background_type == u'gradient' : # gradient
105+ elif self._theme.background_type == u'gradient':
106+ # gradient
107 gradient = None
108 if self._theme.background_direction == u'horizontal':
109 w = int(self._frame.width()) / 2
110- gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height()) # vertical
111+ # vertical
112+ gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height())
113 elif self._theme.background_direction == u'vertical':
114 h = int(self._frame.height()) / 2
115- gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h) # Horizontal
116+ # Horizontal
117+ gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h)
118 else:
119 w = int(self._frame.width()) / 2
120 h = int(self._frame.height()) / 2
121- gradient = QtGui.QRadialGradient(w, h, w) # Circular
122+ # Circular
123+ gradient = QtGui.QRadialGradient(w, h, w)
124 gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor))
125 gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor))
126 painter.setBrush(QtGui.QBrush(gradient))
127@@ -182,7 +184,8 @@
128 rectPath.lineTo(max_x, 0)
129 rectPath.closeSubpath()
130 painter.drawPath(rectPath)
131- elif self._theme.background_type== u'image': # image
132+ elif self._theme.background_type== u'image':
133+ # image
134 painter.fillRect(self._frame.rect(), QtCore.Qt.black)
135 if self.bg_image is not None:
136 painter.drawImage(0 ,0 , self.bg_image)
137@@ -252,11 +255,14 @@
138
139 def _correctAlignment(self, rect, bbox):
140 x = rect.left()
141- if int(self._theme.display_verticalAlign) == 0: # top align
142+ if int(self._theme.display_verticalAlign) == 0:
143+ # top align
144 y = rect.top()
145- elif int(self._theme.display_verticalAlign) == 2: # bottom align
146+ elif int(self._theme.display_verticalAlign) == 2:
147+ # bottom align
148 y = rect.bottom() - bbox.height()
149- elif int(self._theme.display_verticalAlign) == 1: # centre align
150+ elif int(self._theme.display_verticalAlign) == 1:
151+ # centre align
152 y = rect.top() + (rect.height() - bbox.height()) / 2
153 else:
154 log.error(u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign)