Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||
Proposed branch: | lp:~trb143/openlp/bugfixes | ||||||||
Merge into: | lp:openlp | ||||||||
Diff against target: | None lines | ||||||||
To merge this branch: | bzr merge lp:~trb143/openlp/bugfixes | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raoul Snyman | Approve | ||
Review via email: mp+9708@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : | # |
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : | # |
Looks fine, though there are a few more comments that I feel are necessary ;-)
review:
Approve
lp:~trb143/openlp/bugfixes
updated
- 500. By Tim Bentley
-
Bug fixes from last merge
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'openlp/core/lib/renderer.py' | |||
2 | --- openlp/core/lib/renderer.py 2009-08-03 19:49:21 +0000 | |||
3 | +++ openlp/core/lib/renderer.py 2009-08-05 17:59:37 +0000 | |||
4 | @@ -167,32 +167,37 @@ | |||
5 | 167 | #take the width work out approx how many characters and add 50% | 167 | #take the width work out approx how many characters and add 50% |
6 | 168 | line_width = self._rect.width() - self._right_margin | 168 | line_width = self._rect.width() - self._right_margin |
7 | 169 | #number of lines on a page - adjust for rounding up. | 169 | #number of lines on a page - adjust for rounding up. |
8 | 170 | #print self._rect.height() , metrics.height(), int(self._rect.height() / metrics.height()) | ||
9 | 170 | page_length = int(self._rect.height() / metrics.height()) - 1 | 171 | page_length = int(self._rect.height() / metrics.height()) - 1 |
10 | 171 | ave_line_width = line_width / metrics.averageCharWidth() | 172 | ave_line_width = line_width / metrics.averageCharWidth() |
12 | 172 | #print ave_line_width | 173 | # print "A", ave_line_width |
13 | 173 | ave_line_width = int(ave_line_width + (ave_line_width * 0.5)) | 174 | ave_line_width = int(ave_line_width + (ave_line_width * 0.5)) |
15 | 174 | #print ave_line_width | 175 | # print "B", ave_line_width |
16 | 175 | split_pages = [] | 176 | split_pages = [] |
17 | 176 | page = [] | 177 | page = [] |
18 | 177 | split_lines = [] | 178 | split_lines = [] |
19 | 178 | count = 0 | 179 | count = 0 |
20 | 179 | for line in text: | 180 | for line in text: |
22 | 180 | #print line , len(line) | 181 | # print "C", line , len(line) |
23 | 181 | if len(line) > ave_line_width: | 182 | if len(line) > ave_line_width: |
24 | 182 | while len(line) > 0: | 183 | while len(line) > 0: |
25 | 183 | pos = line.find(u' ', ave_line_width) | 184 | pos = line.find(u' ', ave_line_width) |
27 | 184 | #print ave_line_width, pos, line[:pos] | 185 | # print "D2", len(line), ave_line_width, pos, line[:pos] |
28 | 185 | split_text = line[:pos] | 186 | split_text = line[:pos] |
30 | 186 | #print metrics.width(split_text, -1), line_width | 187 | # print "E", metrics.width(split_text, -1), line_width |
31 | 187 | while metrics.width(split_text, -1) > line_width: | 188 | while metrics.width(split_text, -1) > line_width: |
32 | 188 | #Find the next space to the left | 189 | #Find the next space to the left |
33 | 189 | pos = line[:pos].rfind(u' ') | 190 | pos = line[:pos].rfind(u' ') |
35 | 190 | #print ave_line_width, pos, line[:pos] | 191 | # print "F", ave_line_width, pos, line[:pos] |
36 | 191 | #no more spaces found | 192 | #no more spaces found |
38 | 192 | if pos == -1: | 193 | if pos == 0: |
39 | 193 | split_text = line | 194 | split_text = line |
40 | 195 | while metrics.width(split_text, -1) > line_width: | ||
41 | 196 | split_text = split_text[:-1] | ||
42 | 197 | pos = len(split_text) | ||
43 | 194 | else: | 198 | else: |
44 | 195 | split_text = line[:pos] | 199 | split_text = line[:pos] |
45 | 200 | # print "F1", split_text, line, pos | ||
46 | 196 | split_lines.append(split_text) | 201 | split_lines.append(split_text) |
47 | 197 | line = line[pos:] | 202 | line = line[pos:] |
48 | 198 | #Text fits in a line now | 203 | #Text fits in a line now |
49 | @@ -200,13 +205,14 @@ | |||
50 | 200 | split_lines.append(line) | 205 | split_lines.append(line) |
51 | 201 | line = u'' | 206 | line = u'' |
52 | 202 | # count += 1 | 207 | # count += 1 |
54 | 203 | # if count == 50: | 208 | # if count == 15: |
55 | 204 | # a = c | 209 | # a = c |
58 | 205 | #print split_lines | 210 | # print "G", split_lines |
59 | 206 | #print line | 211 | # print "H", line |
60 | 207 | else: | 212 | else: |
61 | 208 | split_lines.append(line) | 213 | split_lines.append(line) |
62 | 209 | line = u'' | 214 | line = u'' |
63 | 215 | #print "I", split_lines, page_length | ||
64 | 210 | for line in split_lines: | 216 | for line in split_lines: |
65 | 211 | page.append(line) | 217 | page.append(line) |
66 | 212 | if len(page) == page_length: | 218 | if len(page) == page_length: |
67 | @@ -306,72 +312,72 @@ | |||
68 | 306 | QtCore.Qt.SmoothTransformation) | 312 | QtCore.Qt.SmoothTransformation) |
69 | 307 | log.debug(u'render background End') | 313 | log.debug(u'render background End') |
70 | 308 | 314 | ||
137 | 309 | def _split_set_of_lines(self, lines, footer): | 315 | # def _split_set_of_lines(self, lines, footer): |
138 | 310 | """ | 316 | # """ |
139 | 311 | Given a list of lines, decide how to split them best if they don't all | 317 | # Given a list of lines, decide how to split them best if they don't all |
140 | 312 | fit on the screen. This is done by splitting at 1/2, 1/3 or 1/4 of the | 318 | # fit on the screen. This is done by splitting at 1/2, 1/3 or 1/4 of the |
141 | 313 | set. If it doesn't fit, even at this size, just split at each | 319 | # set. If it doesn't fit, even at this size, just split at each |
142 | 314 | opportunity. We'll do this by getting the bounding box of each line, | 320 | # opportunity. We'll do this by getting the bounding box of each line, |
143 | 315 | and then summing them appropriately. | 321 | # and then summing them appropriately. |
144 | 316 | 322 | # | |
145 | 317 | Returns a list of [lists of lines], one set for each screenful. | 323 | # Returns a list of [lists of lines], one set for each screenful. |
146 | 318 | 324 | # | |
147 | 319 | ``lines`` | 325 | # ``lines`` |
148 | 320 | The lines of text to split. | 326 | # The lines of text to split. |
149 | 321 | 327 | # | |
150 | 322 | ``footer`` | 328 | # ``footer`` |
151 | 323 | The footer text. | 329 | # The footer text. |
152 | 324 | """ | 330 | # """ |
153 | 325 | bboxes = [] | 331 | # bboxes = [] |
154 | 326 | for line in lines: | 332 | # for line in lines: |
155 | 327 | bboxes.append(self._render_and_wrap_single_line(line, footer)) | 333 | # bboxes.append(self._render_and_wrap_single_line(line, footer)) |
156 | 328 | numlines = len(lines) | 334 | # numlines = len(lines) |
157 | 329 | bottom = self._rect.bottom() | 335 | # bottom = self._rect.bottom() |
158 | 330 | for ratio in (numlines, numlines/2, numlines/3, numlines/4): | 336 | # for ratio in (numlines, numlines/2, numlines/3, numlines/4): |
159 | 331 | good = 1 | 337 | # good = 1 |
160 | 332 | startline = 0 | 338 | # startline = 0 |
161 | 333 | endline = startline + ratio | 339 | # endline = startline + ratio |
162 | 334 | while (endline <= numlines and endline != 0): | 340 | # while (endline <= numlines and endline != 0): |
163 | 335 | by = 0 | 341 | # by = 0 |
164 | 336 | for (x,y) in bboxes[startline:endline]: | 342 | # for (x,y) in bboxes[startline:endline]: |
165 | 337 | by += y | 343 | # by += y |
166 | 338 | if by > bottom: | 344 | # if by > bottom: |
167 | 339 | good = 0 | 345 | # good = 0 |
168 | 340 | break | 346 | # break |
169 | 341 | startline += ratio | 347 | # startline += ratio |
170 | 342 | endline = startline + ratio | 348 | # endline = startline + ratio |
171 | 343 | if good == 1: | 349 | # if good == 1: |
172 | 344 | break | 350 | # break |
173 | 345 | retval = [] | 351 | # retval = [] |
174 | 346 | numlines_per_page = ratio | 352 | # numlines_per_page = ratio |
175 | 347 | if good: | 353 | # if good: |
176 | 348 | c = 0 | 354 | # c = 0 |
177 | 349 | thislines = [] | 355 | # thislines = [] |
178 | 350 | while c < numlines: | 356 | # while c < numlines: |
179 | 351 | thislines.append(lines[c]) | 357 | # thislines.append(lines[c]) |
180 | 352 | c += 1 | 358 | # c += 1 |
181 | 353 | if len(thislines) == numlines_per_page: | 359 | # if len(thislines) == numlines_per_page: |
182 | 354 | retval.append(thislines) | 360 | # retval.append(thislines) |
183 | 355 | thislines = [] | 361 | # thislines = [] |
184 | 356 | if len(thislines) > 0: | 362 | # if len(thislines) > 0: |
185 | 357 | retval.append(thislines) | 363 | # retval.append(thislines) |
186 | 358 | else: | 364 | # else: |
187 | 359 | # print "Just split where you can" | 365 | # # print "Just split where you can" |
188 | 360 | retval = [] | 366 | # retval = [] |
189 | 361 | startline = 0 | 367 | # startline = 0 |
190 | 362 | endline = startline + 1 | 368 | # endline = startline + 1 |
191 | 363 | while (endline <= numlines): | 369 | # while (endline <= numlines): |
192 | 364 | by = 0 | 370 | # by = 0 |
193 | 365 | for (x,y) in bboxes[startline:endline]: | 371 | # for (x,y) in bboxes[startline:endline]: |
194 | 366 | by += y | 372 | # by += y |
195 | 367 | if by > bottom: | 373 | # if by > bottom: |
196 | 368 | retval.append(lines[startline:endline-1]) | 374 | # retval.append(lines[startline:endline-1]) |
197 | 369 | startline = endline-1 | 375 | # startline = endline-1 |
198 | 370 | # gets incremented below | 376 | # # gets incremented below |
199 | 371 | endline = startline | 377 | # endline = startline |
200 | 372 | by = 0 | 378 | # by = 0 |
201 | 373 | endline += 1 | 379 | # endline += 1 |
202 | 374 | return retval | 380 | # return retval |
203 | 375 | 381 | ||
204 | 376 | def _correctAlignment(self, rect, bbox): | 382 | def _correctAlignment(self, rect, bbox): |
205 | 377 | """ | 383 | """ |
206 | 378 | 384 | ||
207 | === modified file 'openlp/core/lib/themexmlhandler.py' | |||
208 | --- openlp/core/lib/themexmlhandler.py 2009-08-03 19:49:21 +0000 | |||
209 | +++ openlp/core/lib/themexmlhandler.py 2009-08-05 17:59:37 +0000 | |||
210 | @@ -161,7 +161,7 @@ | |||
211 | 161 | #Create Filename element | 161 | #Create Filename element |
212 | 162 | self.child_element(background, u'filename', filename) | 162 | self.child_element(background, u'filename', filename) |
213 | 163 | 163 | ||
215 | 164 | def add_font(self, name, color, proportion, override, fonttype=u'main', weight=u'Bold', italics=False, | 164 | def add_font(self, name, color, proportion, override, fonttype=u'main', weight=u'Normal', italics=u'False', |
216 | 165 | xpos=0, ypos=0, width=0, height=0): | 165 | xpos=0, ypos=0, width=0, height=0): |
217 | 166 | """ | 166 | """ |
218 | 167 | Add a Font. | 167 | Add a Font. |
219 | 168 | 168 | ||
220 | === modified file 'openlp/plugins/bibles/lib/mediaitem.py' | |||
221 | --- openlp/plugins/bibles/lib/mediaitem.py 2009-08-02 13:44:41 +0000 | |||
222 | +++ openlp/plugins/bibles/lib/mediaitem.py 2009-08-05 17:59:37 +0000 | |||
223 | @@ -20,6 +20,7 @@ | |||
224 | 20 | Place, Suite 330, Boston, MA 02111-1307 USA | 20 | Place, Suite 330, Boston, MA 02111-1307 USA |
225 | 21 | """ | 21 | """ |
226 | 22 | import logging | 22 | import logging |
227 | 23 | import time | ||
228 | 23 | 24 | ||
229 | 24 | from PyQt4 import QtCore, QtGui | 25 | from PyQt4 import QtCore, QtGui |
230 | 25 | 26 | ||
231 | @@ -268,6 +269,8 @@ | |||
232 | 268 | def setQuickMsg2(self, text): | 269 | def setQuickMsg2(self, text): |
233 | 269 | self.QuickMsg2.setText(translate(u'BibleMediaItem', unicode(text))) | 270 | self.QuickMsg2.setText(translate(u'BibleMediaItem', unicode(text))) |
234 | 270 | Receiver().send_message(u'openlpprocessevents') | 271 | Receiver().send_message(u'openlpprocessevents') |
235 | 272 | #minor delay to get the events processed | ||
236 | 273 | time.sleep(0.5) | ||
237 | 271 | 274 | ||
238 | 272 | def loadBibles(self): | 275 | def loadBibles(self): |
239 | 273 | log.debug(u'Loading Bibles') | 276 | log.debug(u'Loading Bibles') |
Fix italic handling xml error
Fix screen refresh issue
Fix renderer where word is bigger than line!