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
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2011-06-01 07:38:19 +0000
+++ openlp/core/lib/renderer.py 2011-06-06 17:41:16 +0000
@@ -241,7 +241,7 @@
241 ``screen``241 ``screen``
242 The QSize of the screen.242 The QSize of the screen.
243 """243 """
244 log.debug(u'calculate default %s', screen)244 log.debug(u'_calculate default %s', screen)
245 self.width = screen.width()245 self.width = screen.width()
246 self.height = screen.height()246 self.height = screen.height()
247 self.screen_ratio = float(self.height) / float(self.width)247 self.screen_ratio = float(self.height) / float(self.width)
@@ -286,7 +286,7 @@
286 ``rect_footer``286 ``rect_footer``
287 The footer text block.287 The footer text block.
288 """288 """
289 log.debug(u'set_text_rectangle %s , %s' % (rect_main, rect_footer))289 log.debug(u'_set_text_rectangle %s , %s' % (rect_main, rect_footer))
290 self._rect = rect_main290 self._rect = rect_main
291 self._rect_footer = rect_footer291 self._rect_footer = rect_footer
292 self.page_width = self._rect.width()292 self.page_width = self._rect.width()
@@ -339,7 +339,7 @@
339 # Text too long so go to next page.339 # Text too long so go to next page.
340 if self.web_frame.contentsSize().height() > self.page_height:340 if self.web_frame.contentsSize().height() > self.page_height:
341 if force_page and line_count > 0:341 if force_page and line_count > 0:
342 Receiver.send_message(u'theme_line_count', line_count)342 Receiver.send_message(u'theme_line_count', line_count - 1)
343 line_count = -1343 line_count = -1
344 while html_text.endswith(u'<br>'):344 while html_text.endswith(u'<br>'):
345 html_text = html_text[:-4]345 html_text = html_text[:-4]
346346
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py 2011-05-26 17:11:22 +0000
+++ openlp/core/ui/themeform.py 2011-06-06 17:41:16 +0000
@@ -202,7 +202,7 @@
202 Updates the lines on a page on the wizard202 Updates the lines on a page on the wizard
203 """203 """
204 self.mainLineCountLabel.setText(unicode(translate('OpenLP.ThemeForm',204 self.mainLineCountLabel.setText(unicode(translate('OpenLP.ThemeForm',
205 '(%d lines per slide)')) % int(lines))205 '(approximately %d lines per slide)')) % int(lines))
206206
207 def resizeEvent(self, event=None):207 def resizeEvent(self, event=None):
208 """208 """