Merge lp:~trb143/openlp/ThemeManager into lp:openlp

Proposed by Tim Bentley
Status: Superseded
Proposed branch: lp:~trb143/openlp/ThemeManager
Merge into: lp:openlp
Diff against target: None lines
To merge this branch: bzr merge lp:~trb143/openlp/ThemeManager
Reviewer Review Type Date Requested Status
OpenLP Core Pending
Review via email: mp+5232@code.launchpad.net

This proposal has been superseded by a proposal from 2009-04-05.

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote :

443. By Tim Bentley 3 minutes ago
    Add Eventing after Themes loaded to tell plugins the themes have changed
442. By Tim Bentley 21 hours ago

    Store Theme name in list for correct display
441. By Tim Bentley on 2009-04-04

    Add ThemeManagerDialog
    More Rendering improvements
440. By Tim Bentley on 2009-04-04

    Add Themes to Bible Tab and default values
439. By Tim Bentley on 2009-04-04

    Add rendering for Circles and amend XML schema accordingly
438. By Tim Bentley on 2009-04-04

    Renderer now supports linear gradients correctly
    Update XML to include direction
    Add Booleans instead of 0/1 to XML schema
437. By Tim Bentley on 2009-04-03

    More ThemeManager changes
    Fix Rendering and theme handling
    Generate PNG theme on conversion
436. By Tim Bentley on 2009-04-01

    Fix up Theme XML code to work with strings and files.
    Fix Render.py to work with new XML schema
435. By Tim Bentley on 2009-04-01

    Import version 2 xml and build object.
434. By Tim Bentley on 2009-03-31

    Finish Import conversions take 1
    Add copyright information

433. By Tim Bentley on 2009-03-29
    Clean Up code style
    Add Theme migration code
    Fixes to Renderer

lp:~trb143/openlp/ThemeManager updated
444. By Tim Bentley

Add new event for Theme Loading

Unmerged revisions

444. By Tim Bentley

Add new event for Theme Loading

443. By Tim Bentley

Add Eventing after Themes loaded to tell plugins the themes have changed

442. By Tim Bentley

Store Theme name in list for correct display

441. By Tim Bentley

Add ThemeManagerDialog
More Rendering improvements

440. By Tim Bentley

Add Themes to Bible Tab and default values

439. By Tim Bentley

Add rendering for Circles and amend XML schema accordingly

438. By Tim Bentley

Renderer now supports linear gradients correctly
Update XML to include direction
Add Booleans instead of 0/1 to XML schema

437. By Tim Bentley

More ThemeManager changes
Fix Rendering and theme handling
Generate PNG theme on conversion

436. By Tim Bentley

Fix up Theme XML code to work with strings and files.
Fix Render.py to work with new XML schema

435. By Tim Bentley

Import version 2 xml and build object.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py 2009-02-28 23:19:45 +0000
+++ openlp/core/__init__.py 2009-04-03 19:32:00 +0000
@@ -23,7 +23,14 @@
23from settingsmanager import SettingsManager23from settingsmanager import SettingsManager
24from pluginmanager import PluginManager24from pluginmanager import PluginManager
2525
26__all__ = ['Renderer', 'SettingsManager', 'PluginManager', 'translate']26__all__ = ['Renderer', 'SettingsManager', 'PluginManager', 'translate', 'fileToXML']
2727
28def translate(context, text):28def translate(context, text):
29 return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)29 return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)
30
31def fileToXML(xmlfile):
32 file=open(xmlfile)
33 xml =''.join(file.readlines()) # read the file and change list to a string
34 file.close()
35 return xml
36
3037
=== modified file 'openlp/core/lib/eventmanager.py'
--- openlp/core/lib/eventmanager.py 2009-03-25 20:30:48 +0000
+++ openlp/core/lib/eventmanager.py 2009-03-30 19:58:34 +0000
@@ -26,21 +26,21 @@
26 A mechanism to send events to all registered endpoints26 A mechanism to send events to all registered endpoints
27 the endpoints are registered and listen with a handle_event method27 the endpoints are registered and listen with a handle_event method
28 the endpoint will decide whether to do somthing with the event or ignore it28 the endpoint will decide whether to do somthing with the event or ignore it
29 29
30 """30 """
31 global log31 global log
32 log=logging.getLogger(u'EventManager')32 log=logging.getLogger(u'EventManager')
33 33
34 def __init__(self):34 def __init__(self):
35 self.endpoints=[]35 self.endpoints=[]
36 log.info(u'Initialising')36 log.info(u'Initialising')
37 37
38 def register(self, plugin):38 def register(self, plugin):
39 log.debug(u'plugin %s registered with EventManager'%plugin) 39 log.debug(u'plugin %s registered with EventManager', plugin)
40 self.endpoints.append(plugin)40 self.endpoints.append(plugin)
41 41
42 def post_event(self, event):42 def post_event(self, event):
43 log.debug(u'post event called for event %s'%event.get_type)43 log.debug(u'post event called for event %s', event.get_type)
44 for point in self.endpoints:44 for point in self.endpoints:
45 point.handle_event(event)45 point.handle_event(event)
4646
4747
=== modified file 'openlp/core/lib/songxmlhandler.py'
--- openlp/core/lib/songxmlhandler.py 2009-03-14 07:08:15 +0000
+++ openlp/core/lib/songxmlhandler.py 2009-03-31 20:16:54 +0000
@@ -1,6 +1,24 @@
1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""
4OpenLP - Open Source Lyrics Projection
5Copyright (c) 2008 Raoul Snyman
6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free Software
10Foundation; version 2 of the License.
11
12This program is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14PARTICULAR PURPOSE. See the GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License along with
17this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18Place, Suite 330, Boston, MA 02111-1307 USA
1from xml.dom.minidom import Document19from xml.dom.minidom import Document
2from xml.etree.ElementTree import ElementTree, XML, dump20from xml.etree.ElementTree import ElementTree, XML, dump
3"""21
4<?xml version="1.0" encoding="UTF-8"?>22<?xml version="1.0" encoding="UTF-8"?>
5<song version="1.0">23<song version="1.0">
6 <lyrics language="en">24 <lyrics language="en">
@@ -11,24 +29,27 @@
11</song>29</song>
1230
13"""31"""
32from xml.dom.minidom import Document
33from xml.etree.ElementTree import ElementTree, XML, dump
34
14class SongXMLBuilder():35class SongXMLBuilder():
15 def __init__(self):36 def __init__(self):
16 # Create the minidom document 37 # Create the minidom document
17 self.song_xml = Document()38 self.song_xml = Document()
18 39
19 def new_document(self):40 def new_document(self):
20 # Create the <song> base element41 # Create the <song> base element
21 self.song = self.song_xml.createElement(u'song')42 self.song = self.song_xml.createElement(u'song')
22 self.song_xml.appendChild(self.song)43 self.song_xml.appendChild(self.song)
23 self.song.setAttribute(u'version', u'1.0')44 self.song.setAttribute(u'version', u'1.0')
24 45
25 def add_lyrics_to_song(self):46 def add_lyrics_to_song(self):
26 # Create the main <lyrics> element47 # Create the main <lyrics> element
27 self.lyrics = self.song_xml.createElement(u'lyrics')48 self.lyrics = self.song_xml.createElement(u'lyrics')
28 self.lyrics.setAttribute(u'language', u'en')49 self.lyrics.setAttribute(u'language', u'en')
29 self.song.appendChild(self.lyrics)50 self.song.appendChild(self.lyrics)
30 51
31 def add_verse_to_lyrics(self, type, number, content): 52 def add_verse_to_lyrics(self, type, number, content):
32 """53 """
33 type - type of verse (Chorus, Verse , Bridge, Custom etc54 type - type of verse (Chorus, Verse , Bridge, Custom etc
34 number - number of item eg verse 155 number - number of item eg verse 1
@@ -36,34 +57,34 @@
36 """57 """
37 verse = self.song_xml.createElement(u'verse')58 verse = self.song_xml.createElement(u'verse')
38 verse.setAttribute(u'type', type)59 verse.setAttribute(u'type', type)
39 verse.setAttribute(u'label', number) 60 verse.setAttribute(u'label', number)
40 self.lyrics.appendChild(verse)61 self.lyrics.appendChild(verse)
41 62
42 # add data as a CDATA section63 # add data as a CDATA section
43 cds = self.song_xml.createCDATASection(content)64 cds = self.song_xml.createCDATASection(content)
44 verse.appendChild(cds)65 verse.appendChild(cds)
45 66
46 def dump_xml(self):67 def dump_xml(self):
47 # Debugging aid to see what we have68 # Debugging aid to see what we have
48 print self.song_xml.toprettyxml(indent=" ")69 print self.song_xml.toprettyxml(indent=" ")
49 70
50 def extract_xml(self):71 def extract_xml(self):
51 # Print our newly created XML72 # Print our newly created XML
52 return self.song_xml.toxml()73 return self.song_xml.toxml()
53 74
54class SongXMLParser():75class SongXMLParser():
55 def __init__(self, xml):76 def __init__(self, xml):
56 self.song_xml = ElementTree(element=XML(xml))77 self.song_xml = ElementTree(element=XML(xml))
57 78
58 def get_verses(self):79 def get_verses(self):
59 #return a list of verse's and attributes80 #return a list of verse's and attributes
60 iter=self.song_xml.getiterator()81 iter=self.song_xml.getiterator()
61 verse_list = []82 verse_list = []
62 for element in iter: 83 for element in iter:
63 if element.tag == u'verse':84 if element.tag == u'verse':
64 verse_list.append([element.attrib, element.text])85 verse_list.append([element.attrib, element.text])
65 return verse_list86 return verse_list
66 87
67 def dump_xml(self):88 def dump_xml(self):
68 # Debugging aid to see what we have89 # Debugging aid to see what we have
69 print dump(self.song_xml)90 print dump(self.song_xml)
7091
=== modified file 'openlp/core/lib/themexmlhandler.py'
--- openlp/core/lib/themexmlhandler.py 2009-03-28 20:12:22 +0000
+++ openlp/core/lib/themexmlhandler.py 2009-04-04 17:36:15 +0000
@@ -1,16 +1,29 @@
1from xml.dom.minidom import Document1# -*- coding: utf-8 -*-
2from xml.etree.ElementTree import ElementTree, XML, dump2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4<?xml version="1.0" encoding="UTF-8"?>4OpenLP - Open Source Lyrics Projection
5<song version="1.0">5Copyright (c) 2008 Raoul Snyman
6 <lyrics language="en">6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard
7 <verse type="chorus" label="1">7
8 <![CDATA[ ... ]]>8This program is free software; you can redistribute it and/or modify it under
9 </verse>9the terms of the GNU General Public License as published by the Free Software
10 </lyrics>10Foundation; version 2 of the License.
11</song>11
1212This program is distributed in the hope that it will be useful, but WITHOUT ANY
13"""13WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14PARTICULAR PURPOSE. See the GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License along with
17this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18Place, Suite 330, Boston, MA 02111-1307 USA
19from xml.dom.minidom import Document
20from xml.etree.ElementTree import ElementTree, XML, dump
21
22For XML Schema see wiki.openlp.org
23"""
24from xml.dom.minidom import Document
25from xml.etree.ElementTree import ElementTree, XML, dump
26
14class ThemeXMLBuilder():27class ThemeXMLBuilder():
15 def __init__(self):28 def __init__(self):
16 # Create the minidom document29 # Create the minidom document
@@ -29,12 +42,12 @@
2942
30 def add_background_transparent(self):43 def add_background_transparent(self):
31 # Create the main <lyrics> element44 # Create the main <lyrics> element
32 background = self.theme_xml.createElement(u'Background')45 background = self.theme_xml.createElement(u'background')
33 background.setAttribute(u'mode', u'transparent')46 background.setAttribute(u'mode', u'transparent')
34 self.theme.appendChild(background)47 self.theme.appendChild(background)
3548
36 def add_background_solid(self, bkcolor):49 def add_background_solid(self, bkcolor):
37 background = self.theme_xml.createElement(u'Background')50 background = self.theme_xml.createElement(u'background')
38 background.setAttribute(u'mode', u'opaque')51 background.setAttribute(u'mode', u'opaque')
39 background.setAttribute(u'type', u'solid')52 background.setAttribute(u'type', u'solid')
40 self.theme.appendChild(background)53 self.theme.appendChild(background)
@@ -44,24 +57,29 @@
44 color.appendChild(bkc)57 color.appendChild(bkc)
45 background.appendChild(color)58 background.appendChild(color)
4659
47 def add_background_gradient(self, startcolor, endcolor):60 def add_background_gradient(self, startcolor, endcolor, direction):
48 background = self.theme_xml.createElement(u'Background')61 background = self.theme_xml.createElement(u'background')
49 background.setAttribute(u'mode', u'opaque')62 background.setAttribute(u'mode', u'opaque')
50 background.setAttribute(u'type', u'gradient')63 background.setAttribute(u'type', u'Gradient')
51 self.theme.appendChild(background)64 self.theme.appendChild(background)
5265
53 color = self.theme_xml.createElement(u'startcolor')66 color = self.theme_xml.createElement(u'startColor')
54 bkc = self.theme_xml.createTextNode(startcolor)67 bkc = self.theme_xml.createTextNode(startcolor)
55 color.appendChild(bkc)68 color.appendChild(bkc)
56 background.appendChild(color)69 background.appendChild(color)
5770
58 color = self.theme_xml.createElement(u'endcolor')71 color = self.theme_xml.createElement(u'endColor')
59 bkc = self.theme_xml.createTextNode(endcolor)72 bkc = self.theme_xml.createTextNode(endcolor)
60 color.appendChild(bkc)73 color.appendChild(bkc)
61 background.appendChild(color)74 background.appendChild(color)
6275
63 def add_background_image(self, filename, bordercolor):76 color = self.theme_xml.createElement(u'direction')
64 background = self.theme_xml.createElement(u'Background')77 bkc = self.theme_xml.createTextNode(direction)
78 color.appendChild(bkc)
79 background.appendChild(color)
80
81 def add_background_image(self, filename):
82 background = self.theme_xml.createElement(u'background')
65 background.setAttribute(u'mode', u'opaque')83 background.setAttribute(u'mode', u'opaque')
66 background.setAttribute(u'type', u'image')84 background.setAttribute(u'type', u'image')
67 self.theme.appendChild(background)85 self.theme.appendChild(background)
@@ -71,26 +89,62 @@
71 color.appendChild(bkc)89 color.appendChild(bkc)
72 background.appendChild(color)90 background.appendChild(color)
7391
74 color = self.theme_xml.createElement(u'bordercolor')92 def add_font(self, fontname, fontcolor, fontproportion, fonttype=u'main'):
75 bkc = self.theme_xml.createTextNode(bordercolor)93 background = self.theme_xml.createElement(u'font')
76 color.appendChild(bkc)94 background.setAttribute(u'type',fonttype)
77 background.appendChild(color)95 self.theme.appendChild(background)
7896
7997 name = self.theme_xml.createElement(u'name')
80 def add_verse_to_lyrics(self, type, number, content):98 fn = self.theme_xml.createTextNode(fontname)
81 """99 name.appendChild(fn)
82 type - type of verse (Chorus, Verse , Bridge, Custom etc100 background.appendChild(name)
83 number - number of item eg verse 1101
84 content - the text to be stored102 name = self.theme_xml.createElement(u'color')
85 """103 fn = self.theme_xml.createTextNode(fontcolor)
86 verse = self.theme_xml.createElement(u'verse')104 name.appendChild(fn)
87 verse.setAttribute(u'type', type)105 background.appendChild(name)
88 verse.setAttribute(u'label', number)106
89 self.lyrics.appendChild(verse)107 name = self.theme_xml.createElement(u'proportion')
90108 fn = self.theme_xml.createTextNode(fontproportion)
91 # add data as a CDATA section109 name.appendChild(fn)
92 cds = self.theme_xml.createCDATASection(content)110 background.appendChild(name)
93 verse.appendChild(cds)111
112 def add_display(self, shadow, shadowColor, outline, outlineColor, horizontal, vertical, wrap):
113 background = self.theme_xml.createElement(u'display')
114 self.theme.appendChild(background)
115
116 tagElement = self.theme_xml.createElement(u'shadow')
117 tagElement.setAttribute(u'color',shadowColor)
118 tagValue = self.theme_xml.createTextNode(shadow)
119 tagElement.appendChild(tagValue)
120 background.appendChild(tagElement)
121
122 tagElement = self.theme_xml.createElement(u'outline')
123 tagElement.setAttribute(u'color',outlineColor)
124 tagValue = self.theme_xml.createTextNode(outline)
125 tagElement.appendChild(tagValue)
126 background.appendChild(tagElement)
127
128 tagElement = self.theme_xml.createElement(u'horizontalAlign')
129 tagValue = self.theme_xml.createTextNode(horizontal)
130 tagElement.appendChild(tagValue)
131 background.appendChild(tagElement)
132
133 tagElement = self.theme_xml.createElement(u'verticalAlign')
134 tagValue = self.theme_xml.createTextNode(vertical)
135 tagElement.appendChild(tagValue)
136 background.appendChild(tagElement)
137
138 tagElement = self.theme_xml.createElement(u'wrapStyle')
139 tagValue = self.theme_xml.createTextNode(wrap)
140 tagElement.appendChild(tagValue)
141 background.appendChild(tagElement)
142
143 def child_element(self, tag, value):
144 tagElement = self.theme_xml.createElement(tag)
145 tagValue = self.theme_xml.createTextNode(value)
146 tagElement.appendChild(ftagValue)
147 self.background.appendChild(tagElement)
94148
95 def dump_xml(self):149 def dump_xml(self):
96 # Debugging aid to see what we have150 # Debugging aid to see what we have
@@ -102,17 +156,35 @@
102156
103class ThemeXMLParser():157class ThemeXMLParser():
104 def __init__(self, xml):158 def __init__(self, xml):
105 self.theme_xml = ElementTree(element=XML(xml))159 theme_xml = ElementTree(element=XML(xml))
106160 iter=theme_xml.getiterator()
107 def get_verses(self):161 master = u''
108 #return a list of verse's and attributes
109 iter=self.theme_xml.getiterator()
110 verse_list = []
111 for element in iter:162 for element in iter:
112 if element.tag == u'verse':163 #print element.tag, element.text
113 verse_list.append([element.attrib, element.text])164 if len(element.getchildren()) > 0:
114 return verse_list165 master= element.tag + u'_'
166 if len(element.attrib) > 0:
167 #print "D", element.tag , element.attrib
168 for e in element.attrib.iteritems():
169 #print "A", master, e[0], e[1]
170 if master == u'font_' and e[0] == u'type':
171 master += e[1] + u'_'
172 elif master == u'display_' and (element.tag == u'shadow' or element.tag == u'outline'):
173 #print "b", master, element.tag, element.text, e[0], e[1]
174 setattr(self, master + element.tag , element.text)
175 setattr(self, master + element.tag +u'_'+ e[0], e[1])
176 else:
177 field = master + e[0]
178 setattr(self, field, e[1])
179 else:
180 #print "c", element.tag
181 if element.tag is not None :
182 field = master + element.tag
183 setattr(self, field, element.text)
115184
116 def dump_xml(self):185 def __str__(self):
117 # Debugging aid to see what we have186 s = u''
118 print dump(self.theme_xml)187 for k in dir(self):
188 if k[0:1] != u'_':
189 s+= u'%30s : %s\n' %(k,getattr(self,k))
190 return s
119191
=== modified file 'openlp/core/render.py'
--- openlp/core/render.py 2009-03-29 16:51:42 +0000
+++ openlp/core/render.py 2009-04-04 17:36:15 +0000
@@ -56,11 +56,11 @@
5656
57 def set_theme(self, theme):57 def set_theme(self, theme):
58 self._theme=theme58 self._theme=theme
59 if theme.BackgroundType == 2:59 if theme.background_type == u'image':
60 self.set_bg_image(theme.BackgroundParameter1)60 self.set_bg_image(theme.background_filename)
6161
62 def set_bg_image(self, filename):62 def set_bg_image(self, filename):
63 log.debug(u"set bg image %s", filename)63 log.debug(u'set bg image %s', filename)
64 self._bg_image_filename=filename64 self._bg_image_filename=filename
65 if self._paint is not None:65 if self._paint is not None:
66 self.scale_bg_image()66 self.scale_bg_image()
@@ -69,11 +69,13 @@
69 assert self._paint69 assert self._paint
70 i=QtGui.QImage(self._bg_image_filename)70 i=QtGui.QImage(self._bg_image_filename)
71 # rescale and offset71 # rescale and offset
72 imw=i.width();imh=i.height()72 imw=i.width()
73 dcw=self._paint.width()+1;dch=self._paint.height()73 imh=i.height()
74 dcw=self._paint.width()+1
75 dch=self._paint.height()
74 imratio=imw/float(imh)76 imratio=imw/float(imh)
75 dcratio=dcw/float(dch)77 dcratio=dcw/float(dch)
76 log.debug(u"Image scaling params %s %s %s %s %s %s", imw, imh, imratio, dcw, dch, dcratio)78 log.debug(u'Image scaling params %s %s %s %s %s %s', imw, imh, imratio, dcw, dch, dcratio)
77 if imratio > dcratio:79 if imratio > dcratio:
78 scale=dcw/float(imw)80 scale=dcw/float(imw)
79 elif imratio < dcratio:81 elif imratio < dcratio:
@@ -94,20 +96,20 @@
94 def set_words_openlp(self, words):96 def set_words_openlp(self, words):
95# log.debug(u" "set words openlp", words97# log.debug(u" "set words openlp", words
96 verses=[]98 verses=[]
97 words=words.replace("\r\n", "\n")99 words=words.replace(u'\r\n', u'\n')
98 verses_text=words.split('\n\n')100 verses_text=words.split(u'\n\n')
99 for v in verses_text:101 for v in verses_text:
100 lines=v.split('\n')102 lines=v.split(u'\n')
101 verses.append(self.split_set_of_lines(lines)[0])103 verses.append(self.split_set_of_lines(lines)[0])
102 self.words=verses104 self.words=verses
103 verses_text=[]105 verses_text=[]
104 for v in verses:106 for v in verses:
105 verses_text.append('\n'.join(v).lstrip()) # remove first \n107 verses_text.append(u'\n'.join(v).lstrip()) # remove first \n
106108
107 return verses_text109 return verses_text
108110
109 def render_screen(self, screennum):111 def render_screen(self, screennum):
110 log.debug(u"render screen\n %s %s ", screennum, self.words[screennum])112 log.debug(u'render screen\n %s %s ', screennum, self.words[screennum])
111 import time113 import time
112 t=0.0114 t=0.0
113 words=self.words[screennum]115 words=self.words[screennum]
@@ -121,40 +123,49 @@
121 def _render_background(self):123 def _render_background(self):
122 assert(self._theme)124 assert(self._theme)
123 assert(self._paint)125 assert(self._paint)
124 log.debug(u"render background %s %s", self._theme.BackgroundType)126 log.debug(u'render background %s ', self._theme.background_type)
125 p=QtGui.QPainter()127 p=QtGui.QPainter()
126 p.begin(self._paint)128 p.begin(self._paint)
127 if self._theme.BackgroundType == 0:129 if self._theme.background_type == u'solid':
128 p.fillRect(self._paint.rect(), self._theme.BackgroundParameter1)130 p.fillRect(self._paint.rect(), QtGui.QColor(self._theme.background_color))
129 elif self._theme.BackgroundType == 1: # gradient131 elif self._theme.background_type == u'Gradient' : # gradient
130 #TODO Add Theme code and fix direction132 gradient = None
131133 if self._theme.background_direction == u'vertical':
132 gradient = QtGui.QLinearGradient(0, 0, self._paint.width(), self._paint.height())134 w = int(self._paint.width())/2
133 gradient.setColorAt(0, QtGui.QColor(255, 0, 0))135 gradient = QtGui.QLinearGradient(w, 0, w, self._paint.height()) # vertical
134 gradient.setColorAt(0.5, QtGui.QColor(0, 255, 0))136 elif self._theme.background_direction == u'horizontal':
135 gradient.setColorAt(1, QtGui.QColor(0, 0, 255))137 h = int(self._paint.height())/2
138 gradient = QtGui.QLinearGradient(0, h, self._paint.width(), h) # Horizontal
139 else:
140 w = int(self._paint.width())/2
141 h = int(self._paint.height())/2
142 gradient = QtGui.QRadialGradient(w, h, w) # Circular
143
144 gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor))
145 gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor))
146
136 p.setBrush(QtGui.QBrush(gradient))147 p.setBrush(QtGui.QBrush(gradient))
137 rectPath = QtGui.QPainterPath()148 rectPath = QtGui.QPainterPath()
138149
139 MAX_X = self._paint.width()150 max_x = self._paint.width()
140 MAX_Y = self._paint.height()151 max_y = self._paint.height()
141
142 rectPath.moveTo(0, 0)152 rectPath.moveTo(0, 0)
143 rectPath.lineTo(0, MAX_Y)153 rectPath.lineTo(0, max_y)
144 rectPath.lineTo(MAX_X, MAX_Y)154 rectPath.lineTo(max_x, max_y)
145 rectPath.lineTo(MAX_X, 0)155 rectPath.lineTo(max_x, 0)
156
146 rectPath.closeSubpath()157 rectPath.closeSubpath()
147 p.drawPath(rectPath)158 p.drawPath(rectPath)
148159
149 elif self._theme.BackgroundType == 2: # image160 elif self._theme.background_type== u'image': # image
150 r=self._paint.rect()161 r=self._paint.rect()
151 log.debug(r.x(), r.y(), r.width(),r.height())162 log.debug(u'Image size details %d %d %d %d ', r.x(), r.y(), r.width(),r.height())
152 log.debug(self._theme.BackgroundParameter2)163 log.debug(u' Background Parameter %d ', self._theme.background_borderColor)
153 if self._theme.BackgroundParameter2 is not None:164 if self._theme.Bbackground_borderColor is not None:
154 p.fillRect(self._paint.rect(), self._theme.BackgroundParameter2)165 p.fillRect(self._paint.rect(), self._theme.background_borderColor)
155 p.drawPixmap(self.background_offsetx,self.background_offsety, self.img)166 p.drawPixmap(self.background_offsetx,self.background_offsety, self.img)
156 p.end()167 p.end()
157 log.debug(u"render background done")168 log.debug(u'render background done')
158169
159 def split_set_of_lines(self, lines):170 def split_set_of_lines(self, lines):
160171
@@ -221,24 +232,23 @@
221232
222 def _render_lines(self, lines):233 def _render_lines(self, lines):
223 """render a set of lines according to the theme, return bounding box"""234 """render a set of lines according to the theme, return bounding box"""
224 log.debug(u"_render_lines %s", lines)235 #log.debug(u'_render_lines %s', lines)
225236
226 bbox=self._render_lines_unaligned(lines)237 bbox=self._render_lines_unaligned(lines)
227 print bbox
228238
229 t=self._theme239 t=self._theme
230 x=self._rect.left()240 x=self._rect.left()
231 if t.VerticalAlign==0: # top align241 if int(t.display_verticalAlign) == 0: # top align
232 y = self._rect.top()242 y = self._rect.top()
233 elif t.VerticalAlign==1: # bottom align243 elif int(t.display_verticalAlign) == 1: # bottom align
234 y=self._rect.bottom()-bbox.height()244 y=self._rect.bottom()-bbox.height()
235 elif t.VerticalAlign==2: # centre align245 elif int(t.display_verticalAlign) == 2: # centre align
236 y=self._rect.top()+(self._rect.height()-bbox.height())/2246 y=self._rect.top()+(self._rect.height()-bbox.height())/2
237 else:247 else:
238 assert(0, "Invalid value for theme.VerticalAlign:%d" % t.VerticalAlign)248 assert(0, u'Invalid value for theme.VerticalAlign:%s' % t.display_verticalAlign)
239 self._render_background()249 self._render_background()
240 bbox=self._render_lines_unaligned(lines, (x,y))250 bbox=self._render_lines_unaligned(lines, (x,y))
241 log.debug(u"render lines DONE")251 log.debug(u'render lines DONE')
242252
243 return bbox253 return bbox
244254
@@ -250,7 +260,7 @@
250 than a screenful (eg. by using split_set_of_lines)260 than a screenful (eg. by using split_set_of_lines)
251261
252 Returns the bounding box of the text as QRect"""262 Returns the bounding box of the text as QRect"""
253 log.debug(u"render unaligned %s", lines)263 log.debug(u'render unaligned %s', lines)
254 x,y=tlcorner264 x,y=tlcorner
255 brx=x265 brx=x
256 bry=y266 bry=y
@@ -269,7 +279,7 @@
269 p.setPen(QtGui.QPen(QtGui.QColor(0,0,255)))279 p.setPen(QtGui.QPen(QtGui.QColor(0,0,255)))
270 p.drawRect(retval)280 p.drawRect(retval)
271 p.end()281 p.end()
272 log.debug(u"render unaligned DONE")282 log.debug(u'render unaligned DONE')
273283
274 return retval284 return retval
275285
@@ -283,7 +293,7 @@
283293
284 Returns the bottom-right corner (of what was rendered) as a tuple(x,y).294 Returns the bottom-right corner (of what was rendered) as a tuple(x,y).
285 """295 """
286 log.debug(u"Render single line '%s' @ %s "%( line, tlcorner))296 #log.debug(u'Render single line %s @ %s '%( line, tlcorner))
287 x,y=tlcorner297 x,y=tlcorner
288 # We draw the text to see how big it is and then iterate to make it fit298 # We draw the text to see how big it is and then iterate to make it fit
289 # when we line wrap we do in in the "lyrics" style, so the second line is299 # when we line wrap we do in in the "lyrics" style, so the second line is
@@ -291,8 +301,8 @@
291301
292 # get the words302 # get the words
293# log.debug(u" "Getting the words split right"303# log.debug(u" "Getting the words split right"
294 words=line.split(" ")304 words=line.split(u' ')
295 thisline=' '.join(words)305 thisline=u' '.join(words)
296 lastword=len(words)306 lastword=len(words)
297 lines=[]307 lines=[]
298 maxx=self._rect.width(); maxy=self._rect.height();308 maxx=self._rect.width(); maxy=self._rect.height();
@@ -307,25 +317,22 @@
307 else:317 else:
308 lastword-=1318 lastword-=1
309 thisline=' '.join(words[:lastword])319 thisline=' '.join(words[:lastword])
310
311# log.debug(u" "This is how they split", lines
312# log.debug(u" "Now render them"
313 startx=x320 startx=x
314 starty=y321 starty=y
315 rightextent=None322 rightextent=None
316 t=self._theme323 t=self._theme
317 align=t.HorizontalAlign324 align=t.display_horizontalAlign
318 wrapstyle=t.WrapStyle325 wrapstyle=t.display_wrapStyle
319326
320 for linenum in range(len(lines)):327 for linenum in range(len(lines)):
321 line=lines[linenum]328 line=lines[linenum]
322 #find out how wide line is329 #find out how wide line is
323 w,h=self._get_extent_and_render(line, tlcorner=(x,y), dodraw=False)330 w,h=self._get_extent_and_render(line, tlcorner=(x,y), draw=False)
324331
325 if t.Shadow:332 if t.display_shadow:
326 w+=self._shadow_offset333 w+=self._shadow_offset
327 h+=self._shadow_offset334 h+=self._shadow_offset
328 if t.Outline:335 if t.display_outline:
329 w+=2*self._outline_offset # pixels either side336 w+=2*self._outline_offset # pixels either side
330 h+=2*self._outline_offset # pixels top/bottom337 h+=2*self._outline_offset # pixels top/bottom
331 if align==0: # left align338 if align==0: # left align
@@ -343,21 +350,22 @@
343 x=(maxx-w)/2;350 x=(maxx-w)/2;
344 rightextent=x+w351 rightextent=x+w
345 # now draw the text, and any outlines/shadows352 # now draw the text, and any outlines/shadows
346 if t.Shadow:353 if t.display_shadow:
347 self._get_extent_and_render(line, tlcorner=(x+self._shadow_offset,y+self._shadow_offset), dodraw=True, color = t.ShadowColor)354 self._get_extent_and_render(line, tlcorner=(x+self._shadow_offset,y+self._shadow_offset),
348 if t.Outline:355 draw=True, color = t.display_shadow_color)
349 self._get_extent_and_render(line, (x+self._outline_offset,y), dodraw=True, color = t.OutlineColor)356 if t.display_outline:
350 self._get_extent_and_render(line, (x,y+self._outline_offset), dodraw=True, color = t.OutlineColor)357 self._get_extent_and_render(line, (x+self._outline_offset,y), draw=True, color = t.display_outline_color)
351 self._get_extent_and_render(line, (x,y-self._outline_offset), dodraw=True, color = t.OutlineColor)358 self._get_extent_and_render(line, (x,y+self._outline_offset), draw=True, color = t.display_outline_color)
352 self._get_extent_and_render(line, (x-self._outline_offset,y), dodraw=True, color = t.OutlineColor)359 self._get_extent_and_render(line, (x,y-self._outline_offset), draw=True, color = t.display_outline_color)
360 self._get_extent_and_render(line, (x-self._outline_offset,y), draw=True, color = t.display_outline_color)
353 if self._outline_offset > 1:361 if self._outline_offset > 1:
354 self._get_extent_and_render(line, (x+self._outline_offset,y+self._outline_offset), dodraw=True, color = t.OutlineColor)362 self._get_extent_and_render(line, (x+self._outline_offset,y+self._outline_offset), draw=True, color = t.display_outline_color)
355 self._get_extent_and_render(line, (x-self._outline_offset,y+self._outline_offset), dodraw=True, color = t.OutlineColor)363 self._get_extent_and_render(line, (x-self._outline_offset,y+self._outline_offset), draw=True, color = t.display_outline_color)
356 self._get_extent_and_render(line, (x+self._outline_offset,y-self._outline_offset), dodraw=True, color = t.OutlineColor)364 self._get_extent_and_render(line, (x+self._outline_offset,y-self._outline_offset), draw=True, color = t.display_outline_color)
357 self._get_extent_and_render(line, (x-self._outline_offset,y-self._outline_offset), dodraw=True, color = t.OutlineColor)365 self._get_extent_and_render(line, (x-self._outline_offset,y-self._outline_offset), draw=True, color = t.display_outline_color)
358366
359 self._get_extent_and_render(line, tlcorner=(x,y), dodraw=True)367 self._get_extent_and_render(line, tlcorner=(x,y), draw=True)
360# log.debug(u" "Line %2d: Render '%s' at (%d, %d) wh=(%d,%d)"%( linenum, line, x, y,w,h)368# log.debug(u'Line %2d: Render '%s' at (%d, %d) wh=(%d,%d)' % ( linenum, line, x, y,w,h)
361 y += h369 y += h
362 if linenum == 0:370 if linenum == 0:
363 self._first_line_right_extent=rightextent371 self._first_line_right_extent=rightextent
@@ -373,47 +381,48 @@
373 return brcorner381 return brcorner
374382
375 # xxx this is what to override for an SDL version383 # xxx this is what to override for an SDL version
376 def _get_extent_and_render(self, line, tlcorner=(0,0), dodraw=False, color=None, footer = False):384 def _get_extent_and_render(self, line, tlcorner=(0,0), draw=False, color=None, footer=False):
377 """Find bounding box of text - as render_single_line.385 """Find bounding box of text - as render_single_line.
378 If dodraw is set, actually draw the text to the current DC as well386 If draw is set, actually draw the text to the current DC as well
379387
380 return width and height of text as a tuple (w,h)"""388 return width and height of text as a tuple (w,h)"""
381 # setup defaults389 # setup defaults
382 log.debug(u"_get_extent_and_render %s %s %s ", [line], tlcorner, dodraw)390 #log.debug(u"_get_extent_and_render %s %s %s ", [line], tlcorner, draw)
383 p=QtGui.QPainter()391 p=QtGui.QPainter()
384 p.begin(self._paint)392 p.begin(self._paint)
385 # 'twould be more efficient to set this once when theme changes393 # 'twould be more efficient to set this once when theme changes
386 # or p changes394 # or p changes
387 if footer :395 if footer :
388 font=QtGui.QFont(self._theme.FontName,396 font=QtGui.QFont(self._theme.font_footer_name,
389 12, # size397 int(self._theme.font_footer_proportion), # size
390 QtGui.QFont.Normal, # weight398 QtGui.QFont.Normal, # weight
391 0)# italic399 0)# italic
392 else:400 else:
393 font=QtGui.QFont(self._theme.FontName,401 font=QtGui.QFont(self._theme.font_main_name,
394 self._theme.FontProportion, # size402 int(self._theme.font_main_proportion), # size
395 QtGui.QFont.Normal, # weight403 QtGui.QFont.Normal, # weight
396 0)# italic404 0)# italic
397 # to make the unit tests monitor independent, we have to be able to405 # to make the unit tests monitor independent, we have to be able to
398 # specify whether a font proportion is in pixels or points406 # specify whether a font proportion is in pixels or points
399 if self._theme.FontUnits.lower() == "pixels":407 if footer:
400 log.debug(u"pixels")408 font.setPixelSize(int(self._theme.font_footer_proportion))
401 if footer:409 else:
402 font.setPixelSize(12)410 font.setPixelSize(int(self._theme.font_main_proportion))
403 else:411 #log.debug(u'Font details %s %s %s %d', self._theme.font_main_name, self._theme.font_main_proportion, font.family(), font.pointSize())
404 font.setPixelSize(self._theme.FontProportion)
405 log.debug(u'Font details %s %s %s %s', self._theme.FontName, self._theme.FontProportion, font.family(), font.pointSize())
406 p.setFont(font)412 p.setFont(font)
407 if color == None:413 if color == None:
408 p.setPen(self._theme.FontColor)414 if footer:
415 p.setPen(QtGui.QColor(self._theme.font_footer_color))
416 else:
417 p.setPen(QtGui.QColor(self._theme.font_main_color))
409 else:418 else:
410 p.setPen(color)419 p.setPen(QtGui.QColor(color))
411 x,y=tlcorner420 x,y=tlcorner
412 metrics=QtGui.QFontMetrics(font)421 metrics=QtGui.QFontMetrics(font)
413 # xxx some fudges to make it exactly like wx! Take 'em out later422 # xxx some fudges to make it exactly like wx! Take 'em out later
414 w=metrics.width(line)423 w=metrics.width(line)
415 h=metrics.height()-2424 h=metrics.height()-2
416 if dodraw:425 if draw:
417 p.drawText(x,y+metrics.height()-metrics.descent()-1, line)426 p.drawText(x,y+metrics.height()-metrics.descent()-1, line)
418 p.end()427 p.end()
419 return (w, h)428 return (w, h)
420429
=== modified file 'openlp/core/theme/theme.py'
--- openlp/core/theme/theme.py 2009-03-29 14:38:23 +0000
+++ openlp/core/theme/theme.py 2009-04-03 19:32:00 +0000
@@ -35,7 +35,7 @@
35'''35'''
3636
37class Theme:37class Theme:
38 def __init__(self, xmlfile=None):38 def __init__(self, xml):
39 """ stores the info about a theme39 """ stores the info about a theme
40 attributes:40 attributes:
41 name : theme name41 name : theme name
@@ -77,11 +77,7 @@
77 """77 """
78 # init to defaults78 # init to defaults
79 self._set_from_XML(blankstylexml)79 self._set_from_XML(blankstylexml)
80 if xmlfile != None:80 self._set_from_XML(xml)
81 # init from xmlfile
82 file=open(xmlfile)
83 t=''.join(file.readlines()) # read the file and change list to a string
84 self._set_from_XML(t)
8581
86 def _get_as_string(self):82 def _get_as_string(self):
87 s=""83 s=""
8884
=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py 2009-03-22 07:11:05 +0000
+++ openlp/core/ui/__init__.py 2009-04-04 17:36:15 +0000
@@ -18,6 +18,7 @@
18Place, Suite 330, Boston, MA 02111-1307 USA18Place, Suite 330, Boston, MA 02111-1307 USA
19"""19"""
2020
21from amendthemeform import AmendThemeForm
21from slidecontroller import SlideController22from slidecontroller import SlideController
22from splashscreen import SplashScreen23from splashscreen import SplashScreen
23from alertstab import AlertsTab24from alertstab import AlertsTab
@@ -31,4 +32,4 @@
31from mainwindow import MainWindow32from mainwindow import MainWindow
3233
33__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',34__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',
34 'MainWindow', 'SlideController', 'ServiceManager', 'ThemeManager']35 'MainWindow', 'SlideController', 'ServiceManager', 'ThemeManager', 'AmendThemeForm']
3536
=== added file 'openlp/core/ui/amendthemedialog.py'
--- openlp/core/ui/amendthemedialog.py 1970-01-01 00:00:00 +0000
+++ openlp/core/ui/amendthemedialog.py 2009-04-04 17:36:15 +0000
@@ -0,0 +1,282 @@
1# -*- coding: utf-8 -*-
2
3# Form implementation generated from reading ui file 'amendthemedialog.ui'
4#
5# Created: Sat Apr 4 18:09:38 2009
6# by: PyQt4 UI code generator 4.4.4
7#
8# WARNING! All changes made in this file will be lost!
9
10from PyQt4 import QtCore, QtGui
11
12class Ui_AmendThemeDialog(object):
13 def setupUi(self, AmendThemeDialog):
14 AmendThemeDialog.setObjectName("AmendThemeDialog")
15 AmendThemeDialog.resize(752, 533)
16 icon = QtGui.QIcon()
17 icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
18 AmendThemeDialog.setWindowIcon(icon)
19 self.ThemeButtonBox = QtGui.QDialogButtonBox(AmendThemeDialog)
20 self.ThemeButtonBox.setGeometry(QtCore.QRect(580, 500, 156, 26))
21 self.ThemeButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
22 self.ThemeButtonBox.setObjectName("ThemeButtonBox")
23 self.layoutWidget = QtGui.QWidget(AmendThemeDialog)
24 self.layoutWidget.setGeometry(QtCore.QRect(30, 70, 691, 401))
25 self.layoutWidget.setObjectName("layoutWidget")
26 self.horizontalLayout_2 = QtGui.QHBoxLayout(self.layoutWidget)
27 self.horizontalLayout_2.setObjectName("horizontalLayout_2")
28 self.LeftSide = QtGui.QWidget(self.layoutWidget)
29 self.LeftSide.setObjectName("LeftSide")
30 self.tabWidget = QtGui.QTabWidget(self.LeftSide)
31 self.tabWidget.setGeometry(QtCore.QRect(0, 0, 341, 401))
32 self.tabWidget.setObjectName("tabWidget")
33 self.BackgroundTab = QtGui.QWidget()
34 self.BackgroundTab.setObjectName("BackgroundTab")
35 self.layoutWidget1 = QtGui.QWidget(self.BackgroundTab)
36 self.layoutWidget1.setGeometry(QtCore.QRect(10, 10, 321, 351))
37 self.layoutWidget1.setObjectName("layoutWidget1")
38 self.gridLayout = QtGui.QGridLayout(self.layoutWidget1)
39 self.gridLayout.setObjectName("gridLayout")
40 self.BackgroundLabel = QtGui.QLabel(self.layoutWidget1)
41 self.BackgroundLabel.setObjectName("BackgroundLabel")
42 self.gridLayout.addWidget(self.BackgroundLabel, 0, 0, 1, 2)
43 self.BackgroundComboBox = QtGui.QComboBox(self.layoutWidget1)
44 self.BackgroundComboBox.setObjectName("BackgroundComboBox")
45 self.BackgroundComboBox.addItem(QtCore.QString())
46 self.BackgroundComboBox.addItem(QtCore.QString())
47 self.gridLayout.addWidget(self.BackgroundComboBox, 0, 2, 1, 2)
48 self.BackgroundTypeLabel = QtGui.QLabel(self.layoutWidget1)
49 self.BackgroundTypeLabel.setObjectName("BackgroundTypeLabel")
50 self.gridLayout.addWidget(self.BackgroundTypeLabel, 1, 0, 1, 2)
51 self.BackgroundTypeComboBox = QtGui.QComboBox(self.layoutWidget1)
52 self.BackgroundTypeComboBox.setObjectName("BackgroundTypeComboBox")
53 self.BackgroundTypeComboBox.addItem(QtCore.QString())
54 self.BackgroundTypeComboBox.addItem(QtCore.QString())
55 self.BackgroundTypeComboBox.addItem(QtCore.QString())
56 self.gridLayout.addWidget(self.BackgroundTypeComboBox, 1, 2, 1, 2)
57 self.Color1Label = QtGui.QLabel(self.layoutWidget1)
58 self.Color1Label.setObjectName("Color1Label")
59 self.gridLayout.addWidget(self.Color1Label, 2, 0, 1, 1)
60 self.Color1PushButton = QtGui.QPushButton(self.layoutWidget1)
61 self.Color1PushButton.setObjectName("Color1PushButton")
62 self.gridLayout.addWidget(self.Color1PushButton, 2, 2, 1, 2)
63 self.Color2Label = QtGui.QLabel(self.layoutWidget1)
64 self.Color2Label.setObjectName("Color2Label")
65 self.gridLayout.addWidget(self.Color2Label, 3, 0, 1, 1)
66 self.Color2PushButton = QtGui.QPushButton(self.layoutWidget1)
67 self.Color2PushButton.setObjectName("Color2PushButton")
68 self.gridLayout.addWidget(self.Color2PushButton, 3, 2, 1, 2)
69 self.ImageLabel = QtGui.QLabel(self.layoutWidget1)
70 self.ImageLabel.setObjectName("ImageLabel")
71 self.gridLayout.addWidget(self.ImageLabel, 4, 0, 1, 1)
72 self.ImageLineEdit = QtGui.QLineEdit(self.layoutWidget1)
73 self.ImageLineEdit.setObjectName("ImageLineEdit")
74 self.gridLayout.addWidget(self.ImageLineEdit, 4, 1, 1, 2)
75 self.ImagePushButton = QtGui.QPushButton(self.layoutWidget1)
76 icon1 = QtGui.QIcon()
77 icon1.addPixmap(QtGui.QPixmap(":/services/service_open.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
78 self.ImagePushButton.setIcon(icon1)
79 self.ImagePushButton.setObjectName("ImagePushButton")
80 self.gridLayout.addWidget(self.ImagePushButton, 4, 3, 1, 1)
81 self.GradientLabel = QtGui.QLabel(self.layoutWidget1)
82 self.GradientLabel.setObjectName("GradientLabel")
83 self.gridLayout.addWidget(self.GradientLabel, 5, 0, 1, 1)
84 self.GradientComboBox = QtGui.QComboBox(self.layoutWidget1)
85 self.GradientComboBox.setObjectName("GradientComboBox")
86 self.GradientComboBox.addItem(QtCore.QString())
87 self.GradientComboBox.addItem(QtCore.QString())
88 self.GradientComboBox.addItem(QtCore.QString())
89 self.gridLayout.addWidget(self.GradientComboBox, 5, 2, 1, 2)
90 self.tabWidget.addTab(self.BackgroundTab, "")
91 self.FontTab = QtGui.QWidget()
92 self.FontTab.setObjectName("FontTab")
93 self.MainFontGroupBox = QtGui.QGroupBox(self.FontTab)
94 self.MainFontGroupBox.setGeometry(QtCore.QRect(20, 20, 307, 119))
95 self.MainFontGroupBox.setObjectName("MainFontGroupBox")
96 self.gridLayout_2 = QtGui.QGridLayout(self.MainFontGroupBox)
97 self.gridLayout_2.setObjectName("gridLayout_2")
98 self.MainFontlabel = QtGui.QLabel(self.MainFontGroupBox)
99 self.MainFontlabel.setObjectName("MainFontlabel")
100 self.gridLayout_2.addWidget(self.MainFontlabel, 0, 0, 1, 1)
101 self.MainFontComboBox = QtGui.QFontComboBox(self.MainFontGroupBox)
102 self.MainFontComboBox.setObjectName("MainFontComboBox")
103 self.gridLayout_2.addWidget(self.MainFontComboBox, 0, 1, 1, 2)
104 self.MainFontColorLabel = QtGui.QLabel(self.MainFontGroupBox)
105 self.MainFontColorLabel.setObjectName("MainFontColorLabel")
106 self.gridLayout_2.addWidget(self.MainFontColorLabel, 1, 0, 1, 1)
107 self.MainFontColorPushButton = QtGui.QPushButton(self.MainFontGroupBox)
108 self.MainFontColorPushButton.setObjectName("MainFontColorPushButton")
109 self.gridLayout_2.addWidget(self.MainFontColorPushButton, 1, 2, 1, 1)
110 self.MainFontSize = QtGui.QLabel(self.MainFontGroupBox)
111 self.MainFontSize.setObjectName("MainFontSize")
112 self.gridLayout_2.addWidget(self.MainFontSize, 2, 0, 1, 1)
113 self.MainFontSizeLineEdit = QtGui.QLineEdit(self.MainFontGroupBox)
114 self.MainFontSizeLineEdit.setObjectName("MainFontSizeLineEdit")
115 self.gridLayout_2.addWidget(self.MainFontSizeLineEdit, 2, 1, 1, 1)
116 self.MainFontlSlider = QtGui.QSlider(self.MainFontGroupBox)
117 self.MainFontlSlider.setProperty("value", QtCore.QVariant(15))
118 self.MainFontlSlider.setMaximum(40)
119 self.MainFontlSlider.setOrientation(QtCore.Qt.Horizontal)
120 self.MainFontlSlider.setTickPosition(QtGui.QSlider.TicksBelow)
121 self.MainFontlSlider.setTickInterval(5)
122 self.MainFontlSlider.setObjectName("MainFontlSlider")
123 self.gridLayout_2.addWidget(self.MainFontlSlider, 2, 2, 1, 1)
124 self.FooterFontGroupBox = QtGui.QGroupBox(self.FontTab)
125 self.FooterFontGroupBox.setGeometry(QtCore.QRect(20, 170, 307, 119))
126 self.FooterFontGroupBox.setObjectName("FooterFontGroupBox")
127 self.gridLayout_3 = QtGui.QGridLayout(self.FooterFontGroupBox)
128 self.gridLayout_3.setObjectName("gridLayout_3")
129 self.FooterFontlabel = QtGui.QLabel(self.FooterFontGroupBox)
130 self.FooterFontlabel.setObjectName("FooterFontlabel")
131 self.gridLayout_3.addWidget(self.FooterFontlabel, 0, 0, 1, 1)
132 self.FooterFontComboBox = QtGui.QFontComboBox(self.FooterFontGroupBox)
133 self.FooterFontComboBox.setObjectName("FooterFontComboBox")
134 self.gridLayout_3.addWidget(self.FooterFontComboBox, 0, 1, 1, 2)
135 self.FooterFontColorLabel = QtGui.QLabel(self.FooterFontGroupBox)
136 self.FooterFontColorLabel.setObjectName("FooterFontColorLabel")
137 self.gridLayout_3.addWidget(self.FooterFontColorLabel, 1, 0, 1, 1)
138 self.FooterColorPushButton = QtGui.QPushButton(self.FooterFontGroupBox)
139 self.FooterColorPushButton.setObjectName("FooterColorPushButton")
140 self.gridLayout_3.addWidget(self.FooterColorPushButton, 1, 2, 1, 1)
141 self.FooterFontSize = QtGui.QLabel(self.FooterFontGroupBox)
142 self.FooterFontSize.setObjectName("FooterFontSize")
143 self.gridLayout_3.addWidget(self.FooterFontSize, 2, 0, 1, 1)
144 self.FooterFontSizeLineEdit = QtGui.QLineEdit(self.FooterFontGroupBox)
145 self.FooterFontSizeLineEdit.setObjectName("FooterFontSizeLineEdit")
146 self.gridLayout_3.addWidget(self.FooterFontSizeLineEdit, 2, 1, 1, 1)
147 self.FooterFontlSlider = QtGui.QSlider(self.FooterFontGroupBox)
148 self.FooterFontlSlider.setProperty("value", QtCore.QVariant(15))
149 self.FooterFontlSlider.setMaximum(40)
150 self.FooterFontlSlider.setOrientation(QtCore.Qt.Horizontal)
151 self.FooterFontlSlider.setTickPosition(QtGui.QSlider.TicksBelow)
152 self.FooterFontlSlider.setTickInterval(5)
153 self.FooterFontlSlider.setObjectName("FooterFontlSlider")
154 self.gridLayout_3.addWidget(self.FooterFontlSlider, 2, 2, 1, 1)
155 self.tabWidget.addTab(self.FontTab, "")
156 self.OptionsTab = QtGui.QWidget()
157 self.OptionsTab.setObjectName("OptionsTab")
158 self.ShadowGroupBox = QtGui.QGroupBox(self.OptionsTab)
159 self.ShadowGroupBox.setGeometry(QtCore.QRect(20, 10, 301, 80))
160 self.ShadowGroupBox.setObjectName("ShadowGroupBox")
161 self.layoutWidget2 = QtGui.QWidget(self.ShadowGroupBox)
162 self.layoutWidget2.setGeometry(QtCore.QRect(10, 20, 281, 54))
163 self.layoutWidget2.setObjectName("layoutWidget2")
164 self.formLayout = QtGui.QFormLayout(self.layoutWidget2)
165 self.formLayout.setObjectName("formLayout")
166 self.ShadowCheckBox = QtGui.QCheckBox(self.layoutWidget2)
167 self.ShadowCheckBox.setObjectName("ShadowCheckBox")
168 self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.ShadowCheckBox)
169 self.ShadowColorLabel = QtGui.QLabel(self.layoutWidget2)
170 self.ShadowColorLabel.setObjectName("ShadowColorLabel")
171 self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.ShadowColorLabel)
172 self.ShadowColorPushButton = QtGui.QPushButton(self.layoutWidget2)
173 self.ShadowColorPushButton.setObjectName("ShadowColorPushButton")
174 self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ShadowColorPushButton)
175 self.AlignmentGroupBox = QtGui.QGroupBox(self.OptionsTab)
176 self.AlignmentGroupBox.setGeometry(QtCore.QRect(10, 200, 321, 161))
177 self.AlignmentGroupBox.setObjectName("AlignmentGroupBox")
178 self.gridLayout_4 = QtGui.QGridLayout(self.AlignmentGroupBox)
179 self.gridLayout_4.setObjectName("gridLayout_4")
180 self.HorizontalLabel = QtGui.QLabel(self.AlignmentGroupBox)
181 self.HorizontalLabel.setObjectName("HorizontalLabel")
182 self.gridLayout_4.addWidget(self.HorizontalLabel, 0, 0, 1, 1)
183 self.HorizontalComboBox = QtGui.QComboBox(self.AlignmentGroupBox)
184 self.HorizontalComboBox.setObjectName("HorizontalComboBox")
185 self.HorizontalComboBox.addItem(QtCore.QString())
186 self.HorizontalComboBox.addItem(QtCore.QString())
187 self.HorizontalComboBox.addItem(QtCore.QString())
188 self.gridLayout_4.addWidget(self.HorizontalComboBox, 0, 1, 1, 1)
189 self.VerticalLabel = QtGui.QLabel(self.AlignmentGroupBox)
190 self.VerticalLabel.setObjectName("VerticalLabel")
191 self.gridLayout_4.addWidget(self.VerticalLabel, 1, 0, 1, 1)
192 self.VerticalComboBox = QtGui.QComboBox(self.AlignmentGroupBox)
193 self.VerticalComboBox.setObjectName("VerticalComboBox")
194 self.VerticalComboBox.addItem(QtCore.QString())
195 self.VerticalComboBox.addItem(QtCore.QString())
196 self.VerticalComboBox.addItem(QtCore.QString())
197 self.gridLayout_4.addWidget(self.VerticalComboBox, 1, 1, 1, 1)
198 self.OutlineGroupBox = QtGui.QGroupBox(self.OptionsTab)
199 self.OutlineGroupBox.setGeometry(QtCore.QRect(20, 110, 301, 80))
200 self.OutlineGroupBox.setObjectName("OutlineGroupBox")
201 self.layoutWidget_3 = QtGui.QWidget(self.OutlineGroupBox)
202 self.layoutWidget_3.setGeometry(QtCore.QRect(10, 20, 281, 54))
203 self.layoutWidget_3.setObjectName("layoutWidget_3")
204 self.OutlineformLayout = QtGui.QFormLayout(self.layoutWidget_3)
205 self.OutlineformLayout.setObjectName("OutlineformLayout")
206 self.OutlineCheckBox = QtGui.QCheckBox(self.layoutWidget_3)
207 self.OutlineCheckBox.setObjectName("OutlineCheckBox")
208 self.OutlineformLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.OutlineCheckBox)
209 self.OutlineColorLabel = QtGui.QLabel(self.layoutWidget_3)
210 self.OutlineColorLabel.setObjectName("OutlineColorLabel")
211 self.OutlineformLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OutlineColorLabel)
212 self.OutlineColorPushButton = QtGui.QPushButton(self.layoutWidget_3)
213 self.OutlineColorPushButton.setObjectName("OutlineColorPushButton")
214 self.OutlineformLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.OutlineColorPushButton)
215 self.tabWidget.addTab(self.OptionsTab, "")
216 self.horizontalLayout_2.addWidget(self.LeftSide)
217 self.RightSide = QtGui.QWidget(self.layoutWidget)
218 self.RightSide.setObjectName("RightSide")
219 self.ThemePreView = QtGui.QGraphicsView(self.RightSide)
220 self.ThemePreView.setGeometry(QtCore.QRect(0, 30, 341, 341))
221 self.ThemePreView.setObjectName("ThemePreView")
222 self.horizontalLayout_2.addWidget(self.RightSide)
223 self.layoutWidget3 = QtGui.QWidget(AmendThemeDialog)
224 self.layoutWidget3.setGeometry(QtCore.QRect(50, 20, 441, 41))
225 self.layoutWidget3.setObjectName("layoutWidget3")
226 self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget3)
227 self.horizontalLayout.setObjectName("horizontalLayout")
228 self.ThemeNameLabel = QtGui.QLabel(self.layoutWidget3)
229 self.ThemeNameLabel.setObjectName("ThemeNameLabel")
230 self.horizontalLayout.addWidget(self.ThemeNameLabel)
231 self.ThemeNameEdit = QtGui.QLineEdit(self.layoutWidget3)
232 self.ThemeNameEdit.setObjectName("ThemeNameEdit")
233 self.horizontalLayout.addWidget(self.ThemeNameEdit)
234
235 self.retranslateUi(AmendThemeDialog)
236 self.tabWidget.setCurrentIndex(1)
237 QtCore.QMetaObject.connectSlotsByName(AmendThemeDialog)
238
239 def retranslateUi(self, AmendThemeDialog):
240 AmendThemeDialog.setWindowTitle(QtGui.QApplication.translate("AmendThemeDialog", "Theme Maintance", None, QtGui.QApplication.UnicodeUTF8))
241 self.BackgroundLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Background:", None, QtGui.QApplication.UnicodeUTF8))
242 self.BackgroundComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Opaque", None, QtGui.QApplication.UnicodeUTF8))
243 self.BackgroundComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Transparent", None, QtGui.QApplication.UnicodeUTF8))
244 self.BackgroundTypeLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Background Type:", None, QtGui.QApplication.UnicodeUTF8))
245 self.BackgroundTypeComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Solid Color", None, QtGui.QApplication.UnicodeUTF8))
246 self.BackgroundTypeComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Gradient", None, QtGui.QApplication.UnicodeUTF8))
247 self.BackgroundTypeComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Image", None, QtGui.QApplication.UnicodeUTF8))
248 self.Color1Label.setText(QtGui.QApplication.translate("AmendThemeDialog", "<Color1>", None, QtGui.QApplication.UnicodeUTF8))
249 self.Color2Label.setText(QtGui.QApplication.translate("AmendThemeDialog", "<Color2>", None, QtGui.QApplication.UnicodeUTF8))
250 self.ImageLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Image:", None, QtGui.QApplication.UnicodeUTF8))
251 self.GradientLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Gradient :", None, QtGui.QApplication.UnicodeUTF8))
252 self.GradientComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Horizontal", None, QtGui.QApplication.UnicodeUTF8))
253 self.GradientComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Vertical", None, QtGui.QApplication.UnicodeUTF8))
254 self.GradientComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Circular", None, QtGui.QApplication.UnicodeUTF8))
255 self.tabWidget.setTabText(self.tabWidget.indexOf(self.BackgroundTab), QtGui.QApplication.translate("AmendThemeDialog", "Background", None, QtGui.QApplication.UnicodeUTF8))
256 self.MainFontGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Main Font", None, QtGui.QApplication.UnicodeUTF8))
257 self.MainFontlabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font:", None, QtGui.QApplication.UnicodeUTF8))
258 self.MainFontColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color", None, QtGui.QApplication.UnicodeUTF8))
259 self.MainFontSize.setText(QtGui.QApplication.translate("AmendThemeDialog", "Size:", None, QtGui.QApplication.UnicodeUTF8))
260 self.FooterFontGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Footer Font", None, QtGui.QApplication.UnicodeUTF8))
261 self.FooterFontlabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font:", None, QtGui.QApplication.UnicodeUTF8))
262 self.FooterFontColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color", None, QtGui.QApplication.UnicodeUTF8))
263 self.FooterFontSize.setText(QtGui.QApplication.translate("AmendThemeDialog", "Size:", None, QtGui.QApplication.UnicodeUTF8))
264 self.tabWidget.setTabText(self.tabWidget.indexOf(self.FontTab), QtGui.QApplication.translate("AmendThemeDialog", "Font", None, QtGui.QApplication.UnicodeUTF8))
265 self.ShadowGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Shadow", None, QtGui.QApplication.UnicodeUTF8))
266 self.ShadowCheckBox.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use Shadow", None, QtGui.QApplication.UnicodeUTF8))
267 self.ShadowColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Shadow Color:", None, QtGui.QApplication.UnicodeUTF8))
268 self.AlignmentGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Alignment", None, QtGui.QApplication.UnicodeUTF8))
269 self.HorizontalLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Horizontal Align:", None, QtGui.QApplication.UnicodeUTF8))
270 self.HorizontalComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Left", None, QtGui.QApplication.UnicodeUTF8))
271 self.HorizontalComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Right", None, QtGui.QApplication.UnicodeUTF8))
272 self.HorizontalComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Center", None, QtGui.QApplication.UnicodeUTF8))
273 self.VerticalLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Vertical Align:", None, QtGui.QApplication.UnicodeUTF8))
274 self.VerticalComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Top", None, QtGui.QApplication.UnicodeUTF8))
275 self.VerticalComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Middle", None, QtGui.QApplication.UnicodeUTF8))
276 self.VerticalComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Bottom", None, QtGui.QApplication.UnicodeUTF8))
277 self.OutlineGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Outline", None, QtGui.QApplication.UnicodeUTF8))
278 self.OutlineCheckBox.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use Outline", None, QtGui.QApplication.UnicodeUTF8))
279 self.OutlineColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Outline Color:", None, QtGui.QApplication.UnicodeUTF8))
280 self.tabWidget.setTabText(self.tabWidget.indexOf(self.OptionsTab), QtGui.QApplication.translate("AmendThemeDialog", "Display Options", None, QtGui.QApplication.UnicodeUTF8))
281 self.ThemeNameLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Theme Name", None, QtGui.QApplication.UnicodeUTF8))
282
0283
=== added file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py 1970-01-01 00:00:00 +0000
+++ openlp/core/ui/amendthemeform.py 2009-04-04 17:36:15 +0000
@@ -0,0 +1,37 @@
1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""
4OpenLP - Open Source Lyrics Projection
5Copyright (c) 2008 Raoul Snyman
6Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free Software
10Foundation; version 2 of the License.
11
12This program is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14PARTICULAR PURPOSE. See the GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License along with
17this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18Place, Suite 330, Boston, MA 02111-1307 USA
19"""
20import logging
21
22from PyQt4 import QtCore, QtGui
23
24#from openlp.core.resources import *
25
26from amendthemedialog import Ui_AmendThemeDialog
27
28log = logging.getLogger(u'AmendThemeForm')
29
30class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
31
32 def __init__(self, parent=None):
33 QtGui.QDialog.__init__(self, parent)
34 self.setupUi(self)
35
36 def loadTheme(self, theme):
37 pass
038
=== modified file 'openlp/core/ui/mainwindow.py' (properties changed: -x to +x)
--- openlp/core/ui/mainwindow.py 2009-03-23 19:17:07 +0000
+++ openlp/core/ui/mainwindow.py 2009-04-05 18:33:56 +0000
@@ -39,16 +39,16 @@
3939
40 def __init__(self):40 def __init__(self):
41 self.main_window = QtGui.QMainWindow()41 self.main_window = QtGui.QMainWindow()
42 self.EventManager = EventManager() 42 self.EventManager = EventManager()
43 self.alert_form = AlertForm()43 self.alert_form = AlertForm()
44 self.about_form = AboutForm()44 self.about_form = AboutForm()
45 self.settings_form = SettingsForm()45 self.settings_form = SettingsForm()
46 46
47 pluginpath = os.path.split(os.path.abspath(__file__))[0]47 pluginpath = os.path.split(os.path.abspath(__file__))[0]
48 pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins'))48 pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins'))
49 self.plugin_manager = PluginManager(pluginpath)49 self.plugin_manager = PluginManager(pluginpath)
50 self.plugin_helpers = {}50 self.plugin_helpers = {}
51 51
52 self.setupUi()52 self.setupUi()
5353
54 log.info(u'Load Plugins')54 log.info(u'Load Plugins')
@@ -56,7 +56,7 @@
56 self.plugin_helpers[u'live'] = self.LiveController56 self.plugin_helpers[u'live'] = self.LiveController
57 self.plugin_helpers[u'event'] = self.EventManager57 self.plugin_helpers[u'event'] = self.EventManager
58 self.plugin_helpers[u'theme'] = self.ThemeManagerContents # Theme manger58 self.plugin_helpers[u'theme'] = self.ThemeManagerContents # Theme manger
59 59
60 self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers, self.EventManager)60 self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers, self.EventManager)
61 # hook methods have to happen after find_plugins. Find plugins needs the controllers61 # hook methods have to happen after find_plugins. Find plugins needs the controllers
62 # hence the hooks have moved from setupUI() to here62 # hence the hooks have moved from setupUI() to here
@@ -77,9 +77,14 @@
77 self.plugin_manager.hook_export_menu(self.FileExportMenu)77 self.plugin_manager.hook_export_menu(self.FileExportMenu)
7878
79 # Call the initialise method to setup plugins.79 # Call the initialise method to setup plugins.
80 log.info(u'initialise plugins') 80 log.info(u'initialise plugins')
81 self.plugin_manager.initialise_plugins()81 self.plugin_manager.initialise_plugins()
82 82
83 # Once all components are initialised load the Themes
84 log.info(u'Load Themes')
85 self.ThemeManagerContents.setEventManager(self.EventManager)
86 self.ThemeManagerContents.loadThemes()
87
83 def setupUi(self):88 def setupUi(self):
84 self.main_window.setObjectName("main_window")89 self.main_window.setObjectName("main_window")
85 self.main_window.resize(1087, 847)90 self.main_window.resize(1087, 847)
@@ -176,7 +181,7 @@
176 self.ServiceManagerContents = ServiceManager(self)181 self.ServiceManagerContents = ServiceManager(self)
177 self.ServiceManagerDock.setWidget(self.ServiceManagerContents)182 self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
178 self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)183 self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
179 #Theme Manager Defined 184 #Theme Manager Defined
180 self.ThemeManagerDock = QtGui.QDockWidget(self.main_window)185 self.ThemeManagerDock = QtGui.QDockWidget(self.main_window)
181 ThemeManagerIcon = QtGui.QIcon()186 ThemeManagerIcon = QtGui.QIcon()
182 ThemeManagerIcon.addPixmap(QtGui.QPixmap(":/system/system_thememanager.png"),187 ThemeManagerIcon.addPixmap(QtGui.QPixmap(":/system/system_thememanager.png"),
@@ -184,46 +189,12 @@
184 self.ThemeManagerDock.setWindowIcon(ThemeManagerIcon)189 self.ThemeManagerDock.setWindowIcon(ThemeManagerIcon)
185 self.ThemeManagerDock.setFloating(False)190 self.ThemeManagerDock.setFloating(False)
186 self.ThemeManagerDock.setObjectName("ThemeManagerDock")191 self.ThemeManagerDock.setObjectName("ThemeManagerDock")
187 192
188 self.ThemeManagerContents = ThemeManager(self) 193 self.ThemeManagerContents = ThemeManager(self)
189
190# self.ThemeManagerContents = QtGui.QWidget()
191# self.ThemeManagerContents.setObjectName("ThemeManagerContents")
192# self.ThemeManagerLayout = QtGui.QVBoxLayout(self.ThemeManagerContents)
193# self.ThemeManagerLayout.setSpacing(0)
194# self.ThemeManagerLayout.setMargin(0)
195# self.ThemeManagerLayout.setObjectName("ThemeManagerLayout")
196# self.ThemeManagerToolbar = QtGui.QToolBar(self.ThemeManagerContents)
197# self.ThemeManagerToolbar.setObjectName("ThemeManagerToolbar")
198# NewThemeIcon = QtGui.QIcon()
199# NewThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_new.png"),
200# QtGui.QIcon.Normal, QtGui.QIcon.Off)
201# self.ThemeNewItem = self.ThemeManagerToolbar.addAction(NewThemeIcon, 'New theme')
202# EditThemeIcon = QtGui.QIcon()
203# EditThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_edit.png"),
204# QtGui.QIcon.Normal, QtGui.QIcon.Off)
205# self.ThemeEditItem = self.ThemeManagerToolbar.addAction(EditThemeIcon, 'Edit theme')
206# DeleteThemeIcon = QtGui.QIcon()
207# DeleteThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_delete.png"),
208# QtGui.QIcon.Normal, QtGui.QIcon.Off)
209# self.ThemeDeleteButton = self.ThemeManagerToolbar.addAction(DeleteThemeIcon, 'Delete theme')
210# self.ThemeManagerToolbar.addSeparator()
211# ImportThemeIcon = QtGui.QIcon()
212# ImportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_import.png"),
213# QtGui.QIcon.Normal, QtGui.QIcon.Off)
214# self.ThemeImportButton = self.ThemeManagerToolbar.addAction(ImportThemeIcon, 'Import theme')
215# ExportThemeIcon = QtGui.QIcon()
216# ExportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_export.png"),
217# QtGui.QIcon.Normal, QtGui.QIcon.Off)
218# self.ThemeExportButton = self.ThemeManagerToolbar.addAction(ExportThemeIcon, 'Export theme')
219# self.ThemeManagerLayout.addWidget(self.ThemeManagerToolbar)
220# self.ThemeManagerListView = QtGui.QListView(self.ThemeManagerContents)
221# self.ThemeManagerListView.setObjectName("ThemeManagerListView")
222# self.ThemeManagerLayout.addWidget(self.ThemeManagerListView)
223194
224 self.ThemeManagerDock.setWidget(self.ThemeManagerContents)195 self.ThemeManagerDock.setWidget(self.ThemeManagerContents)
225 self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock)196 self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock)
226 197
227 self.FileNewItem = QtGui.QAction(self.main_window)198 self.FileNewItem = QtGui.QAction(self.main_window)
228 self.FileNewItem.setIcon(self.ServiceManagerContents.Toolbar.getIconFromTitle("New Service"))199 self.FileNewItem.setIcon(self.ServiceManagerContents.Toolbar.getIconFromTitle("New Service"))
229 self.FileNewItem.setObjectName("FileNewItem")200 self.FileNewItem.setObjectName("FileNewItem")
230201
=== modified file 'openlp/core/ui/thememanager.py' (properties changed: -x to +x)
--- openlp/core/ui/thememanager.py 2009-03-28 20:12:22 +0000
+++ openlp/core/ui/thememanager.py 2009-04-05 18:33:56 +0000
@@ -28,14 +28,20 @@
28from PyQt4 import QtCore, QtGui28from PyQt4 import QtCore, QtGui
29from PyQt4.QtCore import *29from PyQt4.QtCore import *
30from PyQt4.QtGui import *30from PyQt4.QtGui import *
31# from openlp.core.resources import *31
32# from openlp.core.ui import AboutForm, AlertForm, SettingsForm, SlideController32from openlp.core.ui import AmendThemeForm
33from openlp.core import translate33from openlp.core import translate
34from openlp.core import Renderer
35from openlp.core.theme import Theme
36from openlp.core.lib import Event
37from openlp.core.lib import EventType
38from openlp.core.lib import EventManager
34from openlp.core.lib import OpenLPToolbar39from openlp.core.lib import OpenLPToolbar
40from openlp.core.lib import ThemeXMLBuilder
41from openlp.core.lib import ThemeXMLParser
35from openlp.core.utils import ConfigHelper42from openlp.core.utils import ConfigHelper
36#from openlp.core.lib import ThemeItem43
3744
38# from openlp.core import PluginManager
39import logging45import logging
4046
41class ThemeData(QAbstractItemModel):47class ThemeData(QAbstractItemModel):
@@ -51,7 +57,7 @@
51 self.items=[]57 self.items=[]
52 self.rowheight=5058 self.rowheight=50
53 self.maximagewidth=self.rowheight*16/9.0;59 self.maximagewidth=self.rowheight*16/9.0;
54 log.info("Starting")60 log.info(u'Starting')
5561
56 def clearItems(self):62 def clearItems(self):
57 self.items=[]63 self.items=[]
@@ -64,9 +70,10 @@
6470
65 def insertRow(self, row, filename):71 def insertRow(self, row, filename):
66 self.beginInsertRows(QModelIndex(),row,row)72 self.beginInsertRows(QModelIndex(),row,row)
67 log.info("insert row %d:%s"%(row,filename))73 log.info(u'insert row %d:%s'%(row,filename))
68 (prefix, shortfilename) = os.path.split(str(filename))74 (prefix, shortfilename) = os.path.split(str(filename))
69 log.info("shortfilename=%s"%(shortfilename))75 log.info(u'shortfilename=%s'%(shortfilename))
76 theme = shortfilename.split(u'.')
70 # create a preview image77 # create a preview image
71 if os.path.exists(filename):78 if os.path.exists(filename):
72 preview = QPixmap(str(filename))79 preview = QPixmap(str(filename))
@@ -83,8 +90,8 @@
83 p=QPixmap(w,h)90 p=QPixmap(w,h)
84 p.fill(Qt.transparent)91 p.fill(Qt.transparent)
85 # finally create the row92 # finally create the row
86 self.items.insert(row,(filename, p, shortfilename))93 self.items.insert(row,(filename, p, shortfilename, theme[0]))
87 log.info("Items: %s" % self.items)94 log.info(u'Items: %s' % self.items)
88 self.endInsertRows()95 self.endInsertRows()
8996
90 def removeRow(self, row):97 def removeRow(self, row):
@@ -106,7 +113,7 @@
106 if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row!113 if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row!
107 return QVariant()114 return QVariant()
108 if role==Qt.DisplayRole:115 if role==Qt.DisplayRole:
109 retval= self.items[row][2]116 retval= self.items[row][3]
110 elif role == Qt.DecorationRole:117 elif role == Qt.DecorationRole:
111 retval= self.items[row][1]118 retval= self.items[row][1]
112 else:119 else:
@@ -122,7 +129,7 @@
122 yield i129 yield i
123130
124 def item(self, row):131 def item(self, row):
125 log.info("Get Item:%d -> %s" %(row, str(self.items)))132 log.info(u'Get Item:%d -> %s' %(row, str(self.items)))
126 return self.items[row]133 return self.items[row]
127134
128class ThemeManager(QWidget):135class ThemeManager(QWidget):
@@ -138,14 +145,19 @@
138 self.Layout = QtGui.QVBoxLayout(self)145 self.Layout = QtGui.QVBoxLayout(self)
139 self.Layout.setSpacing(0)146 self.Layout.setSpacing(0)
140 self.Layout.setMargin(0)147 self.Layout.setMargin(0)
148 self.amendThemeForm = AmendThemeForm()
141 self.Toolbar = OpenLPToolbar(self)149 self.Toolbar = OpenLPToolbar(self)
142 self.Toolbar.addToolbarButton("New Theme", ":/themes/theme_new.png")150 self.Toolbar.addToolbarButton(translate('ThemeManager',u'New Theme'), ":/themes/theme_new.png",
143 self.Toolbar.addToolbarButton("Edit Theme", ":/themes/theme_edit.png")151 translate('ThemeManager',u'Allows a Theme to be created'), self.onAddTheme)
144 self.Toolbar.addToolbarButton("Delete Theme", ":/themes/theme_delete.png")152 self.Toolbar.addToolbarButton(translate('ThemeManager',u'Edit Theme'), ":/themes/theme_edit.png",
153 translate('ThemeManager',u'Allows a Theme to be amended'), self.onEditTheme)
154 self.Toolbar.addToolbarButton(translate('ThemeManager',u'Delete Theme'), ":/themes/theme_delete.png",
155 translate('ThemeManager',u'Allows a Theme to be deleted'), self.onDeleteTheme)
145 self.Toolbar.addSeparator()156 self.Toolbar.addSeparator()
146 self.Toolbar.addToolbarButton("Import Theme", ":/themes/theme_import.png",157 self.Toolbar.addToolbarButton(translate('ThemeManager',u'Import Theme'), ":/themes/theme_import.png",
147 u'Allows Themes to be imported', self.onImportTheme)158 translate('ThemeManager',u'Allows Themes to be imported'), self.onImportTheme)
148 self.Toolbar.addToolbarButton("Export Theme", ":/themes/theme_export.png")159 self.Toolbar.addToolbarButton(translate('ThemeManager',u'Export Theme'), ":/themes/theme_export.png",
160 translate('ThemeManager',u'Allows Themes to be exported'), self.onExportTheme)
149 self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar)161 self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar)
150 self.Toolbar.addAction(self.ThemeWidget)162 self.Toolbar.addAction(self.ThemeWidget)
151163
@@ -161,62 +173,29 @@
161 self.themelist= []173 self.themelist= []
162 self.path = os.path.join(ConfigHelper.get_data_path(), u'themes')174 self.path = os.path.join(ConfigHelper.get_data_path(), u'themes')
163 self.checkThemesExists(self.path)175 self.checkThemesExists(self.path)
164 self.loadThemes() # load the themes176
165177 def setEventManager(self, eventManager):
166# def addThemeItem(self, item):178 self.eventManager = eventManager
167# """Adds Theme item"""179
168# log.info("addThemeItem")180 def onAddTheme(self):
169# indexes=self.TreeView.selectedIndexes()181 self.amendThemeForm.exec_()
170# assert len(indexes) <= 1 # can only have one selected index in this view182
171# if indexes == []:183 def onEditTheme(self):
172# log.info("No row")184 self.amendThemeForm.loadTheme(theme)
173# row = None185 self.amendThemeForm.exec_()
174# selected_item = None186
175# else:187 def onDeleteTheme(self):
176# row=indexes[0].row()188 pass
177# # if currently selected is of correct type, add it to it189
178# log.info("row:%d"%row)190 def onExportTheme(self):
179# selected_item=self.Theme_data.item(row)191 pass
180# if type(selected_item) == type(item):
181# log.info("Add to existing item")
182# selected_item.add(item)
183# else:
184# log.info("Create new item")
185# if row is None:
186# self.Theme_data.addRow(item)
187# else:
188# self.Theme_data.insertRow(row+1, item)
189#
190# def removeThemeItem(self):
191# """Remove currently selected item"""
192# pass
193#
194# def oos_as_text(self):
195# text=[]
196# log.info( "oos as text")
197# log.info("Data:"+str(self.Theme_data))
198# for i in self.Theme_data:
199# text.append("# " + str(i))
200# text.append(i.get_oos_text())
201# return '\n'.join(text)
202#
203# def write_oos(self, filename):
204# """
205# Write a full OOS file out - iterate over plugins and call their respective methods
206# This format is totally arbitrary testing purposes - something sensible needs to go in here!
207# """
208# oosfile=open(filename, "w")
209# oosfile.write("# BEGIN OOS\n")
210# oosfile.write(self.oos_as_text)
211# oosfile.write("# END OOS\n")
212# oosfile.close()
213192
214 def onImportTheme(self):193 def onImportTheme(self):
215 files = QtGui.QFileDialog.getOpenFileNames(None,194 files = QtGui.QFileDialog.getOpenFileNames(None,
216 translate('ThemeManager', u'Select Import File'),195 translate('ThemeManager', u'Select Import File'),
217 self.path,196 self.path,
218 u'Theme (*.theme)')197 u'Theme (*.theme)')
219 log.info(u'New Themes) %s', str(files))198 log.info(u'New Themes %s', str(files))
220 if len(files) > 0:199 if len(files) > 0:
221 for file in files:200 for file in files:
222 self.unzipTheme(file, self.path)201 self.unzipTheme(file, self.path)
@@ -228,9 +207,11 @@
228# self.themelist = [u'African Sunset', u'Snowy Mountains', u'Wilderness', u'Wet and Windy London']207# self.themelist = [u'African Sunset', u'Snowy Mountains', u'Wilderness', u'Wet and Windy London']
229 for root, dirs, files in os.walk(self.path):208 for root, dirs, files in os.walk(self.path):
230 for name in files:209 for name in files:
231 if name.endswith(u'.bmp'):210 if name.endswith(u'.png'):
232 self.Theme_data.addRow(os.path.join(self.path, name))211 self.Theme_data.addRow(os.path.join(self.path, name))
233212
213 self.eventManager.post_event(Event(EventType.ThemeListChanged))
214
234 def getThemes(self):215 def getThemes(self):
235 return self.themelist216 return self.themelist
236217
@@ -249,16 +230,99 @@
249 os.mkdir(os.path.join(dir, file))230 os.mkdir(os.path.join(dir, file))
250 else:231 else:
251 fullpath = os.path.join(dir, file)232 fullpath = os.path.join(dir, file)
233 names = file.split(u'/')
234 xml_data = zip.read(file)
252 if file.endswith(u'.xml'):235 if file.endswith(u'.xml'):
253 self.checkVersion1(fullpath)236 if self.checkVersion1(xml_data):
254 outfile = open(fullpath, 'w')237 filexml = self.migrateVersion122(filename, fullpath, xml_data)
255 outfile.write(zip.read(file))238 outfile = open(fullpath, 'w')
256 outfile.close()239 outfile.write(filexml)
240 outfile.close()
241 self.generateImage(dir,names[0], filexml)
242 else:
243 if file.endswith(u'.bmp'):
244 if fullpath is not os.path.join(dir, file):
245 outfile = open(fullpath, 'w')
246 outfile.write(zip.read(file))
247 outfile.close()
257248
258 def checkVersion1(self, xmlfile):249 def checkVersion1(self, xmlfile):
259 file=open(xmlfile)250 log.debug(u'checkVersion1 ')
260 t=''.join(file.readlines()) # read the file and change list to a string251 t = xmlfile
261 tree = ElementTree(element=XML(t)).getroot()252 tree = ElementTree(element=XML(t)).getroot()
262 print "AA"253 if tree.find(u'BackgroundType') is None :
263 print tree.find('BackgroundType')254 return False
264 print "AAA"255 else:
256 return True
257
258 def migrateVersion122(self, filename , fullpath, xml_data):
259 log.debug(u'migrateVersion122 %s %s', filename , fullpath)
260 t=Theme(xml_data)
261
262 newtheme = ThemeXMLBuilder()
263 newtheme.new_document(t.Name)
264 if t.BackgroundType == 0:
265 newtheme.add_background_solid(str(t.BackgroundParameter1.name()))
266 elif t.BackgroundType == 1:
267 direction = "vertical"
268 if t.BackgroundParameter1.name() == 1:
269 direction = "horizontal"
270 newtheme.add_background_gradient(str(t.BackgroundParameter1.name()), str(t.BackgroundParameter2.name()), direction)
271 else:
272 newtheme.add_background_image(str(t.BackgroundParameter1))
273
274 newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(t.FontProportion * 2))
275 newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(12), u'footer')
276 outline = False
277 shadow = False
278 if t.Shadow == 1:
279 shadow = True
280 if t.Outline == 1:
281 outline = True
282 newtheme.add_display(str(shadow), str(t.ShadowColor.name()), str(outline), str(t.OutlineColor.name()),
283 str(t.HorizontalAlign), str(t.VerticalAlign), str(t.WrapStyle))
284 return newtheme.extract_xml()
285
286 def generateImage(self, dir, name, theme_xml):
287 log.debug(u'generateImage %s %s ', dir, theme_xml)
288 theme = ThemeXMLParser(theme_xml)
289 #print theme
290 size=QtCore.QSize(800,600)
291 frame=TstFrame(size)
292 frame=frame
293 paintdest=frame.GetPixmap()
294 r=Renderer()
295 r.set_paint_dest(paintdest)
296
297 r.set_theme(theme) # set default theme
298 r._render_background()
299 r.set_text_rectangle(QtCore.QRect(0,0, size.width()-1, size.height()-1))
300
301 lines=[]
302 lines.append(u'Amazing Grace!')
303 lines.append(u'How sweet the sound')
304 lines.append(u'To save a wretch like me;')
305 lines.append(u'I once was lost but now am found,')
306 lines.append(u'Was blind, but now I see.')
307
308 answer=r._render_lines(lines)
309 r._get_extent_and_render(u'Amazing Grace (John Newton) ', (10, 560), True, None, True)
310 r._get_extent_and_render(u'CCLI xxx (c)Openlp.org', (10, 580), True, None, True)
311
312 im=frame.GetPixmap().toImage()
313 testpathname=os.path.join(dir, name+u'.png')
314 if os.path.exists(testpathname):
315 os.unlink(testpathname)
316 im.save(testpathname, u'png')
317 log.debug(u'Theme image written to %s',testpathname)
318
319
320class TstFrame:
321 def __init__(self, size):
322 """Create the DemoPanel."""
323 self.width=size.width();
324 self.height=size.height();
325 # create something to be painted into
326 self._Buffer = QtGui.QPixmap(self.width, self.height)
327 def GetPixmap(self):
328 return self._Buffer
265329
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2009-03-09 12:49:55 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2009-04-04 10:24:39 +0000
@@ -68,12 +68,14 @@
68 self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)68 self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
69 self.NewChaptersCheckBox.setObjectName("NewChaptersCheckBox")69 self.NewChaptersCheckBox.setObjectName("NewChaptersCheckBox")
70 self.VerseDisplayLayout.addWidget(self.NewChaptersCheckBox, 1, 0, 1, 1)70 self.VerseDisplayLayout.addWidget(self.NewChaptersCheckBox, 1, 0, 1, 1)
71
71 self.DisplayStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox)72 self.DisplayStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
72 self.DisplayStyleWidget.setObjectName(u'DisplayStyleWidget')73 self.DisplayStyleWidget.setObjectName(u'DisplayStyleWidget')
73 self.DisplayStyleLayout = QtGui.QHBoxLayout(self.DisplayStyleWidget)74 self.DisplayStyleLayout = QtGui.QHBoxLayout(self.DisplayStyleWidget)
74 self.DisplayStyleLayout.setSpacing(8)75 self.DisplayStyleLayout.setSpacing(8)
75 self.DisplayStyleLayout.setMargin(0)76 self.DisplayStyleLayout.setMargin(0)
76 self.DisplayStyleLayout.setObjectName(u'DisplayStyleLayout')77 self.DisplayStyleLayout.setObjectName(u'DisplayStyleLayout')
78
77 self.DisplayStyleLabel = QtGui.QLabel(self.DisplayStyleWidget)79 self.DisplayStyleLabel = QtGui.QLabel(self.DisplayStyleWidget)
78 self.DisplayStyleLabel.setObjectName(u'DisplayStyleLabel')80 self.DisplayStyleLabel.setObjectName(u'DisplayStyleLabel')
79 self.DisplayStyleLayout.addWidget(self.DisplayStyleLabel)81 self.DisplayStyleLayout.addWidget(self.DisplayStyleLabel)
@@ -85,9 +87,26 @@
85 self.DisplayStyleComboBox.addItem(QtCore.QString())87 self.DisplayStyleComboBox.addItem(QtCore.QString())
86 self.DisplayStyleLayout.addWidget(self.DisplayStyleComboBox)88 self.DisplayStyleLayout.addWidget(self.DisplayStyleComboBox)
87 self.VerseDisplayLayout.addWidget(self.DisplayStyleWidget, 2, 0, 1, 1)89 self.VerseDisplayLayout.addWidget(self.DisplayStyleWidget, 2, 0, 1, 1)
90
91 self.BibleThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
92 self.BibleThemeWidget.setObjectName(u'BibleThemeWidget')
93 self.BibleThemeLayout = QtGui.QHBoxLayout(self.BibleThemeWidget)
94 self.BibleThemeLayout.setSpacing(8)
95 self.BibleThemeLayout.setMargin(0)
96 self.BibleThemeLayout.setObjectName(u'BibleThemeLayout')
97
98 self.BibleThemeLabel = QtGui.QLabel(self.BibleThemeWidget)
99 self.BibleThemeLabel.setObjectName(u'BibleThemeLabel')
100 self.BibleThemeLayout.addWidget(self.BibleThemeLabel)
101 self.BibleThemeComboBox = QtGui.QComboBox(self.BibleThemeWidget)
102 self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox')
103 self.BibleThemeComboBox.addItem(QtCore.QString())
104 self.BibleThemeLayout.addWidget(self.BibleThemeComboBox)
105 self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 3, 0, 1, 1)
106
88 self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox)107 self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
89 self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel')108 self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel')
90 self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 3, 0, 1, 1)109 self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 4, 0, 1, 1)
91 self.BibleLeftLayout.addWidget(self.VerseDisplayGroupBox)110 self.BibleLeftLayout.addWidget(self.VerseDisplayGroupBox)
92 self.BibleLeftSpacer = QtGui.QSpacerItem(40, 20,111 self.BibleLeftSpacer = QtGui.QSpacerItem(40, 20,
93 QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)112 QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
@@ -132,6 +151,7 @@
132 self.ParagraphRadioButton.setText(translate('SettingsForm','Paragraph style'))151 self.ParagraphRadioButton.setText(translate('SettingsForm','Paragraph style'))
133 self.NewChaptersCheckBox.setText(translate('SettingsForm', 'Only show new chapter numbers'))152 self.NewChaptersCheckBox.setText(translate('SettingsForm', 'Only show new chapter numbers'))
134 self.DisplayStyleLabel.setText(translate('SettingsForm', 'Display Style:'))153 self.DisplayStyleLabel.setText(translate('SettingsForm', 'Display Style:'))
154 self.BibleThemeLabel.setText(translate('SettingsForm', 'Bible Theme:'))
135 self.DisplayStyleComboBox.setItemText(0, translate('SettingsForm', 'No brackets'))155 self.DisplayStyleComboBox.setItemText(0, translate('SettingsForm', 'No brackets'))
136 self.DisplayStyleComboBox.setItemText(1, translate('SettingsForm', '( and )'))156 self.DisplayStyleComboBox.setItemText(1, translate('SettingsForm', '( and )'))
137 self.DisplayStyleComboBox.setItemText(2, translate('SettingsForm', '{ and }'))157 self.DisplayStyleComboBox.setItemText(2, translate('SettingsForm', '{ and }'))
@@ -165,6 +185,7 @@
165 self.paragraph_style = self.convertStringToBoolean(self.config.get_config('paragraph style', u'True'))185 self.paragraph_style = self.convertStringToBoolean(self.config.get_config('paragraph style', u'True'))
166 self.show_new_chapters = self.convertStringToBoolean(self.config.get_config('display new chapter', u"False"))186 self.show_new_chapters = self.convertStringToBoolean(self.config.get_config('display new chapter', u"False"))
167 self.display_style = int(self.config.get_config('display brackets', '0'))187 self.display_style = int(self.config.get_config('display brackets', '0'))
188 self.bible_theme = int(self.config.get_config('bible theme', '0'))
168 self.bible_search = self.convertStringToBoolean(self.config.get_config('search as type', u'True'))189 self.bible_search = self.convertStringToBoolean(self.config.get_config('search as type', u'True'))
169 if self.paragraph_style:190 if self.paragraph_style:
170 self.ParagraphRadioButton.setChecked(True)191 self.ParagraphRadioButton.setChecked(True)
@@ -173,9 +194,14 @@
173 self.NewChaptersCheckBox.setChecked(self.show_new_chapters)194 self.NewChaptersCheckBox.setChecked(self.show_new_chapters)
174 self.DisplayStyleComboBox.setCurrentIndex(self.display_style)195 self.DisplayStyleComboBox.setCurrentIndex(self.display_style)
175 self.BibleSearchCheckBox.setChecked(self.bible_search)196 self.BibleSearchCheckBox.setChecked(self.bible_search)
197 if self.bible_theme == 0: # must be new set to first
198 self.BibleThemeComboBox.setCurrentIndex(self.bible_theme)
199 else:
200 pass # TODO need to code
176201
177 def save(self):202 def save(self):
178 self.config.set_config("paragraph style", str(self.paragraph_style))203 self.config.set_config("paragraph style", str(self.paragraph_style))
179 self.config.set_config("display new chapter", str(self.show_new_chapters))204 self.config.set_config("display new chapter", str(self.show_new_chapters))
180 self.config.set_config("display brackets", str(self.display_style))205 self.config.set_config("display brackets", str(self.display_style))
181 self.config.set_config("search as type", str(self.bible_search))206 self.config.set_config("search as type", str(self.bible_search))
207 self.config.set_config("bible theme", str(self.bible_theme))
182208
=== added file 'resources/forms/amendthemedialog.ui'
--- resources/forms/amendthemedialog.ui 1970-01-01 00:00:00 +0000
+++ resources/forms/amendthemedialog.ui 2009-04-04 17:36:15 +0000
@@ -0,0 +1,547 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>AmendThemeDialog</class>
4 <widget class="QWidget" name="AmendThemeDialog">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>752</width>
10 <height>533</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Theme Maintance</string>
15 </property>
16 <property name="windowIcon">
17 <iconset resource="../images/openlp-2.qrc">
18 <normaloff>:/icon/openlp.org-icon-32.bmp</normaloff>:/icon/openlp.org-icon-32.bmp</iconset>
19 </property>
20 <widget class="QDialogButtonBox" name="ThemeButtonBox">
21 <property name="geometry">
22 <rect>
23 <x>580</x>
24 <y>500</y>
25 <width>156</width>
26 <height>26</height>
27 </rect>
28 </property>
29 <property name="standardButtons">
30 <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
31 </property>
32 </widget>
33 <widget class="QWidget" name="layoutWidget">
34 <property name="geometry">
35 <rect>
36 <x>30</x>
37 <y>70</y>
38 <width>691</width>
39 <height>401</height>
40 </rect>
41 </property>
42 <layout class="QHBoxLayout" name="horizontalLayout_2">
43 <item>
44 <widget class="QWidget" name="LeftSide" native="true">
45 <widget class="QTabWidget" name="tabWidget">
46 <property name="geometry">
47 <rect>
48 <x>0</x>
49 <y>0</y>
50 <width>341</width>
51 <height>401</height>
52 </rect>
53 </property>
54 <property name="currentIndex">
55 <number>1</number>
56 </property>
57 <widget class="QWidget" name="BackgroundTab">
58 <attribute name="title">
59 <string>Background</string>
60 </attribute>
61 <widget class="QWidget" name="layoutWidget">
62 <property name="geometry">
63 <rect>
64 <x>10</x>
65 <y>10</y>
66 <width>321</width>
67 <height>351</height>
68 </rect>
69 </property>
70 <layout class="QGridLayout" name="gridLayout">
71 <item row="0" column="0" colspan="2">
72 <widget class="QLabel" name="BackgroundLabel">
73 <property name="text">
74 <string>Background:</string>
75 </property>
76 </widget>
77 </item>
78 <item row="0" column="2" colspan="2">
79 <widget class="QComboBox" name="BackgroundComboBox">
80 <item>
81 <property name="text">
82 <string>Opaque</string>
83 </property>
84 </item>
85 <item>
86 <property name="text">
87 <string>Transparent</string>
88 </property>
89 </item>
90 </widget>
91 </item>
92 <item row="1" column="0" colspan="2">
93 <widget class="QLabel" name="BackgroundTypeLabel">
94 <property name="text">
95 <string>Background Type:</string>
96 </property>
97 </widget>
98 </item>
99 <item row="1" column="2" colspan="2">
100 <widget class="QComboBox" name="BackgroundTypeComboBox">
101 <item>
102 <property name="text">
103 <string>Solid Color</string>
104 </property>
105 </item>
106 <item>
107 <property name="text">
108 <string>Gradient</string>
109 </property>
110 </item>
111 <item>
112 <property name="text">
113 <string>Image</string>
114 </property>
115 </item>
116 </widget>
117 </item>
118 <item row="2" column="0">
119 <widget class="QLabel" name="Color1Label">
120 <property name="text">
121 <string>&lt;Color1&gt;</string>
122 </property>
123 </widget>
124 </item>
125 <item row="2" column="2" colspan="2">
126 <widget class="QPushButton" name="Color1PushButton">
127 <property name="text">
128 <string/>
129 </property>
130 </widget>
131 </item>
132 <item row="3" column="0">
133 <widget class="QLabel" name="Color2Label">
134 <property name="text">
135 <string>&lt;Color2&gt;</string>
136 </property>
137 </widget>
138 </item>
139 <item row="3" column="2" colspan="2">
140 <widget class="QPushButton" name="Color2PushButton">
141 <property name="text">
142 <string/>
143 </property>
144 </widget>
145 </item>
146 <item row="4" column="0">
147 <widget class="QLabel" name="ImageLabel">
148 <property name="text">
149 <string>Image:</string>
150 </property>
151 </widget>
152 </item>
153 <item row="4" column="1" colspan="2">
154 <widget class="QLineEdit" name="ImageLineEdit"/>
155 </item>
156 <item row="4" column="3">
157 <widget class="QPushButton" name="ImagePushButton">
158 <property name="text">
159 <string/>
160 </property>
161 <property name="icon">
162 <iconset resource="../images/openlp-2.qrc">
163 <normaloff>:/services/service_open.png</normaloff>:/services/service_open.png</iconset>
164 </property>
165 </widget>
166 </item>
167 <item row="5" column="0">
168 <widget class="QLabel" name="GradientLabel">
169 <property name="text">
170 <string>Gradient :</string>
171 </property>
172 </widget>
173 </item>
174 <item row="5" column="2" colspan="2">
175 <widget class="QComboBox" name="GradientComboBox">
176 <item>
177 <property name="text">
178 <string>Horizontal</string>
179 </property>
180 </item>
181 <item>
182 <property name="text">
183 <string>Vertical</string>
184 </property>
185 </item>
186 <item>
187 <property name="text">
188 <string>Circular</string>
189 </property>
190 </item>
191 </widget>
192 </item>
193 </layout>
194 </widget>
195 </widget>
196 <widget class="QWidget" name="FontTab">
197 <attribute name="title">
198 <string>Font</string>
199 </attribute>
200 <widget class="QGroupBox" name="MainFontGroupBox">
201 <property name="geometry">
202 <rect>
203 <x>20</x>
204 <y>20</y>
205 <width>307</width>
206 <height>119</height>
207 </rect>
208 </property>
209 <property name="title">
210 <string>Main Font</string>
211 </property>
212 <layout class="QGridLayout" name="gridLayout_2">
213 <item row="0" column="0">
214 <widget class="QLabel" name="MainFontlabel">
215 <property name="text">
216 <string>Font:</string>
217 </property>
218 </widget>
219 </item>
220 <item row="0" column="1" colspan="2">
221 <widget class="QFontComboBox" name="MainFontComboBox"/>
222 </item>
223 <item row="1" column="0">
224 <widget class="QLabel" name="MainFontColorLabel">
225 <property name="text">
226 <string>Font Color</string>
227 </property>
228 </widget>
229 </item>
230 <item row="1" column="2">
231 <widget class="QPushButton" name="MainFontColorPushButton">
232 <property name="text">
233 <string/>
234 </property>
235 </widget>
236 </item>
237 <item row="2" column="0">
238 <widget class="QLabel" name="MainFontSize">
239 <property name="text">
240 <string>Size:</string>
241 </property>
242 </widget>
243 </item>
244 <item row="2" column="1">
245 <widget class="QLineEdit" name="MainFontSizeLineEdit"/>
246 </item>
247 <item row="2" column="2">
248 <widget class="QSlider" name="MainFontlSlider">
249 <property name="value">
250 <number>15</number>
251 </property>
252 <property name="maximum">
253 <number>40</number>
254 </property>
255 <property name="orientation">
256 <enum>Qt::Horizontal</enum>
257 </property>
258 <property name="tickPosition">
259 <enum>QSlider::TicksBelow</enum>
260 </property>
261 <property name="tickInterval">
262 <number>5</number>
263 </property>
264 </widget>
265 </item>
266 </layout>
267 </widget>
268 <widget class="QGroupBox" name="FooterFontGroupBox">
269 <property name="geometry">
270 <rect>
271 <x>20</x>
272 <y>170</y>
273 <width>307</width>
274 <height>119</height>
275 </rect>
276 </property>
277 <property name="title">
278 <string>Footer Font</string>
279 </property>
280 <layout class="QGridLayout" name="gridLayout_3">
281 <item row="0" column="0">
282 <widget class="QLabel" name="FooterFontlabel">
283 <property name="text">
284 <string>Font:</string>
285 </property>
286 </widget>
287 </item>
288 <item row="0" column="1" colspan="2">
289 <widget class="QFontComboBox" name="FooterFontComboBox"/>
290 </item>
291 <item row="1" column="0">
292 <widget class="QLabel" name="FooterFontColorLabel">
293 <property name="text">
294 <string>Font Color</string>
295 </property>
296 </widget>
297 </item>
298 <item row="1" column="2">
299 <widget class="QPushButton" name="FooterColorPushButton">
300 <property name="text">
301 <string/>
302 </property>
303 </widget>
304 </item>
305 <item row="2" column="0">
306 <widget class="QLabel" name="FooterFontSize">
307 <property name="text">
308 <string>Size:</string>
309 </property>
310 </widget>
311 </item>
312 <item row="2" column="1">
313 <widget class="QLineEdit" name="FooterFontSizeLineEdit"/>
314 </item>
315 <item row="2" column="2">
316 <widget class="QSlider" name="FooterFontlSlider">
317 <property name="value">
318 <number>15</number>
319 </property>
320 <property name="maximum">
321 <number>40</number>
322 </property>
323 <property name="orientation">
324 <enum>Qt::Horizontal</enum>
325 </property>
326 <property name="tickPosition">
327 <enum>QSlider::TicksBelow</enum>
328 </property>
329 <property name="tickInterval">
330 <number>5</number>
331 </property>
332 </widget>
333 </item>
334 </layout>
335 </widget>
336 </widget>
337 <widget class="QWidget" name="OptionsTab">
338 <attribute name="title">
339 <string>Display Options</string>
340 </attribute>
341 <widget class="QGroupBox" name="ShadowGroupBox">
342 <property name="geometry">
343 <rect>
344 <x>20</x>
345 <y>10</y>
346 <width>301</width>
347 <height>80</height>
348 </rect>
349 </property>
350 <property name="title">
351 <string>Shadow</string>
352 </property>
353 <widget class="QWidget" name="layoutWidget">
354 <property name="geometry">
355 <rect>
356 <x>10</x>
357 <y>20</y>
358 <width>281</width>
359 <height>54</height>
360 </rect>
361 </property>
362 <layout class="QFormLayout" name="formLayout">
363 <item row="0" column="0">
364 <widget class="QCheckBox" name="ShadowCheckBox">
365 <property name="text">
366 <string>Use Shadow</string>
367 </property>
368 </widget>
369 </item>
370 <item row="1" column="0">
371 <widget class="QLabel" name="ShadowColorLabel">
372 <property name="text">
373 <string>Shadow Color:</string>
374 </property>
375 </widget>
376 </item>
377 <item row="1" column="1">
378 <widget class="QPushButton" name="ShadowColorPushButton">
379 <property name="text">
380 <string/>
381 </property>
382 </widget>
383 </item>
384 </layout>
385 </widget>
386 </widget>
387 <widget class="QGroupBox" name="AlignmentGroupBox">
388 <property name="geometry">
389 <rect>
390 <x>10</x>
391 <y>200</y>
392 <width>321</width>
393 <height>161</height>
394 </rect>
395 </property>
396 <property name="title">
397 <string>Alignment</string>
398 </property>
399 <layout class="QGridLayout" name="gridLayout_4">
400 <item row="0" column="0">
401 <widget class="QLabel" name="HorizontalLabel">
402 <property name="text">
403 <string>Horizontal Align:</string>
404 </property>
405 </widget>
406 </item>
407 <item row="0" column="1">
408 <widget class="QComboBox" name="HorizontalComboBox">
409 <item>
410 <property name="text">
411 <string>Left</string>
412 </property>
413 </item>
414 <item>
415 <property name="text">
416 <string>Right</string>
417 </property>
418 </item>
419 <item>
420 <property name="text">
421 <string>Center</string>
422 </property>
423 </item>
424 </widget>
425 </item>
426 <item row="1" column="0">
427 <widget class="QLabel" name="VerticalLabel">
428 <property name="text">
429 <string>Vertical Align:</string>
430 </property>
431 </widget>
432 </item>
433 <item row="1" column="1">
434 <widget class="QComboBox" name="VerticalComboBox">
435 <item>
436 <property name="text">
437 <string>Top</string>
438 </property>
439 </item>
440 <item>
441 <property name="text">
442 <string>Middle</string>
443 </property>
444 </item>
445 <item>
446 <property name="text">
447 <string>Bottom</string>
448 </property>
449 </item>
450 </widget>
451 </item>
452 </layout>
453 </widget>
454 <widget class="QGroupBox" name="OutlineGroupBox">
455 <property name="geometry">
456 <rect>
457 <x>20</x>
458 <y>110</y>
459 <width>301</width>
460 <height>80</height>
461 </rect>
462 </property>
463 <property name="title">
464 <string>Outline</string>
465 </property>
466 <widget class="QWidget" name="layoutWidget_3">
467 <property name="geometry">
468 <rect>
469 <x>10</x>
470 <y>20</y>
471 <width>281</width>
472 <height>54</height>
473 </rect>
474 </property>
475 <layout class="QFormLayout" name="OutlineformLayout">
476 <item row="0" column="0">
477 <widget class="QCheckBox" name="OutlineCheckBox">
478 <property name="text">
479 <string>Use Outline</string>
480 </property>
481 </widget>
482 </item>
483 <item row="1" column="0">
484 <widget class="QLabel" name="OutlineColorLabel">
485 <property name="text">
486 <string>Outline Color:</string>
487 </property>
488 </widget>
489 </item>
490 <item row="1" column="1">
491 <widget class="QPushButton" name="OutlineColorPushButton">
492 <property name="text">
493 <string/>
494 </property>
495 </widget>
496 </item>
497 </layout>
498 </widget>
499 </widget>
500 </widget>
501 </widget>
502 </widget>
503 </item>
504 <item>
505 <widget class="QWidget" name="RightSide" native="true">
506 <widget class="QGraphicsView" name="ThemePreView">
507 <property name="geometry">
508 <rect>
509 <x>0</x>
510 <y>30</y>
511 <width>341</width>
512 <height>341</height>
513 </rect>
514 </property>
515 </widget>
516 </widget>
517 </item>
518 </layout>
519 </widget>
520 <widget class="QWidget" name="layoutWidget">
521 <property name="geometry">
522 <rect>
523 <x>50</x>
524 <y>20</y>
525 <width>441</width>
526 <height>41</height>
527 </rect>
528 </property>
529 <layout class="QHBoxLayout" name="horizontalLayout">
530 <item>
531 <widget class="QLabel" name="ThemeNameLabel">
532 <property name="text">
533 <string>Theme Name</string>
534 </property>
535 </widget>
536 </item>
537 <item>
538 <widget class="QLineEdit" name="ThemeNameEdit"/>
539 </item>
540 </layout>
541 </widget>
542 </widget>
543 <resources>
544 <include location="../images/openlp-2.qrc"/>
545 </resources>
546 <connections/>
547</ui>