Merge lp:~trb143/openlp/ThemeManager into lp:openlp
- ThemeManager
- Merge into trunk
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 |
Related bugs: |
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.
Commit message
Description of the change
Tim Bentley (trb143) wrote : | # |
- 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
1 | === modified file 'openlp/core/__init__.py' |
2 | --- openlp/core/__init__.py 2009-02-28 23:19:45 +0000 |
3 | +++ openlp/core/__init__.py 2009-04-03 19:32:00 +0000 |
4 | @@ -23,7 +23,14 @@ |
5 | from settingsmanager import SettingsManager |
6 | from pluginmanager import PluginManager |
7 | |
8 | -__all__ = ['Renderer', 'SettingsManager', 'PluginManager', 'translate'] |
9 | +__all__ = ['Renderer', 'SettingsManager', 'PluginManager', 'translate', 'fileToXML'] |
10 | |
11 | def translate(context, text): |
12 | return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8) |
13 | + |
14 | +def fileToXML(xmlfile): |
15 | + file=open(xmlfile) |
16 | + xml =''.join(file.readlines()) # read the file and change list to a string |
17 | + file.close() |
18 | + return xml |
19 | + |
20 | |
21 | === modified file 'openlp/core/lib/eventmanager.py' |
22 | --- openlp/core/lib/eventmanager.py 2009-03-25 20:30:48 +0000 |
23 | +++ openlp/core/lib/eventmanager.py 2009-03-30 19:58:34 +0000 |
24 | @@ -26,21 +26,21 @@ |
25 | A mechanism to send events to all registered endpoints |
26 | the endpoints are registered and listen with a handle_event method |
27 | the endpoint will decide whether to do somthing with the event or ignore it |
28 | - |
29 | + |
30 | """ |
31 | global log |
32 | log=logging.getLogger(u'EventManager') |
33 | - |
34 | + |
35 | def __init__(self): |
36 | self.endpoints=[] |
37 | log.info(u'Initialising') |
38 | - |
39 | + |
40 | def register(self, plugin): |
41 | - log.debug(u'plugin %s registered with EventManager'%plugin) |
42 | + log.debug(u'plugin %s registered with EventManager', plugin) |
43 | self.endpoints.append(plugin) |
44 | - |
45 | + |
46 | def post_event(self, event): |
47 | - log.debug(u'post event called for event %s'%event.get_type) |
48 | + log.debug(u'post event called for event %s', event.get_type) |
49 | for point in self.endpoints: |
50 | point.handle_event(event) |
51 | |
52 | |
53 | === modified file 'openlp/core/lib/songxmlhandler.py' |
54 | --- openlp/core/lib/songxmlhandler.py 2009-03-14 07:08:15 +0000 |
55 | +++ openlp/core/lib/songxmlhandler.py 2009-03-31 20:16:54 +0000 |
56 | @@ -1,6 +1,24 @@ |
57 | +# -*- coding: utf-8 -*- |
58 | +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 |
59 | +""" |
60 | +OpenLP - Open Source Lyrics Projection |
61 | +Copyright (c) 2008 Raoul Snyman |
62 | +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard |
63 | + |
64 | +This program is free software; you can redistribute it and/or modify it under |
65 | +the terms of the GNU General Public License as published by the Free Software |
66 | +Foundation; version 2 of the License. |
67 | + |
68 | +This program is distributed in the hope that it will be useful, but WITHOUT ANY |
69 | +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
70 | +PARTICULAR PURPOSE. See the GNU General Public License for more details. |
71 | + |
72 | +You should have received a copy of the GNU General Public License along with |
73 | +this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
74 | +Place, Suite 330, Boston, MA 02111-1307 USA |
75 | from xml.dom.minidom import Document |
76 | from xml.etree.ElementTree import ElementTree, XML, dump |
77 | -""" |
78 | + |
79 | <?xml version="1.0" encoding="UTF-8"?> |
80 | <song version="1.0"> |
81 | <lyrics language="en"> |
82 | @@ -11,24 +29,27 @@ |
83 | </song> |
84 | |
85 | """ |
86 | +from xml.dom.minidom import Document |
87 | +from xml.etree.ElementTree import ElementTree, XML, dump |
88 | + |
89 | class SongXMLBuilder(): |
90 | def __init__(self): |
91 | - # Create the minidom document |
92 | + # Create the minidom document |
93 | self.song_xml = Document() |
94 | - |
95 | + |
96 | def new_document(self): |
97 | # Create the <song> base element |
98 | self.song = self.song_xml.createElement(u'song') |
99 | self.song_xml.appendChild(self.song) |
100 | self.song.setAttribute(u'version', u'1.0') |
101 | - |
102 | + |
103 | def add_lyrics_to_song(self): |
104 | # Create the main <lyrics> element |
105 | self.lyrics = self.song_xml.createElement(u'lyrics') |
106 | self.lyrics.setAttribute(u'language', u'en') |
107 | self.song.appendChild(self.lyrics) |
108 | - |
109 | - def add_verse_to_lyrics(self, type, number, content): |
110 | + |
111 | + def add_verse_to_lyrics(self, type, number, content): |
112 | """ |
113 | type - type of verse (Chorus, Verse , Bridge, Custom etc |
114 | number - number of item eg verse 1 |
115 | @@ -36,34 +57,34 @@ |
116 | """ |
117 | verse = self.song_xml.createElement(u'verse') |
118 | verse.setAttribute(u'type', type) |
119 | - verse.setAttribute(u'label', number) |
120 | + verse.setAttribute(u'label', number) |
121 | self.lyrics.appendChild(verse) |
122 | - |
123 | + |
124 | # add data as a CDATA section |
125 | cds = self.song_xml.createCDATASection(content) |
126 | verse.appendChild(cds) |
127 | - |
128 | + |
129 | def dump_xml(self): |
130 | # Debugging aid to see what we have |
131 | print self.song_xml.toprettyxml(indent=" ") |
132 | - |
133 | + |
134 | def extract_xml(self): |
135 | # Print our newly created XML |
136 | return self.song_xml.toxml() |
137 | - |
138 | + |
139 | class SongXMLParser(): |
140 | def __init__(self, xml): |
141 | self.song_xml = ElementTree(element=XML(xml)) |
142 | - |
143 | + |
144 | def get_verses(self): |
145 | #return a list of verse's and attributes |
146 | iter=self.song_xml.getiterator() |
147 | verse_list = [] |
148 | - for element in iter: |
149 | + for element in iter: |
150 | if element.tag == u'verse': |
151 | verse_list.append([element.attrib, element.text]) |
152 | return verse_list |
153 | - |
154 | + |
155 | def dump_xml(self): |
156 | # Debugging aid to see what we have |
157 | print dump(self.song_xml) |
158 | |
159 | === modified file 'openlp/core/lib/themexmlhandler.py' |
160 | --- openlp/core/lib/themexmlhandler.py 2009-03-28 20:12:22 +0000 |
161 | +++ openlp/core/lib/themexmlhandler.py 2009-04-04 17:36:15 +0000 |
162 | @@ -1,16 +1,29 @@ |
163 | -from xml.dom.minidom import Document |
164 | -from xml.etree.ElementTree import ElementTree, XML, dump |
165 | -""" |
166 | -<?xml version="1.0" encoding="UTF-8"?> |
167 | -<song version="1.0"> |
168 | - <lyrics language="en"> |
169 | - <verse type="chorus" label="1"> |
170 | - <![CDATA[ ... ]]> |
171 | - </verse> |
172 | - </lyrics> |
173 | -</song> |
174 | - |
175 | -""" |
176 | +# -*- coding: utf-8 -*- |
177 | +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 |
178 | +""" |
179 | +OpenLP - Open Source Lyrics Projection |
180 | +Copyright (c) 2008 Raoul Snyman |
181 | +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard |
182 | + |
183 | +This program is free software; you can redistribute it and/or modify it under |
184 | +the terms of the GNU General Public License as published by the Free Software |
185 | +Foundation; version 2 of the License. |
186 | + |
187 | +This program is distributed in the hope that it will be useful, but WITHOUT ANY |
188 | +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
189 | +PARTICULAR PURPOSE. See the GNU General Public License for more details. |
190 | + |
191 | +You should have received a copy of the GNU General Public License along with |
192 | +this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
193 | +Place, Suite 330, Boston, MA 02111-1307 USA |
194 | +from xml.dom.minidom import Document |
195 | +from xml.etree.ElementTree import ElementTree, XML, dump |
196 | + |
197 | +For XML Schema see wiki.openlp.org |
198 | +""" |
199 | +from xml.dom.minidom import Document |
200 | +from xml.etree.ElementTree import ElementTree, XML, dump |
201 | + |
202 | class ThemeXMLBuilder(): |
203 | def __init__(self): |
204 | # Create the minidom document |
205 | @@ -29,12 +42,12 @@ |
206 | |
207 | def add_background_transparent(self): |
208 | # Create the main <lyrics> element |
209 | - background = self.theme_xml.createElement(u'Background') |
210 | + background = self.theme_xml.createElement(u'background') |
211 | background.setAttribute(u'mode', u'transparent') |
212 | self.theme.appendChild(background) |
213 | |
214 | def add_background_solid(self, bkcolor): |
215 | - background = self.theme_xml.createElement(u'Background') |
216 | + background = self.theme_xml.createElement(u'background') |
217 | background.setAttribute(u'mode', u'opaque') |
218 | background.setAttribute(u'type', u'solid') |
219 | self.theme.appendChild(background) |
220 | @@ -44,24 +57,29 @@ |
221 | color.appendChild(bkc) |
222 | background.appendChild(color) |
223 | |
224 | - def add_background_gradient(self, startcolor, endcolor): |
225 | - background = self.theme_xml.createElement(u'Background') |
226 | + def add_background_gradient(self, startcolor, endcolor, direction): |
227 | + background = self.theme_xml.createElement(u'background') |
228 | background.setAttribute(u'mode', u'opaque') |
229 | - background.setAttribute(u'type', u'gradient') |
230 | + background.setAttribute(u'type', u'Gradient') |
231 | self.theme.appendChild(background) |
232 | |
233 | - color = self.theme_xml.createElement(u'startcolor') |
234 | + color = self.theme_xml.createElement(u'startColor') |
235 | bkc = self.theme_xml.createTextNode(startcolor) |
236 | color.appendChild(bkc) |
237 | background.appendChild(color) |
238 | |
239 | - color = self.theme_xml.createElement(u'endcolor') |
240 | + color = self.theme_xml.createElement(u'endColor') |
241 | bkc = self.theme_xml.createTextNode(endcolor) |
242 | color.appendChild(bkc) |
243 | background.appendChild(color) |
244 | |
245 | - def add_background_image(self, filename, bordercolor): |
246 | - background = self.theme_xml.createElement(u'Background') |
247 | + color = self.theme_xml.createElement(u'direction') |
248 | + bkc = self.theme_xml.createTextNode(direction) |
249 | + color.appendChild(bkc) |
250 | + background.appendChild(color) |
251 | + |
252 | + def add_background_image(self, filename): |
253 | + background = self.theme_xml.createElement(u'background') |
254 | background.setAttribute(u'mode', u'opaque') |
255 | background.setAttribute(u'type', u'image') |
256 | self.theme.appendChild(background) |
257 | @@ -71,26 +89,62 @@ |
258 | color.appendChild(bkc) |
259 | background.appendChild(color) |
260 | |
261 | - color = self.theme_xml.createElement(u'bordercolor') |
262 | - bkc = self.theme_xml.createTextNode(bordercolor) |
263 | - color.appendChild(bkc) |
264 | - background.appendChild(color) |
265 | - |
266 | - |
267 | - def add_verse_to_lyrics(self, type, number, content): |
268 | - """ |
269 | - type - type of verse (Chorus, Verse , Bridge, Custom etc |
270 | - number - number of item eg verse 1 |
271 | - content - the text to be stored |
272 | - """ |
273 | - verse = self.theme_xml.createElement(u'verse') |
274 | - verse.setAttribute(u'type', type) |
275 | - verse.setAttribute(u'label', number) |
276 | - self.lyrics.appendChild(verse) |
277 | - |
278 | - # add data as a CDATA section |
279 | - cds = self.theme_xml.createCDATASection(content) |
280 | - verse.appendChild(cds) |
281 | + def add_font(self, fontname, fontcolor, fontproportion, fonttype=u'main'): |
282 | + background = self.theme_xml.createElement(u'font') |
283 | + background.setAttribute(u'type',fonttype) |
284 | + self.theme.appendChild(background) |
285 | + |
286 | + name = self.theme_xml.createElement(u'name') |
287 | + fn = self.theme_xml.createTextNode(fontname) |
288 | + name.appendChild(fn) |
289 | + background.appendChild(name) |
290 | + |
291 | + name = self.theme_xml.createElement(u'color') |
292 | + fn = self.theme_xml.createTextNode(fontcolor) |
293 | + name.appendChild(fn) |
294 | + background.appendChild(name) |
295 | + |
296 | + name = self.theme_xml.createElement(u'proportion') |
297 | + fn = self.theme_xml.createTextNode(fontproportion) |
298 | + name.appendChild(fn) |
299 | + background.appendChild(name) |
300 | + |
301 | + def add_display(self, shadow, shadowColor, outline, outlineColor, horizontal, vertical, wrap): |
302 | + background = self.theme_xml.createElement(u'display') |
303 | + self.theme.appendChild(background) |
304 | + |
305 | + tagElement = self.theme_xml.createElement(u'shadow') |
306 | + tagElement.setAttribute(u'color',shadowColor) |
307 | + tagValue = self.theme_xml.createTextNode(shadow) |
308 | + tagElement.appendChild(tagValue) |
309 | + background.appendChild(tagElement) |
310 | + |
311 | + tagElement = self.theme_xml.createElement(u'outline') |
312 | + tagElement.setAttribute(u'color',outlineColor) |
313 | + tagValue = self.theme_xml.createTextNode(outline) |
314 | + tagElement.appendChild(tagValue) |
315 | + background.appendChild(tagElement) |
316 | + |
317 | + tagElement = self.theme_xml.createElement(u'horizontalAlign') |
318 | + tagValue = self.theme_xml.createTextNode(horizontal) |
319 | + tagElement.appendChild(tagValue) |
320 | + background.appendChild(tagElement) |
321 | + |
322 | + tagElement = self.theme_xml.createElement(u'verticalAlign') |
323 | + tagValue = self.theme_xml.createTextNode(vertical) |
324 | + tagElement.appendChild(tagValue) |
325 | + background.appendChild(tagElement) |
326 | + |
327 | + tagElement = self.theme_xml.createElement(u'wrapStyle') |
328 | + tagValue = self.theme_xml.createTextNode(wrap) |
329 | + tagElement.appendChild(tagValue) |
330 | + background.appendChild(tagElement) |
331 | + |
332 | + def child_element(self, tag, value): |
333 | + tagElement = self.theme_xml.createElement(tag) |
334 | + tagValue = self.theme_xml.createTextNode(value) |
335 | + tagElement.appendChild(ftagValue) |
336 | + self.background.appendChild(tagElement) |
337 | |
338 | def dump_xml(self): |
339 | # Debugging aid to see what we have |
340 | @@ -102,17 +156,35 @@ |
341 | |
342 | class ThemeXMLParser(): |
343 | def __init__(self, xml): |
344 | - self.theme_xml = ElementTree(element=XML(xml)) |
345 | - |
346 | - def get_verses(self): |
347 | - #return a list of verse's and attributes |
348 | - iter=self.theme_xml.getiterator() |
349 | - verse_list = [] |
350 | + theme_xml = ElementTree(element=XML(xml)) |
351 | + iter=theme_xml.getiterator() |
352 | + master = u'' |
353 | for element in iter: |
354 | - if element.tag == u'verse': |
355 | - verse_list.append([element.attrib, element.text]) |
356 | - return verse_list |
357 | + #print element.tag, element.text |
358 | + if len(element.getchildren()) > 0: |
359 | + master= element.tag + u'_' |
360 | + if len(element.attrib) > 0: |
361 | + #print "D", element.tag , element.attrib |
362 | + for e in element.attrib.iteritems(): |
363 | + #print "A", master, e[0], e[1] |
364 | + if master == u'font_' and e[0] == u'type': |
365 | + master += e[1] + u'_' |
366 | + elif master == u'display_' and (element.tag == u'shadow' or element.tag == u'outline'): |
367 | + #print "b", master, element.tag, element.text, e[0], e[1] |
368 | + setattr(self, master + element.tag , element.text) |
369 | + setattr(self, master + element.tag +u'_'+ e[0], e[1]) |
370 | + else: |
371 | + field = master + e[0] |
372 | + setattr(self, field, e[1]) |
373 | + else: |
374 | + #print "c", element.tag |
375 | + if element.tag is not None : |
376 | + field = master + element.tag |
377 | + setattr(self, field, element.text) |
378 | |
379 | - def dump_xml(self): |
380 | - # Debugging aid to see what we have |
381 | - print dump(self.theme_xml) |
382 | + def __str__(self): |
383 | + s = u'' |
384 | + for k in dir(self): |
385 | + if k[0:1] != u'_': |
386 | + s+= u'%30s : %s\n' %(k,getattr(self,k)) |
387 | + return s |
388 | |
389 | === modified file 'openlp/core/render.py' |
390 | --- openlp/core/render.py 2009-03-29 16:51:42 +0000 |
391 | +++ openlp/core/render.py 2009-04-04 17:36:15 +0000 |
392 | @@ -56,11 +56,11 @@ |
393 | |
394 | def set_theme(self, theme): |
395 | self._theme=theme |
396 | - if theme.BackgroundType == 2: |
397 | - self.set_bg_image(theme.BackgroundParameter1) |
398 | + if theme.background_type == u'image': |
399 | + self.set_bg_image(theme.background_filename) |
400 | |
401 | def set_bg_image(self, filename): |
402 | - log.debug(u"set bg image %s", filename) |
403 | + log.debug(u'set bg image %s', filename) |
404 | self._bg_image_filename=filename |
405 | if self._paint is not None: |
406 | self.scale_bg_image() |
407 | @@ -69,11 +69,13 @@ |
408 | assert self._paint |
409 | i=QtGui.QImage(self._bg_image_filename) |
410 | # rescale and offset |
411 | - imw=i.width();imh=i.height() |
412 | - dcw=self._paint.width()+1;dch=self._paint.height() |
413 | + imw=i.width() |
414 | + imh=i.height() |
415 | + dcw=self._paint.width()+1 |
416 | + dch=self._paint.height() |
417 | imratio=imw/float(imh) |
418 | dcratio=dcw/float(dch) |
419 | - log.debug(u"Image scaling params %s %s %s %s %s %s", imw, imh, imratio, dcw, dch, dcratio) |
420 | + log.debug(u'Image scaling params %s %s %s %s %s %s', imw, imh, imratio, dcw, dch, dcratio) |
421 | if imratio > dcratio: |
422 | scale=dcw/float(imw) |
423 | elif imratio < dcratio: |
424 | @@ -94,20 +96,20 @@ |
425 | def set_words_openlp(self, words): |
426 | # log.debug(u" "set words openlp", words |
427 | verses=[] |
428 | - words=words.replace("\r\n", "\n") |
429 | - verses_text=words.split('\n\n') |
430 | + words=words.replace(u'\r\n', u'\n') |
431 | + verses_text=words.split(u'\n\n') |
432 | for v in verses_text: |
433 | - lines=v.split('\n') |
434 | + lines=v.split(u'\n') |
435 | verses.append(self.split_set_of_lines(lines)[0]) |
436 | self.words=verses |
437 | verses_text=[] |
438 | for v in verses: |
439 | - verses_text.append('\n'.join(v).lstrip()) # remove first \n |
440 | + verses_text.append(u'\n'.join(v).lstrip()) # remove first \n |
441 | |
442 | return verses_text |
443 | |
444 | def render_screen(self, screennum): |
445 | - log.debug(u"render screen\n %s %s ", screennum, self.words[screennum]) |
446 | + log.debug(u'render screen\n %s %s ', screennum, self.words[screennum]) |
447 | import time |
448 | t=0.0 |
449 | words=self.words[screennum] |
450 | @@ -121,40 +123,49 @@ |
451 | def _render_background(self): |
452 | assert(self._theme) |
453 | assert(self._paint) |
454 | - log.debug(u"render background %s %s", self._theme.BackgroundType) |
455 | + log.debug(u'render background %s ', self._theme.background_type) |
456 | p=QtGui.QPainter() |
457 | p.begin(self._paint) |
458 | - if self._theme.BackgroundType == 0: |
459 | - p.fillRect(self._paint.rect(), self._theme.BackgroundParameter1) |
460 | - elif self._theme.BackgroundType == 1: # gradient |
461 | - #TODO Add Theme code and fix direction |
462 | - |
463 | - gradient = QtGui.QLinearGradient(0, 0, self._paint.width(), self._paint.height()) |
464 | - gradient.setColorAt(0, QtGui.QColor(255, 0, 0)) |
465 | - gradient.setColorAt(0.5, QtGui.QColor(0, 255, 0)) |
466 | - gradient.setColorAt(1, QtGui.QColor(0, 0, 255)) |
467 | + if self._theme.background_type == u'solid': |
468 | + p.fillRect(self._paint.rect(), QtGui.QColor(self._theme.background_color)) |
469 | + elif self._theme.background_type == u'Gradient' : # gradient |
470 | + gradient = None |
471 | + if self._theme.background_direction == u'vertical': |
472 | + w = int(self._paint.width())/2 |
473 | + gradient = QtGui.QLinearGradient(w, 0, w, self._paint.height()) # vertical |
474 | + elif self._theme.background_direction == u'horizontal': |
475 | + h = int(self._paint.height())/2 |
476 | + gradient = QtGui.QLinearGradient(0, h, self._paint.width(), h) # Horizontal |
477 | + else: |
478 | + w = int(self._paint.width())/2 |
479 | + h = int(self._paint.height())/2 |
480 | + gradient = QtGui.QRadialGradient(w, h, w) # Circular |
481 | + |
482 | + gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor)) |
483 | + gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor)) |
484 | + |
485 | p.setBrush(QtGui.QBrush(gradient)) |
486 | rectPath = QtGui.QPainterPath() |
487 | |
488 | - MAX_X = self._paint.width() |
489 | - MAX_Y = self._paint.height() |
490 | - |
491 | + max_x = self._paint.width() |
492 | + max_y = self._paint.height() |
493 | rectPath.moveTo(0, 0) |
494 | - rectPath.lineTo(0, MAX_Y) |
495 | - rectPath.lineTo(MAX_X, MAX_Y) |
496 | - rectPath.lineTo(MAX_X, 0) |
497 | + rectPath.lineTo(0, max_y) |
498 | + rectPath.lineTo(max_x, max_y) |
499 | + rectPath.lineTo(max_x, 0) |
500 | + |
501 | rectPath.closeSubpath() |
502 | p.drawPath(rectPath) |
503 | |
504 | - elif self._theme.BackgroundType == 2: # image |
505 | + elif self._theme.background_type== u'image': # image |
506 | r=self._paint.rect() |
507 | - log.debug(r.x(), r.y(), r.width(),r.height()) |
508 | - log.debug(self._theme.BackgroundParameter2) |
509 | - if self._theme.BackgroundParameter2 is not None: |
510 | - p.fillRect(self._paint.rect(), self._theme.BackgroundParameter2) |
511 | + log.debug(u'Image size details %d %d %d %d ', r.x(), r.y(), r.width(),r.height()) |
512 | + log.debug(u' Background Parameter %d ', self._theme.background_borderColor) |
513 | + if self._theme.Bbackground_borderColor is not None: |
514 | + p.fillRect(self._paint.rect(), self._theme.background_borderColor) |
515 | p.drawPixmap(self.background_offsetx,self.background_offsety, self.img) |
516 | p.end() |
517 | - log.debug(u"render background done") |
518 | + log.debug(u'render background done') |
519 | |
520 | def split_set_of_lines(self, lines): |
521 | |
522 | @@ -221,24 +232,23 @@ |
523 | |
524 | def _render_lines(self, lines): |
525 | """render a set of lines according to the theme, return bounding box""" |
526 | - log.debug(u"_render_lines %s", lines) |
527 | + #log.debug(u'_render_lines %s', lines) |
528 | |
529 | bbox=self._render_lines_unaligned(lines) |
530 | - print bbox |
531 | |
532 | t=self._theme |
533 | x=self._rect.left() |
534 | - if t.VerticalAlign==0: # top align |
535 | + if int(t.display_verticalAlign) == 0: # top align |
536 | y = self._rect.top() |
537 | - elif t.VerticalAlign==1: # bottom align |
538 | + elif int(t.display_verticalAlign) == 1: # bottom align |
539 | y=self._rect.bottom()-bbox.height() |
540 | - elif t.VerticalAlign==2: # centre align |
541 | + elif int(t.display_verticalAlign) == 2: # centre align |
542 | y=self._rect.top()+(self._rect.height()-bbox.height())/2 |
543 | else: |
544 | - assert(0, "Invalid value for theme.VerticalAlign:%d" % t.VerticalAlign) |
545 | + assert(0, u'Invalid value for theme.VerticalAlign:%s' % t.display_verticalAlign) |
546 | self._render_background() |
547 | bbox=self._render_lines_unaligned(lines, (x,y)) |
548 | - log.debug(u"render lines DONE") |
549 | + log.debug(u'render lines DONE') |
550 | |
551 | return bbox |
552 | |
553 | @@ -250,7 +260,7 @@ |
554 | than a screenful (eg. by using split_set_of_lines) |
555 | |
556 | Returns the bounding box of the text as QRect""" |
557 | - log.debug(u"render unaligned %s", lines) |
558 | + log.debug(u'render unaligned %s', lines) |
559 | x,y=tlcorner |
560 | brx=x |
561 | bry=y |
562 | @@ -269,7 +279,7 @@ |
563 | p.setPen(QtGui.QPen(QtGui.QColor(0,0,255))) |
564 | p.drawRect(retval) |
565 | p.end() |
566 | - log.debug(u"render unaligned DONE") |
567 | + log.debug(u'render unaligned DONE') |
568 | |
569 | return retval |
570 | |
571 | @@ -283,7 +293,7 @@ |
572 | |
573 | Returns the bottom-right corner (of what was rendered) as a tuple(x,y). |
574 | """ |
575 | - log.debug(u"Render single line '%s' @ %s "%( line, tlcorner)) |
576 | + #log.debug(u'Render single line %s @ %s '%( line, tlcorner)) |
577 | x,y=tlcorner |
578 | # We draw the text to see how big it is and then iterate to make it fit |
579 | # when we line wrap we do in in the "lyrics" style, so the second line is |
580 | @@ -291,8 +301,8 @@ |
581 | |
582 | # get the words |
583 | # log.debug(u" "Getting the words split right" |
584 | - words=line.split(" ") |
585 | - thisline=' '.join(words) |
586 | + words=line.split(u' ') |
587 | + thisline=u' '.join(words) |
588 | lastword=len(words) |
589 | lines=[] |
590 | maxx=self._rect.width(); maxy=self._rect.height(); |
591 | @@ -307,25 +317,22 @@ |
592 | else: |
593 | lastword-=1 |
594 | thisline=' '.join(words[:lastword]) |
595 | - |
596 | -# log.debug(u" "This is how they split", lines |
597 | -# log.debug(u" "Now render them" |
598 | startx=x |
599 | starty=y |
600 | rightextent=None |
601 | t=self._theme |
602 | - align=t.HorizontalAlign |
603 | - wrapstyle=t.WrapStyle |
604 | + align=t.display_horizontalAlign |
605 | + wrapstyle=t.display_wrapStyle |
606 | |
607 | for linenum in range(len(lines)): |
608 | line=lines[linenum] |
609 | #find out how wide line is |
610 | - w,h=self._get_extent_and_render(line, tlcorner=(x,y), dodraw=False) |
611 | + w,h=self._get_extent_and_render(line, tlcorner=(x,y), draw=False) |
612 | |
613 | - if t.Shadow: |
614 | + if t.display_shadow: |
615 | w+=self._shadow_offset |
616 | h+=self._shadow_offset |
617 | - if t.Outline: |
618 | + if t.display_outline: |
619 | w+=2*self._outline_offset # pixels either side |
620 | h+=2*self._outline_offset # pixels top/bottom |
621 | if align==0: # left align |
622 | @@ -343,21 +350,22 @@ |
623 | x=(maxx-w)/2; |
624 | rightextent=x+w |
625 | # now draw the text, and any outlines/shadows |
626 | - if t.Shadow: |
627 | - self._get_extent_and_render(line, tlcorner=(x+self._shadow_offset,y+self._shadow_offset), dodraw=True, color = t.ShadowColor) |
628 | - if t.Outline: |
629 | - self._get_extent_and_render(line, (x+self._outline_offset,y), dodraw=True, color = t.OutlineColor) |
630 | - self._get_extent_and_render(line, (x,y+self._outline_offset), dodraw=True, color = t.OutlineColor) |
631 | - self._get_extent_and_render(line, (x,y-self._outline_offset), dodraw=True, color = t.OutlineColor) |
632 | - self._get_extent_and_render(line, (x-self._outline_offset,y), dodraw=True, color = t.OutlineColor) |
633 | + if t.display_shadow: |
634 | + self._get_extent_and_render(line, tlcorner=(x+self._shadow_offset,y+self._shadow_offset), |
635 | + draw=True, color = t.display_shadow_color) |
636 | + if t.display_outline: |
637 | + self._get_extent_and_render(line, (x+self._outline_offset,y), draw=True, color = t.display_outline_color) |
638 | + self._get_extent_and_render(line, (x,y+self._outline_offset), draw=True, color = t.display_outline_color) |
639 | + self._get_extent_and_render(line, (x,y-self._outline_offset), draw=True, color = t.display_outline_color) |
640 | + self._get_extent_and_render(line, (x-self._outline_offset,y), draw=True, color = t.display_outline_color) |
641 | if self._outline_offset > 1: |
642 | - self._get_extent_and_render(line, (x+self._outline_offset,y+self._outline_offset), dodraw=True, color = t.OutlineColor) |
643 | - self._get_extent_and_render(line, (x-self._outline_offset,y+self._outline_offset), dodraw=True, color = t.OutlineColor) |
644 | - self._get_extent_and_render(line, (x+self._outline_offset,y-self._outline_offset), dodraw=True, color = t.OutlineColor) |
645 | - self._get_extent_and_render(line, (x-self._outline_offset,y-self._outline_offset), dodraw=True, color = t.OutlineColor) |
646 | + self._get_extent_and_render(line, (x+self._outline_offset,y+self._outline_offset), draw=True, color = t.display_outline_color) |
647 | + self._get_extent_and_render(line, (x-self._outline_offset,y+self._outline_offset), draw=True, color = t.display_outline_color) |
648 | + self._get_extent_and_render(line, (x+self._outline_offset,y-self._outline_offset), draw=True, color = t.display_outline_color) |
649 | + self._get_extent_and_render(line, (x-self._outline_offset,y-self._outline_offset), draw=True, color = t.display_outline_color) |
650 | |
651 | - self._get_extent_and_render(line, tlcorner=(x,y), dodraw=True) |
652 | -# log.debug(u" "Line %2d: Render '%s' at (%d, %d) wh=(%d,%d)"%( linenum, line, x, y,w,h) |
653 | + self._get_extent_and_render(line, tlcorner=(x,y), draw=True) |
654 | +# log.debug(u'Line %2d: Render '%s' at (%d, %d) wh=(%d,%d)' % ( linenum, line, x, y,w,h) |
655 | y += h |
656 | if linenum == 0: |
657 | self._first_line_right_extent=rightextent |
658 | @@ -373,47 +381,48 @@ |
659 | return brcorner |
660 | |
661 | # xxx this is what to override for an SDL version |
662 | - def _get_extent_and_render(self, line, tlcorner=(0,0), dodraw=False, color=None, footer = False): |
663 | + def _get_extent_and_render(self, line, tlcorner=(0,0), draw=False, color=None, footer=False): |
664 | """Find bounding box of text - as render_single_line. |
665 | - If dodraw is set, actually draw the text to the current DC as well |
666 | + If draw is set, actually draw the text to the current DC as well |
667 | |
668 | return width and height of text as a tuple (w,h)""" |
669 | # setup defaults |
670 | - log.debug(u"_get_extent_and_render %s %s %s ", [line], tlcorner, dodraw) |
671 | + #log.debug(u"_get_extent_and_render %s %s %s ", [line], tlcorner, draw) |
672 | p=QtGui.QPainter() |
673 | p.begin(self._paint) |
674 | # 'twould be more efficient to set this once when theme changes |
675 | # or p changes |
676 | if footer : |
677 | - font=QtGui.QFont(self._theme.FontName, |
678 | - 12, # size |
679 | + font=QtGui.QFont(self._theme.font_footer_name, |
680 | + int(self._theme.font_footer_proportion), # size |
681 | QtGui.QFont.Normal, # weight |
682 | 0)# italic |
683 | else: |
684 | - font=QtGui.QFont(self._theme.FontName, |
685 | - self._theme.FontProportion, # size |
686 | + font=QtGui.QFont(self._theme.font_main_name, |
687 | + int(self._theme.font_main_proportion), # size |
688 | QtGui.QFont.Normal, # weight |
689 | 0)# italic |
690 | # to make the unit tests monitor independent, we have to be able to |
691 | # specify whether a font proportion is in pixels or points |
692 | - if self._theme.FontUnits.lower() == "pixels": |
693 | - log.debug(u"pixels") |
694 | - if footer: |
695 | - font.setPixelSize(12) |
696 | - else: |
697 | - font.setPixelSize(self._theme.FontProportion) |
698 | - log.debug(u'Font details %s %s %s %s', self._theme.FontName, self._theme.FontProportion, font.family(), font.pointSize()) |
699 | + if footer: |
700 | + font.setPixelSize(int(self._theme.font_footer_proportion)) |
701 | + else: |
702 | + font.setPixelSize(int(self._theme.font_main_proportion)) |
703 | + #log.debug(u'Font details %s %s %s %d', self._theme.font_main_name, self._theme.font_main_proportion, font.family(), font.pointSize()) |
704 | p.setFont(font) |
705 | if color == None: |
706 | - p.setPen(self._theme.FontColor) |
707 | + if footer: |
708 | + p.setPen(QtGui.QColor(self._theme.font_footer_color)) |
709 | + else: |
710 | + p.setPen(QtGui.QColor(self._theme.font_main_color)) |
711 | else: |
712 | - p.setPen(color) |
713 | + p.setPen(QtGui.QColor(color)) |
714 | x,y=tlcorner |
715 | metrics=QtGui.QFontMetrics(font) |
716 | # xxx some fudges to make it exactly like wx! Take 'em out later |
717 | w=metrics.width(line) |
718 | h=metrics.height()-2 |
719 | - if dodraw: |
720 | + if draw: |
721 | p.drawText(x,y+metrics.height()-metrics.descent()-1, line) |
722 | p.end() |
723 | return (w, h) |
724 | |
725 | === modified file 'openlp/core/theme/theme.py' |
726 | --- openlp/core/theme/theme.py 2009-03-29 14:38:23 +0000 |
727 | +++ openlp/core/theme/theme.py 2009-04-03 19:32:00 +0000 |
728 | @@ -35,7 +35,7 @@ |
729 | ''' |
730 | |
731 | class Theme: |
732 | - def __init__(self, xmlfile=None): |
733 | + def __init__(self, xml): |
734 | """ stores the info about a theme |
735 | attributes: |
736 | name : theme name |
737 | @@ -77,11 +77,7 @@ |
738 | """ |
739 | # init to defaults |
740 | self._set_from_XML(blankstylexml) |
741 | - if xmlfile != None: |
742 | - # init from xmlfile |
743 | - file=open(xmlfile) |
744 | - t=''.join(file.readlines()) # read the file and change list to a string |
745 | - self._set_from_XML(t) |
746 | + self._set_from_XML(xml) |
747 | |
748 | def _get_as_string(self): |
749 | s="" |
750 | |
751 | === modified file 'openlp/core/ui/__init__.py' |
752 | --- openlp/core/ui/__init__.py 2009-03-22 07:11:05 +0000 |
753 | +++ openlp/core/ui/__init__.py 2009-04-04 17:36:15 +0000 |
754 | @@ -18,6 +18,7 @@ |
755 | Place, Suite 330, Boston, MA 02111-1307 USA |
756 | """ |
757 | |
758 | +from amendthemeform import AmendThemeForm |
759 | from slidecontroller import SlideController |
760 | from splashscreen import SplashScreen |
761 | from alertstab import AlertsTab |
762 | @@ -31,4 +32,4 @@ |
763 | from mainwindow import MainWindow |
764 | |
765 | __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', |
766 | - 'MainWindow', 'SlideController', 'ServiceManager', 'ThemeManager'] |
767 | + 'MainWindow', 'SlideController', 'ServiceManager', 'ThemeManager', 'AmendThemeForm'] |
768 | |
769 | === added file 'openlp/core/ui/amendthemedialog.py' |
770 | --- openlp/core/ui/amendthemedialog.py 1970-01-01 00:00:00 +0000 |
771 | +++ openlp/core/ui/amendthemedialog.py 2009-04-04 17:36:15 +0000 |
772 | @@ -0,0 +1,282 @@ |
773 | +# -*- coding: utf-8 -*- |
774 | + |
775 | +# Form implementation generated from reading ui file 'amendthemedialog.ui' |
776 | +# |
777 | +# Created: Sat Apr 4 18:09:38 2009 |
778 | +# by: PyQt4 UI code generator 4.4.4 |
779 | +# |
780 | +# WARNING! All changes made in this file will be lost! |
781 | + |
782 | +from PyQt4 import QtCore, QtGui |
783 | + |
784 | +class Ui_AmendThemeDialog(object): |
785 | + def setupUi(self, AmendThemeDialog): |
786 | + AmendThemeDialog.setObjectName("AmendThemeDialog") |
787 | + AmendThemeDialog.resize(752, 533) |
788 | + icon = QtGui.QIcon() |
789 | + icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
790 | + AmendThemeDialog.setWindowIcon(icon) |
791 | + self.ThemeButtonBox = QtGui.QDialogButtonBox(AmendThemeDialog) |
792 | + self.ThemeButtonBox.setGeometry(QtCore.QRect(580, 500, 156, 26)) |
793 | + self.ThemeButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) |
794 | + self.ThemeButtonBox.setObjectName("ThemeButtonBox") |
795 | + self.layoutWidget = QtGui.QWidget(AmendThemeDialog) |
796 | + self.layoutWidget.setGeometry(QtCore.QRect(30, 70, 691, 401)) |
797 | + self.layoutWidget.setObjectName("layoutWidget") |
798 | + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.layoutWidget) |
799 | + self.horizontalLayout_2.setObjectName("horizontalLayout_2") |
800 | + self.LeftSide = QtGui.QWidget(self.layoutWidget) |
801 | + self.LeftSide.setObjectName("LeftSide") |
802 | + self.tabWidget = QtGui.QTabWidget(self.LeftSide) |
803 | + self.tabWidget.setGeometry(QtCore.QRect(0, 0, 341, 401)) |
804 | + self.tabWidget.setObjectName("tabWidget") |
805 | + self.BackgroundTab = QtGui.QWidget() |
806 | + self.BackgroundTab.setObjectName("BackgroundTab") |
807 | + self.layoutWidget1 = QtGui.QWidget(self.BackgroundTab) |
808 | + self.layoutWidget1.setGeometry(QtCore.QRect(10, 10, 321, 351)) |
809 | + self.layoutWidget1.setObjectName("layoutWidget1") |
810 | + self.gridLayout = QtGui.QGridLayout(self.layoutWidget1) |
811 | + self.gridLayout.setObjectName("gridLayout") |
812 | + self.BackgroundLabel = QtGui.QLabel(self.layoutWidget1) |
813 | + self.BackgroundLabel.setObjectName("BackgroundLabel") |
814 | + self.gridLayout.addWidget(self.BackgroundLabel, 0, 0, 1, 2) |
815 | + self.BackgroundComboBox = QtGui.QComboBox(self.layoutWidget1) |
816 | + self.BackgroundComboBox.setObjectName("BackgroundComboBox") |
817 | + self.BackgroundComboBox.addItem(QtCore.QString()) |
818 | + self.BackgroundComboBox.addItem(QtCore.QString()) |
819 | + self.gridLayout.addWidget(self.BackgroundComboBox, 0, 2, 1, 2) |
820 | + self.BackgroundTypeLabel = QtGui.QLabel(self.layoutWidget1) |
821 | + self.BackgroundTypeLabel.setObjectName("BackgroundTypeLabel") |
822 | + self.gridLayout.addWidget(self.BackgroundTypeLabel, 1, 0, 1, 2) |
823 | + self.BackgroundTypeComboBox = QtGui.QComboBox(self.layoutWidget1) |
824 | + self.BackgroundTypeComboBox.setObjectName("BackgroundTypeComboBox") |
825 | + self.BackgroundTypeComboBox.addItem(QtCore.QString()) |
826 | + self.BackgroundTypeComboBox.addItem(QtCore.QString()) |
827 | + self.BackgroundTypeComboBox.addItem(QtCore.QString()) |
828 | + self.gridLayout.addWidget(self.BackgroundTypeComboBox, 1, 2, 1, 2) |
829 | + self.Color1Label = QtGui.QLabel(self.layoutWidget1) |
830 | + self.Color1Label.setObjectName("Color1Label") |
831 | + self.gridLayout.addWidget(self.Color1Label, 2, 0, 1, 1) |
832 | + self.Color1PushButton = QtGui.QPushButton(self.layoutWidget1) |
833 | + self.Color1PushButton.setObjectName("Color1PushButton") |
834 | + self.gridLayout.addWidget(self.Color1PushButton, 2, 2, 1, 2) |
835 | + self.Color2Label = QtGui.QLabel(self.layoutWidget1) |
836 | + self.Color2Label.setObjectName("Color2Label") |
837 | + self.gridLayout.addWidget(self.Color2Label, 3, 0, 1, 1) |
838 | + self.Color2PushButton = QtGui.QPushButton(self.layoutWidget1) |
839 | + self.Color2PushButton.setObjectName("Color2PushButton") |
840 | + self.gridLayout.addWidget(self.Color2PushButton, 3, 2, 1, 2) |
841 | + self.ImageLabel = QtGui.QLabel(self.layoutWidget1) |
842 | + self.ImageLabel.setObjectName("ImageLabel") |
843 | + self.gridLayout.addWidget(self.ImageLabel, 4, 0, 1, 1) |
844 | + self.ImageLineEdit = QtGui.QLineEdit(self.layoutWidget1) |
845 | + self.ImageLineEdit.setObjectName("ImageLineEdit") |
846 | + self.gridLayout.addWidget(self.ImageLineEdit, 4, 1, 1, 2) |
847 | + self.ImagePushButton = QtGui.QPushButton(self.layoutWidget1) |
848 | + icon1 = QtGui.QIcon() |
849 | + icon1.addPixmap(QtGui.QPixmap(":/services/service_open.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
850 | + self.ImagePushButton.setIcon(icon1) |
851 | + self.ImagePushButton.setObjectName("ImagePushButton") |
852 | + self.gridLayout.addWidget(self.ImagePushButton, 4, 3, 1, 1) |
853 | + self.GradientLabel = QtGui.QLabel(self.layoutWidget1) |
854 | + self.GradientLabel.setObjectName("GradientLabel") |
855 | + self.gridLayout.addWidget(self.GradientLabel, 5, 0, 1, 1) |
856 | + self.GradientComboBox = QtGui.QComboBox(self.layoutWidget1) |
857 | + self.GradientComboBox.setObjectName("GradientComboBox") |
858 | + self.GradientComboBox.addItem(QtCore.QString()) |
859 | + self.GradientComboBox.addItem(QtCore.QString()) |
860 | + self.GradientComboBox.addItem(QtCore.QString()) |
861 | + self.gridLayout.addWidget(self.GradientComboBox, 5, 2, 1, 2) |
862 | + self.tabWidget.addTab(self.BackgroundTab, "") |
863 | + self.FontTab = QtGui.QWidget() |
864 | + self.FontTab.setObjectName("FontTab") |
865 | + self.MainFontGroupBox = QtGui.QGroupBox(self.FontTab) |
866 | + self.MainFontGroupBox.setGeometry(QtCore.QRect(20, 20, 307, 119)) |
867 | + self.MainFontGroupBox.setObjectName("MainFontGroupBox") |
868 | + self.gridLayout_2 = QtGui.QGridLayout(self.MainFontGroupBox) |
869 | + self.gridLayout_2.setObjectName("gridLayout_2") |
870 | + self.MainFontlabel = QtGui.QLabel(self.MainFontGroupBox) |
871 | + self.MainFontlabel.setObjectName("MainFontlabel") |
872 | + self.gridLayout_2.addWidget(self.MainFontlabel, 0, 0, 1, 1) |
873 | + self.MainFontComboBox = QtGui.QFontComboBox(self.MainFontGroupBox) |
874 | + self.MainFontComboBox.setObjectName("MainFontComboBox") |
875 | + self.gridLayout_2.addWidget(self.MainFontComboBox, 0, 1, 1, 2) |
876 | + self.MainFontColorLabel = QtGui.QLabel(self.MainFontGroupBox) |
877 | + self.MainFontColorLabel.setObjectName("MainFontColorLabel") |
878 | + self.gridLayout_2.addWidget(self.MainFontColorLabel, 1, 0, 1, 1) |
879 | + self.MainFontColorPushButton = QtGui.QPushButton(self.MainFontGroupBox) |
880 | + self.MainFontColorPushButton.setObjectName("MainFontColorPushButton") |
881 | + self.gridLayout_2.addWidget(self.MainFontColorPushButton, 1, 2, 1, 1) |
882 | + self.MainFontSize = QtGui.QLabel(self.MainFontGroupBox) |
883 | + self.MainFontSize.setObjectName("MainFontSize") |
884 | + self.gridLayout_2.addWidget(self.MainFontSize, 2, 0, 1, 1) |
885 | + self.MainFontSizeLineEdit = QtGui.QLineEdit(self.MainFontGroupBox) |
886 | + self.MainFontSizeLineEdit.setObjectName("MainFontSizeLineEdit") |
887 | + self.gridLayout_2.addWidget(self.MainFontSizeLineEdit, 2, 1, 1, 1) |
888 | + self.MainFontlSlider = QtGui.QSlider(self.MainFontGroupBox) |
889 | + self.MainFontlSlider.setProperty("value", QtCore.QVariant(15)) |
890 | + self.MainFontlSlider.setMaximum(40) |
891 | + self.MainFontlSlider.setOrientation(QtCore.Qt.Horizontal) |
892 | + self.MainFontlSlider.setTickPosition(QtGui.QSlider.TicksBelow) |
893 | + self.MainFontlSlider.setTickInterval(5) |
894 | + self.MainFontlSlider.setObjectName("MainFontlSlider") |
895 | + self.gridLayout_2.addWidget(self.MainFontlSlider, 2, 2, 1, 1) |
896 | + self.FooterFontGroupBox = QtGui.QGroupBox(self.FontTab) |
897 | + self.FooterFontGroupBox.setGeometry(QtCore.QRect(20, 170, 307, 119)) |
898 | + self.FooterFontGroupBox.setObjectName("FooterFontGroupBox") |
899 | + self.gridLayout_3 = QtGui.QGridLayout(self.FooterFontGroupBox) |
900 | + self.gridLayout_3.setObjectName("gridLayout_3") |
901 | + self.FooterFontlabel = QtGui.QLabel(self.FooterFontGroupBox) |
902 | + self.FooterFontlabel.setObjectName("FooterFontlabel") |
903 | + self.gridLayout_3.addWidget(self.FooterFontlabel, 0, 0, 1, 1) |
904 | + self.FooterFontComboBox = QtGui.QFontComboBox(self.FooterFontGroupBox) |
905 | + self.FooterFontComboBox.setObjectName("FooterFontComboBox") |
906 | + self.gridLayout_3.addWidget(self.FooterFontComboBox, 0, 1, 1, 2) |
907 | + self.FooterFontColorLabel = QtGui.QLabel(self.FooterFontGroupBox) |
908 | + self.FooterFontColorLabel.setObjectName("FooterFontColorLabel") |
909 | + self.gridLayout_3.addWidget(self.FooterFontColorLabel, 1, 0, 1, 1) |
910 | + self.FooterColorPushButton = QtGui.QPushButton(self.FooterFontGroupBox) |
911 | + self.FooterColorPushButton.setObjectName("FooterColorPushButton") |
912 | + self.gridLayout_3.addWidget(self.FooterColorPushButton, 1, 2, 1, 1) |
913 | + self.FooterFontSize = QtGui.QLabel(self.FooterFontGroupBox) |
914 | + self.FooterFontSize.setObjectName("FooterFontSize") |
915 | + self.gridLayout_3.addWidget(self.FooterFontSize, 2, 0, 1, 1) |
916 | + self.FooterFontSizeLineEdit = QtGui.QLineEdit(self.FooterFontGroupBox) |
917 | + self.FooterFontSizeLineEdit.setObjectName("FooterFontSizeLineEdit") |
918 | + self.gridLayout_3.addWidget(self.FooterFontSizeLineEdit, 2, 1, 1, 1) |
919 | + self.FooterFontlSlider = QtGui.QSlider(self.FooterFontGroupBox) |
920 | + self.FooterFontlSlider.setProperty("value", QtCore.QVariant(15)) |
921 | + self.FooterFontlSlider.setMaximum(40) |
922 | + self.FooterFontlSlider.setOrientation(QtCore.Qt.Horizontal) |
923 | + self.FooterFontlSlider.setTickPosition(QtGui.QSlider.TicksBelow) |
924 | + self.FooterFontlSlider.setTickInterval(5) |
925 | + self.FooterFontlSlider.setObjectName("FooterFontlSlider") |
926 | + self.gridLayout_3.addWidget(self.FooterFontlSlider, 2, 2, 1, 1) |
927 | + self.tabWidget.addTab(self.FontTab, "") |
928 | + self.OptionsTab = QtGui.QWidget() |
929 | + self.OptionsTab.setObjectName("OptionsTab") |
930 | + self.ShadowGroupBox = QtGui.QGroupBox(self.OptionsTab) |
931 | + self.ShadowGroupBox.setGeometry(QtCore.QRect(20, 10, 301, 80)) |
932 | + self.ShadowGroupBox.setObjectName("ShadowGroupBox") |
933 | + self.layoutWidget2 = QtGui.QWidget(self.ShadowGroupBox) |
934 | + self.layoutWidget2.setGeometry(QtCore.QRect(10, 20, 281, 54)) |
935 | + self.layoutWidget2.setObjectName("layoutWidget2") |
936 | + self.formLayout = QtGui.QFormLayout(self.layoutWidget2) |
937 | + self.formLayout.setObjectName("formLayout") |
938 | + self.ShadowCheckBox = QtGui.QCheckBox(self.layoutWidget2) |
939 | + self.ShadowCheckBox.setObjectName("ShadowCheckBox") |
940 | + self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.ShadowCheckBox) |
941 | + self.ShadowColorLabel = QtGui.QLabel(self.layoutWidget2) |
942 | + self.ShadowColorLabel.setObjectName("ShadowColorLabel") |
943 | + self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.ShadowColorLabel) |
944 | + self.ShadowColorPushButton = QtGui.QPushButton(self.layoutWidget2) |
945 | + self.ShadowColorPushButton.setObjectName("ShadowColorPushButton") |
946 | + self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ShadowColorPushButton) |
947 | + self.AlignmentGroupBox = QtGui.QGroupBox(self.OptionsTab) |
948 | + self.AlignmentGroupBox.setGeometry(QtCore.QRect(10, 200, 321, 161)) |
949 | + self.AlignmentGroupBox.setObjectName("AlignmentGroupBox") |
950 | + self.gridLayout_4 = QtGui.QGridLayout(self.AlignmentGroupBox) |
951 | + self.gridLayout_4.setObjectName("gridLayout_4") |
952 | + self.HorizontalLabel = QtGui.QLabel(self.AlignmentGroupBox) |
953 | + self.HorizontalLabel.setObjectName("HorizontalLabel") |
954 | + self.gridLayout_4.addWidget(self.HorizontalLabel, 0, 0, 1, 1) |
955 | + self.HorizontalComboBox = QtGui.QComboBox(self.AlignmentGroupBox) |
956 | + self.HorizontalComboBox.setObjectName("HorizontalComboBox") |
957 | + self.HorizontalComboBox.addItem(QtCore.QString()) |
958 | + self.HorizontalComboBox.addItem(QtCore.QString()) |
959 | + self.HorizontalComboBox.addItem(QtCore.QString()) |
960 | + self.gridLayout_4.addWidget(self.HorizontalComboBox, 0, 1, 1, 1) |
961 | + self.VerticalLabel = QtGui.QLabel(self.AlignmentGroupBox) |
962 | + self.VerticalLabel.setObjectName("VerticalLabel") |
963 | + self.gridLayout_4.addWidget(self.VerticalLabel, 1, 0, 1, 1) |
964 | + self.VerticalComboBox = QtGui.QComboBox(self.AlignmentGroupBox) |
965 | + self.VerticalComboBox.setObjectName("VerticalComboBox") |
966 | + self.VerticalComboBox.addItem(QtCore.QString()) |
967 | + self.VerticalComboBox.addItem(QtCore.QString()) |
968 | + self.VerticalComboBox.addItem(QtCore.QString()) |
969 | + self.gridLayout_4.addWidget(self.VerticalComboBox, 1, 1, 1, 1) |
970 | + self.OutlineGroupBox = QtGui.QGroupBox(self.OptionsTab) |
971 | + self.OutlineGroupBox.setGeometry(QtCore.QRect(20, 110, 301, 80)) |
972 | + self.OutlineGroupBox.setObjectName("OutlineGroupBox") |
973 | + self.layoutWidget_3 = QtGui.QWidget(self.OutlineGroupBox) |
974 | + self.layoutWidget_3.setGeometry(QtCore.QRect(10, 20, 281, 54)) |
975 | + self.layoutWidget_3.setObjectName("layoutWidget_3") |
976 | + self.OutlineformLayout = QtGui.QFormLayout(self.layoutWidget_3) |
977 | + self.OutlineformLayout.setObjectName("OutlineformLayout") |
978 | + self.OutlineCheckBox = QtGui.QCheckBox(self.layoutWidget_3) |
979 | + self.OutlineCheckBox.setObjectName("OutlineCheckBox") |
980 | + self.OutlineformLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.OutlineCheckBox) |
981 | + self.OutlineColorLabel = QtGui.QLabel(self.layoutWidget_3) |
982 | + self.OutlineColorLabel.setObjectName("OutlineColorLabel") |
983 | + self.OutlineformLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OutlineColorLabel) |
984 | + self.OutlineColorPushButton = QtGui.QPushButton(self.layoutWidget_3) |
985 | + self.OutlineColorPushButton.setObjectName("OutlineColorPushButton") |
986 | + self.OutlineformLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.OutlineColorPushButton) |
987 | + self.tabWidget.addTab(self.OptionsTab, "") |
988 | + self.horizontalLayout_2.addWidget(self.LeftSide) |
989 | + self.RightSide = QtGui.QWidget(self.layoutWidget) |
990 | + self.RightSide.setObjectName("RightSide") |
991 | + self.ThemePreView = QtGui.QGraphicsView(self.RightSide) |
992 | + self.ThemePreView.setGeometry(QtCore.QRect(0, 30, 341, 341)) |
993 | + self.ThemePreView.setObjectName("ThemePreView") |
994 | + self.horizontalLayout_2.addWidget(self.RightSide) |
995 | + self.layoutWidget3 = QtGui.QWidget(AmendThemeDialog) |
996 | + self.layoutWidget3.setGeometry(QtCore.QRect(50, 20, 441, 41)) |
997 | + self.layoutWidget3.setObjectName("layoutWidget3") |
998 | + self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget3) |
999 | + self.horizontalLayout.setObjectName("horizontalLayout") |
1000 | + self.ThemeNameLabel = QtGui.QLabel(self.layoutWidget3) |
1001 | + self.ThemeNameLabel.setObjectName("ThemeNameLabel") |
1002 | + self.horizontalLayout.addWidget(self.ThemeNameLabel) |
1003 | + self.ThemeNameEdit = QtGui.QLineEdit(self.layoutWidget3) |
1004 | + self.ThemeNameEdit.setObjectName("ThemeNameEdit") |
1005 | + self.horizontalLayout.addWidget(self.ThemeNameEdit) |
1006 | + |
1007 | + self.retranslateUi(AmendThemeDialog) |
1008 | + self.tabWidget.setCurrentIndex(1) |
1009 | + QtCore.QMetaObject.connectSlotsByName(AmendThemeDialog) |
1010 | + |
1011 | + def retranslateUi(self, AmendThemeDialog): |
1012 | + AmendThemeDialog.setWindowTitle(QtGui.QApplication.translate("AmendThemeDialog", "Theme Maintance", None, QtGui.QApplication.UnicodeUTF8)) |
1013 | + self.BackgroundLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Background:", None, QtGui.QApplication.UnicodeUTF8)) |
1014 | + self.BackgroundComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Opaque", None, QtGui.QApplication.UnicodeUTF8)) |
1015 | + self.BackgroundComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Transparent", None, QtGui.QApplication.UnicodeUTF8)) |
1016 | + self.BackgroundTypeLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Background Type:", None, QtGui.QApplication.UnicodeUTF8)) |
1017 | + self.BackgroundTypeComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Solid Color", None, QtGui.QApplication.UnicodeUTF8)) |
1018 | + self.BackgroundTypeComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Gradient", None, QtGui.QApplication.UnicodeUTF8)) |
1019 | + self.BackgroundTypeComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Image", None, QtGui.QApplication.UnicodeUTF8)) |
1020 | + self.Color1Label.setText(QtGui.QApplication.translate("AmendThemeDialog", "<Color1>", None, QtGui.QApplication.UnicodeUTF8)) |
1021 | + self.Color2Label.setText(QtGui.QApplication.translate("AmendThemeDialog", "<Color2>", None, QtGui.QApplication.UnicodeUTF8)) |
1022 | + self.ImageLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Image:", None, QtGui.QApplication.UnicodeUTF8)) |
1023 | + self.GradientLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Gradient :", None, QtGui.QApplication.UnicodeUTF8)) |
1024 | + self.GradientComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Horizontal", None, QtGui.QApplication.UnicodeUTF8)) |
1025 | + self.GradientComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Vertical", None, QtGui.QApplication.UnicodeUTF8)) |
1026 | + self.GradientComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Circular", None, QtGui.QApplication.UnicodeUTF8)) |
1027 | + self.tabWidget.setTabText(self.tabWidget.indexOf(self.BackgroundTab), QtGui.QApplication.translate("AmendThemeDialog", "Background", None, QtGui.QApplication.UnicodeUTF8)) |
1028 | + self.MainFontGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Main Font", None, QtGui.QApplication.UnicodeUTF8)) |
1029 | + self.MainFontlabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font:", None, QtGui.QApplication.UnicodeUTF8)) |
1030 | + self.MainFontColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color", None, QtGui.QApplication.UnicodeUTF8)) |
1031 | + self.MainFontSize.setText(QtGui.QApplication.translate("AmendThemeDialog", "Size:", None, QtGui.QApplication.UnicodeUTF8)) |
1032 | + self.FooterFontGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Footer Font", None, QtGui.QApplication.UnicodeUTF8)) |
1033 | + self.FooterFontlabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font:", None, QtGui.QApplication.UnicodeUTF8)) |
1034 | + self.FooterFontColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color", None, QtGui.QApplication.UnicodeUTF8)) |
1035 | + self.FooterFontSize.setText(QtGui.QApplication.translate("AmendThemeDialog", "Size:", None, QtGui.QApplication.UnicodeUTF8)) |
1036 | + self.tabWidget.setTabText(self.tabWidget.indexOf(self.FontTab), QtGui.QApplication.translate("AmendThemeDialog", "Font", None, QtGui.QApplication.UnicodeUTF8)) |
1037 | + self.ShadowGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Shadow", None, QtGui.QApplication.UnicodeUTF8)) |
1038 | + self.ShadowCheckBox.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use Shadow", None, QtGui.QApplication.UnicodeUTF8)) |
1039 | + self.ShadowColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Shadow Color:", None, QtGui.QApplication.UnicodeUTF8)) |
1040 | + self.AlignmentGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Alignment", None, QtGui.QApplication.UnicodeUTF8)) |
1041 | + self.HorizontalLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Horizontal Align:", None, QtGui.QApplication.UnicodeUTF8)) |
1042 | + self.HorizontalComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Left", None, QtGui.QApplication.UnicodeUTF8)) |
1043 | + self.HorizontalComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Right", None, QtGui.QApplication.UnicodeUTF8)) |
1044 | + self.HorizontalComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Center", None, QtGui.QApplication.UnicodeUTF8)) |
1045 | + self.VerticalLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Vertical Align:", None, QtGui.QApplication.UnicodeUTF8)) |
1046 | + self.VerticalComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Top", None, QtGui.QApplication.UnicodeUTF8)) |
1047 | + self.VerticalComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Middle", None, QtGui.QApplication.UnicodeUTF8)) |
1048 | + self.VerticalComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Bottom", None, QtGui.QApplication.UnicodeUTF8)) |
1049 | + self.OutlineGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Outline", None, QtGui.QApplication.UnicodeUTF8)) |
1050 | + self.OutlineCheckBox.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use Outline", None, QtGui.QApplication.UnicodeUTF8)) |
1051 | + self.OutlineColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Outline Color:", None, QtGui.QApplication.UnicodeUTF8)) |
1052 | + self.tabWidget.setTabText(self.tabWidget.indexOf(self.OptionsTab), QtGui.QApplication.translate("AmendThemeDialog", "Display Options", None, QtGui.QApplication.UnicodeUTF8)) |
1053 | + self.ThemeNameLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Theme Name", None, QtGui.QApplication.UnicodeUTF8)) |
1054 | + |
1055 | |
1056 | === added file 'openlp/core/ui/amendthemeform.py' |
1057 | --- openlp/core/ui/amendthemeform.py 1970-01-01 00:00:00 +0000 |
1058 | +++ openlp/core/ui/amendthemeform.py 2009-04-04 17:36:15 +0000 |
1059 | @@ -0,0 +1,37 @@ |
1060 | +# -*- coding: utf-8 -*- |
1061 | +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 |
1062 | +""" |
1063 | +OpenLP - Open Source Lyrics Projection |
1064 | +Copyright (c) 2008 Raoul Snyman |
1065 | +Portions copyright (c) 2008 Martin Thompson, Tim Bentley, |
1066 | + |
1067 | +This program is free software; you can redistribute it and/or modify it under |
1068 | +the terms of the GNU General Public License as published by the Free Software |
1069 | +Foundation; version 2 of the License. |
1070 | + |
1071 | +This program is distributed in the hope that it will be useful, but WITHOUT ANY |
1072 | +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
1073 | +PARTICULAR PURPOSE. See the GNU General Public License for more details. |
1074 | + |
1075 | +You should have received a copy of the GNU General Public License along with |
1076 | +this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
1077 | +Place, Suite 330, Boston, MA 02111-1307 USA |
1078 | +""" |
1079 | +import logging |
1080 | + |
1081 | +from PyQt4 import QtCore, QtGui |
1082 | + |
1083 | +#from openlp.core.resources import * |
1084 | + |
1085 | +from amendthemedialog import Ui_AmendThemeDialog |
1086 | + |
1087 | +log = logging.getLogger(u'AmendThemeForm') |
1088 | + |
1089 | +class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): |
1090 | + |
1091 | + def __init__(self, parent=None): |
1092 | + QtGui.QDialog.__init__(self, parent) |
1093 | + self.setupUi(self) |
1094 | + |
1095 | + def loadTheme(self, theme): |
1096 | + pass |
1097 | |
1098 | === modified file 'openlp/core/ui/mainwindow.py' (properties changed: -x to +x) |
1099 | --- openlp/core/ui/mainwindow.py 2009-03-23 19:17:07 +0000 |
1100 | +++ openlp/core/ui/mainwindow.py 2009-04-05 18:33:56 +0000 |
1101 | @@ -39,16 +39,16 @@ |
1102 | |
1103 | def __init__(self): |
1104 | self.main_window = QtGui.QMainWindow() |
1105 | - self.EventManager = EventManager() |
1106 | + self.EventManager = EventManager() |
1107 | self.alert_form = AlertForm() |
1108 | self.about_form = AboutForm() |
1109 | self.settings_form = SettingsForm() |
1110 | - |
1111 | + |
1112 | pluginpath = os.path.split(os.path.abspath(__file__))[0] |
1113 | pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins')) |
1114 | self.plugin_manager = PluginManager(pluginpath) |
1115 | self.plugin_helpers = {} |
1116 | - |
1117 | + |
1118 | self.setupUi() |
1119 | |
1120 | log.info(u'Load Plugins') |
1121 | @@ -56,7 +56,7 @@ |
1122 | self.plugin_helpers[u'live'] = self.LiveController |
1123 | self.plugin_helpers[u'event'] = self.EventManager |
1124 | self.plugin_helpers[u'theme'] = self.ThemeManagerContents # Theme manger |
1125 | - |
1126 | + |
1127 | self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers, self.EventManager) |
1128 | # hook methods have to happen after find_plugins. Find plugins needs the controllers |
1129 | # hence the hooks have moved from setupUI() to here |
1130 | @@ -77,9 +77,14 @@ |
1131 | self.plugin_manager.hook_export_menu(self.FileExportMenu) |
1132 | |
1133 | # Call the initialise method to setup plugins. |
1134 | - log.info(u'initialise plugins') |
1135 | + log.info(u'initialise plugins') |
1136 | self.plugin_manager.initialise_plugins() |
1137 | - |
1138 | + |
1139 | + # Once all components are initialised load the Themes |
1140 | + log.info(u'Load Themes') |
1141 | + self.ThemeManagerContents.setEventManager(self.EventManager) |
1142 | + self.ThemeManagerContents.loadThemes() |
1143 | + |
1144 | def setupUi(self): |
1145 | self.main_window.setObjectName("main_window") |
1146 | self.main_window.resize(1087, 847) |
1147 | @@ -176,7 +181,7 @@ |
1148 | self.ServiceManagerContents = ServiceManager(self) |
1149 | self.ServiceManagerDock.setWidget(self.ServiceManagerContents) |
1150 | self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock) |
1151 | - #Theme Manager Defined |
1152 | + #Theme Manager Defined |
1153 | self.ThemeManagerDock = QtGui.QDockWidget(self.main_window) |
1154 | ThemeManagerIcon = QtGui.QIcon() |
1155 | ThemeManagerIcon.addPixmap(QtGui.QPixmap(":/system/system_thememanager.png"), |
1156 | @@ -184,46 +189,12 @@ |
1157 | self.ThemeManagerDock.setWindowIcon(ThemeManagerIcon) |
1158 | self.ThemeManagerDock.setFloating(False) |
1159 | self.ThemeManagerDock.setObjectName("ThemeManagerDock") |
1160 | - |
1161 | - self.ThemeManagerContents = ThemeManager(self) |
1162 | - |
1163 | -# self.ThemeManagerContents = QtGui.QWidget() |
1164 | -# self.ThemeManagerContents.setObjectName("ThemeManagerContents") |
1165 | -# self.ThemeManagerLayout = QtGui.QVBoxLayout(self.ThemeManagerContents) |
1166 | -# self.ThemeManagerLayout.setSpacing(0) |
1167 | -# self.ThemeManagerLayout.setMargin(0) |
1168 | -# self.ThemeManagerLayout.setObjectName("ThemeManagerLayout") |
1169 | -# self.ThemeManagerToolbar = QtGui.QToolBar(self.ThemeManagerContents) |
1170 | -# self.ThemeManagerToolbar.setObjectName("ThemeManagerToolbar") |
1171 | -# NewThemeIcon = QtGui.QIcon() |
1172 | -# NewThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_new.png"), |
1173 | -# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
1174 | -# self.ThemeNewItem = self.ThemeManagerToolbar.addAction(NewThemeIcon, 'New theme') |
1175 | -# EditThemeIcon = QtGui.QIcon() |
1176 | -# EditThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_edit.png"), |
1177 | -# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
1178 | -# self.ThemeEditItem = self.ThemeManagerToolbar.addAction(EditThemeIcon, 'Edit theme') |
1179 | -# DeleteThemeIcon = QtGui.QIcon() |
1180 | -# DeleteThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_delete.png"), |
1181 | -# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
1182 | -# self.ThemeDeleteButton = self.ThemeManagerToolbar.addAction(DeleteThemeIcon, 'Delete theme') |
1183 | -# self.ThemeManagerToolbar.addSeparator() |
1184 | -# ImportThemeIcon = QtGui.QIcon() |
1185 | -# ImportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_import.png"), |
1186 | -# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
1187 | -# self.ThemeImportButton = self.ThemeManagerToolbar.addAction(ImportThemeIcon, 'Import theme') |
1188 | -# ExportThemeIcon = QtGui.QIcon() |
1189 | -# ExportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_export.png"), |
1190 | -# QtGui.QIcon.Normal, QtGui.QIcon.Off) |
1191 | -# self.ThemeExportButton = self.ThemeManagerToolbar.addAction(ExportThemeIcon, 'Export theme') |
1192 | -# self.ThemeManagerLayout.addWidget(self.ThemeManagerToolbar) |
1193 | -# self.ThemeManagerListView = QtGui.QListView(self.ThemeManagerContents) |
1194 | -# self.ThemeManagerListView.setObjectName("ThemeManagerListView") |
1195 | -# self.ThemeManagerLayout.addWidget(self.ThemeManagerListView) |
1196 | + |
1197 | + self.ThemeManagerContents = ThemeManager(self) |
1198 | |
1199 | self.ThemeManagerDock.setWidget(self.ThemeManagerContents) |
1200 | self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock) |
1201 | - |
1202 | + |
1203 | self.FileNewItem = QtGui.QAction(self.main_window) |
1204 | self.FileNewItem.setIcon(self.ServiceManagerContents.Toolbar.getIconFromTitle("New Service")) |
1205 | self.FileNewItem.setObjectName("FileNewItem") |
1206 | |
1207 | === modified file 'openlp/core/ui/thememanager.py' (properties changed: -x to +x) |
1208 | --- openlp/core/ui/thememanager.py 2009-03-28 20:12:22 +0000 |
1209 | +++ openlp/core/ui/thememanager.py 2009-04-05 18:33:56 +0000 |
1210 | @@ -28,14 +28,20 @@ |
1211 | from PyQt4 import QtCore, QtGui |
1212 | from PyQt4.QtCore import * |
1213 | from PyQt4.QtGui import * |
1214 | -# from openlp.core.resources import * |
1215 | -# from openlp.core.ui import AboutForm, AlertForm, SettingsForm, SlideController |
1216 | + |
1217 | +from openlp.core.ui import AmendThemeForm |
1218 | from openlp.core import translate |
1219 | +from openlp.core import Renderer |
1220 | +from openlp.core.theme import Theme |
1221 | +from openlp.core.lib import Event |
1222 | +from openlp.core.lib import EventType |
1223 | +from openlp.core.lib import EventManager |
1224 | from openlp.core.lib import OpenLPToolbar |
1225 | +from openlp.core.lib import ThemeXMLBuilder |
1226 | +from openlp.core.lib import ThemeXMLParser |
1227 | from openlp.core.utils import ConfigHelper |
1228 | -#from openlp.core.lib import ThemeItem |
1229 | - |
1230 | -# from openlp.core import PluginManager |
1231 | + |
1232 | + |
1233 | import logging |
1234 | |
1235 | class ThemeData(QAbstractItemModel): |
1236 | @@ -51,7 +57,7 @@ |
1237 | self.items=[] |
1238 | self.rowheight=50 |
1239 | self.maximagewidth=self.rowheight*16/9.0; |
1240 | - log.info("Starting") |
1241 | + log.info(u'Starting') |
1242 | |
1243 | def clearItems(self): |
1244 | self.items=[] |
1245 | @@ -64,9 +70,10 @@ |
1246 | |
1247 | def insertRow(self, row, filename): |
1248 | self.beginInsertRows(QModelIndex(),row,row) |
1249 | - log.info("insert row %d:%s"%(row,filename)) |
1250 | + log.info(u'insert row %d:%s'%(row,filename)) |
1251 | (prefix, shortfilename) = os.path.split(str(filename)) |
1252 | - log.info("shortfilename=%s"%(shortfilename)) |
1253 | + log.info(u'shortfilename=%s'%(shortfilename)) |
1254 | + theme = shortfilename.split(u'.') |
1255 | # create a preview image |
1256 | if os.path.exists(filename): |
1257 | preview = QPixmap(str(filename)) |
1258 | @@ -83,8 +90,8 @@ |
1259 | p=QPixmap(w,h) |
1260 | p.fill(Qt.transparent) |
1261 | # finally create the row |
1262 | - self.items.insert(row,(filename, p, shortfilename)) |
1263 | - log.info("Items: %s" % self.items) |
1264 | + self.items.insert(row,(filename, p, shortfilename, theme[0])) |
1265 | + log.info(u'Items: %s' % self.items) |
1266 | self.endInsertRows() |
1267 | |
1268 | def removeRow(self, row): |
1269 | @@ -106,7 +113,7 @@ |
1270 | if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row! |
1271 | return QVariant() |
1272 | if role==Qt.DisplayRole: |
1273 | - retval= self.items[row][2] |
1274 | + retval= self.items[row][3] |
1275 | elif role == Qt.DecorationRole: |
1276 | retval= self.items[row][1] |
1277 | else: |
1278 | @@ -122,7 +129,7 @@ |
1279 | yield i |
1280 | |
1281 | def item(self, row): |
1282 | - log.info("Get Item:%d -> %s" %(row, str(self.items))) |
1283 | + log.info(u'Get Item:%d -> %s' %(row, str(self.items))) |
1284 | return self.items[row] |
1285 | |
1286 | class ThemeManager(QWidget): |
1287 | @@ -138,14 +145,19 @@ |
1288 | self.Layout = QtGui.QVBoxLayout(self) |
1289 | self.Layout.setSpacing(0) |
1290 | self.Layout.setMargin(0) |
1291 | + self.amendThemeForm = AmendThemeForm() |
1292 | self.Toolbar = OpenLPToolbar(self) |
1293 | - self.Toolbar.addToolbarButton("New Theme", ":/themes/theme_new.png") |
1294 | - self.Toolbar.addToolbarButton("Edit Theme", ":/themes/theme_edit.png") |
1295 | - self.Toolbar.addToolbarButton("Delete Theme", ":/themes/theme_delete.png") |
1296 | + self.Toolbar.addToolbarButton(translate('ThemeManager',u'New Theme'), ":/themes/theme_new.png", |
1297 | + translate('ThemeManager',u'Allows a Theme to be created'), self.onAddTheme) |
1298 | + self.Toolbar.addToolbarButton(translate('ThemeManager',u'Edit Theme'), ":/themes/theme_edit.png", |
1299 | + translate('ThemeManager',u'Allows a Theme to be amended'), self.onEditTheme) |
1300 | + self.Toolbar.addToolbarButton(translate('ThemeManager',u'Delete Theme'), ":/themes/theme_delete.png", |
1301 | + translate('ThemeManager',u'Allows a Theme to be deleted'), self.onDeleteTheme) |
1302 | self.Toolbar.addSeparator() |
1303 | - self.Toolbar.addToolbarButton("Import Theme", ":/themes/theme_import.png", |
1304 | - u'Allows Themes to be imported', self.onImportTheme) |
1305 | - self.Toolbar.addToolbarButton("Export Theme", ":/themes/theme_export.png") |
1306 | + self.Toolbar.addToolbarButton(translate('ThemeManager',u'Import Theme'), ":/themes/theme_import.png", |
1307 | + translate('ThemeManager',u'Allows Themes to be imported'), self.onImportTheme) |
1308 | + self.Toolbar.addToolbarButton(translate('ThemeManager',u'Export Theme'), ":/themes/theme_export.png", |
1309 | + translate('ThemeManager',u'Allows Themes to be exported'), self.onExportTheme) |
1310 | self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar) |
1311 | self.Toolbar.addAction(self.ThemeWidget) |
1312 | |
1313 | @@ -161,62 +173,29 @@ |
1314 | self.themelist= [] |
1315 | self.path = os.path.join(ConfigHelper.get_data_path(), u'themes') |
1316 | self.checkThemesExists(self.path) |
1317 | - self.loadThemes() # load the themes |
1318 | - |
1319 | -# def addThemeItem(self, item): |
1320 | -# """Adds Theme item""" |
1321 | -# log.info("addThemeItem") |
1322 | -# indexes=self.TreeView.selectedIndexes() |
1323 | -# assert len(indexes) <= 1 # can only have one selected index in this view |
1324 | -# if indexes == []: |
1325 | -# log.info("No row") |
1326 | -# row = None |
1327 | -# selected_item = None |
1328 | -# else: |
1329 | -# row=indexes[0].row() |
1330 | -# # if currently selected is of correct type, add it to it |
1331 | -# log.info("row:%d"%row) |
1332 | -# selected_item=self.Theme_data.item(row) |
1333 | -# if type(selected_item) == type(item): |
1334 | -# log.info("Add to existing item") |
1335 | -# selected_item.add(item) |
1336 | -# else: |
1337 | -# log.info("Create new item") |
1338 | -# if row is None: |
1339 | -# self.Theme_data.addRow(item) |
1340 | -# else: |
1341 | -# self.Theme_data.insertRow(row+1, item) |
1342 | -# |
1343 | -# def removeThemeItem(self): |
1344 | -# """Remove currently selected item""" |
1345 | -# pass |
1346 | -# |
1347 | -# def oos_as_text(self): |
1348 | -# text=[] |
1349 | -# log.info( "oos as text") |
1350 | -# log.info("Data:"+str(self.Theme_data)) |
1351 | -# for i in self.Theme_data: |
1352 | -# text.append("# " + str(i)) |
1353 | -# text.append(i.get_oos_text()) |
1354 | -# return '\n'.join(text) |
1355 | -# |
1356 | -# def write_oos(self, filename): |
1357 | -# """ |
1358 | -# Write a full OOS file out - iterate over plugins and call their respective methods |
1359 | -# This format is totally arbitrary testing purposes - something sensible needs to go in here! |
1360 | -# """ |
1361 | -# oosfile=open(filename, "w") |
1362 | -# oosfile.write("# BEGIN OOS\n") |
1363 | -# oosfile.write(self.oos_as_text) |
1364 | -# oosfile.write("# END OOS\n") |
1365 | -# oosfile.close() |
1366 | + |
1367 | + def setEventManager(self, eventManager): |
1368 | + self.eventManager = eventManager |
1369 | + |
1370 | + def onAddTheme(self): |
1371 | + self.amendThemeForm.exec_() |
1372 | + |
1373 | + def onEditTheme(self): |
1374 | + self.amendThemeForm.loadTheme(theme) |
1375 | + self.amendThemeForm.exec_() |
1376 | + |
1377 | + def onDeleteTheme(self): |
1378 | + pass |
1379 | + |
1380 | + def onExportTheme(self): |
1381 | + pass |
1382 | |
1383 | def onImportTheme(self): |
1384 | files = QtGui.QFileDialog.getOpenFileNames(None, |
1385 | translate('ThemeManager', u'Select Import File'), |
1386 | self.path, |
1387 | u'Theme (*.theme)') |
1388 | - log.info(u'New Themes) %s', str(files)) |
1389 | + log.info(u'New Themes %s', str(files)) |
1390 | if len(files) > 0: |
1391 | for file in files: |
1392 | self.unzipTheme(file, self.path) |
1393 | @@ -228,9 +207,11 @@ |
1394 | # self.themelist = [u'African Sunset', u'Snowy Mountains', u'Wilderness', u'Wet and Windy London'] |
1395 | for root, dirs, files in os.walk(self.path): |
1396 | for name in files: |
1397 | - if name.endswith(u'.bmp'): |
1398 | + if name.endswith(u'.png'): |
1399 | self.Theme_data.addRow(os.path.join(self.path, name)) |
1400 | |
1401 | + self.eventManager.post_event(Event(EventType.ThemeListChanged)) |
1402 | + |
1403 | def getThemes(self): |
1404 | return self.themelist |
1405 | |
1406 | @@ -249,16 +230,99 @@ |
1407 | os.mkdir(os.path.join(dir, file)) |
1408 | else: |
1409 | fullpath = os.path.join(dir, file) |
1410 | + names = file.split(u'/') |
1411 | + xml_data = zip.read(file) |
1412 | if file.endswith(u'.xml'): |
1413 | - self.checkVersion1(fullpath) |
1414 | - outfile = open(fullpath, 'w') |
1415 | - outfile.write(zip.read(file)) |
1416 | - outfile.close() |
1417 | + if self.checkVersion1(xml_data): |
1418 | + filexml = self.migrateVersion122(filename, fullpath, xml_data) |
1419 | + outfile = open(fullpath, 'w') |
1420 | + outfile.write(filexml) |
1421 | + outfile.close() |
1422 | + self.generateImage(dir,names[0], filexml) |
1423 | + else: |
1424 | + if file.endswith(u'.bmp'): |
1425 | + if fullpath is not os.path.join(dir, file): |
1426 | + outfile = open(fullpath, 'w') |
1427 | + outfile.write(zip.read(file)) |
1428 | + outfile.close() |
1429 | |
1430 | def checkVersion1(self, xmlfile): |
1431 | - file=open(xmlfile) |
1432 | - t=''.join(file.readlines()) # read the file and change list to a string |
1433 | + log.debug(u'checkVersion1 ') |
1434 | + t = xmlfile |
1435 | tree = ElementTree(element=XML(t)).getroot() |
1436 | - print "AA" |
1437 | - print tree.find('BackgroundType') |
1438 | - print "AAA" |
1439 | + if tree.find(u'BackgroundType') is None : |
1440 | + return False |
1441 | + else: |
1442 | + return True |
1443 | + |
1444 | + def migrateVersion122(self, filename , fullpath, xml_data): |
1445 | + log.debug(u'migrateVersion122 %s %s', filename , fullpath) |
1446 | + t=Theme(xml_data) |
1447 | + |
1448 | + newtheme = ThemeXMLBuilder() |
1449 | + newtheme.new_document(t.Name) |
1450 | + if t.BackgroundType == 0: |
1451 | + newtheme.add_background_solid(str(t.BackgroundParameter1.name())) |
1452 | + elif t.BackgroundType == 1: |
1453 | + direction = "vertical" |
1454 | + if t.BackgroundParameter1.name() == 1: |
1455 | + direction = "horizontal" |
1456 | + newtheme.add_background_gradient(str(t.BackgroundParameter1.name()), str(t.BackgroundParameter2.name()), direction) |
1457 | + else: |
1458 | + newtheme.add_background_image(str(t.BackgroundParameter1)) |
1459 | + |
1460 | + newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(t.FontProportion * 2)) |
1461 | + newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(12), u'footer') |
1462 | + outline = False |
1463 | + shadow = False |
1464 | + if t.Shadow == 1: |
1465 | + shadow = True |
1466 | + if t.Outline == 1: |
1467 | + outline = True |
1468 | + newtheme.add_display(str(shadow), str(t.ShadowColor.name()), str(outline), str(t.OutlineColor.name()), |
1469 | + str(t.HorizontalAlign), str(t.VerticalAlign), str(t.WrapStyle)) |
1470 | + return newtheme.extract_xml() |
1471 | + |
1472 | + def generateImage(self, dir, name, theme_xml): |
1473 | + log.debug(u'generateImage %s %s ', dir, theme_xml) |
1474 | + theme = ThemeXMLParser(theme_xml) |
1475 | + #print theme |
1476 | + size=QtCore.QSize(800,600) |
1477 | + frame=TstFrame(size) |
1478 | + frame=frame |
1479 | + paintdest=frame.GetPixmap() |
1480 | + r=Renderer() |
1481 | + r.set_paint_dest(paintdest) |
1482 | + |
1483 | + r.set_theme(theme) # set default theme |
1484 | + r._render_background() |
1485 | + r.set_text_rectangle(QtCore.QRect(0,0, size.width()-1, size.height()-1)) |
1486 | + |
1487 | + lines=[] |
1488 | + lines.append(u'Amazing Grace!') |
1489 | + lines.append(u'How sweet the sound') |
1490 | + lines.append(u'To save a wretch like me;') |
1491 | + lines.append(u'I once was lost but now am found,') |
1492 | + lines.append(u'Was blind, but now I see.') |
1493 | + |
1494 | + answer=r._render_lines(lines) |
1495 | + r._get_extent_and_render(u'Amazing Grace (John Newton) ', (10, 560), True, None, True) |
1496 | + r._get_extent_and_render(u'CCLI xxx (c)Openlp.org', (10, 580), True, None, True) |
1497 | + |
1498 | + im=frame.GetPixmap().toImage() |
1499 | + testpathname=os.path.join(dir, name+u'.png') |
1500 | + if os.path.exists(testpathname): |
1501 | + os.unlink(testpathname) |
1502 | + im.save(testpathname, u'png') |
1503 | + log.debug(u'Theme image written to %s',testpathname) |
1504 | + |
1505 | + |
1506 | +class TstFrame: |
1507 | + def __init__(self, size): |
1508 | + """Create the DemoPanel.""" |
1509 | + self.width=size.width(); |
1510 | + self.height=size.height(); |
1511 | + # create something to be painted into |
1512 | + self._Buffer = QtGui.QPixmap(self.width, self.height) |
1513 | + def GetPixmap(self): |
1514 | + return self._Buffer |
1515 | |
1516 | === modified file 'openlp/plugins/bibles/lib/biblestab.py' |
1517 | --- openlp/plugins/bibles/lib/biblestab.py 2009-03-09 12:49:55 +0000 |
1518 | +++ openlp/plugins/bibles/lib/biblestab.py 2009-04-04 10:24:39 +0000 |
1519 | @@ -68,12 +68,14 @@ |
1520 | self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) |
1521 | self.NewChaptersCheckBox.setObjectName("NewChaptersCheckBox") |
1522 | self.VerseDisplayLayout.addWidget(self.NewChaptersCheckBox, 1, 0, 1, 1) |
1523 | + |
1524 | self.DisplayStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox) |
1525 | self.DisplayStyleWidget.setObjectName(u'DisplayStyleWidget') |
1526 | self.DisplayStyleLayout = QtGui.QHBoxLayout(self.DisplayStyleWidget) |
1527 | self.DisplayStyleLayout.setSpacing(8) |
1528 | self.DisplayStyleLayout.setMargin(0) |
1529 | self.DisplayStyleLayout.setObjectName(u'DisplayStyleLayout') |
1530 | + |
1531 | self.DisplayStyleLabel = QtGui.QLabel(self.DisplayStyleWidget) |
1532 | self.DisplayStyleLabel.setObjectName(u'DisplayStyleLabel') |
1533 | self.DisplayStyleLayout.addWidget(self.DisplayStyleLabel) |
1534 | @@ -85,9 +87,26 @@ |
1535 | self.DisplayStyleComboBox.addItem(QtCore.QString()) |
1536 | self.DisplayStyleLayout.addWidget(self.DisplayStyleComboBox) |
1537 | self.VerseDisplayLayout.addWidget(self.DisplayStyleWidget, 2, 0, 1, 1) |
1538 | + |
1539 | + self.BibleThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox) |
1540 | + self.BibleThemeWidget.setObjectName(u'BibleThemeWidget') |
1541 | + self.BibleThemeLayout = QtGui.QHBoxLayout(self.BibleThemeWidget) |
1542 | + self.BibleThemeLayout.setSpacing(8) |
1543 | + self.BibleThemeLayout.setMargin(0) |
1544 | + self.BibleThemeLayout.setObjectName(u'BibleThemeLayout') |
1545 | + |
1546 | + self.BibleThemeLabel = QtGui.QLabel(self.BibleThemeWidget) |
1547 | + self.BibleThemeLabel.setObjectName(u'BibleThemeLabel') |
1548 | + self.BibleThemeLayout.addWidget(self.BibleThemeLabel) |
1549 | + self.BibleThemeComboBox = QtGui.QComboBox(self.BibleThemeWidget) |
1550 | + self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox') |
1551 | + self.BibleThemeComboBox.addItem(QtCore.QString()) |
1552 | + self.BibleThemeLayout.addWidget(self.BibleThemeComboBox) |
1553 | + self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 3, 0, 1, 1) |
1554 | + |
1555 | self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox) |
1556 | self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel') |
1557 | - self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 3, 0, 1, 1) |
1558 | + self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 4, 0, 1, 1) |
1559 | self.BibleLeftLayout.addWidget(self.VerseDisplayGroupBox) |
1560 | self.BibleLeftSpacer = QtGui.QSpacerItem(40, 20, |
1561 | QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
1562 | @@ -132,6 +151,7 @@ |
1563 | self.ParagraphRadioButton.setText(translate('SettingsForm','Paragraph style')) |
1564 | self.NewChaptersCheckBox.setText(translate('SettingsForm', 'Only show new chapter numbers')) |
1565 | self.DisplayStyleLabel.setText(translate('SettingsForm', 'Display Style:')) |
1566 | + self.BibleThemeLabel.setText(translate('SettingsForm', 'Bible Theme:')) |
1567 | self.DisplayStyleComboBox.setItemText(0, translate('SettingsForm', 'No brackets')) |
1568 | self.DisplayStyleComboBox.setItemText(1, translate('SettingsForm', '( and )')) |
1569 | self.DisplayStyleComboBox.setItemText(2, translate('SettingsForm', '{ and }')) |
1570 | @@ -165,6 +185,7 @@ |
1571 | self.paragraph_style = self.convertStringToBoolean(self.config.get_config('paragraph style', u'True')) |
1572 | self.show_new_chapters = self.convertStringToBoolean(self.config.get_config('display new chapter', u"False")) |
1573 | self.display_style = int(self.config.get_config('display brackets', '0')) |
1574 | + self.bible_theme = int(self.config.get_config('bible theme', '0')) |
1575 | self.bible_search = self.convertStringToBoolean(self.config.get_config('search as type', u'True')) |
1576 | if self.paragraph_style: |
1577 | self.ParagraphRadioButton.setChecked(True) |
1578 | @@ -173,9 +194,14 @@ |
1579 | self.NewChaptersCheckBox.setChecked(self.show_new_chapters) |
1580 | self.DisplayStyleComboBox.setCurrentIndex(self.display_style) |
1581 | self.BibleSearchCheckBox.setChecked(self.bible_search) |
1582 | + if self.bible_theme == 0: # must be new set to first |
1583 | + self.BibleThemeComboBox.setCurrentIndex(self.bible_theme) |
1584 | + else: |
1585 | + pass # TODO need to code |
1586 | |
1587 | def save(self): |
1588 | self.config.set_config("paragraph style", str(self.paragraph_style)) |
1589 | self.config.set_config("display new chapter", str(self.show_new_chapters)) |
1590 | self.config.set_config("display brackets", str(self.display_style)) |
1591 | self.config.set_config("search as type", str(self.bible_search)) |
1592 | + self.config.set_config("bible theme", str(self.bible_theme)) |
1593 | |
1594 | === added file 'resources/forms/amendthemedialog.ui' |
1595 | --- resources/forms/amendthemedialog.ui 1970-01-01 00:00:00 +0000 |
1596 | +++ resources/forms/amendthemedialog.ui 2009-04-04 17:36:15 +0000 |
1597 | @@ -0,0 +1,547 @@ |
1598 | +<?xml version="1.0" encoding="UTF-8"?> |
1599 | +<ui version="4.0"> |
1600 | + <class>AmendThemeDialog</class> |
1601 | + <widget class="QWidget" name="AmendThemeDialog"> |
1602 | + <property name="geometry"> |
1603 | + <rect> |
1604 | + <x>0</x> |
1605 | + <y>0</y> |
1606 | + <width>752</width> |
1607 | + <height>533</height> |
1608 | + </rect> |
1609 | + </property> |
1610 | + <property name="windowTitle"> |
1611 | + <string>Theme Maintance</string> |
1612 | + </property> |
1613 | + <property name="windowIcon"> |
1614 | + <iconset resource="../images/openlp-2.qrc"> |
1615 | + <normaloff>:/icon/openlp.org-icon-32.bmp</normaloff>:/icon/openlp.org-icon-32.bmp</iconset> |
1616 | + </property> |
1617 | + <widget class="QDialogButtonBox" name="ThemeButtonBox"> |
1618 | + <property name="geometry"> |
1619 | + <rect> |
1620 | + <x>580</x> |
1621 | + <y>500</y> |
1622 | + <width>156</width> |
1623 | + <height>26</height> |
1624 | + </rect> |
1625 | + </property> |
1626 | + <property name="standardButtons"> |
1627 | + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
1628 | + </property> |
1629 | + </widget> |
1630 | + <widget class="QWidget" name="layoutWidget"> |
1631 | + <property name="geometry"> |
1632 | + <rect> |
1633 | + <x>30</x> |
1634 | + <y>70</y> |
1635 | + <width>691</width> |
1636 | + <height>401</height> |
1637 | + </rect> |
1638 | + </property> |
1639 | + <layout class="QHBoxLayout" name="horizontalLayout_2"> |
1640 | + <item> |
1641 | + <widget class="QWidget" name="LeftSide" native="true"> |
1642 | + <widget class="QTabWidget" name="tabWidget"> |
1643 | + <property name="geometry"> |
1644 | + <rect> |
1645 | + <x>0</x> |
1646 | + <y>0</y> |
1647 | + <width>341</width> |
1648 | + <height>401</height> |
1649 | + </rect> |
1650 | + </property> |
1651 | + <property name="currentIndex"> |
1652 | + <number>1</number> |
1653 | + </property> |
1654 | + <widget class="QWidget" name="BackgroundTab"> |
1655 | + <attribute name="title"> |
1656 | + <string>Background</string> |
1657 | + </attribute> |
1658 | + <widget class="QWidget" name="layoutWidget"> |
1659 | + <property name="geometry"> |
1660 | + <rect> |
1661 | + <x>10</x> |
1662 | + <y>10</y> |
1663 | + <width>321</width> |
1664 | + <height>351</height> |
1665 | + </rect> |
1666 | + </property> |
1667 | + <layout class="QGridLayout" name="gridLayout"> |
1668 | + <item row="0" column="0" colspan="2"> |
1669 | + <widget class="QLabel" name="BackgroundLabel"> |
1670 | + <property name="text"> |
1671 | + <string>Background:</string> |
1672 | + </property> |
1673 | + </widget> |
1674 | + </item> |
1675 | + <item row="0" column="2" colspan="2"> |
1676 | + <widget class="QComboBox" name="BackgroundComboBox"> |
1677 | + <item> |
1678 | + <property name="text"> |
1679 | + <string>Opaque</string> |
1680 | + </property> |
1681 | + </item> |
1682 | + <item> |
1683 | + <property name="text"> |
1684 | + <string>Transparent</string> |
1685 | + </property> |
1686 | + </item> |
1687 | + </widget> |
1688 | + </item> |
1689 | + <item row="1" column="0" colspan="2"> |
1690 | + <widget class="QLabel" name="BackgroundTypeLabel"> |
1691 | + <property name="text"> |
1692 | + <string>Background Type:</string> |
1693 | + </property> |
1694 | + </widget> |
1695 | + </item> |
1696 | + <item row="1" column="2" colspan="2"> |
1697 | + <widget class="QComboBox" name="BackgroundTypeComboBox"> |
1698 | + <item> |
1699 | + <property name="text"> |
1700 | + <string>Solid Color</string> |
1701 | + </property> |
1702 | + </item> |
1703 | + <item> |
1704 | + <property name="text"> |
1705 | + <string>Gradient</string> |
1706 | + </property> |
1707 | + </item> |
1708 | + <item> |
1709 | + <property name="text"> |
1710 | + <string>Image</string> |
1711 | + </property> |
1712 | + </item> |
1713 | + </widget> |
1714 | + </item> |
1715 | + <item row="2" column="0"> |
1716 | + <widget class="QLabel" name="Color1Label"> |
1717 | + <property name="text"> |
1718 | + <string><Color1></string> |
1719 | + </property> |
1720 | + </widget> |
1721 | + </item> |
1722 | + <item row="2" column="2" colspan="2"> |
1723 | + <widget class="QPushButton" name="Color1PushButton"> |
1724 | + <property name="text"> |
1725 | + <string/> |
1726 | + </property> |
1727 | + </widget> |
1728 | + </item> |
1729 | + <item row="3" column="0"> |
1730 | + <widget class="QLabel" name="Color2Label"> |
1731 | + <property name="text"> |
1732 | + <string><Color2></string> |
1733 | + </property> |
1734 | + </widget> |
1735 | + </item> |
1736 | + <item row="3" column="2" colspan="2"> |
1737 | + <widget class="QPushButton" name="Color2PushButton"> |
1738 | + <property name="text"> |
1739 | + <string/> |
1740 | + </property> |
1741 | + </widget> |
1742 | + </item> |
1743 | + <item row="4" column="0"> |
1744 | + <widget class="QLabel" name="ImageLabel"> |
1745 | + <property name="text"> |
1746 | + <string>Image:</string> |
1747 | + </property> |
1748 | + </widget> |
1749 | + </item> |
1750 | + <item row="4" column="1" colspan="2"> |
1751 | + <widget class="QLineEdit" name="ImageLineEdit"/> |
1752 | + </item> |
1753 | + <item row="4" column="3"> |
1754 | + <widget class="QPushButton" name="ImagePushButton"> |
1755 | + <property name="text"> |
1756 | + <string/> |
1757 | + </property> |
1758 | + <property name="icon"> |
1759 | + <iconset resource="../images/openlp-2.qrc"> |
1760 | + <normaloff>:/services/service_open.png</normaloff>:/services/service_open.png</iconset> |
1761 | + </property> |
1762 | + </widget> |
1763 | + </item> |
1764 | + <item row="5" column="0"> |
1765 | + <widget class="QLabel" name="GradientLabel"> |
1766 | + <property name="text"> |
1767 | + <string>Gradient :</string> |
1768 | + </property> |
1769 | + </widget> |
1770 | + </item> |
1771 | + <item row="5" column="2" colspan="2"> |
1772 | + <widget class="QComboBox" name="GradientComboBox"> |
1773 | + <item> |
1774 | + <property name="text"> |
1775 | + <string>Horizontal</string> |
1776 | + </property> |
1777 | + </item> |
1778 | + <item> |
1779 | + <property name="text"> |
1780 | + <string>Vertical</string> |
1781 | + </property> |
1782 | + </item> |
1783 | + <item> |
1784 | + <property name="text"> |
1785 | + <string>Circular</string> |
1786 | + </property> |
1787 | + </item> |
1788 | + </widget> |
1789 | + </item> |
1790 | + </layout> |
1791 | + </widget> |
1792 | + </widget> |
1793 | + <widget class="QWidget" name="FontTab"> |
1794 | + <attribute name="title"> |
1795 | + <string>Font</string> |
1796 | + </attribute> |
1797 | + <widget class="QGroupBox" name="MainFontGroupBox"> |
1798 | + <property name="geometry"> |
1799 | + <rect> |
1800 | + <x>20</x> |
1801 | + <y>20</y> |
1802 | + <width>307</width> |
1803 | + <height>119</height> |
1804 | + </rect> |
1805 | + </property> |
1806 | + <property name="title"> |
1807 | + <string>Main Font</string> |
1808 | + </property> |
1809 | + <layout class="QGridLayout" name="gridLayout_2"> |
1810 | + <item row="0" column="0"> |
1811 | + <widget class="QLabel" name="MainFontlabel"> |
1812 | + <property name="text"> |
1813 | + <string>Font:</string> |
1814 | + </property> |
1815 | + </widget> |
1816 | + </item> |
1817 | + <item row="0" column="1" colspan="2"> |
1818 | + <widget class="QFontComboBox" name="MainFontComboBox"/> |
1819 | + </item> |
1820 | + <item row="1" column="0"> |
1821 | + <widget class="QLabel" name="MainFontColorLabel"> |
1822 | + <property name="text"> |
1823 | + <string>Font Color</string> |
1824 | + </property> |
1825 | + </widget> |
1826 | + </item> |
1827 | + <item row="1" column="2"> |
1828 | + <widget class="QPushButton" name="MainFontColorPushButton"> |
1829 | + <property name="text"> |
1830 | + <string/> |
1831 | + </property> |
1832 | + </widget> |
1833 | + </item> |
1834 | + <item row="2" column="0"> |
1835 | + <widget class="QLabel" name="MainFontSize"> |
1836 | + <property name="text"> |
1837 | + <string>Size:</string> |
1838 | + </property> |
1839 | + </widget> |
1840 | + </item> |
1841 | + <item row="2" column="1"> |
1842 | + <widget class="QLineEdit" name="MainFontSizeLineEdit"/> |
1843 | + </item> |
1844 | + <item row="2" column="2"> |
1845 | + <widget class="QSlider" name="MainFontlSlider"> |
1846 | + <property name="value"> |
1847 | + <number>15</number> |
1848 | + </property> |
1849 | + <property name="maximum"> |
1850 | + <number>40</number> |
1851 | + </property> |
1852 | + <property name="orientation"> |
1853 | + <enum>Qt::Horizontal</enum> |
1854 | + </property> |
1855 | + <property name="tickPosition"> |
1856 | + <enum>QSlider::TicksBelow</enum> |
1857 | + </property> |
1858 | + <property name="tickInterval"> |
1859 | + <number>5</number> |
1860 | + </property> |
1861 | + </widget> |
1862 | + </item> |
1863 | + </layout> |
1864 | + </widget> |
1865 | + <widget class="QGroupBox" name="FooterFontGroupBox"> |
1866 | + <property name="geometry"> |
1867 | + <rect> |
1868 | + <x>20</x> |
1869 | + <y>170</y> |
1870 | + <width>307</width> |
1871 | + <height>119</height> |
1872 | + </rect> |
1873 | + </property> |
1874 | + <property name="title"> |
1875 | + <string>Footer Font</string> |
1876 | + </property> |
1877 | + <layout class="QGridLayout" name="gridLayout_3"> |
1878 | + <item row="0" column="0"> |
1879 | + <widget class="QLabel" name="FooterFontlabel"> |
1880 | + <property name="text"> |
1881 | + <string>Font:</string> |
1882 | + </property> |
1883 | + </widget> |
1884 | + </item> |
1885 | + <item row="0" column="1" colspan="2"> |
1886 | + <widget class="QFontComboBox" name="FooterFontComboBox"/> |
1887 | + </item> |
1888 | + <item row="1" column="0"> |
1889 | + <widget class="QLabel" name="FooterFontColorLabel"> |
1890 | + <property name="text"> |
1891 | + <string>Font Color</string> |
1892 | + </property> |
1893 | + </widget> |
1894 | + </item> |
1895 | + <item row="1" column="2"> |
1896 | + <widget class="QPushButton" name="FooterColorPushButton"> |
1897 | + <property name="text"> |
1898 | + <string/> |
1899 | + </property> |
1900 | + </widget> |
1901 | + </item> |
1902 | + <item row="2" column="0"> |
1903 | + <widget class="QLabel" name="FooterFontSize"> |
1904 | + <property name="text"> |
1905 | + <string>Size:</string> |
1906 | + </property> |
1907 | + </widget> |
1908 | + </item> |
1909 | + <item row="2" column="1"> |
1910 | + <widget class="QLineEdit" name="FooterFontSizeLineEdit"/> |
1911 | + </item> |
1912 | + <item row="2" column="2"> |
1913 | + <widget class="QSlider" name="FooterFontlSlider"> |
1914 | + <property name="value"> |
1915 | + <number>15</number> |
1916 | + </property> |
1917 | + <property name="maximum"> |
1918 | + <number>40</number> |
1919 | + </property> |
1920 | + <property name="orientation"> |
1921 | + <enum>Qt::Horizontal</enum> |
1922 | + </property> |
1923 | + <property name="tickPosition"> |
1924 | + <enum>QSlider::TicksBelow</enum> |
1925 | + </property> |
1926 | + <property name="tickInterval"> |
1927 | + <number>5</number> |
1928 | + </property> |
1929 | + </widget> |
1930 | + </item> |
1931 | + </layout> |
1932 | + </widget> |
1933 | + </widget> |
1934 | + <widget class="QWidget" name="OptionsTab"> |
1935 | + <attribute name="title"> |
1936 | + <string>Display Options</string> |
1937 | + </attribute> |
1938 | + <widget class="QGroupBox" name="ShadowGroupBox"> |
1939 | + <property name="geometry"> |
1940 | + <rect> |
1941 | + <x>20</x> |
1942 | + <y>10</y> |
1943 | + <width>301</width> |
1944 | + <height>80</height> |
1945 | + </rect> |
1946 | + </property> |
1947 | + <property name="title"> |
1948 | + <string>Shadow</string> |
1949 | + </property> |
1950 | + <widget class="QWidget" name="layoutWidget"> |
1951 | + <property name="geometry"> |
1952 | + <rect> |
1953 | + <x>10</x> |
1954 | + <y>20</y> |
1955 | + <width>281</width> |
1956 | + <height>54</height> |
1957 | + </rect> |
1958 | + </property> |
1959 | + <layout class="QFormLayout" name="formLayout"> |
1960 | + <item row="0" column="0"> |
1961 | + <widget class="QCheckBox" name="ShadowCheckBox"> |
1962 | + <property name="text"> |
1963 | + <string>Use Shadow</string> |
1964 | + </property> |
1965 | + </widget> |
1966 | + </item> |
1967 | + <item row="1" column="0"> |
1968 | + <widget class="QLabel" name="ShadowColorLabel"> |
1969 | + <property name="text"> |
1970 | + <string>Shadow Color:</string> |
1971 | + </property> |
1972 | + </widget> |
1973 | + </item> |
1974 | + <item row="1" column="1"> |
1975 | + <widget class="QPushButton" name="ShadowColorPushButton"> |
1976 | + <property name="text"> |
1977 | + <string/> |
1978 | + </property> |
1979 | + </widget> |
1980 | + </item> |
1981 | + </layout> |
1982 | + </widget> |
1983 | + </widget> |
1984 | + <widget class="QGroupBox" name="AlignmentGroupBox"> |
1985 | + <property name="geometry"> |
1986 | + <rect> |
1987 | + <x>10</x> |
1988 | + <y>200</y> |
1989 | + <width>321</width> |
1990 | + <height>161</height> |
1991 | + </rect> |
1992 | + </property> |
1993 | + <property name="title"> |
1994 | + <string>Alignment</string> |
1995 | + </property> |
1996 | + <layout class="QGridLayout" name="gridLayout_4"> |
1997 | + <item row="0" column="0"> |
1998 | + <widget class="QLabel" name="HorizontalLabel"> |
1999 | + <property name="text"> |
2000 | + <string>Horizontal Align:</string> |
2001 | + </property> |
2002 | + </widget> |
2003 | + </item> |
2004 | + <item row="0" column="1"> |
2005 | + <widget class="QComboBox" name="HorizontalComboBox"> |
2006 | + <item> |
2007 | + <property name="text"> |
2008 | + <string>Left</string> |
2009 | + </property> |
2010 | + </item> |
2011 | + <item> |
2012 | + <property name="text"> |
2013 | + <string>Right</string> |
2014 | + </property> |
2015 | + </item> |
2016 | + <item> |
2017 | + <property name="text"> |
2018 | + <string>Center</string> |
2019 | + </property> |
2020 | + </item> |
2021 | + </widget> |
2022 | + </item> |
2023 | + <item row="1" column="0"> |
2024 | + <widget class="QLabel" name="VerticalLabel"> |
2025 | + <property name="text"> |
2026 | + <string>Vertical Align:</string> |
2027 | + </property> |
2028 | + </widget> |
2029 | + </item> |
2030 | + <item row="1" column="1"> |
2031 | + <widget class="QComboBox" name="VerticalComboBox"> |
2032 | + <item> |
2033 | + <property name="text"> |
2034 | + <string>Top</string> |
2035 | + </property> |
2036 | + </item> |
2037 | + <item> |
2038 | + <property name="text"> |
2039 | + <string>Middle</string> |
2040 | + </property> |
2041 | + </item> |
2042 | + <item> |
2043 | + <property name="text"> |
2044 | + <string>Bottom</string> |
2045 | + </property> |
2046 | + </item> |
2047 | + </widget> |
2048 | + </item> |
2049 | + </layout> |
2050 | + </widget> |
2051 | + <widget class="QGroupBox" name="OutlineGroupBox"> |
2052 | + <property name="geometry"> |
2053 | + <rect> |
2054 | + <x>20</x> |
2055 | + <y>110</y> |
2056 | + <width>301</width> |
2057 | + <height>80</height> |
2058 | + </rect> |
2059 | + </property> |
2060 | + <property name="title"> |
2061 | + <string>Outline</string> |
2062 | + </property> |
2063 | + <widget class="QWidget" name="layoutWidget_3"> |
2064 | + <property name="geometry"> |
2065 | + <rect> |
2066 | + <x>10</x> |
2067 | + <y>20</y> |
2068 | + <width>281</width> |
2069 | + <height>54</height> |
2070 | + </rect> |
2071 | + </property> |
2072 | + <layout class="QFormLayout" name="OutlineformLayout"> |
2073 | + <item row="0" column="0"> |
2074 | + <widget class="QCheckBox" name="OutlineCheckBox"> |
2075 | + <property name="text"> |
2076 | + <string>Use Outline</string> |
2077 | + </property> |
2078 | + </widget> |
2079 | + </item> |
2080 | + <item row="1" column="0"> |
2081 | + <widget class="QLabel" name="OutlineColorLabel"> |
2082 | + <property name="text"> |
2083 | + <string>Outline Color:</string> |
2084 | + </property> |
2085 | + </widget> |
2086 | + </item> |
2087 | + <item row="1" column="1"> |
2088 | + <widget class="QPushButton" name="OutlineColorPushButton"> |
2089 | + <property name="text"> |
2090 | + <string/> |
2091 | + </property> |
2092 | + </widget> |
2093 | + </item> |
2094 | + </layout> |
2095 | + </widget> |
2096 | + </widget> |
2097 | + </widget> |
2098 | + </widget> |
2099 | + </widget> |
2100 | + </item> |
2101 | + <item> |
2102 | + <widget class="QWidget" name="RightSide" native="true"> |
2103 | + <widget class="QGraphicsView" name="ThemePreView"> |
2104 | + <property name="geometry"> |
2105 | + <rect> |
2106 | + <x>0</x> |
2107 | + <y>30</y> |
2108 | + <width>341</width> |
2109 | + <height>341</height> |
2110 | + </rect> |
2111 | + </property> |
2112 | + </widget> |
2113 | + </widget> |
2114 | + </item> |
2115 | + </layout> |
2116 | + </widget> |
2117 | + <widget class="QWidget" name="layoutWidget"> |
2118 | + <property name="geometry"> |
2119 | + <rect> |
2120 | + <x>50</x> |
2121 | + <y>20</y> |
2122 | + <width>441</width> |
2123 | + <height>41</height> |
2124 | + </rect> |
2125 | + </property> |
2126 | + <layout class="QHBoxLayout" name="horizontalLayout"> |
2127 | + <item> |
2128 | + <widget class="QLabel" name="ThemeNameLabel"> |
2129 | + <property name="text"> |
2130 | + <string>Theme Name</string> |
2131 | + </property> |
2132 | + </widget> |
2133 | + </item> |
2134 | + <item> |
2135 | + <widget class="QLineEdit" name="ThemeNameEdit"/> |
2136 | + </item> |
2137 | + </layout> |
2138 | + </widget> |
2139 | + </widget> |
2140 | + <resources> |
2141 | + <include location="../images/openlp-2.qrc"/> |
2142 | + </resources> |
2143 | + <connections/> |
2144 | +</ui> |
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