do not pass instance variable as argument

This commit is contained in:
Andreas Preikschat 2011-08-05 10:43:32 +02:00
parent f4eb21eb05
commit d8008df902

View File

@ -83,7 +83,7 @@ class Renderer(object):
Updates the render manager's information about the current screen. Updates the render manager's information about the current screen.
""" """
log.debug(u'Update Display') log.debug(u'Update Display')
self._calculate_default(self.screens.current[u'size']) self._calculate_default()
if self.display: if self.display:
self.display.close() self.display.close()
self.display = MainDisplay(None, self.imageManager, False) self.display = MainDisplay(None, self.imageManager, False)
@ -161,7 +161,7 @@ class Renderer(object):
self.theme_data = override_theme self.theme_data = override_theme
else: else:
self.theme_data = self.themeManager.getThemeData(theme) self.theme_data = self.themeManager.getThemeData(theme)
self._calculate_default(self.screens.current[u'size']) self._calculate_default()
self._build_text_rectangle(self.theme_data) self._build_text_rectangle(self.theme_data)
# if No file do not update cache # if No file do not update cache
if self.theme_data.background_filename: if self.theme_data.background_filename:
@ -183,7 +183,7 @@ class Renderer(object):
# save value for use in format_slide # save value for use in format_slide
self.force_page = force_page self.force_page = force_page
# set the default image size for previews # set the default image size for previews
self._calculate_default(self.screens.preview[u'size']) self._calculate_default()
# build a service item to generate preview # build a service item to generate preview
serviceItem = ServiceItem() serviceItem = ServiceItem()
serviceItem.theme = theme_data serviceItem.theme = theme_data
@ -201,7 +201,7 @@ class Renderer(object):
raw_html = serviceItem.get_rendered_frame(0) raw_html = serviceItem.get_rendered_frame(0)
preview = self.display.text(raw_html) preview = self.display.text(raw_html)
# Reset the real screen size for subsequent render requests # Reset the real screen size for subsequent render requests
self._calculate_default(self.screens.current[u'size']) self._calculate_default()
return preview return preview
self.force_page = False self.force_page = False
@ -243,13 +243,11 @@ class Renderer(object):
new_pages.append(page) new_pages.append(page)
return new_pages return new_pages
def _calculate_default(self, size): def _calculate_default(self):
""" """
Calculate the default dimentions of the screen. Calculate the default dimentions of the screen.
``size``
The screen's size to calculate the default of (``QtCore.QRect``).
""" """
size = self.screens.current[u'size']
self.width = size.width() self.width = size.width()
self.height = size.height() self.height = size.height()
self.screen_ratio = float(self.height) / float(self.width) self.screen_ratio = float(self.height) / float(self.width)