forked from openlp/openlp
Fix up theme xml handling to new schema
This commit is contained in:
parent
fc092ed919
commit
4e8a7f47eb
@ -87,16 +87,16 @@ body {
|
|||||||
var transition = %s;
|
var transition = %s;
|
||||||
|
|
||||||
function show_video(state, path, volume, loop){
|
function show_video(state, path, volume, loop){
|
||||||
// Note, the preferred method for looping would be to use the
|
// Note, the preferred method for looping would be to use the
|
||||||
// video tag loop attribute.
|
// video tag loop attribute.
|
||||||
// But QtWebKit doesn't support this. Neither does it support the
|
// But QtWebKit doesn't support this. Neither does it support the
|
||||||
// onended event, hence the setInterval()
|
// onended event, hence the setInterval()
|
||||||
// In addition, setting the currentTime attribute to zero to restart
|
// In addition, setting the currentTime attribute to zero to restart
|
||||||
// the video raises an INDEX_SIZE_ERROR: DOM Exception 1
|
// the video raises an INDEX_SIZE_ERROR: DOM Exception 1
|
||||||
// To complicate it further, sometimes vid.currentTime stops
|
// To complicate it further, sometimes vid.currentTime stops
|
||||||
// slightly short of vid.duration and vid.ended is intermittent!
|
// slightly short of vid.duration and vid.ended is intermittent!
|
||||||
//
|
//
|
||||||
// Note, currently the background may go black between loops. Not
|
// Note, currently the background may go black between loops. Not
|
||||||
// desirable. Need to investigate using two <video>'s, and hiding/
|
// desirable. Need to investigate using two <video>'s, and hiding/
|
||||||
// preloading one, and toggle between the two when looping.
|
// preloading one, and toggle between the two when looping.
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ body {
|
|||||||
vid2.volume = volume;
|
vid2.volume = volume;
|
||||||
}
|
}
|
||||||
switch(state){
|
switch(state){
|
||||||
case 'init':
|
case 'init':
|
||||||
vid.src = path;
|
vid.src = path;
|
||||||
vid2.src = path;
|
vid2.src = path;
|
||||||
if(loop == null) loop = false;
|
if(loop == null) loop = false;
|
||||||
@ -129,8 +129,8 @@ body {
|
|||||||
vid.style.visibility = 'visible';
|
vid.style.visibility = 'visible';
|
||||||
if(vid.looping){
|
if(vid.looping){
|
||||||
video_timer = setInterval(
|
video_timer = setInterval(
|
||||||
function() {
|
function() {
|
||||||
show_video('poll');
|
show_video('poll');
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -447,17 +447,17 @@ def build_lyrics_css(item, webkitvers):
|
|||||||
lyricsmain += build_lyrics_outline_css(theme)
|
lyricsmain += build_lyrics_outline_css(theme)
|
||||||
else:
|
else:
|
||||||
outline = build_lyrics_outline_css(theme)
|
outline = build_lyrics_outline_css(theme)
|
||||||
if theme.display_shadow:
|
if theme.font_main_shadow:
|
||||||
if theme.display_outline and webkitvers < 534.3:
|
if theme.font_main_outline and webkitvers < 534.3:
|
||||||
shadow = u'padding-left: %spx; padding-top: %spx;' % \
|
shadow = u'padding-left: %spx; padding-top: %spx;' % \
|
||||||
(int(theme.display_shadow_size) +
|
(int(theme.font_main_shadow_size) +
|
||||||
(int(theme.display_outline_size) * 2),
|
(int(theme.font_main_outline_size) * 2),
|
||||||
theme.display_shadow_size)
|
theme.font_main_shadow_size)
|
||||||
shadow += build_lyrics_outline_css(theme, True)
|
shadow += build_lyrics_outline_css(theme, True)
|
||||||
else:
|
else:
|
||||||
lyricsmain += u' text-shadow: %s %spx %spx;' % \
|
lyricsmain += u' text-shadow: %s %spx %spx;' % \
|
||||||
(theme.display_shadow_color, theme.display_shadow_size,
|
(theme.font_mainy_shadow_color, theme.font_main_shadow_size,
|
||||||
theme.display_shadow_size)
|
theme.font_main_shadow_size)
|
||||||
lyrics_css = style % (lyricstable, lyrics, lyricsmain, outline, shadow)
|
lyrics_css = style % (lyricstable, lyrics, lyricsmain, outline, shadow)
|
||||||
return lyrics_css
|
return lyrics_css
|
||||||
|
|
||||||
@ -472,14 +472,14 @@ def build_lyrics_outline_css(theme, is_shadow=False):
|
|||||||
`is_shadow`
|
`is_shadow`
|
||||||
If true, use the shadow colors instead
|
If true, use the shadow colors instead
|
||||||
"""
|
"""
|
||||||
if theme.display_outline:
|
if theme.font_main_outline:
|
||||||
size = float(theme.display_outline_size) / 16
|
size = float(theme.font_main_outline_size) / 16
|
||||||
if is_shadow:
|
if is_shadow:
|
||||||
fill_color = theme.display_shadow_color
|
fill_color = theme.font_main_shadow_color
|
||||||
outline_color = theme.display_shadow_color
|
outline_color = theme.font_main_shadow_color
|
||||||
else:
|
else:
|
||||||
fill_color = theme.font_main_color
|
fill_color = theme.font_main_color
|
||||||
outline_color = theme.display_outline_color
|
outline_color = theme.font_main_outline_color
|
||||||
return u' -webkit-text-stroke: %sem %s; ' \
|
return u' -webkit-text-stroke: %sem %s; ' \
|
||||||
u'-webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
u'-webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
||||||
else:
|
else:
|
||||||
@ -512,8 +512,8 @@ def build_lyrics_format_css(theme, width, height):
|
|||||||
valign = u'middle'
|
valign = u'middle'
|
||||||
else:
|
else:
|
||||||
valign = u'top'
|
valign = u'top'
|
||||||
if theme.display_outline:
|
if theme.font_main_outline:
|
||||||
left_margin = int(theme.display_outline_size) * 2
|
left_margin = int(theme.font_main_outline_size) * 2
|
||||||
else:
|
else:
|
||||||
left_margin = 0
|
left_margin = 0
|
||||||
lyrics = u'white-space:pre-wrap; word-wrap: break-word; ' \
|
lyrics = u'white-space:pre-wrap; word-wrap: break-word; ' \
|
||||||
@ -523,12 +523,12 @@ def build_lyrics_format_css(theme, width, height):
|
|||||||
(align, valign, theme.font_main_name, theme.font_main_proportion,
|
(align, valign, theme.font_main_name, theme.font_main_proportion,
|
||||||
theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
|
theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
|
||||||
left_margin, width, height)
|
left_margin, width, height)
|
||||||
if theme.display_outline:
|
if theme.font_main_outline:
|
||||||
if webkit_version() < 534.3:
|
if webkit_version() < 534.3:
|
||||||
lyrics += u' letter-spacing: 1px;'
|
lyrics += u' letter-spacing: 1px;'
|
||||||
if theme.font_main_italics:
|
if theme.font_main_italics:
|
||||||
lyrics += u' font-style:italic; '
|
lyrics += u' font-style:italic; '
|
||||||
if theme.font_main_weight == u'Bold':
|
if theme.font_main_bold:
|
||||||
lyrics += u' font-weight:bold; '
|
lyrics += u' font-weight:bold; '
|
||||||
return lyrics
|
return lyrics
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ def build_lyrics_html(item, webkitvers):
|
|||||||
# display:table/display:table-cell are required for each lyric block.
|
# display:table/display:table-cell are required for each lyric block.
|
||||||
lyrics = u''
|
lyrics = u''
|
||||||
theme = item.themedata
|
theme = item.themedata
|
||||||
if webkitvers < 534.4 and theme and theme.display_outline:
|
if webkitvers < 534.4 and theme and theme.font_main_outline:
|
||||||
lyrics += u'<div class="lyricstable">' \
|
lyrics += u'<div class="lyricstable">' \
|
||||||
u'<div id="lyricsshadow" style="opacity:1" ' \
|
u'<div id="lyricsshadow" style="opacity:1" ' \
|
||||||
u'class="lyricscell lyricsshadow"></div></div>'
|
u'class="lyricscell lyricsshadow"></div></div>'
|
||||||
|
@ -90,9 +90,9 @@ class Renderer(object):
|
|||||||
self._rect_footer = rect_footer
|
self._rect_footer = rect_footer
|
||||||
self.page_width = self._rect.width()
|
self.page_width = self._rect.width()
|
||||||
self.page_height = self._rect.height()
|
self.page_height = self._rect.height()
|
||||||
if self._theme.display_shadow:
|
if self._theme.font_main_shadow:
|
||||||
self.page_width -= int(self._theme.display_shadow_size)
|
self.page_width -= int(self._theme.font_main_shadow_size)
|
||||||
self.page_height -= int(self._theme.display_shadow_size)
|
self.page_height -= int(self._theme.font_main_shadow_size)
|
||||||
self.web = QtWebKit.QWebView()
|
self.web = QtWebKit.QWebView()
|
||||||
self.web.setVisible(False)
|
self.web.setVisible(False)
|
||||||
self.web.resize(self.page_width, self.page_height)
|
self.web.resize(self.page_width, self.page_height)
|
||||||
|
@ -31,6 +31,7 @@ import re
|
|||||||
|
|
||||||
from xml.dom.minidom import Document
|
from xml.dom.minidom import Document
|
||||||
from xml.etree.ElementTree import ElementTree, XML
|
from xml.etree.ElementTree import ElementTree, XML
|
||||||
|
from lxml import etree, objectify
|
||||||
|
|
||||||
from openlp.core.lib import str_to_bool
|
from openlp.core.lib import str_to_bool
|
||||||
|
|
||||||
@ -54,26 +55,27 @@ BLANK_THEME_XML = \
|
|||||||
<name>Arial</name>
|
<name>Arial</name>
|
||||||
<color>#000000</color>
|
<color>#000000</color>
|
||||||
<proportion>30</proportion>
|
<proportion>30</proportion>
|
||||||
<weight>Normal</weight>
|
<bold>False</bold>
|
||||||
<italics>False</italics>
|
<italics>False</italics>
|
||||||
<line_adjustment>0</line_adjustment>
|
<line_adjustment>0</line_adjustment>
|
||||||
|
<shadow color="#ffffff" size="5">True</shadow>
|
||||||
|
<outline color="#ffffff" size="2">False</outline>
|
||||||
<location override="False" x="10" y="10" width="1004" height="690"/>
|
<location override="False" x="10" y="10" width="1004" height="690"/>
|
||||||
</font>
|
</font>
|
||||||
<font type="footer">
|
<font type="footer">
|
||||||
<name>Arial</name>
|
<name>Arial</name>
|
||||||
<color>#000000</color>
|
<color>#000000</color>
|
||||||
<proportion>12</proportion>
|
<proportion>12</proportion>
|
||||||
<weight>Normal</weight>
|
<bold>False</bold>
|
||||||
<italics>False</italics>
|
<italics>False</italics>
|
||||||
|
<shadow color="#000000" size="5">True</shadow>
|
||||||
|
<outline color="#000000" size="2">False</outline>
|
||||||
<line_adjustment>0</line_adjustment>
|
<line_adjustment>0</line_adjustment>
|
||||||
<location override="False" x="10" y="690" width="1004" height="78"/>
|
<location override="False" x="10" y="690" width="1004" height="78"/>
|
||||||
</font>
|
</font>
|
||||||
<display>
|
<display>
|
||||||
<shadow color="#000000" size="5">True</shadow>
|
|
||||||
<outline color="#000000" size="2">False</outline>
|
|
||||||
<horizontalAlign>0</horizontalAlign>
|
<horizontalAlign>0</horizontalAlign>
|
||||||
<verticalAlign>0</verticalAlign>
|
<verticalAlign>0</verticalAlign>
|
||||||
<wrapStyle>0</wrapStyle>
|
|
||||||
<slideTransition>False</slideTransition>
|
<slideTransition>False</slideTransition>
|
||||||
</display>
|
</display>
|
||||||
</theme>
|
</theme>
|
||||||
@ -87,7 +89,7 @@ class ThemeLevel(object):
|
|||||||
Service = 2
|
Service = 2
|
||||||
Song = 3
|
Song = 3
|
||||||
|
|
||||||
boolean_list = [u'italics', u'override', u'outline', u'shadow', \
|
boolean_list = [u'bold', u'italics', u'override', u'outline', u'shadow', \
|
||||||
u'slide_transition']
|
u'slide_transition']
|
||||||
|
|
||||||
integer_list =[u'proportion', u'line_adjustment', u'x', u'height', u'y', \
|
integer_list =[u'proportion', u'line_adjustment', u'x', u'height', u'y', \
|
||||||
@ -186,12 +188,13 @@ class ThemeXML(object):
|
|||||||
background.setAttribute(u'mode', u'opaque')
|
background.setAttribute(u'mode', u'opaque')
|
||||||
background.setAttribute(u'type', u'image')
|
background.setAttribute(u'type', u'image')
|
||||||
self.theme.appendChild(background)
|
self.theme.appendChild(background)
|
||||||
#Create Filename element
|
# Create Filename element
|
||||||
self.child_element(background, u'filename', filename)
|
self.child_element(background, u'filename', filename)
|
||||||
|
|
||||||
def add_font(self, name, color, proportion, override, fonttype=u'main',
|
def add_font(self, name, color, proportion, override, fonttype=u'main',
|
||||||
weight=u'Normal', italics=u'False', line_adjustment=0,
|
bold=u'False', italics=u'False', line_adjustment=0,
|
||||||
xpos=0, ypos=0, width=0, height=0):
|
xpos=0, ypos=0, width=0, height=0 , outline=u'False', outline_color=u'#ffffff',
|
||||||
|
outline_pixel=2, shadow=u'False', shadow_color=u'#ffffff', shadow_pixel=5):
|
||||||
"""
|
"""
|
||||||
Add a Font.
|
Add a Font.
|
||||||
|
|
||||||
@ -227,25 +230,44 @@ class ThemeXML(object):
|
|||||||
|
|
||||||
``height``
|
``height``
|
||||||
The height of the text block.
|
The height of the text block.
|
||||||
|
|
||||||
|
``outline``
|
||||||
|
Whether or not to show an outline.
|
||||||
|
|
||||||
|
``outline_color``
|
||||||
|
The colour of the outline.
|
||||||
|
|
||||||
|
``outline_size``
|
||||||
|
How big the Shadow is
|
||||||
|
|
||||||
|
``shadow``
|
||||||
|
Whether or not to show a shadow.
|
||||||
|
|
||||||
|
``shadow_color``
|
||||||
|
The colour of the shadow.
|
||||||
|
|
||||||
|
``shadow_size``
|
||||||
|
How big the Shadow is
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
background = self.theme_xml.createElement(u'font')
|
background = self.theme_xml.createElement(u'font')
|
||||||
background.setAttribute(u'type', fonttype)
|
background.setAttribute(u'type', fonttype)
|
||||||
self.theme.appendChild(background)
|
self.theme.appendChild(background)
|
||||||
#Create Font name element
|
# Create Font name element
|
||||||
self.child_element(background, u'name', name)
|
self.child_element(background, u'name', name)
|
||||||
#Create Font color element
|
# Create Font color element
|
||||||
self.child_element(background, u'color', color)
|
self.child_element(background, u'color', color)
|
||||||
#Create Proportion name element
|
# Create Proportion name element
|
||||||
self.child_element(background, u'proportion', proportion)
|
self.child_element(background, u'proportion', proportion)
|
||||||
#Create weight name element
|
# Create weight name element
|
||||||
self.child_element(background, u'weight', weight)
|
self.child_element(background, u'bold', bold)
|
||||||
#Create italics name element
|
# Create italics name element
|
||||||
self.child_element(background, u'italics', italics)
|
self.child_element(background, u'italics', italics)
|
||||||
#Create indentation name element
|
# Create indentation name element
|
||||||
self.child_element(
|
self.child_element(
|
||||||
background, u'line_adjustment', unicode(line_adjustment))
|
background, u'line_adjustment', unicode(line_adjustment))
|
||||||
|
# Create Location element
|
||||||
#Create Location element
|
|
||||||
element = self.theme_xml.createElement(u'location')
|
element = self.theme_xml.createElement(u'location')
|
||||||
element.setAttribute(u'override', override)
|
element.setAttribute(u'override', override)
|
||||||
if override == u'True':
|
if override == u'True':
|
||||||
@ -254,72 +276,50 @@ class ThemeXML(object):
|
|||||||
element.setAttribute(u'width', width)
|
element.setAttribute(u'width', width)
|
||||||
element.setAttribute(u'height', height)
|
element.setAttribute(u'height', height)
|
||||||
background.appendChild(element)
|
background.appendChild(element)
|
||||||
|
# Shadow
|
||||||
|
element = self.theme_xml.createElement(u'shadow')
|
||||||
|
element.setAttribute(u'shadowColor', unicode(shadow_color))
|
||||||
|
element.setAttribute(u'shadowSize', unicode(shadow_pixel))
|
||||||
|
value = self.theme_xml.createTextNode(unicode(shadow))
|
||||||
|
element.appendChild(value)
|
||||||
|
background.appendChild(element)
|
||||||
|
# Outline
|
||||||
|
element = self.theme_xml.createElement(u'outline')
|
||||||
|
element.setAttribute(u'outlineColor', unicode(outline_color))
|
||||||
|
element.setAttribute(u'outlineSize', unicode(outline_pixel))
|
||||||
|
value = self.theme_xml.createTextNode(unicode(outline))
|
||||||
|
element.appendChild(value)
|
||||||
|
background.appendChild(element)
|
||||||
|
|
||||||
def add_display(self, shadow, shadow_color, outline, outline_color,
|
def add_display(self, horizontal, vertical, transition):
|
||||||
horizontal, vertical, wrap, transition, shadow_pixel=5,
|
|
||||||
outline_pixel=2):
|
|
||||||
"""
|
"""
|
||||||
Add a Display options.
|
Add a Display options.
|
||||||
|
|
||||||
``shadow``
|
|
||||||
Whether or not to show a shadow.
|
|
||||||
|
|
||||||
``shadow_color``
|
|
||||||
The colour of the shadow.
|
|
||||||
|
|
||||||
``outline``
|
|
||||||
Whether or not to show an outline.
|
|
||||||
|
|
||||||
``outline_color``
|
|
||||||
The colour of the outline.
|
|
||||||
|
|
||||||
``horizontal``
|
``horizontal``
|
||||||
The horizontal alignment of the text.
|
The horizontal alignment of the text.
|
||||||
|
|
||||||
``vertical``
|
``vertical``
|
||||||
The vertical alignment of the text.
|
The vertical alignment of the text.
|
||||||
|
|
||||||
``wrap``
|
|
||||||
Wrap style.
|
|
||||||
|
|
||||||
``transition``
|
``transition``
|
||||||
Whether the slide transition is active.
|
Whether the slide transition is active.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
background = self.theme_xml.createElement(u'display')
|
background = self.theme_xml.createElement(u'display')
|
||||||
self.theme.appendChild(background)
|
self.theme.appendChild(background)
|
||||||
# Shadow
|
|
||||||
element = self.theme_xml.createElement(u'shadow')
|
|
||||||
element.setAttribute(u'color', shadow_color)
|
|
||||||
element.setAttribute(u'size', unicode(shadow_pixel))
|
|
||||||
value = self.theme_xml.createTextNode(shadow)
|
|
||||||
element.appendChild(value)
|
|
||||||
background.appendChild(element)
|
|
||||||
# Outline
|
|
||||||
element = self.theme_xml.createElement(u'outline')
|
|
||||||
element.setAttribute(u'color', outline_color)
|
|
||||||
element.setAttribute(u'size', unicode(outline_pixel))
|
|
||||||
value = self.theme_xml.createTextNode(outline)
|
|
||||||
element.appendChild(value)
|
|
||||||
background.appendChild(element)
|
|
||||||
# Horizontal alignment
|
# Horizontal alignment
|
||||||
element = self.theme_xml.createElement(u'horizontalAlign')
|
element = self.theme_xml.createElement(u'horizontalAlign')
|
||||||
value = self.theme_xml.createTextNode(horizontal)
|
value = self.theme_xml.createTextNode(unicode(horizontal))
|
||||||
element.appendChild(value)
|
element.appendChild(value)
|
||||||
background.appendChild(element)
|
background.appendChild(element)
|
||||||
# Vertical alignment
|
# Vertical alignment
|
||||||
element = self.theme_xml.createElement(u'verticalAlign')
|
element = self.theme_xml.createElement(u'verticalAlign')
|
||||||
value = self.theme_xml.createTextNode(vertical)
|
value = self.theme_xml.createTextNode(unicode(vertical))
|
||||||
element.appendChild(value)
|
|
||||||
background.appendChild(element)
|
|
||||||
# Wrap style
|
|
||||||
element = self.theme_xml.createElement(u'wrapStyle')
|
|
||||||
value = self.theme_xml.createTextNode(wrap)
|
|
||||||
element.appendChild(value)
|
element.appendChild(value)
|
||||||
background.appendChild(element)
|
background.appendChild(element)
|
||||||
# Slide Transition
|
# Slide Transition
|
||||||
element = self.theme_xml.createElement(u'slideTransition')
|
element = self.theme_xml.createElement(u'slideTransition')
|
||||||
value = self.theme_xml.createTextNode(transition)
|
value = self.theme_xml.createTextNode(unicode(transition))
|
||||||
element.appendChild(value)
|
element.appendChild(value)
|
||||||
background.appendChild(element)
|
background.appendChild(element)
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ class ThemeXML(object):
|
|||||||
The XML string to parse.
|
The XML string to parse.
|
||||||
"""
|
"""
|
||||||
self.parse_xml(BLANK_THEME_XML)
|
self.parse_xml(BLANK_THEME_XML)
|
||||||
self.parse_xml(xml)
|
self.parse_xml(unicode(xml))
|
||||||
|
|
||||||
def parse_xml(self, xml):
|
def parse_xml(self, xml):
|
||||||
"""
|
"""
|
||||||
@ -368,47 +368,69 @@ class ThemeXML(object):
|
|||||||
``xml``
|
``xml``
|
||||||
The XML string to parse.
|
The XML string to parse.
|
||||||
"""
|
"""
|
||||||
theme_xml = ElementTree(element=XML(xml.encode(u'ascii',
|
# remove encoding string
|
||||||
u'xmlcharrefreplace')))
|
if xml[:5] == u'<?xml':
|
||||||
|
xml = xml[38:]
|
||||||
|
try:
|
||||||
|
theme_xml = objectify.fromstring(xml)
|
||||||
|
except etree.XMLSyntaxError:
|
||||||
|
log.exception(u'Invalid xml %s', xml)
|
||||||
|
# print objectify.dump(theme_xml)
|
||||||
xml_iter = theme_xml.getiterator()
|
xml_iter = theme_xml.getiterator()
|
||||||
master = u''
|
|
||||||
for element in xml_iter:
|
for element in xml_iter:
|
||||||
if not isinstance(element.text, unicode):
|
parent = element.getparent()
|
||||||
element.text = unicode(str(element.text), u'utf-8')
|
master = u''
|
||||||
if element.getchildren():
|
if parent is not None:
|
||||||
master = element.tag + u'_'
|
if element.getparent().tag == u'font':
|
||||||
else:
|
master = element.getparent().tag + u'_' + element.getparent().attrib[u'type']
|
||||||
# background transparent tags have no children so special case
|
if element.getparent().tag == u'display':
|
||||||
if element.tag == u'background':
|
master = element.getparent().tag
|
||||||
for e in element.attrib.iteritems():
|
if element.getparent().tag == u'background':
|
||||||
self._create_attr(element.tag , e[0], e[1])
|
master = element.getparent().tag
|
||||||
if element.attrib:
|
if element.getparent().attrib:
|
||||||
for e in element.attrib.iteritems():
|
for attr in element.getparent().attrib:
|
||||||
if master == u'font_' and e[0] == u'type':
|
self._create_attr(master, attr, element.getparent().attrib[attr])
|
||||||
master += e[1] + u'_'
|
if master:
|
||||||
elif master == u'display_' and (element.tag == u'shadow' \
|
# the next few lines fix up errors in the XML to the current standard.
|
||||||
or element.tag == u'outline' ):
|
# move the fields from display to font_main
|
||||||
self._create_attr(master, element.tag, element.text)
|
if master == u'display' and (element.tag == u'shadow' or element.tag == u'outline'):
|
||||||
self._create_attr(master, element.tag + u'_'+ e[0], e[1])
|
master = u'font_main'
|
||||||
|
# fix bold font
|
||||||
|
if element.tag == u'weight':
|
||||||
|
if element.text.strip().lstrip() == u'Normal':
|
||||||
|
self._create_attr(master, u'bold', False)
|
||||||
else:
|
else:
|
||||||
field = master + e[0]
|
self._create_attr(master, u'bold', True)
|
||||||
self._create_attr(master, e[0], e[1])
|
else:
|
||||||
|
# normal service happens here!
|
||||||
|
self._create_attr(master, element.tag, element.text)
|
||||||
|
if element.attrib:
|
||||||
|
# correction for the shadow and outline tags
|
||||||
|
if element.tag == u'shadow' or element.tag == u'outline':
|
||||||
|
master = master + '_' + element.tag
|
||||||
|
for attr in element.attrib:
|
||||||
|
self._create_attr(master, attr, element.attrib[attr])
|
||||||
|
else:
|
||||||
|
self._create_attr(master, element.tag, element.text)
|
||||||
else:
|
else:
|
||||||
if element.tag:
|
if element.tag == u'name':
|
||||||
element.text = element.text.strip().lstrip()
|
self._create_attr(u'theme', element.tag, element.text)
|
||||||
self._create_attr(master , element.tag, element.text)
|
|
||||||
|
|
||||||
def _create_attr(self, master , element, value):
|
def _create_attr(self, master , element, value):
|
||||||
"""
|
"""
|
||||||
Create the attributes with the correct data types and name format
|
Create the attributes with the correct data types and name format
|
||||||
"""
|
"""
|
||||||
field = self._de_hump(element)
|
field = self._de_hump(element)
|
||||||
if field in boolean_list:
|
tag = master + u'_' + field
|
||||||
setattr(self, master + field, str_to_bool(value))
|
if element in boolean_list:
|
||||||
elif field in integer_list:
|
setattr(self, tag, str_to_bool(value))
|
||||||
setattr(self, master + field, int(value))
|
elif element in integer_list:
|
||||||
|
setattr(self, tag, int(value))
|
||||||
else:
|
else:
|
||||||
setattr(self, master + field, unicode(value))
|
# make string value unicode
|
||||||
|
if not isinstance(value, unicode):
|
||||||
|
value = unicode(str(value), u'utf-8')
|
||||||
|
setattr(self, tag, unicode(value).strip().lstrip())
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""
|
"""
|
||||||
@ -453,7 +475,13 @@ class ThemeXML(object):
|
|||||||
unicode(self.font_main_x),
|
unicode(self.font_main_x),
|
||||||
unicode(self.font_main_y),
|
unicode(self.font_main_y),
|
||||||
unicode(self.font_main_width),
|
unicode(self.font_main_width),
|
||||||
unicode(self.font_main_height))
|
unicode(self.font_main_height),
|
||||||
|
self.font_main_outline,
|
||||||
|
self.font_main_outline_color,
|
||||||
|
self.font_main_outline_size,
|
||||||
|
self.font_main_shadow,
|
||||||
|
self.font_main_shadow_color,
|
||||||
|
self.font_main_shadow_size)
|
||||||
self.add_font(unicode(self.font_footer_name),
|
self.add_font(unicode(self.font_footer_name),
|
||||||
unicode(self.font_footer_color),
|
unicode(self.font_footer_color),
|
||||||
unicode(self.font_footer_proportion),
|
unicode(self.font_footer_proportion),
|
||||||
@ -464,15 +492,13 @@ class ThemeXML(object):
|
|||||||
unicode(self.font_footer_x),
|
unicode(self.font_footer_x),
|
||||||
unicode(self.font_footer_y),
|
unicode(self.font_footer_y),
|
||||||
unicode(self.font_footer_width),
|
unicode(self.font_footer_width),
|
||||||
unicode(self.font_footer_height))
|
unicode(self.font_footer_height),
|
||||||
self.add_display(unicode(self.display_shadow),
|
self.font_footer_outline,
|
||||||
unicode(self.display_shadow_color),
|
self.font_footer_outline_color,
|
||||||
unicode(self.display_outline),
|
self.font_footer_outline_size,
|
||||||
unicode(self.display_outline_color),
|
self.font_footer_shadow,
|
||||||
unicode(self.display_horizontal_align),
|
self.font_footer_shadow_color,
|
||||||
unicode(self.display_vertical_align),
|
self.font_footer_shadow_size)
|
||||||
unicode(self.display_wrap_style),
|
self.add_display(self.display_horizontal_align,
|
||||||
unicode(self.display_slide_transition),
|
self.display_vertical_align,
|
||||||
unicode(self.display_shadow_size),
|
self.display_slide_transition)
|
||||||
unicode(self.display_outline_size))
|
|
||||||
|
|
||||||
|
@ -762,8 +762,8 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
u'30', u'False')
|
u'30', u'False')
|
||||||
newtheme.add_font(unicode(QtGui.QFont().family()), u'#FFFFFF',
|
newtheme.add_font(unicode(QtGui.QFont().family()), u'#FFFFFF',
|
||||||
u'12', u'False', u'footer')
|
u'12', u'False', u'footer')
|
||||||
newtheme.add_display(u'False', u'#FFFFFF', u'False',
|
newtheme.add_display(u'0', u'0', u'0')
|
||||||
unicode(u'#FFFFFF'), u'0', u'0', u'0', u'False')
|
print newtheme.extract_xml()
|
||||||
return newtheme.extract_xml()
|
return newtheme.extract_xml()
|
||||||
|
|
||||||
def createThemeFromXml(self, theme_xml, path):
|
def createThemeFromXml(self, theme_xml, path):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'themewizard.ui'
|
# Form implementation generated from reading ui file 'themewizard.ui'
|
||||||
#
|
#
|
||||||
# Created: Sat Oct 2 08:13:48 2010
|
# Created: Sun Oct 3 17:44:50 2010
|
||||||
# by: PyQt4 UI code generator 4.7.4
|
# by: PyQt4 UI code generator 4.7.4
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@ -20,10 +20,10 @@ class Ui_ThemeWizard(object):
|
|||||||
self.welcomePage.setTitle("")
|
self.welcomePage.setTitle("")
|
||||||
self.welcomePage.setSubTitle("")
|
self.welcomePage.setSubTitle("")
|
||||||
self.welcomePage.setObjectName("welcomePage")
|
self.welcomePage.setObjectName("welcomePage")
|
||||||
self.WelcomeLayout = QtGui.QHBoxLayout(self.welcomePage)
|
self.welcomeLayout = QtGui.QHBoxLayout(self.welcomePage)
|
||||||
self.WelcomeLayout.setSpacing(8)
|
self.welcomeLayout.setSpacing(8)
|
||||||
self.WelcomeLayout.setMargin(0)
|
self.welcomeLayout.setMargin(0)
|
||||||
self.WelcomeLayout.setObjectName("WelcomeLayout")
|
self.welcomeLayout.setObjectName("welcomeLayout")
|
||||||
self.importBibleImage = QtGui.QLabel(self.welcomePage)
|
self.importBibleImage = QtGui.QLabel(self.welcomePage)
|
||||||
self.importBibleImage.setMinimumSize(QtCore.QSize(163, 0))
|
self.importBibleImage.setMinimumSize(QtCore.QSize(163, 0))
|
||||||
self.importBibleImage.setMaximumSize(QtCore.QSize(163, 16777215))
|
self.importBibleImage.setMaximumSize(QtCore.QSize(163, 16777215))
|
||||||
@ -32,7 +32,7 @@ class Ui_ThemeWizard(object):
|
|||||||
self.importBibleImage.setPixmap(QtGui.QPixmap(":/wizards/wizard_importbible.bmp"))
|
self.importBibleImage.setPixmap(QtGui.QPixmap(":/wizards/wizard_importbible.bmp"))
|
||||||
self.importBibleImage.setIndent(0)
|
self.importBibleImage.setIndent(0)
|
||||||
self.importBibleImage.setObjectName("importBibleImage")
|
self.importBibleImage.setObjectName("importBibleImage")
|
||||||
self.WelcomeLayout.addWidget(self.importBibleImage)
|
self.welcomeLayout.addWidget(self.importBibleImage)
|
||||||
self.welcomePageLayout = QtGui.QVBoxLayout()
|
self.welcomePageLayout = QtGui.QVBoxLayout()
|
||||||
self.welcomePageLayout.setSpacing(8)
|
self.welcomePageLayout.setSpacing(8)
|
||||||
self.welcomePageLayout.setObjectName("welcomePageLayout")
|
self.welcomePageLayout.setObjectName("welcomePageLayout")
|
||||||
@ -48,7 +48,7 @@ class Ui_ThemeWizard(object):
|
|||||||
self.welcomePageLayout.addWidget(self.informationLabel)
|
self.welcomePageLayout.addWidget(self.informationLabel)
|
||||||
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||||
self.welcomePageLayout.addItem(spacerItem1)
|
self.welcomePageLayout.addItem(spacerItem1)
|
||||||
self.WelcomeLayout.addLayout(self.welcomePageLayout)
|
self.welcomeLayout.addLayout(self.welcomePageLayout)
|
||||||
ThemeWizard.addPage(self.welcomePage)
|
ThemeWizard.addPage(self.welcomePage)
|
||||||
self.backgroundPage = QtGui.QWizardPage()
|
self.backgroundPage = QtGui.QWizardPage()
|
||||||
self.backgroundPage.setObjectName("backgroundPage")
|
self.backgroundPage.setObjectName("backgroundPage")
|
||||||
@ -110,27 +110,27 @@ class Ui_ThemeWizard(object):
|
|||||||
ThemeWizard.addPage(self.backgroundPage)
|
ThemeWizard.addPage(self.backgroundPage)
|
||||||
self.mainAreaPage = QtGui.QWizardPage()
|
self.mainAreaPage = QtGui.QWizardPage()
|
||||||
self.mainAreaPage.setObjectName("mainAreaPage")
|
self.mainAreaPage.setObjectName("mainAreaPage")
|
||||||
self.mainAreaLayout = QtGui.QFormLayout(self.mainAreaPage)
|
self.formLayout = QtGui.QFormLayout(self.mainAreaPage)
|
||||||
self.mainAreaLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow)
|
self.formLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
|
||||||
self.mainAreaLayout.setContentsMargins(50, 20, 20, 20)
|
self.formLayout.setContentsMargins(-1, 20, 20, 20)
|
||||||
self.mainAreaLayout.setSpacing(8)
|
self.formLayout.setSpacing(8)
|
||||||
self.mainAreaLayout.setObjectName("mainAreaLayout")
|
self.formLayout.setObjectName("formLayout")
|
||||||
self.mainFontLabel = QtGui.QLabel(self.mainAreaPage)
|
self.mainFontLabel = QtGui.QLabel(self.mainAreaPage)
|
||||||
self.mainFontLabel.setObjectName("mainFontLabel")
|
self.mainFontLabel.setObjectName("mainFontLabel")
|
||||||
self.mainAreaLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.mainFontLabel)
|
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.mainFontLabel)
|
||||||
self.mainFontComboBox = QtGui.QFontComboBox(self.mainAreaPage)
|
self.mainFontComboBox = QtGui.QFontComboBox(self.mainAreaPage)
|
||||||
self.mainFontComboBox.setObjectName("mainFontComboBox")
|
self.mainFontComboBox.setObjectName("mainFontComboBox")
|
||||||
self.mainAreaLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.mainFontComboBox)
|
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.mainFontComboBox)
|
||||||
self.mainColorLabel = QtGui.QLabel(self.mainAreaPage)
|
self.mainColorLabel = QtGui.QLabel(self.mainAreaPage)
|
||||||
self.mainColorLabel.setObjectName("mainColorLabel")
|
self.mainColorLabel.setObjectName("mainColorLabel")
|
||||||
self.mainAreaLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.mainColorLabel)
|
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.mainColorLabel)
|
||||||
self.mainColorPushButton = QtGui.QPushButton(self.mainAreaPage)
|
self.mainColorPushButton = QtGui.QPushButton(self.mainAreaPage)
|
||||||
self.mainColorPushButton.setText("")
|
self.mainColorPushButton.setText("")
|
||||||
self.mainColorPushButton.setObjectName("mainColorPushButton")
|
self.mainColorPushButton.setObjectName("mainColorPushButton")
|
||||||
self.mainAreaLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.mainColorPushButton)
|
self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.mainColorPushButton)
|
||||||
self.mainSizeLabel = QtGui.QLabel(self.mainAreaPage)
|
self.mainSizeLabel = QtGui.QLabel(self.mainAreaPage)
|
||||||
self.mainSizeLabel.setObjectName("mainSizeLabel")
|
self.mainSizeLabel.setObjectName("mainSizeLabel")
|
||||||
self.mainAreaLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.mainSizeLabel)
|
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.mainSizeLabel)
|
||||||
self.mainSizeLayout = QtGui.QHBoxLayout()
|
self.mainSizeLayout = QtGui.QHBoxLayout()
|
||||||
self.mainSizeLayout.setSpacing(8)
|
self.mainSizeLayout.setSpacing(8)
|
||||||
self.mainSizeLayout.setMargin(0)
|
self.mainSizeLayout.setMargin(0)
|
||||||
@ -149,23 +149,49 @@ class Ui_ThemeWizard(object):
|
|||||||
self.mainLineCountLabel = QtGui.QLabel(self.mainAreaPage)
|
self.mainLineCountLabel = QtGui.QLabel(self.mainAreaPage)
|
||||||
self.mainLineCountLabel.setObjectName("mainLineCountLabel")
|
self.mainLineCountLabel.setObjectName("mainLineCountLabel")
|
||||||
self.mainSizeLayout.addWidget(self.mainLineCountLabel)
|
self.mainSizeLayout.addWidget(self.mainLineCountLabel)
|
||||||
self.mainAreaLayout.setLayout(2, QtGui.QFormLayout.FieldRole, self.mainSizeLayout)
|
self.formLayout.setLayout(2, QtGui.QFormLayout.FieldRole, self.mainSizeLayout)
|
||||||
|
self.lineSpacingLabel = QtGui.QLabel(self.mainAreaPage)
|
||||||
|
self.lineSpacingLabel.setObjectName("lineSpacingLabel")
|
||||||
|
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lineSpacingLabel)
|
||||||
|
self.lineSpacingSpinBox = QtGui.QSpinBox(self.mainAreaPage)
|
||||||
|
self.lineSpacingSpinBox.setMinimum(-50)
|
||||||
|
self.lineSpacingSpinBox.setMaximum(50)
|
||||||
|
self.lineSpacingSpinBox.setObjectName("lineSpacingSpinBox")
|
||||||
|
self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lineSpacingSpinBox)
|
||||||
self.mainOutlineCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
self.mainOutlineCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
||||||
self.mainOutlineCheckBox.setObjectName("mainOutlineCheckBox")
|
self.mainOutlineCheckBox.setObjectName("mainOutlineCheckBox")
|
||||||
self.mainAreaLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.mainOutlineCheckBox)
|
self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.mainOutlineCheckBox)
|
||||||
|
self.outlineLayout = QtGui.QHBoxLayout()
|
||||||
|
self.outlineLayout.setObjectName("outlineLayout")
|
||||||
self.mainOutlineColorPushButton = QtGui.QPushButton(self.mainAreaPage)
|
self.mainOutlineColorPushButton = QtGui.QPushButton(self.mainAreaPage)
|
||||||
self.mainOutlineColorPushButton.setEnabled(False)
|
self.mainOutlineColorPushButton.setEnabled(False)
|
||||||
self.mainOutlineColorPushButton.setText("")
|
self.mainOutlineColorPushButton.setText("")
|
||||||
self.mainOutlineColorPushButton.setObjectName("mainOutlineColorPushButton")
|
self.mainOutlineColorPushButton.setObjectName("mainOutlineColorPushButton")
|
||||||
self.mainAreaLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.mainOutlineColorPushButton)
|
self.outlineLayout.addWidget(self.mainOutlineColorPushButton)
|
||||||
|
self.outlineSizeLabel = QtGui.QLabel(self.mainAreaPage)
|
||||||
|
self.outlineSizeLabel.setObjectName("outlineSizeLabel")
|
||||||
|
self.outlineLayout.addWidget(self.outlineSizeLabel)
|
||||||
|
self.outlineSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage)
|
||||||
|
self.outlineSizeSpinBox.setObjectName("outlineSizeSpinBox")
|
||||||
|
self.outlineLayout.addWidget(self.outlineSizeSpinBox)
|
||||||
|
self.formLayout.setLayout(4, QtGui.QFormLayout.FieldRole, self.outlineLayout)
|
||||||
self.mainShadowCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
self.mainShadowCheckBox = QtGui.QCheckBox(self.mainAreaPage)
|
||||||
self.mainShadowCheckBox.setObjectName("mainShadowCheckBox")
|
self.mainShadowCheckBox.setObjectName("mainShadowCheckBox")
|
||||||
self.mainAreaLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.mainShadowCheckBox)
|
self.formLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.mainShadowCheckBox)
|
||||||
|
self.shadowLayout = QtGui.QHBoxLayout()
|
||||||
|
self.shadowLayout.setObjectName("shadowLayout")
|
||||||
self.mainShadowColorPushButton = QtGui.QPushButton(self.mainAreaPage)
|
self.mainShadowColorPushButton = QtGui.QPushButton(self.mainAreaPage)
|
||||||
self.mainShadowColorPushButton.setEnabled(False)
|
self.mainShadowColorPushButton.setEnabled(False)
|
||||||
self.mainShadowColorPushButton.setText("")
|
self.mainShadowColorPushButton.setText("")
|
||||||
self.mainShadowColorPushButton.setObjectName("mainShadowColorPushButton")
|
self.mainShadowColorPushButton.setObjectName("mainShadowColorPushButton")
|
||||||
self.mainAreaLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.mainShadowColorPushButton)
|
self.shadowLayout.addWidget(self.mainShadowColorPushButton)
|
||||||
|
self.shadowSizeLabel = QtGui.QLabel(self.mainAreaPage)
|
||||||
|
self.shadowSizeLabel.setObjectName("shadowSizeLabel")
|
||||||
|
self.shadowLayout.addWidget(self.shadowSizeLabel)
|
||||||
|
self.shadowSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage)
|
||||||
|
self.shadowSizeSpinBox.setObjectName("shadowSizeSpinBox")
|
||||||
|
self.shadowLayout.addWidget(self.shadowSizeSpinBox)
|
||||||
|
self.formLayout.setLayout(5, QtGui.QFormLayout.FieldRole, self.shadowLayout)
|
||||||
ThemeWizard.addPage(self.mainAreaPage)
|
ThemeWizard.addPage(self.mainAreaPage)
|
||||||
self.footerAreaPage = QtGui.QWizardPage()
|
self.footerAreaPage = QtGui.QWizardPage()
|
||||||
self.footerAreaPage.setObjectName("footerAreaPage")
|
self.footerAreaPage.setObjectName("footerAreaPage")
|
||||||
@ -428,9 +454,15 @@ class Ui_ThemeWizard(object):
|
|||||||
self.mainColorLabel.setText(QtGui.QApplication.translate("ThemeWizard", "Color:", None, QtGui.QApplication.UnicodeUTF8))
|
self.mainColorLabel.setText(QtGui.QApplication.translate("ThemeWizard", "Color:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.mainSizeLabel.setText(QtGui.QApplication.translate("ThemeWizard", "Size:", None, QtGui.QApplication.UnicodeUTF8))
|
self.mainSizeLabel.setText(QtGui.QApplication.translate("ThemeWizard", "Size:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.mainSizeSpinBox.setSuffix(QtGui.QApplication.translate("ThemeWizard", "pt", None, QtGui.QApplication.UnicodeUTF8))
|
self.mainSizeSpinBox.setSuffix(QtGui.QApplication.translate("ThemeWizard", "pt", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.mainLineCountLabel.setText(QtGui.QApplication.translate("ThemeWizard", "(%d lines per silde)", None, QtGui.QApplication.UnicodeUTF8))
|
self.mainLineCountLabel.setText(QtGui.QApplication.translate("ThemeWizard", "(%d lines per slide)", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.lineSpacingLabel.setText(QtGui.QApplication.translate("ThemeWizard", "Line Spacing:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.lineSpacingSpinBox.setSuffix(QtGui.QApplication.translate("ThemeWizard", "pt", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.mainOutlineCheckBox.setText(QtGui.QApplication.translate("ThemeWizard", "&Outline:", None, QtGui.QApplication.UnicodeUTF8))
|
self.mainOutlineCheckBox.setText(QtGui.QApplication.translate("ThemeWizard", "&Outline:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.outlineSizeLabel.setText(QtGui.QApplication.translate("ThemeWizard", "Size:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.outlineSizeSpinBox.setSuffix(QtGui.QApplication.translate("ThemeWizard", "pt", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.mainShadowCheckBox.setText(QtGui.QApplication.translate("ThemeWizard", "&Shadow:", None, QtGui.QApplication.UnicodeUTF8))
|
self.mainShadowCheckBox.setText(QtGui.QApplication.translate("ThemeWizard", "&Shadow:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.shadowSizeLabel.setText(QtGui.QApplication.translate("ThemeWizard", "Size:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.shadowSizeSpinBox.setSuffix(QtGui.QApplication.translate("ThemeWizard", "pt", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.footerAreaPage.setTitle(QtGui.QApplication.translate("ThemeWizard", "Footer Area Font Details", None, QtGui.QApplication.UnicodeUTF8))
|
self.footerAreaPage.setTitle(QtGui.QApplication.translate("ThemeWizard", "Footer Area Font Details", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.footerAreaPage.setSubTitle(QtGui.QApplication.translate("ThemeWizard", "Define the font and display characteristics for the Footer text", None, QtGui.QApplication.UnicodeUTF8))
|
self.footerAreaPage.setSubTitle(QtGui.QApplication.translate("ThemeWizard", "Define the font and display characteristics for the Footer text", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.footerFontLabel.setText(QtGui.QApplication.translate("ThemeWizard", "Font:", None, QtGui.QApplication.UnicodeUTF8))
|
self.footerFontLabel.setText(QtGui.QApplication.translate("ThemeWizard", "Font:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
@ -33,6 +33,52 @@ from themewizard import Ui_ThemeWizard
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class BackgroundType(object):
|
||||||
|
Solid = 0
|
||||||
|
Gradient = 1
|
||||||
|
Image = 3
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def to_string(type):
|
||||||
|
if type == BackgroundType.Solid:
|
||||||
|
return u'solid'
|
||||||
|
elif type == BackgroundType.Gradient:
|
||||||
|
return u'gradient'
|
||||||
|
elif type == BackgroundType.Image:
|
||||||
|
return u'image'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_string(type_string):
|
||||||
|
if type_string == u'solid':
|
||||||
|
return BackgroundType.Solid
|
||||||
|
elif type_string == u'gradient':
|
||||||
|
return BackgroundType.Gradient
|
||||||
|
elif type_string == u'image':
|
||||||
|
return BackgroundType.Image
|
||||||
|
|
||||||
|
class BackgroundGradientType(object):
|
||||||
|
Horizontal = 0
|
||||||
|
Vertical = 1
|
||||||
|
Circular = 3
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def to_string(type):
|
||||||
|
if type == BackgroundType.Solid:
|
||||||
|
return u'horizontal'
|
||||||
|
elif type == BackgroundType.Gradient:
|
||||||
|
return u'vertical'
|
||||||
|
elif type == BackgroundType.Image:
|
||||||
|
return u'circular'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_string(type_string):
|
||||||
|
if type_string == u'horizontal':
|
||||||
|
return BackgroundType.Solid
|
||||||
|
elif type_string == u'vertical':
|
||||||
|
return BackgroundType.Gradient
|
||||||
|
elif type_string == u'circular':
|
||||||
|
return BackgroundType.Image
|
||||||
|
|
||||||
class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||||
"""
|
"""
|
||||||
This is the Bible Import Wizard, which allows easy importing of Bibles
|
This is the Bible Import Wizard, which allows easy importing of Bibles
|
||||||
@ -54,8 +100,6 @@ class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
The Bible plugin.
|
The Bible plugin.
|
||||||
"""
|
"""
|
||||||
# Do not translate as internal
|
# Do not translate as internal
|
||||||
self.backgrounds = [u'solid', u'gradient', u'image']
|
|
||||||
self.gradients = [u'horizontal', u'vertical', u'circular']
|
|
||||||
QtGui.QWizard.__init__(self, parent)
|
QtGui.QWizard.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.registerFields()
|
self.registerFields()
|
||||||
@ -75,7 +119,7 @@ class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
self.onColor2PushButtonClicked)
|
self.onColor2PushButtonClicked)
|
||||||
QtCore.QObject.connect(self.imageBrowseButton,
|
QtCore.QObject.connect(self.imageBrowseButton,
|
||||||
QtCore.SIGNAL(u'pressed()'),
|
QtCore.SIGNAL(u'pressed()'),
|
||||||
self.onimageBrowseButtonClicked)
|
self.onImageBrowseButtonClicked)
|
||||||
|
|
||||||
def exec_(self):
|
def exec_(self):
|
||||||
"""
|
"""
|
||||||
@ -92,10 +136,10 @@ class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
# Background Screen
|
# Background Screen
|
||||||
if self.currentId() == 0:
|
if self.currentId() == 0:
|
||||||
print self.field(u'background_type').toString()
|
print self.field(u'background_type').toString()
|
||||||
self.paintBackgroundScreen()
|
self.setBackgroundTabValues()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def paintBackgroundScreen(self):
|
def setBackgroundTabValues(self):
|
||||||
if self.theme.background_type == u'solid':
|
if self.theme.background_type == u'solid':
|
||||||
self.setField(u'background_type', QtCore.QVariant(0))
|
self.setField(u'background_type', QtCore.QVariant(0))
|
||||||
self.color1PushButton.setVisible(True)
|
self.color1PushButton.setVisible(True)
|
||||||
@ -153,7 +197,7 @@ class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
|
|
||||||
def setDefaults(self):
|
def setDefaults(self):
|
||||||
self.restart()
|
self.restart()
|
||||||
self.paintBackgroundScreen()
|
self.setBackgroundTabValues()
|
||||||
|
|
||||||
def registerFields(self):
|
def registerFields(self):
|
||||||
self.welcomePage.registerField(
|
self.welcomePage.registerField(
|
||||||
@ -169,27 +213,27 @@ class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
|
|
||||||
def onBackgroundComboBox(self, index):
|
def onBackgroundComboBox(self, index):
|
||||||
self.theme.background_type = self.backgrounds[index]
|
self.theme.background_type = self.backgrounds[index]
|
||||||
self.paintBackgroundScreen()
|
self.setBackgroundTabValues()
|
||||||
|
|
||||||
def onGradientComboBox(self, index):
|
def onGradientComboBox(self, index):
|
||||||
self.theme.background_direction = self.gradients[index]
|
self.theme.background_direction = self.gradients[index]
|
||||||
self.paintBackgroundScreen()
|
self.setBackgroundTabValues()
|
||||||
|
|
||||||
def onColor1PushButtonClicked(self):
|
def onColor1PushButtonClicked(self):
|
||||||
if self.theme.background_type == u'solid':
|
if self.theme.background_type == u'solid':
|
||||||
self.theme.background_color = \
|
self.theme.background_color = \
|
||||||
self._colorButtonPushed(self.theme.background_color)
|
self._colorButton(self.theme.background_color)
|
||||||
else:
|
else:
|
||||||
self.theme.background_start_color = \
|
self.theme.background_start_color = \
|
||||||
self._colorButtonPushed(self.theme.background_start_color)
|
self._colorButton(self.theme.background_start_color)
|
||||||
self.paintBackgroundScreen()
|
self.setBackgroundTabValues()
|
||||||
|
|
||||||
def onColor2PushButtonClicked(self):
|
def onColor2PushButtonClicked(self):
|
||||||
self.theme.background_end_color = \
|
self.theme.background_end_color = \
|
||||||
self._colorButtonPushed(self.theme.background_end_color)
|
self._colorButton(self.theme.background_end_color)
|
||||||
self.paintBackgroundScreen()
|
self.setBackgroundTabValues()
|
||||||
|
|
||||||
def onimageBrowseButtonClicked(self):
|
def onImageBrowseButtonClicked(self):
|
||||||
images_filter = get_images_filter()
|
images_filter = get_images_filter()
|
||||||
images_filter = '%s;;%s (*.*) (*)' % (images_filter,
|
images_filter = '%s;;%s (*.*) (*)' % (images_filter,
|
||||||
translate('OpenLP.AmendThemeForm', 'All Files'))
|
translate('OpenLP.AmendThemeForm', 'All Files'))
|
||||||
@ -198,13 +242,11 @@ class ThemeWizardForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
images_filter)
|
images_filter)
|
||||||
if filename:
|
if filename:
|
||||||
self.theme.background_filename = filename
|
self.theme.background_filename = filename
|
||||||
self.paintBackgroundScreen()
|
self.setBackgroundTabValues()
|
||||||
|
|
||||||
def _colorButtonPushed(self, field):
|
def _colorButton(self, field):
|
||||||
new_color = QtGui.QColorDialog.getColor(
|
new_color = QtGui.QColorDialog.getColor(
|
||||||
QtGui.QColor(field), self)
|
QtGui.QColor(field), self)
|
||||||
if new_color.isValid():
|
if new_color.isValid():
|
||||||
field = new_color.name()
|
field = new_color.name()
|
||||||
return field
|
return field
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<property name="subTitle">
|
<property name="subTitle">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="WelcomeLayout">
|
<layout class="QHBoxLayout" name="welcomeLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
</property>
|
</property>
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="pixmap">
|
<property name="pixmap">
|
||||||
<pixmap resource="Projects/OpenLP/trunk/resources/images/openlp-2.qrc">:/wizards/wizard_importbible.bmp</pixmap>
|
<pixmap resource="../images/openlp-2.qrc">:/wizards/wizard_importbible.bmp</pixmap>
|
||||||
</property>
|
</property>
|
||||||
<property name="indent">
|
<property name="indent">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@ -224,7 +224,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="Projects/OpenLP/trunk/resources/images/openlp-2.qrc">
|
<iconset resource="../images/openlp-2.qrc">
|
||||||
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
|
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -266,9 +266,9 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="subTitle">
|
<property name="subTitle">
|
||||||
<string>Define the font and display characteristics for the Display text</string>
|
<string>Define the font and display characteristics for the Display text</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="mainAreaLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<property name="fieldGrowthPolicy">
|
<property name="formAlignment">
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
@ -276,9 +276,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
|
||||||
<number>50</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>20</number>
|
<number>20</number>
|
||||||
</property>
|
</property>
|
||||||
@ -355,45 +352,101 @@ p, li { white-space: pre-wrap; }
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="mainLineCountLabel">
|
<widget class="QLabel" name="mainLineCountLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>(%d lines per silde)</string>
|
<string>(%d lines per slide)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="lineSpacingLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Line Spacing:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QSpinBox" name="lineSpacingSpinBox">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>pt</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-50</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="mainOutlineCheckBox">
|
<widget class="QCheckBox" name="mainOutlineCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Outline:</string>
|
<string>&Outline:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QPushButton" name="mainOutlineColorPushButton">
|
<layout class="QHBoxLayout" name="outlineLayout">
|
||||||
<property name="enabled">
|
<item>
|
||||||
<bool>false</bool>
|
<widget class="QPushButton" name="mainOutlineColorPushButton">
|
||||||
</property>
|
<property name="enabled">
|
||||||
<property name="text">
|
<bool>false</bool>
|
||||||
<string/>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="outlineSizeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="outlineSizeSpinBox">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>pt</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="mainShadowCheckBox">
|
<widget class="QCheckBox" name="mainShadowCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Shadow:</string>
|
<string>&Shadow:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QPushButton" name="mainShadowColorPushButton">
|
<layout class="QHBoxLayout" name="shadowLayout">
|
||||||
<property name="enabled">
|
<item>
|
||||||
<bool>false</bool>
|
<widget class="QPushButton" name="mainShadowColorPushButton">
|
||||||
</property>
|
<property name="enabled">
|
||||||
<property name="text">
|
<bool>false</bool>
|
||||||
<string/>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="shadowSizeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="shadowSizeSpinBox">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>pt</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -972,7 +1025,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="Projects/OpenLP/trunk/resources/images/openlp-2.qrc"/>
|
<include location="../images/openlp-2.qrc"/>
|
||||||
|
<include location="../images/openlp-2.qrc"/>
|
||||||
<include location="Projects/OpenLP/trunk/resources/images/openlp-2.qrc"/>
|
<include location="Projects/OpenLP/trunk/resources/images/openlp-2.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Loading…
Reference in New Issue
Block a user