~wgrant/openlp/openlyrics_test

« back to all changes in this revision

Viewing changes to openlp/core/lib/renderer.py

  • Committer: Martin Zibricky
  • Date: 2011-10-06 16:16:29 UTC
  • mfrom: (1186.2.584 openlp)
  • Revision ID: mzibr.public@gmail.com-20111006161629-17tyvvq60h3h15dd
[merge] r1770, rename testing dir to tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
        if not self.force_page:
202
202
            self.display.buildHtml(serviceItem)
203
203
            raw_html = serviceItem.get_rendered_frame(0)
204
 
            preview = self.display.text(raw_html)
 
204
            self.display.text(raw_html)
 
205
            preview = self.display.preview()
205
206
            # Reset the real screen size for subsequent render requests
206
207
            self._calculate_default()
207
208
            return preview
304
305
            The theme to build a text block for.
305
306
        """
306
307
        log.debug(u'_build_text_rectangle')
307
 
        main_rect = None
308
 
        footer_rect = None
 
308
        main_rect = self.get_main_rectangle(theme)
 
309
        footer_rect = self.get_main_rectangle(theme)
 
310
        self._set_text_rectangle(main_rect, footer_rect)
 
311
 
 
312
    def get_main_rectangle(self, theme):
 
313
        """
 
314
        Calculates the placement and size of the main rectangle.
 
315
 
 
316
        ``theme``
 
317
            The theme information
 
318
        """
309
319
        if not theme.font_main_override:
310
 
            main_rect = QtCore.QRect(10, 0, self.width - 20, self.footer_start)
 
320
            return QtCore.QRect(10, 0, self.width - 20, self.footer_start)
311
321
        else:
312
 
            main_rect = QtCore.QRect(theme.font_main_x, theme.font_main_y,
 
322
            return QtCore.QRect(theme.font_main_x, theme.font_main_y,
313
323
                theme.font_main_width - 1, theme.font_main_height - 1)
 
324
 
 
325
    def get_footer_rectangle(self, theme):
 
326
        """
 
327
        Calculates the placement and size of the footer rectangle.
 
328
 
 
329
        ``theme``
 
330
            The theme information
 
331
        """
314
332
        if not theme.font_footer_override:
315
 
            footer_rect = QtCore.QRect(10, self.footer_start, self.width - 20,
 
333
            return QtCore.QRect(10, self.footer_start, self.width - 20,
316
334
                self.height - self.footer_start)
317
335
        else:
318
 
            footer_rect = QtCore.QRect(theme.font_footer_x,
 
336
            return QtCore.QRect(theme.font_footer_x,
319
337
                theme.font_footer_y, theme.font_footer_width - 1,
320
338
                theme.font_footer_height - 1)
321
 
        self._set_text_rectangle(main_rect, footer_rect)
322
339
 
323
340
    def _set_text_rectangle(self, rect_main, rect_footer):
324
341
        """