Merge lp:~trb143/openlp/bug_788231 into lp:openlp

Proposed by Tim Bentley
Status: Merged
Approved by: Andreas Preikschat
Approved revision: 1495
Merged at revision: 1619
Proposed branch: lp:~trb143/openlp/bug_788231
Merge into: lp:openlp
Diff against target: 43 lines (+4/-4)
2 files modified
openlp/core/lib/renderer.py (+3/-3)
openlp/core/ui/themeform.py (+1/-1)
To merge this branch: bzr merge lp:~trb143/openlp/bug_788231
Reviewer Review Type Date Requested Status
Andreas Preikschat (community) Approve
Raoul Snyman Approve
Review via email: mp+63589@code.launchpad.net

Description of the change

Try to improve the number of lines calculation.
As stated in the bug report the number of lines is not an exact science and things like super and sub script mess things up.
I have tested with a text only slide and the numbers now match!

Updated UI to add vagueness but may be the documentation needs to be changed as well

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

Hello,

Why the -1 in line 27? In my tests this makes the results rather inaccurate. I tested 30px-74px (certainly not all sizes, but I checked the line count predictions and they were all smaller than the actual line count).

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

> Hello,
>
> Why the -1 in line 27? In my tests this makes the results rather inaccurate. I
> tested 30px-74px (certainly not all sizes, but I checked the line count
> predictions and they were all smaller than the actual line count).

line_count is incremented at the start of the loop so it is one line bigger that number of lines that fit on the page

Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

Approve, because the logic is correct.

review: Approve

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 2011-06-01 07:38:19 +0000
3+++ openlp/core/lib/renderer.py 2011-06-06 17:41:16 +0000
4@@ -241,7 +241,7 @@
5 ``screen``
6 The QSize of the screen.
7 """
8- log.debug(u'calculate default %s', screen)
9+ log.debug(u'_calculate default %s', screen)
10 self.width = screen.width()
11 self.height = screen.height()
12 self.screen_ratio = float(self.height) / float(self.width)
13@@ -286,7 +286,7 @@
14 ``rect_footer``
15 The footer text block.
16 """
17- log.debug(u'set_text_rectangle %s , %s' % (rect_main, rect_footer))
18+ log.debug(u'_set_text_rectangle %s , %s' % (rect_main, rect_footer))
19 self._rect = rect_main
20 self._rect_footer = rect_footer
21 self.page_width = self._rect.width()
22@@ -339,7 +339,7 @@
23 # Text too long so go to next page.
24 if self.web_frame.contentsSize().height() > self.page_height:
25 if force_page and line_count > 0:
26- Receiver.send_message(u'theme_line_count', line_count)
27+ Receiver.send_message(u'theme_line_count', line_count - 1)
28 line_count = -1
29 while html_text.endswith(u'<br>'):
30 html_text = html_text[:-4]
31
32=== modified file 'openlp/core/ui/themeform.py'
33--- openlp/core/ui/themeform.py 2011-05-26 17:11:22 +0000
34+++ openlp/core/ui/themeform.py 2011-06-06 17:41:16 +0000
35@@ -202,7 +202,7 @@
36 Updates the lines on a page on the wizard
37 """
38 self.mainLineCountLabel.setText(unicode(translate('OpenLP.ThemeForm',
39- '(%d lines per slide)')) % int(lines))
40+ '(approximately %d lines per slide)')) % int(lines))
41
42 def resizeEvent(self, event=None):
43 """