forked from openlp/openlp
Cache theme backgrounds earlier
bzr-revno: 1978
This commit is contained in:
commit
ab0be0006a
@ -109,6 +109,7 @@ class Renderer(object):
|
|||||||
self.global_theme_data = \
|
self.global_theme_data = \
|
||||||
self.themeManager.getThemeData(self.global_theme)
|
self.themeManager.getThemeData(self.global_theme)
|
||||||
self.theme_data = None
|
self.theme_data = None
|
||||||
|
self._cache_background_image(self.global_theme_data)
|
||||||
|
|
||||||
def set_service_theme(self, service_theme):
|
def set_service_theme(self, service_theme):
|
||||||
"""
|
"""
|
||||||
@ -119,6 +120,21 @@ class Renderer(object):
|
|||||||
"""
|
"""
|
||||||
self.service_theme = service_theme
|
self.service_theme = service_theme
|
||||||
self.theme_data = None
|
self.theme_data = None
|
||||||
|
self._cache_background_image(self.themeManager.getThemeData
|
||||||
|
(service_theme))
|
||||||
|
|
||||||
|
def _cache_background_image(self, temp_theme):
|
||||||
|
"""
|
||||||
|
Adds a background image to the image cache if necessary.
|
||||||
|
|
||||||
|
``temp_theme``
|
||||||
|
The theme object containing the theme data.
|
||||||
|
"""
|
||||||
|
# if No file do not update cache
|
||||||
|
if temp_theme.background_filename:
|
||||||
|
self.imageManager.add_image(temp_theme.theme_name,
|
||||||
|
temp_theme.background_filename, u'theme',
|
||||||
|
QtGui.QColor(temp_theme.background_border_color))
|
||||||
|
|
||||||
def set_override_theme(self, override_theme, override_levels=False):
|
def set_override_theme(self, override_theme, override_levels=False):
|
||||||
"""
|
"""
|
||||||
@ -163,11 +179,7 @@ class Renderer(object):
|
|||||||
self.theme_data = self.themeManager.getThemeData(theme)
|
self.theme_data = self.themeManager.getThemeData(theme)
|
||||||
self._calculate_default()
|
self._calculate_default()
|
||||||
self._build_text_rectangle(self.theme_data)
|
self._build_text_rectangle(self.theme_data)
|
||||||
# if No file do not update cache
|
self._cache_background_image(self.theme_data)
|
||||||
if self.theme_data.background_filename:
|
|
||||||
self.imageManager.add_image(self.theme_data.theme_name,
|
|
||||||
self.theme_data.background_filename, u'theme',
|
|
||||||
QtGui.QColor(self.theme_data.background_border_color))
|
|
||||||
return self._rect, self._rect_footer
|
return self._rect, self._rect_footer
|
||||||
|
|
||||||
def generate_preview(self, theme_data, force_page=False):
|
def generate_preview(self, theme_data, force_page=False):
|
||||||
|
@ -164,7 +164,7 @@
|
|||||||
<input type="search" name="search-text" id="search-text" value="" />
|
<input type="search" name="search-text" id="search-text" value="" />
|
||||||
</div>
|
</div>
|
||||||
<a href="#" id="search-submit" data-role="button">${search}</a>
|
<a href="#" id="search-submit" data-role="button">${search}</a>
|
||||||
<ul data-role="listview" data-inset="true">
|
<ul data-role="listview" data-inset="true"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div data-role="page" id="options">
|
<div data-role="page" id="options">
|
||||||
|
Loading…
Reference in New Issue
Block a user