forked from openlp/openlp
Start to clean up rendermanger
fix bugs in rendereing fix thememanager to allow new themes to be created
This commit is contained in:
parent
c8726a3892
commit
ba6e581223
@ -43,29 +43,28 @@ class RenderManager:
|
|||||||
self.calculate_default(self.screen_list[self.current_display-1][1])
|
self.calculate_default(self.screen_list[self.current_display-1][1])
|
||||||
self.frame = None
|
self.frame = None
|
||||||
|
|
||||||
def set_default_theme(self, theme):
|
def set_override_theme(self, theme):
|
||||||
log.debug("default theme set to %s", theme)
|
log.debug("set override theme to %s", theme)
|
||||||
self.default_theme = self.theme_manager.getThemeData(theme)
|
if theme is not None:
|
||||||
self.renderer.set_theme(self.default_theme)
|
self.theme = theme
|
||||||
|
else:
|
||||||
|
self.theme = self.default_theme
|
||||||
|
log.debug("theme is now %s", self.theme)
|
||||||
|
|
||||||
self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1),
|
self.theme = self.theme_manager.getThemeData(self.theme)
|
||||||
QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start))
|
|
||||||
|
|
||||||
|
|
||||||
def set_theme(self, theme):
|
|
||||||
log.debug("theme set to %s", theme)
|
|
||||||
self.theme = theme
|
|
||||||
self.renderer.set_theme(self.theme)
|
self.renderer.set_theme(self.theme)
|
||||||
|
|
||||||
self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1),
|
self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1),
|
||||||
QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start))
|
QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start))
|
||||||
if theme.font_main_override == False:
|
|
||||||
|
if self.theme.font_main_override == False:
|
||||||
pass
|
pass
|
||||||
if theme.font_footer_override == False:
|
if self.theme.font_footer_override == False:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def generate_preview(self):
|
def generate_preview(self, themedata):
|
||||||
self.calculate_default(QtCore.QSize(800,600))
|
self.calculate_default(QtCore.QSize(800,600))
|
||||||
|
self.renderer.set_theme(themedata)
|
||||||
|
|
||||||
self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1),
|
self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1),
|
||||||
QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start))
|
QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start))
|
||||||
|
@ -124,6 +124,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
self.path = path
|
self.path = path
|
||||||
|
|
||||||
def loadTheme(self, theme):
|
def loadTheme(self, theme):
|
||||||
|
log.debug(u'LoadTheme %s ', theme)
|
||||||
if theme == None:
|
if theme == None:
|
||||||
self.theme.parse(self.baseTheme())
|
self.theme.parse(self.baseTheme())
|
||||||
else:
|
else:
|
||||||
@ -354,13 +355,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
#Local Methods
|
#Local Methods
|
||||||
#
|
#
|
||||||
def baseTheme(self):
|
def baseTheme(self):
|
||||||
log.debug(u'base Theme')
|
log.debug(u'base theme created')
|
||||||
newtheme = ThemeXML()
|
newtheme = ThemeXML()
|
||||||
newtheme.new_document(u'New Theme')
|
newtheme.new_document(u'New Theme')
|
||||||
newtheme.add_background_solid(str(u'#000000'))
|
newtheme.add_background_solid(str(u'#000000'))
|
||||||
newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(30), False)
|
newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(30), u'False')
|
||||||
newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(12), False, u'footer')
|
newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(12), u'False', u'footer')
|
||||||
newtheme.add_display(str(False), str(u'#FFFFFF'), str(False), str(u'#FFFFFF'),
|
newtheme.add_display(u'False', str(u'#FFFFFF'), u'False', str(u'#FFFFFF'),
|
||||||
str(0), str(0), str(0))
|
str(0), str(0), str(0))
|
||||||
|
|
||||||
return newtheme.extract_xml()
|
return newtheme.extract_xml()
|
||||||
|
@ -143,7 +143,7 @@ class ServiceManager(QWidget):
|
|||||||
QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected)
|
QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected)
|
||||||
|
|
||||||
def onThemeComboBoxSelected(self, currentIndex):
|
def onThemeComboBoxSelected(self, currentIndex):
|
||||||
self.renderManager.set_default_theme(self.ThemeComboBox.currentText())
|
self.renderManager.default_theme =self.ThemeComboBox.currentText()
|
||||||
|
|
||||||
def addServiceItem(self, item):
|
def addServiceItem(self, item):
|
||||||
"""Adds service item"""
|
"""Adds service item"""
|
||||||
@ -197,5 +197,5 @@ class ServiceManager(QWidget):
|
|||||||
self.ThemeComboBox.clear()
|
self.ThemeComboBox.clear()
|
||||||
for theme in theme_list:
|
for theme in theme_list:
|
||||||
self.ThemeComboBox.addItem(theme)
|
self.ThemeComboBox.addItem(theme)
|
||||||
self.renderManager.set_default_theme(self.ThemeComboBox.currentText())
|
self.renderManager.default_theme = self.ThemeComboBox.currentText()
|
||||||
|
|
||||||
|
@ -219,7 +219,6 @@ class ThemeManager(QWidget):
|
|||||||
|
|
||||||
def loadThemes(self):
|
def loadThemes(self):
|
||||||
log.debug(u'Load themes from dir')
|
log.debug(u'Load themes from dir')
|
||||||
# self.themelist = [u'African Sunset', u'Snowy Mountains', u'Wilderness', u'Wet and Windy London']
|
|
||||||
for root, dirs, files in os.walk(self.path):
|
for root, dirs, files in os.walk(self.path):
|
||||||
for name in files:
|
for name in files:
|
||||||
if name.endswith(u'.png'):
|
if name.endswith(u'.png'):
|
||||||
@ -232,6 +231,7 @@ class ThemeManager(QWidget):
|
|||||||
return self.Theme_data.getList()
|
return self.Theme_data.getList()
|
||||||
|
|
||||||
def getThemeData(self, themename):
|
def getThemeData(self, themename):
|
||||||
|
log.debug(u'getthemedata for theme %s', themename)
|
||||||
xml_file = os.path.join(self.path, str(themename), str(themename)+u'.xml')
|
xml_file = os.path.join(self.path, str(themename), str(themename)+u'.xml')
|
||||||
xml = fileToXML(xml_file)
|
xml = fileToXML(xml_file)
|
||||||
theme = ThemeXML()
|
theme = ThemeXML()
|
||||||
@ -344,9 +344,8 @@ class ThemeManager(QWidget):
|
|||||||
im.save(samplepathname, u'png')
|
im.save(samplepathname, u'png')
|
||||||
log.debug(u'Theme image written to %s',samplepathname)
|
log.debug(u'Theme image written to %s',samplepathname)
|
||||||
|
|
||||||
def generateImage(self, theme):
|
def generateImage(self, themedata):
|
||||||
log.debug(u'generateImage %s ', theme)
|
log.debug(u'generateImage %s ', themedata)
|
||||||
self.renderManager.set_theme(theme)
|
frame = self.renderManager.generate_preview(themedata)
|
||||||
frame = self.renderManager.generate_preview()
|
|
||||||
return frame
|
return frame
|
||||||
|
|
||||||
|
@ -355,6 +355,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
if len(footer_lines) <= 1:
|
if len(footer_lines) <= 1:
|
||||||
footer_lines.append(book)
|
footer_lines.append(book)
|
||||||
|
|
||||||
|
self.parent.render_manager.set_override_theme(None)
|
||||||
frame=self.parent.render_manager.generate_slide(main_lines, footer_lines)
|
frame=self.parent.render_manager.generate_slide(main_lines, footer_lines)
|
||||||
self.parent.preview_controller.previewFrame(frame)
|
self.parent.preview_controller.previewFrame(frame)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user