forked from openlp/openlp
Fix bugs with renderer
bzr-revno: 1005
This commit is contained in:
commit
3f93a44519
@ -47,26 +47,13 @@ class Renderer(object):
|
||||
Initialise the renderer.
|
||||
"""
|
||||
self._rect = None
|
||||
self._debug = False
|
||||
self._display_shadow_size_footer = 0
|
||||
self._display_outline_size_footer = 0
|
||||
self.theme_name = None
|
||||
self._theme = None
|
||||
self._bg_image_filename = None
|
||||
self.frame = None
|
||||
self.frame_opaque = None
|
||||
self.bg_frame = None
|
||||
self.bg_image = None
|
||||
|
||||
def set_debug(self, debug):
|
||||
"""
|
||||
Set the debug mode of the renderer.
|
||||
|
||||
``debug``
|
||||
The debug mode.
|
||||
"""
|
||||
self._debug = debug
|
||||
|
||||
def set_theme(self, theme):
|
||||
"""
|
||||
Set the theme to be used.
|
||||
@ -159,7 +146,7 @@ class Renderer(object):
|
||||
doc = QtGui.QTextDocument()
|
||||
doc.setPageSize(QtCore.QSizeF(self._rect.width(), self._rect.height()))
|
||||
df = doc.defaultFont()
|
||||
df.setPixelSize(self._theme.font_main_proportion)
|
||||
df.setPointSize(self._theme.font_main_proportion)
|
||||
df.setFamily(self._theme.font_main_name)
|
||||
main_weight = 50
|
||||
if self._theme.font_main_weight == u'Bold':
|
||||
@ -188,7 +175,7 @@ class Renderer(object):
|
||||
# Text too long so gone to next mage
|
||||
if layout.pageCount() != 1:
|
||||
formatted.append(shell % old_html_text)
|
||||
temp_text = line
|
||||
temp_text = line + line_end
|
||||
old_html_text = temp_text
|
||||
formatted.append(shell % old_html_text)
|
||||
log.debug(u'format_slide - End')
|
||||
|
@ -93,6 +93,7 @@ class RenderManager(object):
|
||||
"""
|
||||
self.global_theme = global_theme
|
||||
self.theme_level = theme_level
|
||||
self.themedata = None
|
||||
|
||||
def set_service_theme(self, service_theme):
|
||||
"""
|
||||
@ -102,6 +103,7 @@ class RenderManager(object):
|
||||
The service-level theme to be set.
|
||||
"""
|
||||
self.service_theme = service_theme
|
||||
self.themedata = None
|
||||
|
||||
def set_override_theme(self, theme, overrideLevels=False):
|
||||
"""
|
||||
@ -111,6 +113,10 @@ class RenderManager(object):
|
||||
``theme``
|
||||
The name of the song-level theme. None means the service
|
||||
item wants to use the given value.
|
||||
|
||||
``overrideLevels``
|
||||
Used to force the theme data passed in to be used.
|
||||
|
||||
"""
|
||||
log.debug(u'set override theme to %s', theme)
|
||||
theme_level = self.theme_level
|
||||
@ -137,6 +143,7 @@ class RenderManager(object):
|
||||
if self.theme != self.renderer.theme_name or self.themedata is None \
|
||||
or overrideLevels:
|
||||
log.debug(u'theme is now %s', self.theme)
|
||||
# Force the theme to be the one passed in.
|
||||
if overrideLevels:
|
||||
self.themedata = theme
|
||||
else:
|
||||
|
@ -319,9 +319,6 @@ class MainDisplay(DisplayWidget):
|
||||
# Make display show up if in single screen mode
|
||||
if self.isLive:
|
||||
self.setVisible(True)
|
||||
# save preview for debugging
|
||||
if log.isEnabledFor(logging.DEBUG):
|
||||
preview.save(u'temp.png', u'png')
|
||||
return preview
|
||||
|
||||
def buildHtml(self, serviceItem):
|
||||
|
@ -574,7 +574,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
* An osd which is a pickle of the service items
|
||||
* All image, presentation and video files needed to run the service.
|
||||
"""
|
||||
log.debug(u'onSaveService')
|
||||
log.debug(u'onSaveService %s' % quick)
|
||||
if not quick or self.isNew:
|
||||
filename = QtGui.QFileDialog.getSaveFileName(self,
|
||||
translate('OpenLP.ServiceManager', 'Save Service'),
|
||||
@ -755,6 +755,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
"""
|
||||
Set the theme for the current service
|
||||
"""
|
||||
log.debug(u'onThemeComboBoxSelected')
|
||||
self.service_theme = unicode(self.themeComboBox.currentText())
|
||||
self.parent.RenderManager.set_service_theme(self.service_theme)
|
||||
QtCore.QSettings().setValue(
|
||||
@ -767,6 +768,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
The theme may have changed in the settings dialog so make
|
||||
sure the theme combo box is in the correct state.
|
||||
"""
|
||||
log.debug(u'themeChange')
|
||||
if self.parent.RenderManager.theme_level == ThemeLevel.Global:
|
||||
self.toolbar.actions[u'ThemeLabel'].setVisible(False)
|
||||
self.toolbar.actions[u'ThemeWidget'].setVisible(False)
|
||||
@ -779,6 +781,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
Rebuild the service list as things have changed and a
|
||||
repaint is the easiest way to do this.
|
||||
"""
|
||||
log.debug(u'regenerateServiceItems')
|
||||
# force reset of renderer as theme data has changed
|
||||
self.parent.RenderManager.themedata = None
|
||||
if self.serviceItems:
|
||||
@ -800,6 +803,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
``item``
|
||||
Service Item to be added
|
||||
"""
|
||||
log.debug(u'addServiceItem')
|
||||
sitem = self.findServiceItem()[0]
|
||||
item.render()
|
||||
if replace:
|
||||
|
Loading…
Reference in New Issue
Block a user