From a662404122c8d13f809863897d7d02997a0da53c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 15 Apr 2009 05:58:51 +0100 Subject: [PATCH 01/17] Fix XML schema for naming Fix ThemeManager and Renderer to cover changes Move code for Boolean Config issues Various code style fixes --- openlp.pyw | 6 +- openlp/__init__.py | 7 ++ openlp/core/__init__.py | 6 +- openlp/core/lib/settingstab.py | 13 +-- openlp/core/lib/themexmlhandler.py | 111 +++++++++++++++++-------- openlp/core/render.py | 55 ++++++------ openlp/core/ui/amendthemeform.py | 39 ++++++--- openlp/core/ui/thememanager.py | 31 ++++--- openlp/plugins/bibles/lib/biblestab.py | 8 +- openlp/plugins/videos/lib/videotab.py | 18 ++-- 10 files changed, 181 insertions(+), 113 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 4bba69e59..49f348556 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -52,9 +52,9 @@ class OpenLP(QtGui.QApplication): self.processEvents() screens = [] # Decide how many screens we have and their size - for i in range (0 , self.desktop().numScreens()): - screens.insert(i, (i+1, self.desktop().availableGeometry(i+1))) - log.info(u'Screen %d found with resolution %s', i+1, self.desktop().availableGeometry(i+1)) + for screen in xrange (0 , self.desktop().numScreens()): + screens.insert(screen, (screen+1, self.desktop().availableGeometry(screen+1))) + log.info(u'Screen %d found with resolution %s', screen+1, self.desktop().availableGeometry(screen+1)) # start the main app window self.main_window = MainWindow(screens) self.main_window.show() diff --git a/openlp/__init__.py b/openlp/__init__.py index b16ed4f5a..1870f3b96 100644 --- a/openlp/__init__.py +++ b/openlp/__init__.py @@ -15,3 +15,10 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ +__all__ = ['convertStringToBoolean'] + +def convertStringToBoolean(stringvalue): + if stringvalue.lower() == 'true': + return True + else: + return False diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index b19fe8fdf..eb62a77c1 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -3,7 +3,7 @@ """ OpenLP - Open Source Lyrics Projection Copyright (c) 2008 Raoul Snyman -Portions copyright (c) 2008 Martin Thompson, Tim Bentley +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -23,11 +23,11 @@ from render import Renderer from settingsmanager import SettingsManager from pluginmanager import PluginManager -__all__ = ['Renderer', 'SettingsManager', 'PluginManager', 'translate', 'fileToXML'] +__all__ = ['Renderer', 'SettingsManager', 'PluginManager', 'translate', + 'fileToXML' ] def translate(context, text): return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8) def fileToXML(xmlfile): return open(xmlfile).read() - diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 672be9f9f..fce46d40b 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -19,7 +19,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ from PyQt4 import QtCore, QtGui -from openlp.core.resources import * from openlp.core.lib import PluginConfig class SettingsTab(QtGui.QWidget): @@ -39,7 +38,7 @@ class SettingsTab(QtGui.QWidget): else: self.config = PluginConfig(str(title)) self.load() - + def setTitle(self, title): self.tabTitle = title @@ -51,15 +50,9 @@ class SettingsTab(QtGui.QWidget): def retranslateUi(self): pass - + def load(self): pass - + def save(self): pass - - def convertStringToBoolean(self, stringvalue): - if stringvalue.lower() == 'true': - return True - else: - return False diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index 209fce05b..aef0b1e05 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -21,9 +21,50 @@ from xml.etree.ElementTree import ElementTree, XML, dump For XML Schema see wiki.openlp.org """ + +from openlp import convertStringToBoolean from xml.dom.minidom import Document from xml.etree.ElementTree import ElementTree, XML, dump +blankthemexml=\ +''' + + BlankStyle + + + #000000 + + + #000000 + #000000 + vertical + + + fred.bmp + + + Arial + #000000 + 30 + + + + + Arial + #000000 + 12 + + + + True + False + 0 + 0 + 0 + + +''' + class ThemeXML(): def __init__(self): # Create the minidom document @@ -31,11 +72,11 @@ class ThemeXML(): def new_document(self, name): # Create the base element - self.theme = self.theme_xml.createElement(u'Theme') + self.theme = self.theme_xml.createElement(u'theme') self.theme_xml.appendChild(self.theme) self.theme.setAttribute(u'version', u'1.0') - self.name = self.theme_xml.createElement(u'Name') + self.name = self.theme_xml.createElement(u'name') ctn = self.theme_xml.createTextNode(name) self.name.appendChild(ctn) self.theme.appendChild(self.name) @@ -52,30 +93,23 @@ class ThemeXML(): background.setAttribute(u'type', u'solid') self.theme.appendChild(background) - color = self.theme_xml.createElement(u'color1') + color = self.theme_xml.createElement(u'color') bkc = self.theme_xml.createTextNode(bkcolor) color.appendChild(bkc) background.appendChild(color) - color = self.theme_xml.createElement(u'color2') - background.appendChild(color) - - color = self.theme_xml.createElement(u'direction') - background.appendChild(color) - - def add_background_gradient(self, startcolor, endcolor, direction): background = self.theme_xml.createElement(u'background') background.setAttribute(u'mode', u'opaque') background.setAttribute(u'type', u'gradient') self.theme.appendChild(background) - color = self.theme_xml.createElement(u'color1') + color = self.theme_xml.createElement(u'startcolor') bkc = self.theme_xml.createTextNode(startcolor) color.appendChild(bkc) background.appendChild(color) - color = self.theme_xml.createElement(u'color2') + color = self.theme_xml.createElement(u'endcolor') bkc = self.theme_xml.createTextNode(endcolor) color.appendChild(bkc) background.appendChild(color) @@ -96,33 +130,34 @@ class ThemeXML(): color.appendChild(bkc) background.appendChild(color) - def add_font(self, fontname, fontcolor, fontproportion, override, fonttype=u'main', xpos=0, ypos=0 ,width=0, height=0): + def add_font(self, name, color, proportion, override, fonttype=u'main', xpos=0, ypos=0 ,width=0, height=0): background = self.theme_xml.createElement(u'font') background.setAttribute(u'type',fonttype) self.theme.appendChild(background) - name = self.theme_xml.createElement(u'name') - fn = self.theme_xml.createTextNode(fontname) - name.appendChild(fn) - background.appendChild(name) + element = self.theme_xml.createElement(u'name') + fn = self.theme_xml.createTextNode(name) + element.appendChild(fn) + background.appendChild(element) - name = self.theme_xml.createElement(u'color') - fn = self.theme_xml.createTextNode(fontcolor) - name.appendChild(fn) - background.appendChild(name) + element = self.theme_xml.createElement(u'color') + fn = self.theme_xml.createTextNode(color) + element.appendChild(fn) + background.appendChild(element) - name = self.theme_xml.createElement(u'proportion') - fn = self.theme_xml.createTextNode(fontproportion) - name.appendChild(fn) - background.appendChild(name) + element = self.theme_xml.createElement(u'proportion') + fn = self.theme_xml.createTextNode(proportion) + element.appendChild(fn) + background.appendChild(element) - name = self.theme_xml.createElement(u'location') - name.setAttribute(u'override',override) - name.setAttribute(u'x',str(xpos)) - name.setAttribute(u'y',str(ypos)) - name.setAttribute(u'width',str(width)) - name.setAttribute(u'height',str(height)) - background.appendChild(name) + element = self.theme_xml.createElement(u'location') + element.setAttribute(u'override',override) + if override == True: + element.setAttribute(u'x',str(xpos)) + element.setAttribute(u'y',str(ypos)) + element.setAttribute(u'width',str(width)) + element.setAttribute(u'height',str(height)) + background.appendChild(element) def add_display(self, shadow, shadowColor, outline, outlineColor, horizontal, vertical, wrap): background = self.theme_xml.createElement(u'display') @@ -170,6 +205,13 @@ class ThemeXML(): return self.theme_xml.toxml() def parse(self, xml): + self.baseParseXml() + self.parse_xml(xml) + + def baseParseXml(self): + self.parse_xml(blankthemexml) + + def parse_xml(self, xml): theme_xml = ElementTree(element=XML(xml)) iter=theme_xml.getiterator() master = u'' @@ -185,13 +227,14 @@ class ThemeXML(): master += e[1] + u'_' elif master == u'display_' and (element.tag == u'shadow' or element.tag == u'outline'): #print "b", master, element.tag, element.text, e[0], e[1] - setattr(self, master + element.tag , element.text) + et = convertStringToBoolean(element.text) + setattr(self, master + element.tag , et) setattr(self, master + element.tag +u'_'+ e[0], e[1]) else: field = master + e[0] setattr(self, field, e[1]) else: - #print "c", element.tag + #print "c", element.tag, element.text if element.tag is not None : field = master + element.tag setattr(self, field, element.text) diff --git a/openlp/core/render.py b/openlp/core/render.py index 640663e82..e616bc777 100644 --- a/openlp/core/render.py +++ b/openlp/core/render.py @@ -18,12 +18,12 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ import logging +import os, os.path import sys from PyQt4 import QtGui, QtCore, Qt from copy import copy -#from interpolate import interpolate class Renderer: @@ -40,7 +40,7 @@ class Renderer: tell it to render a particular screenfull with render_screen(n) """ - def __init__(self): + def __init__(self, path=None): self._rect=None self._debug=0 self.words=None @@ -50,6 +50,7 @@ class Renderer: self._theme=None self._bg_image_filename=None self._paint=None + self._path = path def set_debug(self, debug): self._debug=debug @@ -61,7 +62,9 @@ class Renderer: def set_bg_image(self, filename): log.debug(u'set bg image %s', filename) - self._bg_image_filename=filename + + self._bg_image_filename=os.path.join(self._path, self._theme.theme_name, filename) + print self._bg_image_filename if self._paint is not None: self.scale_bg_image() @@ -71,6 +74,7 @@ class Renderer: # rescale and offset imw=i.width() imh=i.height() + print imw, imh dcw=self._paint.width()+1 dch=self._paint.height() imratio=imw/float(imh) @@ -128,7 +132,7 @@ class Renderer: p=QtGui.QPainter() p.begin(self._paint) if self._theme.background_type == u'solid': - p.fillRect(self._paint.rect(), QtGui.QColor(self._theme.background_color1)) + p.fillRect(self._paint.rect(), QtGui.QColor(self._theme.background_color)) elif self._theme.background_type == u'gradient' : # gradient gradient = None if self._theme.background_direction == u'vertical': @@ -142,8 +146,8 @@ class Renderer: h = int(self._paint.height())/2 gradient = QtGui.QRadialGradient(w, h, w) # Circular - gradient.setColorAt(0, QtGui.QColor(self._theme.background_color1)) - gradient.setColorAt(1, QtGui.QColor(self._theme.background_color2)) + gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor)) + gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor)) p.setBrush(QtGui.QBrush(gradient)) rectPath = QtGui.QPainterPath() @@ -161,9 +165,9 @@ class Renderer: elif self._theme.background_type== u'image': # image r=self._paint.rect() log.debug(u'Image size details %d %d %d %d ', r.x(), r.y(), r.width(),r.height()) - log.debug(u' Background Parameter %d ', self._theme.background_borderColor) - if self._theme.Bbackground_borderColor is not None: - p.fillRect(self._paint.rect(), self._theme.background_borderColor) + #log.debug(u' Background Parameter %d ', self._theme.background_color1) + #if self._theme.background_color1 is not None: + # p.fillRect(self._paint.rect(), self._theme.background_borderColor) p.drawPixmap(self.background_offsetx,self.background_offsety, self.img) p.end() log.debug(u'render background done') @@ -192,7 +196,7 @@ class Renderer: endline=startline+ratio while (endline<=numlines): by=0 - for (x,y) in bboxes[startline:endline]: + for (x, y) in bboxes[startline:endline]: by+=y if by > bottom: good=0 @@ -220,7 +224,7 @@ class Renderer: endline=startline+1 while (endline<=numlines): by=0 - for (x,y) in bboxes[startline:endline]: + for (x, y) in bboxes[startline:endline]: by+=y if by > bottom: retval.append(lines[startline:endline-1]) @@ -237,7 +241,7 @@ class Renderer: y = rect.top() elif int(self._theme.display_verticalAlign) == 1: # bottom align y=rect.bottom()-bbox.height() - elif int(t.display_verticalAlign) == 2: # centre align + elif int(self._theme.display_verticalAlign) == 2: # centre align y=rect.top()+(rect.height()-bbox.height())/2 else: assert(0, u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign) @@ -254,11 +258,11 @@ class Renderer: # put stuff on background so need to reset before doing the job properly. self._render_background() x, y = self._correctAlignment(self._rect, bbox) - bbox=self._render_lines_unaligned(lines, False, (x,y)) + bbox=self._render_lines_unaligned(lines, False, (x, y)) if lines1 is not None: x, y = self._correctAlignment(self._rect_footer, bbox1) - bbox=self._render_lines_unaligned(lines1, True, (x,y) ) + bbox=self._render_lines_unaligned(lines1, True, (x, y) ) log.debug(u'render lines DONE') @@ -273,7 +277,7 @@ class Renderer: Returns the bounding box of the text as QRect""" log.debug(u'render unaligned %s', lines) - x,y=tlcorner + x, y=tlcorner brx=x bry=y for line in lines: @@ -284,7 +288,7 @@ class Renderer: (thisx, bry) = self._render_single_line(line, footer, (x,bry)) if (thisx > brx): brx=thisx - retval=QtCore.QRect(x,y,brx-x, bry-y) + retval=QtCore.QRect(x, y,brx-x, bry-y) if self._debug: p=QtGui.QPainter() p.begin(self._paint) @@ -303,10 +307,10 @@ class Renderer: If the line is too wide for the context, it wraps, but right-aligns the surplus words in the manner of song lyrics - Returns the bottom-right corner (of what was rendered) as a tuple(x,y). + Returns the bottom-right corner (of what was rendered) as a tuple(x, y). """ #log.debug(u'Render single line %s @ %s '%( line, tlcorner)) - x,y=tlcorner + x, y=tlcorner # We draw the text to see how big it is and then iterate to make it fit # when we line wrap we do in in the "lyrics" style, so the second line is # right aligned with a "hanging indent" @@ -334,12 +338,13 @@ class Renderer: rightextent=None t=self._theme align=t.display_horizontalAlign + wrapstyle=t.display_wrapStyle for linenum in range(len(lines)): line=lines[linenum] #find out how wide line is - w,h=self._get_extent_and_render(line, footer, tlcorner=(x,y), draw=False) + w,h=self._get_extent_and_render(line, footer, tlcorner=(x, y), draw=False) if t.display_shadow: w+=self._shadow_offset @@ -367,8 +372,8 @@ class Renderer: draw=True, color = t.display_shadow_color) if t.display_outline: self._get_extent_and_render(line, footer,(x+self._outline_offset,y), draw=True, color = t.display_outline_color) - self._get_extent_and_render(line, footer,(x,y+self._outline_offset), draw=True, color = t.display_outline_color) - self._get_extent_and_render(line, footer,(x,y-self._outline_offset), draw=True, color = t.display_outline_color) + self._get_extent_and_render(line, footer,(x, y+self._outline_offset), draw=True, color = t.display_outline_color) + self._get_extent_and_render(line, footer,(x, y-self._outline_offset), draw=True, color = t.display_outline_color) self._get_extent_and_render(line, footer,(x-self._outline_offset,y), draw=True, color = t.display_outline_color) if self._outline_offset > 1: self._get_extent_and_render(line, footer,(x+self._outline_offset,y+self._outline_offset), draw=True, color = t.display_outline_color) @@ -376,7 +381,7 @@ class Renderer: self._get_extent_and_render(line, footer,(x+self._outline_offset,y-self._outline_offset), draw=True, color = t.display_outline_color) self._get_extent_and_render(line, footer,(x-self._outline_offset,y-self._outline_offset), draw=True, color = t.display_outline_color) - self._get_extent_and_render(line, footer,tlcorner=(x,y), draw=True) + self._get_extent_and_render(line, footer,tlcorner=(x, y), draw=True) # log.debug(u'Line %2d: Render '%s' at (%d, %d) wh=(%d,%d)' % ( linenum, line, x, y,w,h) y += h if linenum == 0: @@ -386,7 +391,7 @@ class Renderer: p=QtGui.QPainter() p.begin(self._paint) p.setPen(QtGui.QPen(QtGui.QColor(0,255,0))) - p.drawRect(startx,starty,rightextent-startx,y-starty) + p.drawRect(startx,starty,rightextent-startx, y-starty) p.end() brcorner=(rightextent,y) @@ -429,12 +434,12 @@ class Renderer: p.setPen(QtGui.QColor(self._theme.font_main_color)) else: p.setPen(QtGui.QColor(color)) - x,y=tlcorner + x, y=tlcorner metrics=QtGui.QFontMetrics(font) # xxx some fudges to make it exactly like wx! Take 'em out later w=metrics.width(line) h=metrics.height()-2 if draw: - p.drawText(x,y+metrics.height()-metrics.descent()-1, line) + p.drawText(x, y+metrics.height()-metrics.descent()-1, line) p.end() return (w, h) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 2d6c988c4..c6cf4ae18 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -97,29 +97,44 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def onBackgroundTypeComboBoxSelected(self): if self.BackgroundTypeComboBox.currentIndex() == 0: # Solid self.theme.background_type = u'solid' + if self.theme.background_direction == None: # never defined + self.theme.background_direction = u'horizontal' + if self.theme.background_startColor is None : + self.theme.background_startColor = u'#000000' + if self.theme.background_endColor is None : + self.theme.background_endColor = u'#000000' elif self.BackgroundTypeComboBox.currentIndex() == 1: # Gradient self.theme.background_type = u'gradient' if self.theme.background_direction == None: # never defined self.theme.background_direction = u'horizontal' - self.theme.background_color2 = u'#000000' + if self.theme.background_startColor is None : + self.theme.background_startColor = u'#000000' + if self.theme.background_endColor is None : + self.theme.background_endColor = u'#000000' else: self.theme.background_type = u'image' self.stateChanging(self.theme) self.generateImage(self.theme) def onColor1PushButtonClicked(self): - self.theme.background_color1 = QtGui.QColorDialog.getColor( - QColor(self.theme.background_color1), self).name() - self.Color1PushButton.setStyleSheet( - 'background-color: %s' % str(self.theme.background_color1)) + if self.theme.background_type == u'solid': + self.theme.background_color = QtGui.QColorDialog.getColor( + QColor(self.theme.background_color), self).name() + self.Color1PushButton.setStyleSheet( + 'background-color: %s' % str(self.theme.background_color)) + else: + self.theme.background_startColor = QtGui.QColorDialog.getColor( + QColor(self.theme.background_startColor), self).name() + self.Color1PushButton.setStyleSheet( + 'background-color: %s' % str(self.theme.background_startColor)) self.generateImage(self.theme) def onColor2PushButtonClicked(self): - self.theme.background_color2 = QtGui.QColorDialog.getColor( - QColor(self.theme.background_color2), self).name() + self.theme.background_endColor = QtGui.QColorDialog.getColor( + QColor(self.theme.background_endColor), self).name() self.Color2PushButton.setStyleSheet( - 'background-color: %s' % str(self.theme.background_color2)) + 'background-color: %s' % str(self.theme.background_endColor)) self.generateImage(self.theme) @@ -165,7 +180,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def stateChanging(self, theme): if theme.background_type == u'solid': self.Color1PushButton.setStyleSheet( - 'background-color: %s' % str(theme.background_color1)) + 'background-color: %s' % str(theme.background_color)) self.Color1Label.setText(translate(u'ThemeManager', u'Background Font:')) self.Color1Label.setVisible(True) self.Color1PushButton.setVisible(True) @@ -173,9 +188,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.Color2PushButton.setVisible(False) elif theme.background_type == u'gradient': self.Color1PushButton.setStyleSheet( - 'background-color: %s' % str(theme.background_color1)) + 'background-color: %s' % str(theme.background_startColor)) self.Color2PushButton.setStyleSheet( - 'background-color: %s' % str(theme.background_color2)) + 'background-color: %s' % str(theme.background_endColor)) self.Color1Label.setText(translate(u'ThemeManager', u'First Color:')) self.Color2Label.setText(translate(u'ThemeManager', u'Second Color:')) self.Color1Label.setVisible(True) @@ -197,7 +212,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): frame=TstFrame(size) frame=frame paintdest=frame.GetPixmap() - r=Renderer() + r=Renderer(self.path) r.set_paint_dest(paintdest) r.set_theme(theme) # set default theme diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 3726c23a7..a71fe4ae6 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -236,6 +236,8 @@ class ThemeManager(QWidget): def unzipTheme(self, filename, dir): log.debug(u'Unzipping theme %s', filename) zip = zipfile.ZipFile(str(filename)) + filexml = None + themename = None for file in zip.namelist(): if file.endswith('/'): theme_dir = os.path.join(dir, file) @@ -243,21 +245,25 @@ class ThemeManager(QWidget): os.mkdir(os.path.join(dir, file)) else: fullpath = os.path.join(dir, file) - names = file.split(u'/') + if themename is None: + names = file.split(u'/') + themename = names[0] xml_data = zip.read(file) if os.path.splitext (file) [1].lower () in [u'.xml']: if self.checkVersion1(xml_data): filexml = self.migrateVersion122(filename, fullpath, xml_data) - outfile = open(fullpath, 'w') - outfile.write(filexml) - outfile.close() - self.generateImage(dir,names[0], filexml) + else: + file_xml = xml_data + outfile = open(fullpath, 'w') + outfile.write(filexml) + outfile.close() + if os.path.splitext (file) [1].lower () in [u'.bmp']: + print os.path.splitext (file) else: - if os.path.splitext (file) [1].lower () in [u'.bmp']: - if fullpath is not os.path.join(dir, file): - outfile = open(fullpath, 'w') - outfile.write(zip.read(file)) - outfile.close() + outfile = open(fullpath, 'w') + outfile.write(zip.read(file)) + outfile.close() + self.generateImage(dir,themename, filexml) def checkVersion1(self, xmlfile): log.debug(u'checkVersion1 ') @@ -297,7 +303,7 @@ class ThemeManager(QWidget): return newtheme.extract_xml() def generateImage(self, dir, name, theme_xml): - log.debug(u'generateImage %s %s ', dir, theme_xml) + log.debug(u'generateImage %s %s %s', dir, name, theme_xml) theme = ThemeXML() theme.parse(theme_xml) #print theme @@ -305,11 +311,10 @@ class ThemeManager(QWidget): frame=TstFrame(size) frame=frame paintdest=frame.GetPixmap() - r=Renderer() + r=Renderer(dir) r.set_paint_dest(paintdest) r.set_theme(theme) # set default theme - r._render_background() r.set_text_rectangle(QtCore.QRect(0,0, size.width()-1, size.height()-1), QtCore.QRect(10,560, size.width()-1, size.height()-1)) lines=[] diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 0f9b3fe03..dc0918d92 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -21,8 +21,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtCore, QtGui from openlp.core import translate +from openlp import convertStringToBoolean from openlp.core.lib import SettingsTab -from openlp.core.resources import * class BiblesTab(SettingsTab): """ @@ -182,11 +182,11 @@ class BiblesTab(SettingsTab): self.bible_search = True def load(self): - self.paragraph_style = self.convertStringToBoolean(self.config.get_config('paragraph style', u'True')) - self.show_new_chapters = self.convertStringToBoolean(self.config.get_config('display new chapter', u"False")) + self.paragraph_style = convertStringToBoolean(self.config.get_config('paragraph style', u'True')) + self.show_new_chapters = convertStringToBoolean(self.config.get_config('display new chapter', u"False")) self.display_style = int(self.config.get_config('display brackets', '0')) self.bible_theme = int(self.config.get_config('bible theme', '0')) - self.bible_search = self.convertStringToBoolean(self.config.get_config('search as type', u'True')) + self.bible_search = convertStringToBoolean(self.config.get_config('search as type', u'True')) if self.paragraph_style: self.ParagraphRadioButton.setChecked(True) else: diff --git a/openlp/plugins/videos/lib/videotab.py b/openlp/plugins/videos/lib/videotab.py index 475fb9dee..d1e694d0a 100644 --- a/openlp/plugins/videos/lib/videotab.py +++ b/openlp/plugins/videos/lib/videotab.py @@ -21,8 +21,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtCore, QtGui from openlp.core import translate +from openlp import convertStringToBoolean from openlp.core.lib import SettingsTab -from openlp.core.resources import * class VideoTab(SettingsTab): """ @@ -49,12 +49,12 @@ class VideoTab(SettingsTab): self.UseVMRLabel = QtGui.QLabel(self.VideoModeGroupBox) self.UseVMRLabel.setObjectName("UseVMRLabel") self.VideoModeLayout.addWidget(self.UseVMRLabel) - + self.VideoLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.VideoModeGroupBox) - # Signals and slots + # Signals and slots QtCore.QObject.connect(self.UseVMRCheckBox, - QtCore.SIGNAL("stateChanged(int)"), self.onVMRCheckBoxChanged) - + QtCore.SIGNAL("stateChanged(int)"), self.onVMRCheckBoxChanged) + def retranslateUi(self): self.VideoModeGroupBox.setTitle(translate("SettingsForm", "Video Mode")) self.UseVMRCheckBox.setText(translate("SettingsForm", "Use Video Mode Rendering")) @@ -69,11 +69,11 @@ class VideoTab(SettingsTab): self.use_vmr_mode = False if use_vmr_mode == 2: # we have a set value convert to True/False self.use_vmr_mode = True - + def load(self): - self.use_vmr_mode = self.convertStringToBoolean(self.config.get_config(u'use mode layout', u'False')) + self.use_vmr_mode = convertStringToBoolean(self.config.get_config(u'use mode layout', u'False')) if self.use_vmr_mode : self.UseVMRCheckBox.setChecked(True) - + def save(self): - self.config.set_config(u'use mode layout', str(self.use_vmr_mode)) + self.config.set_config(u'use mode layout', str(self.use_vmr_mode)) From a02835f0f89c12ea823cd8176a292434e309a658 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 19 Apr 2009 09:15:40 +0100 Subject: [PATCH 02/17] Add new dialog and fix the Theme import code not to include old style preview code --- openlp/core/ui/amendthemedialog.py | 719 +++++++---- openlp/core/ui/amendthemeform.py | 3 - openlp/core/ui/thememanager.py | 33 +- resources/forms/amendthemedialog.ui | 1712 +++++++++++++++++---------- 4 files changed, 1564 insertions(+), 903 deletions(-) diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index c43180995..0fe2dd27c 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'amendthemedialog.ui' # -# Created: Fri Apr 10 20:38:33 2009 +# Created: Sun Apr 19 07:51:09 2009 # by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! @@ -12,272 +12,416 @@ from PyQt4 import QtCore, QtGui class Ui_AmendThemeDialog(object): def setupUi(self, AmendThemeDialog): AmendThemeDialog.setObjectName("AmendThemeDialog") - AmendThemeDialog.resize(752, 533) + AmendThemeDialog.setWindowModality(QtCore.Qt.ApplicationModal) + AmendThemeDialog.resize(586, 651) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) AmendThemeDialog.setWindowIcon(icon) - self.ThemeButtonBox = QtGui.QDialogButtonBox(AmendThemeDialog) - self.ThemeButtonBox.setGeometry(QtCore.QRect(580, 500, 156, 26)) - self.ThemeButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) - self.ThemeButtonBox.setObjectName("ThemeButtonBox") - self.layoutWidget = QtGui.QWidget(AmendThemeDialog) - self.layoutWidget.setGeometry(QtCore.QRect(50, 20, 441, 41)) - self.layoutWidget.setObjectName("layoutWidget") - self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget) - self.horizontalLayout.setObjectName("horizontalLayout") - self.ThemeNameLabel = QtGui.QLabel(self.layoutWidget) + AmendThemeDialog.setModal(True) + self.AmendThemeLayout = QtGui.QVBoxLayout(AmendThemeDialog) + self.AmendThemeLayout.setSpacing(8) + self.AmendThemeLayout.setMargin(8) + self.AmendThemeLayout.setObjectName("AmendThemeLayout") + self.ThemeNameWidget = QtGui.QWidget(AmendThemeDialog) + self.ThemeNameWidget.setObjectName("ThemeNameWidget") + self.ThemeNameLayout = QtGui.QHBoxLayout(self.ThemeNameWidget) + self.ThemeNameLayout.setSpacing(8) + self.ThemeNameLayout.setMargin(0) + self.ThemeNameLayout.setObjectName("ThemeNameLayout") + self.ThemeNameLabel = QtGui.QLabel(self.ThemeNameWidget) self.ThemeNameLabel.setObjectName("ThemeNameLabel") - self.horizontalLayout.addWidget(self.ThemeNameLabel) - self.ThemeNameEdit = QtGui.QLineEdit(self.layoutWidget) + self.ThemeNameLayout.addWidget(self.ThemeNameLabel) + self.ThemeNameEdit = QtGui.QLineEdit(self.ThemeNameWidget) self.ThemeNameEdit.setObjectName("ThemeNameEdit") - self.horizontalLayout.addWidget(self.ThemeNameEdit) - self.widget = QtGui.QWidget(AmendThemeDialog) - self.widget.setGeometry(QtCore.QRect(31, 71, 721, 411)) - self.widget.setObjectName("widget") - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.widget) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.LeftSide = QtGui.QWidget(self.widget) - self.LeftSide.setObjectName("LeftSide") - self.tabWidget = QtGui.QTabWidget(self.LeftSide) - self.tabWidget.setGeometry(QtCore.QRect(0, 0, 341, 401)) - self.tabWidget.setObjectName("tabWidget") + self.ThemeNameLayout.addWidget(self.ThemeNameEdit) + self.AmendThemeLayout.addWidget(self.ThemeNameWidget) + self.ContentWidget = QtGui.QWidget(AmendThemeDialog) + self.ContentWidget.setObjectName("ContentWidget") + self.ContentLayout = QtGui.QHBoxLayout(self.ContentWidget) + self.ContentLayout.setSpacing(8) + self.ContentLayout.setMargin(0) + self.ContentLayout.setObjectName("ContentLayout") + self.ThemeTabWidget = QtGui.QTabWidget(self.ContentWidget) + self.ThemeTabWidget.setObjectName("ThemeTabWidget") self.BackgroundTab = QtGui.QWidget() self.BackgroundTab.setObjectName("BackgroundTab") - self.layoutWidget1 = QtGui.QWidget(self.BackgroundTab) - self.layoutWidget1.setGeometry(QtCore.QRect(10, 10, 321, 351)) - self.layoutWidget1.setObjectName("layoutWidget1") - self.gridLayout = QtGui.QGridLayout(self.layoutWidget1) - self.gridLayout.setObjectName("gridLayout") - self.BackgroundLabel = QtGui.QLabel(self.layoutWidget1) + self.BackgroundLayout = QtGui.QFormLayout(self.BackgroundTab) + self.BackgroundLayout.setMargin(8) + self.BackgroundLayout.setSpacing(8) + self.BackgroundLayout.setObjectName("BackgroundLayout") + self.BackgroundLabel = QtGui.QLabel(self.BackgroundTab) self.BackgroundLabel.setObjectName("BackgroundLabel") - self.gridLayout.addWidget(self.BackgroundLabel, 0, 0, 1, 2) - self.BackgroundComboBox = QtGui.QComboBox(self.layoutWidget1) + self.BackgroundLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.BackgroundLabel) + self.BackgroundComboBox = QtGui.QComboBox(self.BackgroundTab) self.BackgroundComboBox.setObjectName("BackgroundComboBox") self.BackgroundComboBox.addItem(QtCore.QString()) self.BackgroundComboBox.addItem(QtCore.QString()) - self.gridLayout.addWidget(self.BackgroundComboBox, 0, 2, 1, 2) - self.BackgroundTypeLabel = QtGui.QLabel(self.layoutWidget1) + self.BackgroundLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.BackgroundComboBox) + self.BackgroundTypeLabel = QtGui.QLabel(self.BackgroundTab) self.BackgroundTypeLabel.setObjectName("BackgroundTypeLabel") - self.gridLayout.addWidget(self.BackgroundTypeLabel, 1, 0, 1, 2) - self.BackgroundTypeComboBox = QtGui.QComboBox(self.layoutWidget1) + self.BackgroundLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.BackgroundTypeLabel) + self.BackgroundTypeComboBox = QtGui.QComboBox(self.BackgroundTab) self.BackgroundTypeComboBox.setObjectName("BackgroundTypeComboBox") self.BackgroundTypeComboBox.addItem(QtCore.QString()) self.BackgroundTypeComboBox.addItem(QtCore.QString()) self.BackgroundTypeComboBox.addItem(QtCore.QString()) - self.gridLayout.addWidget(self.BackgroundTypeComboBox, 1, 2, 1, 2) - self.Color1Label = QtGui.QLabel(self.layoutWidget1) + self.BackgroundLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.BackgroundTypeComboBox) + self.Color1Label = QtGui.QLabel(self.BackgroundTab) self.Color1Label.setObjectName("Color1Label") - self.gridLayout.addWidget(self.Color1Label, 2, 0, 1, 1) - self.Color1PushButton = QtGui.QPushButton(self.layoutWidget1) + self.BackgroundLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.Color1Label) + self.Color1PushButton = QtGui.QPushButton(self.BackgroundTab) self.Color1PushButton.setObjectName("Color1PushButton") - self.gridLayout.addWidget(self.Color1PushButton, 2, 2, 1, 2) - self.Color2Label = QtGui.QLabel(self.layoutWidget1) + self.BackgroundLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.Color1PushButton) + self.Color2Label = QtGui.QLabel(self.BackgroundTab) self.Color2Label.setObjectName("Color2Label") - self.gridLayout.addWidget(self.Color2Label, 3, 0, 1, 1) - self.Color2PushButton = QtGui.QPushButton(self.layoutWidget1) + self.BackgroundLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.Color2Label) + self.Color2PushButton = QtGui.QPushButton(self.BackgroundTab) self.Color2PushButton.setObjectName("Color2PushButton") - self.gridLayout.addWidget(self.Color2PushButton, 3, 2, 1, 2) - self.ImageLabel = QtGui.QLabel(self.layoutWidget1) + self.BackgroundLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.Color2PushButton) + self.ImageLabel = QtGui.QLabel(self.BackgroundTab) self.ImageLabel.setObjectName("ImageLabel") - self.gridLayout.addWidget(self.ImageLabel, 4, 0, 1, 1) - self.ImageLineEdit = QtGui.QLineEdit(self.layoutWidget1) - self.ImageLineEdit.setObjectName("ImageLineEdit") - self.gridLayout.addWidget(self.ImageLineEdit, 4, 1, 1, 2) - self.ImagePushButton = QtGui.QPushButton(self.layoutWidget1) - icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(":/services/service_open.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.ImagePushButton.setIcon(icon1) - self.ImagePushButton.setObjectName("ImagePushButton") - self.gridLayout.addWidget(self.ImagePushButton, 4, 3, 1, 1) - self.GradientLabel = QtGui.QLabel(self.layoutWidget1) + self.BackgroundLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.ImageLabel) + self.GradientLabel = QtGui.QLabel(self.BackgroundTab) self.GradientLabel.setObjectName("GradientLabel") - self.gridLayout.addWidget(self.GradientLabel, 5, 0, 1, 1) - self.GradientComboBox = QtGui.QComboBox(self.layoutWidget1) + self.BackgroundLayout.setWidget(6, QtGui.QFormLayout.LabelRole, self.GradientLabel) + self.GradientComboBox = QtGui.QComboBox(self.BackgroundTab) self.GradientComboBox.setObjectName("GradientComboBox") self.GradientComboBox.addItem(QtCore.QString()) self.GradientComboBox.addItem(QtCore.QString()) self.GradientComboBox.addItem(QtCore.QString()) - self.gridLayout.addWidget(self.GradientComboBox, 5, 2, 1, 2) - self.tabWidget.addTab(self.BackgroundTab, "") + self.BackgroundLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.GradientComboBox) + self.ImageFilenameWidget = QtGui.QWidget(self.BackgroundTab) + self.ImageFilenameWidget.setObjectName("ImageFilenameWidget") + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.ImageFilenameWidget) + self.horizontalLayout_2.setSpacing(0) + self.horizontalLayout_2.setMargin(0) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.ImageLineEdit = QtGui.QLineEdit(self.ImageFilenameWidget) + self.ImageLineEdit.setObjectName("ImageLineEdit") + self.horizontalLayout_2.addWidget(self.ImageLineEdit) + self.ImageToolButton = QtGui.QToolButton(self.ImageFilenameWidget) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap(":/images/image_load.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.ImageToolButton.setIcon(icon1) + self.ImageToolButton.setObjectName("ImageToolButton") + self.horizontalLayout_2.addWidget(self.ImageToolButton) + self.BackgroundLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.ImageFilenameWidget) + spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + #self.BackgroundLayout.addItem(spacerItem, 7, 1, 1, 1) + self.ThemeTabWidget.addTab(self.BackgroundTab, "") self.FontMainTab = QtGui.QWidget() self.FontMainTab.setObjectName("FontMainTab") - self.MainFontGroupBox = QtGui.QGroupBox(self.FontMainTab) - self.MainFontGroupBox.setGeometry(QtCore.QRect(20, 10, 307, 119)) + self.FontMainLayout = QtGui.QHBoxLayout(self.FontMainTab) + self.FontMainLayout.setSpacing(8) + self.FontMainLayout.setMargin(8) + self.FontMainLayout.setObjectName("FontMainLayout") + self.MainLeftWidget = QtGui.QWidget(self.FontMainTab) + self.MainLeftWidget.setObjectName("MainLeftWidget") + self.MainLeftLayout = QtGui.QVBoxLayout(self.MainLeftWidget) + self.MainLeftLayout.setSpacing(8) + self.MainLeftLayout.setMargin(0) + self.MainLeftLayout.setObjectName("MainLeftLayout") + self.MainFontGroupBox = QtGui.QGroupBox(self.MainLeftWidget) self.MainFontGroupBox.setObjectName("MainFontGroupBox") - self.gridLayout_2 = QtGui.QGridLayout(self.MainFontGroupBox) - self.gridLayout_2.setObjectName("gridLayout_2") + self.MainFontLayout = QtGui.QFormLayout(self.MainFontGroupBox) + self.MainFontLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.MainFontLayout.setMargin(8) + self.MainFontLayout.setSpacing(8) + self.MainFontLayout.setObjectName("MainFontLayout") self.MainFontlabel = QtGui.QLabel(self.MainFontGroupBox) self.MainFontlabel.setObjectName("MainFontlabel") - self.gridLayout_2.addWidget(self.MainFontlabel, 0, 0, 1, 1) + self.MainFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.MainFontlabel) self.MainFontComboBox = QtGui.QFontComboBox(self.MainFontGroupBox) self.MainFontComboBox.setObjectName("MainFontComboBox") - self.gridLayout_2.addWidget(self.MainFontComboBox, 0, 1, 1, 2) + self.MainFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.MainFontComboBox) self.MainFontColorLabel = QtGui.QLabel(self.MainFontGroupBox) self.MainFontColorLabel.setObjectName("MainFontColorLabel") - self.gridLayout_2.addWidget(self.MainFontColorLabel, 1, 0, 1, 1) + self.MainFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.MainFontColorLabel) self.MainFontColorPushButton = QtGui.QPushButton(self.MainFontGroupBox) self.MainFontColorPushButton.setObjectName("MainFontColorPushButton") - self.gridLayout_2.addWidget(self.MainFontColorPushButton, 1, 2, 1, 1) + self.MainFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.MainFontColorPushButton) self.MainFontSize = QtGui.QLabel(self.MainFontGroupBox) self.MainFontSize.setObjectName("MainFontSize") - self.gridLayout_2.addWidget(self.MainFontSize, 2, 0, 1, 1) - self.MainFontSizeLineEdit = QtGui.QLineEdit(self.MainFontGroupBox) - self.MainFontSizeLineEdit.setObjectName("MainFontSizeLineEdit") - self.gridLayout_2.addWidget(self.MainFontSizeLineEdit, 2, 1, 1, 1) - self.MainFontlSlider = QtGui.QSlider(self.MainFontGroupBox) - self.MainFontlSlider.setProperty("value", QtCore.QVariant(15)) - self.MainFontlSlider.setMaximum(40) - self.MainFontlSlider.setOrientation(QtCore.Qt.Horizontal) - self.MainFontlSlider.setTickPosition(QtGui.QSlider.TicksBelow) - self.MainFontlSlider.setTickInterval(5) - self.MainFontlSlider.setObjectName("MainFontlSlider") - self.gridLayout_2.addWidget(self.MainFontlSlider, 2, 2, 1, 1) - self.FooterFontGroupBox = QtGui.QGroupBox(self.FontMainTab) - self.FooterFontGroupBox.setGeometry(QtCore.QRect(20, 160, 301, 190)) - self.FooterFontGroupBox.setObjectName("FooterFontGroupBox") - self.verticalLayout = QtGui.QVBoxLayout(self.FooterFontGroupBox) - self.verticalLayout.setObjectName("verticalLayout") - self.FontMainUseDefault = QtGui.QCheckBox(self.FooterFontGroupBox) + self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.MainFontSize) + self.MainFontSizeSpinBox = QtGui.QSpinBox(self.MainFontGroupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.MainFontSizeSpinBox.sizePolicy().hasHeightForWidth()) + self.MainFontSizeSpinBox.setSizePolicy(sizePolicy) + self.MainFontSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) + self.MainFontSizeSpinBox.setMaximum(999) + self.MainFontSizeSpinBox.setProperty("value", QtCore.QVariant(16)) + self.MainFontSizeSpinBox.setObjectName("MainFontSizeSpinBox") + self.MainFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.MainFontSizeSpinBox) + self.MainLeftLayout.addWidget(self.MainFontGroupBox) + spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.MainLeftLayout.addItem(spacerItem1) + self.FontMainLayout.addWidget(self.MainLeftWidget) + self.MainRightWidget = QtGui.QWidget(self.FontMainTab) + self.MainRightWidget.setObjectName("MainRightWidget") + self.MainRightLayout = QtGui.QVBoxLayout(self.MainRightWidget) + self.MainRightLayout.setSpacing(8) + self.MainRightLayout.setMargin(0) + self.MainRightLayout.setObjectName("MainRightLayout") + self.MainLocationGroupBox = QtGui.QGroupBox(self.MainRightWidget) + self.MainLocationGroupBox.setObjectName("MainLocationGroupBox") + self.MainLocationLayout = QtGui.QFormLayout(self.MainLocationGroupBox) + self.MainLocationLayout.setMargin(8) + self.MainLocationLayout.setSpacing(8) + self.MainLocationLayout.setObjectName("MainLocationLayout") + self.DefaultLocationLabel = QtGui.QLabel(self.MainLocationGroupBox) + self.DefaultLocationLabel.setObjectName("DefaultLocationLabel") + self.MainLocationLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.DefaultLocationLabel) + self.FontMainUseDefault = QtGui.QCheckBox(self.MainLocationGroupBox) self.FontMainUseDefault.setTristate(False) self.FontMainUseDefault.setObjectName("FontMainUseDefault") - self.verticalLayout.addWidget(self.FontMainUseDefault) - self.horizontalLayout_3 = QtGui.QHBoxLayout() - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.FontMainXLabel = QtGui.QLabel(self.FooterFontGroupBox) + self.MainLocationLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontMainUseDefault) + self.FontMainXLabel = QtGui.QLabel(self.MainLocationGroupBox) self.FontMainXLabel.setObjectName("FontMainXLabel") - self.horizontalLayout_3.addWidget(self.FontMainXLabel) - self.FontMainXEdit = QtGui.QLineEdit(self.FooterFontGroupBox) - self.FontMainXEdit.setObjectName("FontMainXEdit") - self.horizontalLayout_3.addWidget(self.FontMainXEdit) - self.verticalLayout.addLayout(self.horizontalLayout_3) - self.horizontalLayout_4 = QtGui.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.FontMainYLabel = QtGui.QLabel(self.FooterFontGroupBox) + self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FontMainXLabel) + self.FontMainYLabel = QtGui.QLabel(self.MainLocationGroupBox) self.FontMainYLabel.setObjectName("FontMainYLabel") - self.horizontalLayout_4.addWidget(self.FontMainYLabel) - self.FontMainYEdit = QtGui.QLineEdit(self.FooterFontGroupBox) - self.FontMainYEdit.setObjectName("FontMainYEdit") - self.horizontalLayout_4.addWidget(self.FontMainYEdit) - self.verticalLayout.addLayout(self.horizontalLayout_4) - self.horizontalLayout_5 = QtGui.QHBoxLayout() - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.FontMainWidthLabel = QtGui.QLabel(self.FooterFontGroupBox) + self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontMainYLabel) + self.FontMainWidthLabel = QtGui.QLabel(self.MainLocationGroupBox) self.FontMainWidthLabel.setObjectName("FontMainWidthLabel") - self.horizontalLayout_5.addWidget(self.FontMainWidthLabel) - self.FontMainWidthEdit = QtGui.QLineEdit(self.FooterFontGroupBox) - self.FontMainWidthEdit.setObjectName("FontMainWidthEdit") - self.horizontalLayout_5.addWidget(self.FontMainWidthEdit) - self.verticalLayout.addLayout(self.horizontalLayout_5) - self.horizontalLayout_6 = QtGui.QHBoxLayout() - self.horizontalLayout_6.setObjectName("horizontalLayout_6") - self.FontMainHeightLabel = QtGui.QLabel(self.FooterFontGroupBox) + self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontMainWidthLabel) + self.FontMainHeightLabel = QtGui.QLabel(self.MainLocationGroupBox) self.FontMainHeightLabel.setObjectName("FontMainHeightLabel") - self.horizontalLayout_6.addWidget(self.FontMainHeightLabel) - self.FontMainHeightEdit = QtGui.QLineEdit(self.FooterFontGroupBox) - self.FontMainHeightEdit.setObjectName("FontMainHeightEdit") - self.horizontalLayout_6.addWidget(self.FontMainHeightEdit) - self.verticalLayout.addLayout(self.horizontalLayout_6) - self.tabWidget.addTab(self.FontMainTab, "") + self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainHeightLabel) + self.FontMainXSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.FontMainXSpinBox.sizePolicy().hasHeightForWidth()) + self.FontMainXSpinBox.setSizePolicy(sizePolicy) + self.FontMainXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) + self.FontMainXSpinBox.setMaximum(9999) + self.FontMainXSpinBox.setProperty("value", QtCore.QVariant(0)) + self.FontMainXSpinBox.setObjectName("FontMainXSpinBox") + self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontMainXSpinBox) + self.FontMainYSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.FontMainYSpinBox.sizePolicy().hasHeightForWidth()) + self.FontMainYSpinBox.setSizePolicy(sizePolicy) + self.FontMainYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) + self.FontMainYSpinBox.setMaximum(9999) + self.FontMainYSpinBox.setObjectName("FontMainYSpinBox") + self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontMainYSpinBox) + self.FontMainWidthSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.FontMainWidthSpinBox.sizePolicy().hasHeightForWidth()) + self.FontMainWidthSpinBox.setSizePolicy(sizePolicy) + self.FontMainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0)) + self.FontMainWidthSpinBox.setMaximum(9999) + self.FontMainWidthSpinBox.setObjectName("FontMainWidthSpinBox") + self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontMainWidthSpinBox) + self.FontMainHeightSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.FontMainHeightSpinBox.sizePolicy().hasHeightForWidth()) + self.FontMainHeightSpinBox.setSizePolicy(sizePolicy) + self.FontMainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) + self.FontMainHeightSpinBox.setMaximum(9999) + self.FontMainHeightSpinBox.setObjectName("FontMainHeightSpinBox") + self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainHeightSpinBox) + self.MainRightLayout.addWidget(self.MainLocationGroupBox) + spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.MainRightLayout.addItem(spacerItem2) + self.FontMainLayout.addWidget(self.MainRightWidget) + self.ThemeTabWidget.addTab(self.FontMainTab, "") self.FontFooterTab = QtGui.QWidget() self.FontFooterTab.setObjectName("FontFooterTab") - self.FooterFontGroupBox_2 = QtGui.QGroupBox(self.FontFooterTab) - self.FooterFontGroupBox_2.setGeometry(QtCore.QRect(20, 160, 301, 190)) - self.FooterFontGroupBox_2.setObjectName("FooterFontGroupBox_2") - self.verticalLayout_2 = QtGui.QVBoxLayout(self.FooterFontGroupBox_2) - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.FontMainUseDefault_2 = QtGui.QCheckBox(self.FooterFontGroupBox_2) - self.FontMainUseDefault_2.setTristate(False) - self.FontMainUseDefault_2.setObjectName("FontMainUseDefault_2") - self.verticalLayout_2.addWidget(self.FontMainUseDefault_2) - self.horizontalLayout_7 = QtGui.QHBoxLayout() - self.horizontalLayout_7.setObjectName("horizontalLayout_7") - self.FontFooterXLabel = QtGui.QLabel(self.FooterFontGroupBox_2) - self.FontFooterXLabel.setObjectName("FontFooterXLabel") - self.horizontalLayout_7.addWidget(self.FontFooterXLabel) - self.FontFooterXEdit = QtGui.QLineEdit(self.FooterFontGroupBox_2) - self.FontFooterXEdit.setObjectName("FontFooterXEdit") - self.horizontalLayout_7.addWidget(self.FontFooterXEdit) - self.verticalLayout_2.addLayout(self.horizontalLayout_7) - self.horizontalLayout_8 = QtGui.QHBoxLayout() - self.horizontalLayout_8.setObjectName("horizontalLayout_8") - self.FontFooterYLabel = QtGui.QLabel(self.FooterFontGroupBox_2) - self.FontFooterYLabel.setObjectName("FontFooterYLabel") - self.horizontalLayout_8.addWidget(self.FontFooterYLabel) - self.FontFooterYEdit = QtGui.QLineEdit(self.FooterFontGroupBox_2) - self.FontFooterYEdit.setObjectName("FontFooterYEdit") - self.horizontalLayout_8.addWidget(self.FontFooterYEdit) - self.verticalLayout_2.addLayout(self.horizontalLayout_8) - self.horizontalLayout_9 = QtGui.QHBoxLayout() - self.horizontalLayout_9.setObjectName("horizontalLayout_9") - self.FontFooterWidthLabel = QtGui.QLabel(self.FooterFontGroupBox_2) - self.FontFooterWidthLabel.setObjectName("FontFooterWidthLabel") - self.horizontalLayout_9.addWidget(self.FontFooterWidthLabel) - self.FontFooterWidthEdit = QtGui.QLineEdit(self.FooterFontGroupBox_2) - self.FontFooterWidthEdit.setObjectName("FontFooterWidthEdit") - self.horizontalLayout_9.addWidget(self.FontFooterWidthEdit) - self.verticalLayout_2.addLayout(self.horizontalLayout_9) - self.horizontalLayout_10 = QtGui.QHBoxLayout() - self.horizontalLayout_10.setObjectName("horizontalLayout_10") - self.FontFooterHeightLabel = QtGui.QLabel(self.FooterFontGroupBox_2) - self.FontFooterHeightLabel.setObjectName("FontFooterHeightLabel") - self.horizontalLayout_10.addWidget(self.FontFooterHeightLabel) - self.FontFooterHeightEdit = QtGui.QLineEdit(self.FooterFontGroupBox_2) - self.FontFooterHeightEdit.setObjectName("FontFooterHeightEdit") - self.horizontalLayout_10.addWidget(self.FontFooterHeightEdit) - self.verticalLayout_2.addLayout(self.horizontalLayout_10) - self.FooterFontGroupBox_3 = QtGui.QGroupBox(self.FontFooterTab) - self.FooterFontGroupBox_3.setGeometry(QtCore.QRect(20, 10, 307, 119)) - self.FooterFontGroupBox_3.setObjectName("FooterFontGroupBox_3") - self.gridLayout_3 = QtGui.QGridLayout(self.FooterFontGroupBox_3) - self.gridLayout_3.setObjectName("gridLayout_3") - self.FontFooterlabel = QtGui.QLabel(self.FooterFontGroupBox_3) - self.FontFooterlabel.setObjectName("FontFooterlabel") - self.gridLayout_3.addWidget(self.FontFooterlabel, 0, 0, 1, 1) - self.FontFooterComboBox = QtGui.QFontComboBox(self.FooterFontGroupBox_3) + self.FontFooterLayout = QtGui.QHBoxLayout(self.FontFooterTab) + self.FontFooterLayout.setSpacing(8) + self.FontFooterLayout.setMargin(8) + self.FontFooterLayout.setObjectName("FontFooterLayout") + self.FooterLeftWidget = QtGui.QWidget(self.FontFooterTab) + self.FooterLeftWidget.setObjectName("FooterLeftWidget") + self.FooterLeftLayout = QtGui.QVBoxLayout(self.FooterLeftWidget) + self.FooterLeftLayout.setSpacing(8) + self.FooterLeftLayout.setMargin(0) + self.FooterLeftLayout.setObjectName("FooterLeftLayout") + self.FooterFontGroupBox = QtGui.QGroupBox(self.FooterLeftWidget) + self.FooterFontGroupBox.setObjectName("FooterFontGroupBox") + self.FooterFontLayout = QtGui.QFormLayout(self.FooterFontGroupBox) + self.FooterFontLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) + self.FooterFontLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.FooterFontLayout.setMargin(8) + self.FooterFontLayout.setSpacing(8) + self.FooterFontLayout.setObjectName("FooterFontLayout") + self.FontFooterLabel = QtGui.QLabel(self.FooterFontGroupBox) + self.FontFooterLabel.setObjectName("FontFooterLabel") + self.FooterFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.FontFooterLabel) + self.FontFooterComboBox = QtGui.QFontComboBox(self.FooterFontGroupBox) self.FontFooterComboBox.setObjectName("FontFooterComboBox") - self.gridLayout_3.addWidget(self.FontFooterComboBox, 0, 1, 1, 2) - self.FontFooterColorLabel = QtGui.QLabel(self.FooterFontGroupBox_3) + self.FooterFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontFooterComboBox) + self.FontFooterColorLabel = QtGui.QLabel(self.FooterFontGroupBox) self.FontFooterColorLabel.setObjectName("FontFooterColorLabel") - self.gridLayout_3.addWidget(self.FontFooterColorLabel, 1, 0, 1, 1) - self.FontFooterColorPushButton = QtGui.QPushButton(self.FooterFontGroupBox_3) + self.FooterFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FontFooterColorLabel) + self.FontFooterColorPushButton = QtGui.QPushButton(self.FooterFontGroupBox) self.FontFooterColorPushButton.setObjectName("FontFooterColorPushButton") - self.gridLayout_3.addWidget(self.FontFooterColorPushButton, 1, 2, 1, 1) - self.FontFooterSizeLabel = QtGui.QLabel(self.FooterFontGroupBox_3) + self.FooterFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontFooterColorPushButton) + self.FontFooterSizeLabel = QtGui.QLabel(self.FooterFontGroupBox) self.FontFooterSizeLabel.setObjectName("FontFooterSizeLabel") - self.gridLayout_3.addWidget(self.FontFooterSizeLabel, 2, 0, 1, 1) - self.FontFooterSizeLineEdit = QtGui.QLineEdit(self.FooterFontGroupBox_3) - self.FontFooterSizeLineEdit.setObjectName("FontFooterSizeLineEdit") - self.gridLayout_3.addWidget(self.FontFooterSizeLineEdit, 2, 1, 1, 1) - self.FontFooterSlider = QtGui.QSlider(self.FooterFontGroupBox_3) - self.FontFooterSlider.setProperty("value", QtCore.QVariant(15)) - self.FontFooterSlider.setMaximum(40) - self.FontFooterSlider.setOrientation(QtCore.Qt.Horizontal) - self.FontFooterSlider.setTickPosition(QtGui.QSlider.TicksBelow) - self.FontFooterSlider.setTickInterval(5) - self.FontFooterSlider.setObjectName("FontFooterSlider") - self.gridLayout_3.addWidget(self.FontFooterSlider, 2, 2, 1, 1) - self.tabWidget.addTab(self.FontFooterTab, "") - self.OptionsTab = QtGui.QWidget() - self.OptionsTab.setObjectName("OptionsTab") - self.ShadowGroupBox = QtGui.QGroupBox(self.OptionsTab) - self.ShadowGroupBox.setGeometry(QtCore.QRect(20, 10, 301, 80)) + self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontFooterSizeLabel) + self.FontFooterSizeSpinBox = QtGui.QSpinBox(self.FooterFontGroupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.FontFooterSizeSpinBox.sizePolicy().hasHeightForWidth()) + self.FontFooterSizeSpinBox.setSizePolicy(sizePolicy) + self.FontFooterSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) + self.FontFooterSizeSpinBox.setMaximum(999) + self.FontFooterSizeSpinBox.setProperty("value", QtCore.QVariant(10)) + self.FontFooterSizeSpinBox.setObjectName("FontFooterSizeSpinBox") + self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontFooterSizeSpinBox) + self.FooterLeftLayout.addWidget(self.FooterFontGroupBox) + spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.FooterLeftLayout.addItem(spacerItem3) + self.FontFooterLayout.addWidget(self.FooterLeftWidget) + self.FooterRightWidget = QtGui.QWidget(self.FontFooterTab) + self.FooterRightWidget.setObjectName("FooterRightWidget") + self.FooterRightLayout = QtGui.QVBoxLayout(self.FooterRightWidget) + self.FooterRightLayout.setSpacing(8) + self.FooterRightLayout.setMargin(0) + self.FooterRightLayout.setObjectName("FooterRightLayout") + self.LocationFooterGroupBox = QtGui.QGroupBox(self.FooterRightWidget) + self.LocationFooterGroupBox.setObjectName("LocationFooterGroupBox") + self.LocationFooterLayout = QtGui.QFormLayout(self.LocationFooterGroupBox) + self.LocationFooterLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) + self.LocationFooterLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.LocationFooterLayout.setMargin(8) + self.LocationFooterLayout.setSpacing(8) + self.LocationFooterLayout.setObjectName("LocationFooterLayout") + self.FontFooterDefaultLabel = QtGui.QLabel(self.LocationFooterGroupBox) + self.FontFooterDefaultLabel.setObjectName("FontFooterDefaultLabel") + self.LocationFooterLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.FontFooterDefaultLabel) + self.FontFooterDefaultCheckBox = QtGui.QCheckBox(self.LocationFooterGroupBox) + self.FontFooterDefaultCheckBox.setTristate(False) + self.FontFooterDefaultCheckBox.setObjectName("FontFooterDefaultCheckBox") + self.LocationFooterLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontFooterDefaultCheckBox) + self.FontFooterXLabel = QtGui.QLabel(self.LocationFooterGroupBox) + self.FontFooterXLabel.setObjectName("FontFooterXLabel") + self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FontFooterXLabel) + self.FontFooterYLabel = QtGui.QLabel(self.LocationFooterGroupBox) + self.FontFooterYLabel.setObjectName("FontFooterYLabel") + self.LocationFooterLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontFooterYLabel) + self.FontFooterWidthLabel = QtGui.QLabel(self.LocationFooterGroupBox) + self.FontFooterWidthLabel.setObjectName("FontFooterWidthLabel") + self.LocationFooterLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontFooterWidthLabel) + self.FontFooterHeightLabel = QtGui.QLabel(self.LocationFooterGroupBox) + self.FontFooterHeightLabel.setObjectName("FontFooterHeightLabel") + self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontFooterHeightLabel) + self.FontFooterXSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth()) + self.FontFooterXSpinBox.setSizePolicy(sizePolicy) + self.FontFooterXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) + self.FontFooterXSpinBox.setMaximum(9999) + self.FontFooterXSpinBox.setProperty("value", QtCore.QVariant(0)) + self.FontFooterXSpinBox.setObjectName("FontFooterXSpinBox") + self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontFooterXSpinBox) + self.FontFooterYSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.FontFooterYSpinBox.sizePolicy().hasHeightForWidth()) + self.FontFooterYSpinBox.setSizePolicy(sizePolicy) + self.FontFooterYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) + self.FontFooterYSpinBox.setMaximum(9999) + self.FontFooterYSpinBox.setProperty("value", QtCore.QVariant(0)) + self.FontFooterYSpinBox.setObjectName("FontFooterYSpinBox") + self.LocationFooterLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontFooterYSpinBox) + self.FontFooterWidthspinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) + self.FontFooterWidthspinBox.setMinimumSize(QtCore.QSize(78, 0)) + self.FontFooterWidthspinBox.setMaximum(9999) + self.FontFooterWidthspinBox.setObjectName("FontFooterWidthspinBox") + self.LocationFooterLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontFooterWidthspinBox) + self.FontFooterHeightSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) + self.FontFooterHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) + self.FontFooterHeightSpinBox.setMaximum(9999) + self.FontFooterHeightSpinBox.setObjectName("FontFooterHeightSpinBox") + self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontFooterHeightSpinBox) + self.FooterRightLayout.addWidget(self.LocationFooterGroupBox) + spacerItem4 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.FooterRightLayout.addItem(spacerItem4) + self.FontFooterLayout.addWidget(self.FooterRightWidget) + self.ThemeTabWidget.addTab(self.FontFooterTab, "") + self.OtherOptionsTab = QtGui.QWidget() + self.OtherOptionsTab.setObjectName("OtherOptionsTab") + self.OtherOptionsLayout = QtGui.QHBoxLayout(self.OtherOptionsTab) + self.OtherOptionsLayout.setSpacing(8) + self.OtherOptionsLayout.setMargin(8) + self.OtherOptionsLayout.setObjectName("OtherOptionsLayout") + self.OptionsLeftWidget = QtGui.QWidget(self.OtherOptionsTab) + self.OptionsLeftWidget.setObjectName("OptionsLeftWidget") + self.OptionsLeftLayout = QtGui.QVBoxLayout(self.OptionsLeftWidget) + self.OptionsLeftLayout.setSpacing(8) + self.OptionsLeftLayout.setMargin(0) + self.OptionsLeftLayout.setObjectName("OptionsLeftLayout") + self.ShadowGroupBox = QtGui.QGroupBox(self.OptionsLeftWidget) self.ShadowGroupBox.setObjectName("ShadowGroupBox") - self.layoutWidget2 = QtGui.QWidget(self.ShadowGroupBox) - self.layoutWidget2.setGeometry(QtCore.QRect(10, 20, 281, 58)) - self.layoutWidget2.setObjectName("layoutWidget2") - self.formLayout = QtGui.QFormLayout(self.layoutWidget2) - self.formLayout.setObjectName("formLayout") - self.ShadowCheckBox = QtGui.QCheckBox(self.layoutWidget2) + self.verticalLayout = QtGui.QVBoxLayout(self.ShadowGroupBox) + self.verticalLayout.setSpacing(8) + self.verticalLayout.setMargin(8) + self.verticalLayout.setObjectName("verticalLayout") + self.OutlineWidget = QtGui.QWidget(self.ShadowGroupBox) + self.OutlineWidget.setObjectName("OutlineWidget") + self.OutlineLayout = QtGui.QFormLayout(self.OutlineWidget) + self.OutlineLayout.setMargin(0) + self.OutlineLayout.setSpacing(8) + self.OutlineLayout.setObjectName("OutlineLayout") + self.OutlineCheckBox = QtGui.QCheckBox(self.OutlineWidget) + self.OutlineCheckBox.setObjectName("OutlineCheckBox") + self.OutlineLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.OutlineCheckBox) + self.OutlineColorLabel = QtGui.QLabel(self.OutlineWidget) + self.OutlineColorLabel.setObjectName("OutlineColorLabel") + self.OutlineLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OutlineColorLabel) + self.OutlineColorPushButton = QtGui.QPushButton(self.OutlineWidget) + self.OutlineColorPushButton.setObjectName("OutlineColorPushButton") + self.OutlineLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.OutlineColorPushButton) + self.OutlineEnabledLabel = QtGui.QLabel(self.OutlineWidget) + self.OutlineEnabledLabel.setObjectName("OutlineEnabledLabel") + self.OutlineLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.OutlineEnabledLabel) + self.verticalLayout.addWidget(self.OutlineWidget) + self.ShadowWidget = QtGui.QWidget(self.ShadowGroupBox) + self.ShadowWidget.setObjectName("ShadowWidget") + self.ShadowLayout = QtGui.QFormLayout(self.ShadowWidget) + self.ShadowLayout.setMargin(0) + self.ShadowLayout.setSpacing(8) + self.ShadowLayout.setObjectName("ShadowLayout") + self.ShadowCheckBox = QtGui.QCheckBox(self.ShadowWidget) self.ShadowCheckBox.setObjectName("ShadowCheckBox") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.ShadowCheckBox) - self.ShadowColorLabel = QtGui.QLabel(self.layoutWidget2) + self.ShadowLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.ShadowCheckBox) + self.ShadowColorLabel = QtGui.QLabel(self.ShadowWidget) self.ShadowColorLabel.setObjectName("ShadowColorLabel") - self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.ShadowColorLabel) - self.ShadowColorPushButton = QtGui.QPushButton(self.layoutWidget2) + self.ShadowLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.ShadowColorLabel) + self.ShadowColorPushButton = QtGui.QPushButton(self.ShadowWidget) self.ShadowColorPushButton.setObjectName("ShadowColorPushButton") - self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ShadowColorPushButton) - self.AlignmentGroupBox = QtGui.QGroupBox(self.OptionsTab) - self.AlignmentGroupBox.setGeometry(QtCore.QRect(10, 200, 321, 161)) + self.ShadowLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ShadowColorPushButton) + self.ShadowEnabledLabel = QtGui.QLabel(self.ShadowWidget) + self.ShadowEnabledLabel.setObjectName("ShadowEnabledLabel") + self.ShadowLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.ShadowEnabledLabel) + self.verticalLayout.addWidget(self.ShadowWidget) + self.OptionsLeftLayout.addWidget(self.ShadowGroupBox) + spacerItem5 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.OptionsLeftLayout.addItem(spacerItem5) + self.OtherOptionsLayout.addWidget(self.OptionsLeftWidget) + self.OptionsRightWidget = QtGui.QWidget(self.OtherOptionsTab) + self.OptionsRightWidget.setObjectName("OptionsRightWidget") + self.OptionsRightLayout = QtGui.QVBoxLayout(self.OptionsRightWidget) + self.OptionsRightLayout.setSpacing(8) + self.OptionsRightLayout.setMargin(0) + self.OptionsRightLayout.setObjectName("OptionsRightLayout") + self.AlignmentGroupBox = QtGui.QGroupBox(self.OptionsRightWidget) self.AlignmentGroupBox.setObjectName("AlignmentGroupBox") self.gridLayout_4 = QtGui.QGridLayout(self.AlignmentGroupBox) self.gridLayout_4.setObjectName("gridLayout_4") @@ -299,43 +443,82 @@ class Ui_AmendThemeDialog(object): self.VerticalComboBox.addItem(QtCore.QString()) self.VerticalComboBox.addItem(QtCore.QString()) self.gridLayout_4.addWidget(self.VerticalComboBox, 1, 1, 1, 1) - self.OutlineGroupBox = QtGui.QGroupBox(self.OptionsTab) - self.OutlineGroupBox.setGeometry(QtCore.QRect(20, 110, 301, 80)) - self.OutlineGroupBox.setObjectName("OutlineGroupBox") - self.layoutWidget_3 = QtGui.QWidget(self.OutlineGroupBox) - self.layoutWidget_3.setGeometry(QtCore.QRect(10, 20, 281, 58)) - self.layoutWidget_3.setObjectName("layoutWidget_3") - self.OutlineformLayout = QtGui.QFormLayout(self.layoutWidget_3) - self.OutlineformLayout.setObjectName("OutlineformLayout") - self.OutlineCheckBox = QtGui.QCheckBox(self.layoutWidget_3) - self.OutlineCheckBox.setObjectName("OutlineCheckBox") - self.OutlineformLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.OutlineCheckBox) - self.OutlineColorLabel = QtGui.QLabel(self.layoutWidget_3) - self.OutlineColorLabel.setObjectName("OutlineColorLabel") - self.OutlineformLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OutlineColorLabel) - self.OutlineColorPushButton = QtGui.QPushButton(self.layoutWidget_3) - self.OutlineColorPushButton.setObjectName("OutlineColorPushButton") - self.OutlineformLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.OutlineColorPushButton) - self.tabWidget.addTab(self.OptionsTab, "") - self.horizontalLayout_2.addWidget(self.LeftSide) - self.RightSide = QtGui.QWidget(self.widget) - self.RightSide.setObjectName("RightSide") - self.ThemePreview = QtGui.QLabel(self.RightSide) - self.ThemePreview.setGeometry(QtCore.QRect(20, 60, 311, 271)) - self.ThemePreview.setFrameShape(QtGui.QFrame.Box) - self.ThemePreview.setFrameShadow(QtGui.QFrame.Raised) - self.ThemePreview.setLineWidth(2) + self.OptionsRightLayout.addWidget(self.AlignmentGroupBox) + spacerItem6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.OptionsRightLayout.addItem(spacerItem6) + self.OtherOptionsLayout.addWidget(self.OptionsRightWidget) + self.ThemeTabWidget.addTab(self.OtherOptionsTab, "") + self.ContentLayout.addWidget(self.ThemeTabWidget) + self.AmendThemeLayout.addWidget(self.ContentWidget) + self.PreviewGroupBox = QtGui.QGroupBox(AmendThemeDialog) + self.PreviewGroupBox.setObjectName("PreviewGroupBox") + self.ThemePreviewLayout = QtGui.QHBoxLayout(self.PreviewGroupBox) + self.ThemePreviewLayout.setSpacing(8) + self.ThemePreviewLayout.setMargin(8) + self.ThemePreviewLayout.setObjectName("ThemePreviewLayout") + spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.ThemePreviewLayout.addItem(spacerItem7) + self.ThemePreview = QtGui.QLabel(self.PreviewGroupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ThemePreview.sizePolicy().hasHeightForWidth()) + self.ThemePreview.setSizePolicy(sizePolicy) + self.ThemePreview.setMinimumSize(QtCore.QSize(300, 225)) + self.ThemePreview.setFrameShape(QtGui.QFrame.WinPanel) + self.ThemePreview.setFrameShadow(QtGui.QFrame.Sunken) + self.ThemePreview.setLineWidth(1) self.ThemePreview.setScaledContents(True) self.ThemePreview.setObjectName("ThemePreview") - self.horizontalLayout_2.addWidget(self.RightSide) + self.ThemePreviewLayout.addWidget(self.ThemePreview) + spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.ThemePreviewLayout.addItem(spacerItem8) + self.AmendThemeLayout.addWidget(self.PreviewGroupBox) + self.ThemeButtonBox = QtGui.QDialogButtonBox(AmendThemeDialog) + self.ThemeButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) + self.ThemeButtonBox.setObjectName("ThemeButtonBox") + self.AmendThemeLayout.addWidget(self.ThemeButtonBox) self.retranslateUi(AmendThemeDialog) - self.tabWidget.setCurrentIndex(0) + self.ThemeTabWidget.setCurrentIndex(0) + QtCore.QObject.connect(self.ThemeButtonBox, QtCore.SIGNAL("accepted()"), AmendThemeDialog.accept) + QtCore.QObject.connect(self.ThemeButtonBox, QtCore.SIGNAL("rejected()"), AmendThemeDialog.reject) QtCore.QMetaObject.connectSlotsByName(AmendThemeDialog) + AmendThemeDialog.setTabOrder(self.ThemeButtonBox, self.ThemeNameEdit) + AmendThemeDialog.setTabOrder(self.ThemeNameEdit, self.ThemeTabWidget) + AmendThemeDialog.setTabOrder(self.ThemeTabWidget, self.BackgroundComboBox) + AmendThemeDialog.setTabOrder(self.BackgroundComboBox, self.BackgroundTypeComboBox) + AmendThemeDialog.setTabOrder(self.BackgroundTypeComboBox, self.Color1PushButton) + AmendThemeDialog.setTabOrder(self.Color1PushButton, self.Color2PushButton) + AmendThemeDialog.setTabOrder(self.Color2PushButton, self.ImageLineEdit) + AmendThemeDialog.setTabOrder(self.ImageLineEdit, self.ImageToolButton) + AmendThemeDialog.setTabOrder(self.ImageToolButton, self.GradientComboBox) + AmendThemeDialog.setTabOrder(self.GradientComboBox, self.MainFontComboBox) + AmendThemeDialog.setTabOrder(self.MainFontComboBox, self.MainFontColorPushButton) + AmendThemeDialog.setTabOrder(self.MainFontColorPushButton, self.MainFontSizeSpinBox) + AmendThemeDialog.setTabOrder(self.MainFontSizeSpinBox, self.FontMainUseDefault) + AmendThemeDialog.setTabOrder(self.FontMainUseDefault, self.FontMainXSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainXSpinBox, self.FontMainYSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainYSpinBox, self.FontMainWidthSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainWidthSpinBox, self.FontMainHeightSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainHeightSpinBox, self.FontFooterComboBox) + AmendThemeDialog.setTabOrder(self.FontFooterComboBox, self.FontFooterColorPushButton) + AmendThemeDialog.setTabOrder(self.FontFooterColorPushButton, self.FontFooterSizeSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, self.FontFooterDefaultCheckBox) + AmendThemeDialog.setTabOrder(self.FontFooterDefaultCheckBox, self.FontFooterXSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterXSpinBox, self.FontFooterYSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox, self.FontFooterWidthspinBox) + AmendThemeDialog.setTabOrder(self.FontFooterWidthspinBox, self.FontFooterHeightSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterHeightSpinBox, self.OutlineCheckBox) + AmendThemeDialog.setTabOrder(self.OutlineCheckBox, self.OutlineColorPushButton) + AmendThemeDialog.setTabOrder(self.OutlineColorPushButton, self.ShadowCheckBox) + AmendThemeDialog.setTabOrder(self.ShadowCheckBox, self.ShadowColorPushButton) + AmendThemeDialog.setTabOrder(self.ShadowColorPushButton, self.HorizontalComboBox) + AmendThemeDialog.setTabOrder(self.HorizontalComboBox, self.VerticalComboBox) def retranslateUi(self, AmendThemeDialog): AmendThemeDialog.setWindowTitle(QtGui.QApplication.translate("AmendThemeDialog", "Theme Maintance", None, QtGui.QApplication.UnicodeUTF8)) - self.ThemeNameLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Theme Name", None, QtGui.QApplication.UnicodeUTF8)) + self.ThemeNameLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Theme Name:", None, QtGui.QApplication.UnicodeUTF8)) self.BackgroundLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Background:", None, QtGui.QApplication.UnicodeUTF8)) self.BackgroundComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Opaque", None, QtGui.QApplication.UnicodeUTF8)) self.BackgroundComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Transparent", None, QtGui.QApplication.UnicodeUTF8)) @@ -350,32 +533,44 @@ class Ui_AmendThemeDialog(object): self.GradientComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Horizontal", None, QtGui.QApplication.UnicodeUTF8)) self.GradientComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Vertical", None, QtGui.QApplication.UnicodeUTF8)) self.GradientComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Circular", None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.BackgroundTab), QtGui.QApplication.translate("AmendThemeDialog", "Background", None, QtGui.QApplication.UnicodeUTF8)) + self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.BackgroundTab), QtGui.QApplication.translate("AmendThemeDialog", "Background", None, QtGui.QApplication.UnicodeUTF8)) self.MainFontGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Main Font", None, QtGui.QApplication.UnicodeUTF8)) self.MainFontlabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font:", None, QtGui.QApplication.UnicodeUTF8)) - self.MainFontColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color", None, QtGui.QApplication.UnicodeUTF8)) + self.MainFontColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color:", None, QtGui.QApplication.UnicodeUTF8)) self.MainFontSize.setText(QtGui.QApplication.translate("AmendThemeDialog", "Size:", None, QtGui.QApplication.UnicodeUTF8)) - self.FooterFontGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Display Location", None, QtGui.QApplication.UnicodeUTF8)) - self.FontMainUseDefault.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use default location", None, QtGui.QApplication.UnicodeUTF8)) + self.MainFontSizeSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "pt", None, QtGui.QApplication.UnicodeUTF8)) + self.MainLocationGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Display Location", None, QtGui.QApplication.UnicodeUTF8)) + self.DefaultLocationLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use Default Location:", None, QtGui.QApplication.UnicodeUTF8)) self.FontMainXLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "X Position:", None, QtGui.QApplication.UnicodeUTF8)) self.FontMainYLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Y Position:", None, QtGui.QApplication.UnicodeUTF8)) - self.FontMainWidthLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Width", None, QtGui.QApplication.UnicodeUTF8)) - self.FontMainHeightLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Height", None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.FontMainTab), QtGui.QApplication.translate("AmendThemeDialog", "Font Main", None, QtGui.QApplication.UnicodeUTF8)) - self.FooterFontGroupBox_2.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Display Location", None, QtGui.QApplication.UnicodeUTF8)) - self.FontMainUseDefault_2.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use default location", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainWidthLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Width:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainHeightLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Height:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainXSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainYSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainWidthSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainHeightSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) + self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.FontMainTab), QtGui.QApplication.translate("AmendThemeDialog", "Font Main", None, QtGui.QApplication.UnicodeUTF8)) + self.FooterFontGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Footer Font", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterSizeLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Size:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterSizeSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "pt", None, QtGui.QApplication.UnicodeUTF8)) + self.LocationFooterGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Display Location", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterDefaultLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use Default Location:", None, QtGui.QApplication.UnicodeUTF8)) self.FontFooterXLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "X Position:", None, QtGui.QApplication.UnicodeUTF8)) self.FontFooterYLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Y Position:", None, QtGui.QApplication.UnicodeUTF8)) - self.FontFooterWidthLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Width", None, QtGui.QApplication.UnicodeUTF8)) - self.FontFooterHeightLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Height", None, QtGui.QApplication.UnicodeUTF8)) - self.FooterFontGroupBox_3.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Footer Font", None, QtGui.QApplication.UnicodeUTF8)) - self.FontFooterlabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font:", None, QtGui.QApplication.UnicodeUTF8)) - self.FontFooterColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color", None, QtGui.QApplication.UnicodeUTF8)) - self.FontFooterSizeLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Size:", None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.FontFooterTab), QtGui.QApplication.translate("AmendThemeDialog", "Font Footer", None, QtGui.QApplication.UnicodeUTF8)) - self.ShadowGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Shadow", None, QtGui.QApplication.UnicodeUTF8)) - self.ShadowCheckBox.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use Shadow", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterWidthLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Width:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterHeightLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Height:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterXSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterYSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterWidthspinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterHeightSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) + self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.FontFooterTab), QtGui.QApplication.translate("AmendThemeDialog", "Font Footer", None, QtGui.QApplication.UnicodeUTF8)) + self.ShadowGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Shadow && Outline", None, QtGui.QApplication.UnicodeUTF8)) + self.OutlineColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Outline Color:", None, QtGui.QApplication.UnicodeUTF8)) + self.OutlineEnabledLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Show Outline:", None, QtGui.QApplication.UnicodeUTF8)) self.ShadowColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Shadow Color:", None, QtGui.QApplication.UnicodeUTF8)) + self.ShadowEnabledLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Show Shadow:", None, QtGui.QApplication.UnicodeUTF8)) self.AlignmentGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Alignment", None, QtGui.QApplication.UnicodeUTF8)) self.HorizontalLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Horizontal Align:", None, QtGui.QApplication.UnicodeUTF8)) self.HorizontalComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Left", None, QtGui.QApplication.UnicodeUTF8)) @@ -385,8 +580,6 @@ class Ui_AmendThemeDialog(object): self.VerticalComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Top", None, QtGui.QApplication.UnicodeUTF8)) self.VerticalComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Middle", None, QtGui.QApplication.UnicodeUTF8)) self.VerticalComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Bottom", None, QtGui.QApplication.UnicodeUTF8)) - self.OutlineGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Outline", None, QtGui.QApplication.UnicodeUTF8)) - self.OutlineCheckBox.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use Outline", None, QtGui.QApplication.UnicodeUTF8)) - self.OutlineColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Outline Color:", None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.OptionsTab), QtGui.QApplication.translate("AmendThemeDialog", "Alignment", None, QtGui.QApplication.UnicodeUTF8)) + self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.OtherOptionsTab), QtGui.QApplication.translate("AmendThemeDialog", "Other Options", None, QtGui.QApplication.UnicodeUTF8)) + self.PreviewGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Preview", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index c6cf4ae18..c9322f3b1 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -38,9 +38,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.setupUi(self) #define signals - #Exits - QtCore.QObject.connect(self.ThemeButtonBox, QtCore.SIGNAL("accepted()"), self.accept) - QtCore.QObject.connect(self.ThemeButtonBox, QtCore.SIGNAL("rejected()"), self.close) #Buttons QtCore.QObject.connect(self.Color1PushButton , QtCore.SIGNAL("pressed()"), self.onColor1PushButtonClicked) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index a71fe4ae6..21e15f3db 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -245,24 +245,23 @@ class ThemeManager(QWidget): os.mkdir(os.path.join(dir, file)) else: fullpath = os.path.join(dir, file) - if themename is None: - names = file.split(u'/') - themename = names[0] - xml_data = zip.read(file) - if os.path.splitext (file) [1].lower () in [u'.xml']: - if self.checkVersion1(xml_data): - filexml = self.migrateVersion122(filename, fullpath, xml_data) + names = file.split(u'/') + if len(names) > 1: # not preview file + if themename is None: + themename = names[0] + xml_data = zip.read(file) + if os.path.splitext (file) [1].lower () in [u'.xml']: + if self.checkVersion1(xml_data): + filexml = self.migrateVersion122(filename, fullpath, xml_data) + else: + file_xml = xml_data + outfile = open(fullpath, 'w') + outfile.write(filexml) + outfile.close() else: - file_xml = xml_data - outfile = open(fullpath, 'w') - outfile.write(filexml) - outfile.close() - if os.path.splitext (file) [1].lower () in [u'.bmp']: - print os.path.splitext (file) - else: - outfile = open(fullpath, 'w') - outfile.write(zip.read(file)) - outfile.close() + outfile = open(fullpath, 'w') + outfile.write(zip.read(file)) + outfile.close() self.generateImage(dir,themename, filexml) def checkVersion1(self, xmlfile): diff --git a/resources/forms/amendthemedialog.ui b/resources/forms/amendthemedialog.ui index d818a1bb0..febdd98bf 100644 --- a/resources/forms/amendthemedialog.ui +++ b/resources/forms/amendthemedialog.ui @@ -1,729 +1,1201 @@ - - + AmendThemeDialog - - + + + Qt::ApplicationModal + + 0 0 - 752 - 533 + 586 + 651 - + Theme Maintance - - + + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - - - 580 - 500 - 156 - 26 - + + true + + + + 8 - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + 8 - - - - - 50 - 20 - 441 - 41 - - - - - - - Theme Name + + + + + 8 - - - - - - - - - - - 31 - 71 - 721 - 411 - - - - - - - - - 0 - 0 - 341 - 401 - - - - 0 - - - - Background - - - - - 10 - 10 - 321 - 351 - - - - - - + + 0 + + + + + Theme Name: + + + + + + + + + + + + + + 8 + + + 0 + + + + + 0 + + + + Background + + + + 8 + + + 8 + + + 8 + + + + Background: - - + + - + Opaque - + Transparent - - - + + + Background Type: - - + + - + Solid Color - + Gradient - + Image - - - - <Color1> + + + + <Color1> - - - + + + - - - - <Color2> + + + + <Color2> - - - + + + - - - + + + Image: - - - - - - - - - - - :/services/service_open.png:/services/service_open.png - - - - - - + + + Gradient : - - + + - + Horizontal - + Vertical - + Circular - - - - - - Font Main - - - - - 20 - 10 - 307 - 119 - - - - Main Font - - - - - - Font: - + + + + + 0 + + + 0 + + + + + + + + + + + + :/images/image_load.png:/images/image_load.png + + + + - - - - - - - Font Color + + + + Qt::Vertical - - - - - - + + + 20 + 40 + - - - - - - Size: - - - - - - - - - - 15 - - - 40 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 5 - - + - - - - 20 - 160 - 301 - 190 - - - - Display Location - - - - - - Use default location - - - false - - - - - - - - - X Position: - - - - - - - - - - - - - - Y Position: - - - - - - - - - - - - - - Width - - - - - - - - - - - - - - Height - - - - - - - - - - - - - - Font Footer - - - - - 20 - 160 - 301 - 190 - - - - Display Location - - - - - - Use default location - - - false - - - - - - - - - X Position: - - - - - - - - - - - - - - Y Position: - - - - - - - - - - - - - - Width - - - - - - - - - - - - - - Height - - - - - - - - - - - - - - 20 - 10 - 307 - 119 - - - - Footer Font - - - - - - Font: - - - - - - - - - - Font Color - - - - - - - - - - - - - - Size: - - - - - - - - - - 15 - - - 40 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 5 - - - - - - - - - Alignment - - - - - 20 - 10 - 301 - 80 - - - - Shadow - - - - - 10 - 20 - 281 - 58 - + + + Font Main + + + + 8 - - - - - Use Shadow + + 8 + + + + + + 8 - - - - - - Shadow Color: + + 0 - - - - - - - - - - - - - - - - 10 - 200 - 321 - 161 - - - - Alignment - - - - - - Horizontal Align: - + + + + Main Font + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 8 + + + 8 + + + 8 + + + + + Font: + + + + + + + + + + Font Color: + + + + + + + + + + + + + + Size: + + + + + + + + 0 + 0 + + + + + 70 + 0 + + + + pt + + + 999 + + + 16 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + - - - - - Left + + + + + 8 - - - - Right + + 0 - - - - Center - - - - - - - - Vertical Align: - - - - - - - - Top - - - - - Middle - - - - - Bottom - - + + + + Display Location + + + + 8 + + + 8 + + + 8 + + + + + Use Default Location: + + + + + + + + + + false + + + + + + + X Position: + + + + + + + Y Position: + + + + + + + Width: + + + + + + + Height: + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + 0 + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + - - - - 20 - 110 - 301 - 80 - - - - Outline - - - - - 10 - 20 - 281 - 58 - + + + Font Footer + + + + 8 - - - - - Use Outline + + 8 + + + + + + 8 - - - - - - Outline Color: + + 0 - - - - - - + + + + Footer Font + + + + QFormLayout::ExpandingFieldsGrow + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 8 + + + 8 + + + 8 + + + + + Font: + + + + + + + + + + Font Color: + + + + + + + + + + + + + + Size: + + + + + + + + 0 + 0 + + + + + 70 + 0 + + + + pt + + + 999 + + + 10 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 8 - - - - + + 0 + + + + + Display Location + + + + QFormLayout::ExpandingFieldsGrow + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 8 + + + 8 + + + 8 + + + + + Use Default Location: + + + + + + + + + + false + + + + + + + X Position: + + + + + + + Y Position: + + + + + + + Width: + + + + + + + Height: + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + 0 + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + + 9999 + + + 0 + + + + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + + 78 + 0 + + + + px + + + 9999 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Other Options + + + + 8 + + + 8 + + + + + + 8 + + + 0 + + + + + Shadow && Outline + + + + 8 + + + 8 + + + + + + 8 + + + 8 + + + 0 + + + + + + + + + + + + Outline Color: + + + + + + + + + + + + + + Show Outline: + + + + + + + + + + + 8 + + + 8 + + + 0 + + + + + + + + + + + + Shadow Color: + + + + + + + + + + + + + + Show Shadow: + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 8 + + + 0 + + + + + Alignment + + + + + + Horizontal Align: + + + + + + + + Left + + + + + Right + + + + + Center + + + + + + + + Vertical Align: + + + + + + + + Top + + + + + Middle + + + + + Bottom + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + - - - - - - - - - 20 - 60 - 311 - 271 - - - - QFrame::Box - - - QFrame::Raised - - - 2 - - - - - - true - - - - - - + + + + + + + + Preview + + + + 8 + + + 8 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 300 + 225 + + + + QFrame::WinPanel + + + QFrame::Sunken + + + 1 + + + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + ThemeButtonBox + ThemeNameEdit + ThemeTabWidget + BackgroundComboBox + BackgroundTypeComboBox + Color1PushButton + Color2PushButton + ImageLineEdit + ImageToolButton + GradientComboBox + MainFontComboBox + MainFontColorPushButton + MainFontSizeSpinBox + FontMainUseDefault + FontMainXSpinBox + FontMainYSpinBox + FontMainWidthSpinBox + FontMainHeightSpinBox + FontFooterComboBox + FontFooterColorPushButton + FontFooterSizeSpinBox + FontFooterDefaultCheckBox + FontFooterXSpinBox + FontFooterYSpinBox + FontFooterWidthspinBox + FontFooterHeightSpinBox + OutlineCheckBox + OutlineColorPushButton + ShadowCheckBox + ShadowColorPushButton + HorizontalComboBox + VerticalComboBox + - + - + + + ThemeButtonBox + accepted() + AmendThemeDialog + accept() + + + 375 + 466 + + + 375 + 241 + + + + + ThemeButtonBox + rejected() + AmendThemeDialog + reject() + + + 375 + 466 + + + 375 + 241 + + + + From 79e7e09d65ac5a1ceb1e1e3b10abf645647109a0 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 19 Apr 2009 19:17:17 +0100 Subject: [PATCH 03/17] Add theme delete functionality --- openlp/core/ui/thememanager.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 21e15f3db..e5d77970e 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -20,6 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA import os,os.path import sys import zipfile +import shutil from time import sleep from copy import deepcopy @@ -198,7 +199,19 @@ class ThemeManager(QWidget): self.amendThemeForm.exec_() def onDeleteTheme(self): - pass + items = self.ThemeListView.selectedIndexes() + theme = '' + for item in items: + data = self.Theme_data.getValue(item) + theme = data[3] + th = theme + u'.png' + try: + os.remove(os.path.join(self.path, th)) + except: + pass #if not present do not worry + shutil.rmtree(os.path.join(self.path, theme)) + self.Theme_data.clearItems() + self.loadThemes() def onExportTheme(self): pass From 6a309c43ffb4aabad9030ba1a0efcd1bdd517c82 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 19 Apr 2009 19:21:22 +0100 Subject: [PATCH 04/17] move the renderer.py class to core.lib --- openlp/core/__init__.py | 2 +- openlp/core/{ => lib}/render.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename openlp/core/{ => lib}/render.py (100%) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index eb62a77c1..2dd952ce1 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -19,7 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ from PyQt4 import QtCore, QtGui -from render import Renderer +from openlp.core.lib.render import Renderer from settingsmanager import SettingsManager from pluginmanager import PluginManager diff --git a/openlp/core/render.py b/openlp/core/lib/render.py similarity index 100% rename from openlp/core/render.py rename to openlp/core/lib/render.py From 570a35ae65803d5e64cdb9b587f50846805a35ee Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 19 Apr 2009 20:12:18 +0100 Subject: [PATCH 05/17] Renderer cleanups Remove code duplication and simplifications --- openlp/core/lib/render.py | 2 +- openlp/core/ui/amendthemeform.py | 77 +++++++++----------------------- openlp/core/ui/thememanager.py | 62 +++++++++++++------------ 3 files changed, 52 insertions(+), 89 deletions(-) diff --git a/openlp/core/lib/render.py b/openlp/core/lib/render.py index e616bc777..aa444c8f5 100644 --- a/openlp/core/lib/render.py +++ b/openlp/core/lib/render.py @@ -247,7 +247,7 @@ class Renderer: assert(0, u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign) return x, y - def _render_lines(self, lines, lines1=None): + def render_lines(self, lines, lines1=None): """render a set of lines according to the theme, return bounding box""" #log.debug(u'_render_lines %s', lines) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index c9322f3b1..3ffcc1994 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -33,8 +33,9 @@ log = logging.getLogger(u'AmendThemeForm') class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): - def __init__(self, parent=None): + def __init__(self, thememanager, parent=None): QtGui.QDialog.__init__(self, parent) + self.thememanager = thememanager self.setupUi(self) #define signals @@ -71,28 +72,28 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): xml = fileToXML(xml_file) self.theme.parse(xml) self.paintUi(self.theme) - self.generateImage(self.theme) + self.previewTheme(self.theme) - def onGradientComboBoxSelected(self): - if self.GradientComboBox.currentIndex() == 0: # Horizontal + def onGradientComboBoxSelected(self, currentIndex): + if currentIndex == 0: # Horizontal self.theme.background_direction = u'horizontal' - elif self.GradientComboBox.currentIndex() == 1: # vertical + elif currentIndex == 1: # vertical self.theme.background_direction = u'vertical' else: self.theme.background_direction = u'circular' self.stateChanging(self.theme) - self.generateImage(self.theme) + self.previewTheme(self.theme) - def onBackgroundComboBoxSelected(self): - if self.BackgroundComboBox.currentIndex() == 0: # Opaque + def onBackgroundComboBoxSelected(self, currentIndex): + if currentIndex == 0: # Opaque self.theme.background_mode = u'opaque' else: self.theme.background_mode = u'transparent' self.stateChanging(self.theme) - self.generateImage(self.theme) + self.previewTheme(self.theme) - def onBackgroundTypeComboBoxSelected(self): - if self.BackgroundTypeComboBox.currentIndex() == 0: # Solid + def onBackgroundTypeComboBoxSelected(self, currentIndex): + if currentIndex == 0: # Solid self.theme.background_type = u'solid' if self.theme.background_direction == None: # never defined self.theme.background_direction = u'horizontal' @@ -100,7 +101,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.background_startColor = u'#000000' if self.theme.background_endColor is None : self.theme.background_endColor = u'#000000' - elif self.BackgroundTypeComboBox.currentIndex() == 1: # Gradient + elif currentIndex == 1: # Gradient self.theme.background_type = u'gradient' if self.theme.background_direction == None: # never defined self.theme.background_direction = u'horizontal' @@ -111,7 +112,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): else: self.theme.background_type = u'image' self.stateChanging(self.theme) - self.generateImage(self.theme) + self.previewTheme(self.theme) def onColor1PushButtonClicked(self): if self.theme.background_type == u'solid': @@ -125,7 +126,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.Color1PushButton.setStyleSheet( 'background-color: %s' % str(self.theme.background_startColor)) - self.generateImage(self.theme) + self.previewTheme(self.theme) def onColor2PushButtonClicked(self): self.theme.background_endColor = QtGui.QColorDialog.getColor( @@ -133,7 +134,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.Color2PushButton.setStyleSheet( 'background-color: %s' % str(self.theme.background_endColor)) - self.generateImage(self.theme) + self.previewTheme(self.theme) def onMainFontColorPushButtonClicked(self): self.theme.font_main_color = QtGui.QColorDialog.getColor( @@ -141,7 +142,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.MainFontColorPushButton.setStyleSheet( 'background-color: %s' % str(self.theme.font_main_color)) - self.generateImage(self.theme) + self.previewTheme(self.theme) def onFontFooterColorPushButtonClicked(self): self.theme.font_footer_color = QtGui.QColorDialog.getColor( @@ -149,7 +150,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.FontFooterColorPushButton.setStyleSheet( 'background-color: %s' % str(self.theme.font_footer_color)) - self.generateImage(self.theme) + self.previewTheme(self.theme) def baseTheme(self): log.debug(u'base Theme') @@ -200,42 +201,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.Color2Label.setVisible(False) self.Color2PushButton.setVisible(False) - def generateImage(self, theme): - log.debug(u'generateImage %s ', theme) - #theme = ThemeXML() - #theme.parse(theme_xml) - #print theme - size=QtCore.QSize(800,600) - frame=TstFrame(size) - frame=frame - paintdest=frame.GetPixmap() - r=Renderer(self.path) - r.set_paint_dest(paintdest) - - r.set_theme(theme) # set default theme - r._render_background() - r.set_text_rectangle(QtCore.QRect(0,0, size.width()-1, size.height()-1), QtCore.QRect(10,560, size.width()-1, size.height()-1)) - - lines=[] - lines.append(u'Amazing Grace!') - lines.append(u'How sweet the sound') - lines.append(u'To save a wretch like me;') - lines.append(u'I once was lost but now am found,') - lines.append(u'Was blind, but now I see.') - lines1=[] - lines1.append(u'Amazing Grace (John Newton)' ) - lines1.append(u'CCLI xxx (c)Openlp.org') - - answer=r._render_lines(lines, lines1) - - self.ThemePreview.setPixmap(frame.GetPixmap()) - -class TstFrame: - def __init__(self, size): - """Create the DemoPanel.""" - self.width=size.width(); - self.height=size.height(); - # create something to be painted into - self._Buffer = QtGui.QPixmap(self.width, self.height) - def GetPixmap(self): - return self._Buffer + def previewTheme(self, theme): + frame = self.thememanager.generateImage(theme) + self.ThemePreview.setPixmap(frame) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index e5d77970e..cdc40faf0 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -154,7 +154,7 @@ class ThemeManager(QWidget): self.Layout = QtGui.QVBoxLayout(self) self.Layout.setSpacing(0) self.Layout.setMargin(0) - self.amendThemeForm = AmendThemeForm() + self.amendThemeForm = AmendThemeForm(self) self.Toolbar = OpenLPToolbar(self) self.Toolbar.addToolbarButton(translate('ThemeManager',u'New Theme'), ":/themes/theme_new.png", translate('ThemeManager',u'Allows a Theme to be created'), self.onAddTheme) @@ -247,6 +247,11 @@ class ThemeManager(QWidget): os.mkdir(dir) def unzipTheme(self, filename, dir): + """ + Unzip the theme , remove the preview file if stored + Generate a new preview fileCheck the XML theme version and upgrade if + necessary. + """ log.debug(u'Unzipping theme %s', filename) zip = zipfile.ZipFile(str(filename)) filexml = None @@ -265,7 +270,7 @@ class ThemeManager(QWidget): xml_data = zip.read(file) if os.path.splitext (file) [1].lower () in [u'.xml']: if self.checkVersion1(xml_data): - filexml = self.migrateVersion122(filename, fullpath, xml_data) + filexml = self.migrateVersion122(filename, fullpath, xml_data) # upgrade theme xml else: file_xml = xml_data outfile = open(fullpath, 'w') @@ -275,7 +280,7 @@ class ThemeManager(QWidget): outfile = open(fullpath, 'w') outfile.write(zip.read(file)) outfile.close() - self.generateImage(dir,themename, filexml) + self.generateAndSaveImage(dir,themename, filexml) def checkVersion1(self, xmlfile): log.debug(u'checkVersion1 ') @@ -314,20 +319,30 @@ class ThemeManager(QWidget): str(t.HorizontalAlign), str(t.VerticalAlign), str(t.WrapStyle)) return newtheme.extract_xml() - def generateImage(self, dir, name, theme_xml): + def generateAndSaveImage(self, dir, name, theme_xml): log.debug(u'generateImage %s %s %s', dir, name, theme_xml) theme = ThemeXML() theme.parse(theme_xml) - #print theme - size=QtCore.QSize(800,600) - frame=TstFrame(size) - frame=frame - paintdest=frame.GetPixmap() - r=Renderer(dir) - r.set_paint_dest(paintdest) - r.set_theme(theme) # set default theme - r.set_text_rectangle(QtCore.QRect(0,0, size.width()-1, size.height()-1), QtCore.QRect(10,560, size.width()-1, size.height()-1)) + frame = self.generateImage(theme) + + im=frame.toImage() + samplepathname=os.path.join(dir, name+u'.png') + if os.path.exists(samplepathname): + os.unlink(samplepathname) + im.save(samplepathname, u'png') + log.debug(u'Theme image written to %s',samplepathname) + + def generateImage(self, theme): + log.debug(u'generateImage %s ', theme) + size=QtCore.QSize(800,600) + frame = QtGui.QPixmap(size.width(), size.height()) + renderer=Renderer(self.path) + renderer.set_paint_dest(frame) + + renderer.set_theme(theme) # set default theme + #renderer._render_background() + renderer.set_text_rectangle(QtCore.QRect(0,0, size.width()-1, size.height()-1), QtCore.QRect(10,560, size.width()-1, size.height()-1)) lines=[] lines.append(u'Amazing Grace!') @@ -338,23 +353,6 @@ class ThemeManager(QWidget): lines1=[] lines1.append(u'Amazing Grace (John Newton)' ) lines1.append(u'CCLI xxx (c)Openlp.org') + answer=renderer.render_lines(lines, lines1) + return frame - answer=r._render_lines(lines, lines1) - - im=frame.GetPixmap().toImage() - samplepathname=os.path.join(dir, name+u'.png') - if os.path.exists(samplepathname): - os.unlink(samplepathname) - im.save(samplepathname, u'png') - log.debug(u'Theme image written to %s',samplepathname) - - -class TstFrame: - def __init__(self, size): - """Create the DemoPanel.""" - self.width=size.width(); - self.height=size.height(); - # create something to be painted into - self._Buffer = QtGui.QPixmap(self.width, self.height) - def GetPixmap(self): - return self._Buffer From cf2ad84e74f9976b231f89dc4fbd35ca3faf35d9 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 19 Apr 2009 21:07:52 +0100 Subject: [PATCH 06/17] More renderer cleanups More ThemeManager fixes Sortout XML tag name errors --- openlp/core/__init__.py | 3 +-- openlp/core/lib/__init__.py | 5 ++-- openlp/core/lib/render.py | 4 +-- openlp/core/lib/themexmlhandler.py | 4 +-- openlp/core/ui/amendthemeform.py | 40 ++++++++++++++++++++++-------- openlp/core/ui/thememanager.py | 4 +-- 6 files changed, 39 insertions(+), 21 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 2dd952ce1..cf13aada5 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -19,11 +19,10 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ from PyQt4 import QtCore, QtGui -from openlp.core.lib.render import Renderer from settingsmanager import SettingsManager from pluginmanager import PluginManager -__all__ = ['Renderer', 'SettingsManager', 'PluginManager', 'translate', +__all__ = ['SettingsManager', 'PluginManager', 'translate', 'fileToXML' ] def translate(context, text): diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 721437d6e..30e176f85 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -3,7 +3,7 @@ """ OpenLP - Open Source Lyrics Projection Copyright (c) 2008 Raoul Snyman -Portions copyright (c) 2008 Martin Thompson, Tim Bentley, +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -32,7 +32,8 @@ from toolbar import OpenLPToolbar from songxmlhandler import SongXMLBuilder from songxmlhandler import SongXMLParser from themexmlhandler import ThemeXML +from openlp.core.lib.render import Renderer -__all__ = ['PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'EventType' +__all__ = ['Renderer','PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'EventType' 'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder', 'SongXMLParser', 'EventManager', 'ThemeXML'] diff --git a/openlp/core/lib/render.py b/openlp/core/lib/render.py index aa444c8f5..659b61847 100644 --- a/openlp/core/lib/render.py +++ b/openlp/core/lib/render.py @@ -135,10 +135,10 @@ class Renderer: p.fillRect(self._paint.rect(), QtGui.QColor(self._theme.background_color)) elif self._theme.background_type == u'gradient' : # gradient gradient = None - if self._theme.background_direction == u'vertical': + if self._theme.background_direction == u'horizontal': w = int(self._paint.width())/2 gradient = QtGui.QLinearGradient(w, 0, w, self._paint.height()) # vertical - elif self._theme.background_direction == u'horizontal': + elif self._theme.background_direction == u'vertical': h = int(self._paint.height())/2 gradient = QtGui.QLinearGradient(0, h, self._paint.width(), h) # Horizontal else: diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index aef0b1e05..d0f5c6940 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -104,12 +104,12 @@ class ThemeXML(): background.setAttribute(u'type', u'gradient') self.theme.appendChild(background) - color = self.theme_xml.createElement(u'startcolor') + color = self.theme_xml.createElement(u'startColor') bkc = self.theme_xml.createTextNode(startcolor) color.appendChild(bkc) background.appendChild(color) - color = self.theme_xml.createElement(u'endcolor') + color = self.theme_xml.createElement(u'endColor') bkc = self.theme_xml.createTextNode(endcolor) color.appendChild(bkc) background.appendChild(color) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 3ffcc1994..9b406d160 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -23,8 +23,8 @@ import os, os.path from PyQt4 import QtCore, QtGui from PyQt4.QtGui import QColor, QFont from openlp.core.lib import ThemeXML +from openlp.core.lib import Renderer from openlp.core import fileToXML -from openlp.core import Renderer from openlp.core import translate from amendthemedialog import Ui_AmendThemeDialog @@ -75,6 +75,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.previewTheme(self.theme) def onGradientComboBoxSelected(self, currentIndex): + print "Changed ", currentIndex if currentIndex == 0: # Horizontal self.theme.background_direction = u'horizontal' elif currentIndex == 1: # vertical @@ -95,20 +96,16 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def onBackgroundTypeComboBoxSelected(self, currentIndex): if currentIndex == 0: # Solid self.theme.background_type = u'solid' - if self.theme.background_direction == None: # never defined - self.theme.background_direction = u'horizontal' - if self.theme.background_startColor is None : - self.theme.background_startColor = u'#000000' - if self.theme.background_endColor is None : - self.theme.background_endColor = u'#000000' + if self.theme.background_color is None : + self.theme.background_color = u'#000000' elif currentIndex == 1: # Gradient self.theme.background_type = u'gradient' if self.theme.background_direction == None: # never defined - self.theme.background_direction = u'horizontal' + self.onGradientComboBoxSelected(self.GradientComboBox.currentIndex()) if self.theme.background_startColor is None : self.theme.background_startColor = u'#000000' if self.theme.background_endColor is None : - self.theme.background_endColor = u'#000000' + self.theme.background_endColor = u'#ff0000' else: self.theme.background_type = u'image' self.stateChanging(self.theme) @@ -167,7 +164,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def paintUi(self, theme): print theme # leave as helpful for initial development self.stateChanging(theme) - self.BackgroundTypeComboBox.setCurrentIndex(0) + if theme.background_type == u'solid': + self.BackgroundTypeComboBox.setCurrentIndex(0) + elif theme.background_type == u'gradient': + self.BackgroundTypeComboBox.setCurrentIndex(1) + else: + self.BackgroundTypeComboBox.setCurrentIndex(2) + self.BackgroundComboBox.setCurrentIndex(0) self.GradientComboBox.setCurrentIndex(0) self.MainFontColorPushButton.setStyleSheet( @@ -179,11 +182,16 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): if theme.background_type == u'solid': self.Color1PushButton.setStyleSheet( 'background-color: %s' % str(theme.background_color)) - self.Color1Label.setText(translate(u'ThemeManager', u'Background Font:')) + self.Color1Label.setText(translate(u'ThemeManager', u'Background Color:')) self.Color1Label.setVisible(True) self.Color1PushButton.setVisible(True) self.Color2Label.setVisible(False) self.Color2PushButton.setVisible(False) + self.ImageLabel.setVisible(False) + self.ImageLineEdit.setVisible(False) + self.ImageFilenameWidget.setVisible(False) + self.GradientLabel.setVisible(False) + self.GradientComboBox.setVisible(False) elif theme.background_type == u'gradient': self.Color1PushButton.setStyleSheet( 'background-color: %s' % str(theme.background_startColor)) @@ -195,11 +203,21 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.Color1PushButton.setVisible(True) self.Color2Label.setVisible(True) self.Color2PushButton.setVisible(True) + self.ImageLabel.setVisible(False) + self.ImageLineEdit.setVisible(False) + self.ImageFilenameWidget.setVisible(False) + self.GradientLabel.setVisible(True) + self.GradientComboBox.setVisible(True) else: # must be image self.Color1Label.setVisible(False) self.Color1PushButton.setVisible(False) self.Color2Label.setVisible(False) self.Color2PushButton.setVisible(False) + self.ImageLabel.setVisible(True) + self.ImageLineEdit.setVisible(True) + self.ImageFilenameWidget.setVisible(True) + self.GradientLabel.setVisible(False) + self.GradientComboBox.setVisible(False) def previewTheme(self, theme): frame = self.thememanager.generateImage(theme) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index cdc40faf0..70b0bb2e5 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -32,13 +32,13 @@ from PyQt4.QtGui import * from openlp.core.ui import AmendThemeForm from openlp.core import translate -from openlp.core import Renderer from openlp.core.theme import Theme from openlp.core.lib import Event from openlp.core.lib import EventType from openlp.core.lib import EventManager from openlp.core.lib import OpenLPToolbar from openlp.core.lib import ThemeXML +from openlp.core.lib import Renderer from openlp.core.utils import ConfigHelper @@ -301,7 +301,7 @@ class ThemeManager(QWidget): newtheme.add_background_solid(str(t.BackgroundParameter1.name())) elif t.BackgroundType == 1: direction = "vertical" - if t.BackgroundParameter1.name() == 1: + if t.BackgroundParameter3.name() == 1: direction = "horizontal" newtheme.add_background_gradient(str(t.BackgroundParameter1.name()), str(t.BackgroundParameter2.name()), direction) else: From 13a23398412c53a3e98b20c14d5a4851ae8eff9f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 20 Apr 2009 05:58:17 +0100 Subject: [PATCH 07/17] Remove unused file --- openlp/core/interpolate.py | 41 -------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 openlp/core/interpolate.py diff --git a/openlp/core/interpolate.py b/openlp/core/interpolate.py deleted file mode 100644 index f2a48dd06..000000000 --- a/openlp/core/interpolate.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 -""" -OpenLP - Open Source Lyrics Projection -Copyright (c) 2008 Raoul Snyman -Portions copyright (c) 2008 Martin Thompson, Tim Bentley - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA -""" - -# useful linear interpolation routines - -def interp1(val1, val2, fraction): - """return a linear 1d interpolation between val1 and val2 by fraction - if fraction=0.0, returns val1 - if fraction=1.0, returns val2""" - return val1+((val2-val1)*fraction) -def interpolate(val1, val2, fraction): - "vals can be list/tuples - if so, will return a tuple of interpolated values for each element." - assert (fraction >= 0.0) - assert (fraction <= 1.0) - assert (type(val1) == type(val2)) - if (type(val1) == type(()) or - type (val1) == type([])): - assert(len(val1) == len(val2)) - retval=[] - for i in range(len(val1)): - retval.append(interp1(val1[i], val2[i], fraction)) - return tuple(retval) - else: - return interp1(val1, val2, fraction) From 0f80ab4266ae24371bd14db29a15e86394bc69d9 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 20 Apr 2009 19:22:42 +0100 Subject: [PATCH 08/17] Move Plugin Manager to core/lib --- openlp/core/__init__.py | 2 +- openlp/core/{ => lib}/pluginmanager.py | 1 - openlp/core/test/test_plugin_manager.py | 5 +++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename openlp/core/{ => lib}/pluginmanager.py (99%) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index cf13aada5..fce0d08c4 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -20,7 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtCore, QtGui from settingsmanager import SettingsManager -from pluginmanager import PluginManager +from openlp.core.lib.pluginmanager import PluginManager __all__ = ['SettingsManager', 'PluginManager', 'translate', 'fileToXML' ] diff --git a/openlp/core/pluginmanager.py b/openlp/core/lib/pluginmanager.py similarity index 99% rename from openlp/core/pluginmanager.py rename to openlp/core/lib/pluginmanager.py index 03749139e..94a858b2a 100644 --- a/openlp/core/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ - import os import sys import logging diff --git a/openlp/core/test/test_plugin_manager.py b/openlp/core/test/test_plugin_manager.py index 1736d67fb..abf0961e4 100644 --- a/openlp/core/test/test_plugin_manager.py +++ b/openlp/core/test/test_plugin_manager.py @@ -1,4 +1,7 @@ import logging +import os, sys +from openlp.core.lib.pluginmanager import PluginManager + logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%m-%d %H:%M', @@ -14,11 +17,9 @@ logging.getLogger('').addHandler(console) log=logging.getLogger('') logging.info("Logging started") -import os, sys mypath=os.path.split(os.path.abspath(__file__))[0] sys.path.insert(0,(os.path.join(mypath, '..' ,'..', '..'))) -from openlp.core.pluginmanager import PluginManager # test the plugin manager with some plugins in the test_plugins directory class TestPluginManager: From c8094b717f5bdf001c02f70a37c38f1ee55a849f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 20 Apr 2009 21:03:04 +0100 Subject: [PATCH 09/17] Add more controls and fix xml errors --- openlp/core/lib/themexmlhandler.py | 5 +- openlp/core/ui/amendthemeform.py | 118 +++++++++++++++++++++++++---- openlp/core/ui/thememanager.py | 4 +- 3 files changed, 106 insertions(+), 21 deletions(-) diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index d0f5c6940..cab3f0f45 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -46,14 +46,13 @@ blankthemexml=\ Arial #000000 30 - - + Arial #000000 12 - + True diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 9b406d160..a5d283b8a 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -55,7 +55,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL("activated(int)"), self.onBackgroundTypeComboBoxSelected) QtCore.QObject.connect(self.GradientComboBox, QtCore.SIGNAL("activated(int)"), self.onGradientComboBoxSelected) - + QtCore.QObject.connect(self.MainFontComboBox, + QtCore.SIGNAL("activated(int)"), self.onMainFontComboBoxSelected) + QtCore.QObject.connect(self.FontFooterComboBox, + QtCore.SIGNAL("activated(int)"), self.onFontFooterComboBoxSelected) + QtCore.QObject.connect(self.MainFontSizeSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onMainFontSizeSpinBoxChanged) + QtCore.QObject.connect(self.FontFooterSizeSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontFooterSizeSpinBoxChanged) def accept(self): return QtGui.QDialog.accept(self) @@ -74,17 +81,34 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.paintUi(self.theme) self.previewTheme(self.theme) - def onGradientComboBoxSelected(self, currentIndex): - print "Changed ", currentIndex - if currentIndex == 0: # Horizontal - self.theme.background_direction = u'horizontal' - elif currentIndex == 1: # vertical - self.theme.background_direction = u'vertical' - else: - self.theme.background_direction = u'circular' - self.stateChanging(self.theme) + # + #Main Font Tab + # + def onMainFontComboBoxSelected(self): + self.theme.font_main_name = self.MainFontComboBox.currentFont().family() self.previewTheme(self.theme) + def onMainFontSizeSpinBoxChanged(self, value): + self.theme.font_main_proportion = value + self.previewTheme(self.theme) + + # + #Footer Font Tab + # + def onFontFooterComboBoxSelected(self): + self.theme.font_footer_name = self.FontFooterComboBox.currentFont().family() + self.previewTheme(self.theme) + + def onFontFooterSizeSpinBoxChanged(self, value): + self.theme.font_footer_proportion = value + self.previewTheme(self.theme) + + # + #Background Tab + # + def onGradientComboBoxSelected(self, currentIndex): + self.setBackground(self.BackgroundTypeComboBox.currentIndex(), currentIndex) + def onBackgroundComboBoxSelected(self, currentIndex): if currentIndex == 0: # Opaque self.theme.background_mode = u'opaque' @@ -94,14 +118,21 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.previewTheme(self.theme) def onBackgroundTypeComboBoxSelected(self, currentIndex): - if currentIndex == 0: # Solid + self.setBackground(currentIndex, self.GradientComboBox.currentIndex()) + + def setBackground(self, background, gradient): + if background == 0: # Solid self.theme.background_type = u'solid' if self.theme.background_color is None : self.theme.background_color = u'#000000' - elif currentIndex == 1: # Gradient + elif background == 1: # Gradient self.theme.background_type = u'gradient' - if self.theme.background_direction == None: # never defined - self.onGradientComboBoxSelected(self.GradientComboBox.currentIndex()) + if gradient == 0: # Horizontal + self.theme.background_direction = u'horizontal' + elif gradient == 1: # vertical + self.theme.background_direction = u'vertical' + else: + self.theme.background_direction = u'circular' if self.theme.background_startColor is None : self.theme.background_startColor = u'#000000' if self.theme.background_endColor is None : @@ -149,6 +180,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): 'background-color: %s' % str(self.theme.font_footer_color)) self.previewTheme(self.theme) + # + #Local Methods + # def baseTheme(self): log.debug(u'base Theme') newtheme = ThemeXML() @@ -164,20 +198,49 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def paintUi(self, theme): print theme # leave as helpful for initial development self.stateChanging(theme) + if self.theme.background_mode == u'opaque': + self.BackgroundComboBox.setCurrentIndex(0) + else: + self.BackgroundComboBox.setCurrentIndex(1) if theme.background_type == u'solid': self.BackgroundTypeComboBox.setCurrentIndex(0) elif theme.background_type == u'gradient': self.BackgroundTypeComboBox.setCurrentIndex(1) else: self.BackgroundTypeComboBox.setCurrentIndex(2) + if self.theme.background_direction == u'horizontal': + self.GradientComboBox.setCurrentIndex(0) + elif self.theme.background_direction == u'vertical': + self.GradientComboBox.setCurrentIndex(1) + else: + self.GradientComboBox.setCurrentIndex(2) - self.BackgroundComboBox.setCurrentIndex(0) - self.GradientComboBox.setCurrentIndex(0) + self.MainFontSizeSpinBox.setValue(int(self.theme.font_main_proportion)) + self.FontMainXSpinBox.setValue(int(self.theme.font_main_x)) + self.FontMainYSpinBox.setValue(int(self.theme.font_main_y)) + self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width)) + self.FontMainHeightSpinBox.setValue(int(self.theme.font_main_height)) + self.FontFooterSizeSpinBox.setValue(int(self.theme.font_footer_proportion)) + self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x)) + self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y)) + self.FontFooterWidthspinBox.setValue(int(self.theme.font_footer_width)) + self.FontFooterHeightSpinBox.setValue(int(self.theme.font_footer_height)) self.MainFontColorPushButton.setStyleSheet( 'background-color: %s' % str(theme.font_main_color)) self.FontFooterColorPushButton.setStyleSheet( 'background-color: %s' % str(theme.font_footer_color)) + if self.theme.font_main_override == u'True': + self.FontMainUseDefault.setChecked(True) + else: + self.FontMainUseDefault.setChecked(False) + if self.theme.font_footer_override == u'True': + self.FontFooterDefaultCheckBox.setChecked(True) + else: + self.FontFooterDefaultCheckBox.setChecked(False) + + + def stateChanging(self, theme): if theme.background_type == u'solid': self.Color1PushButton.setStyleSheet( @@ -219,6 +282,29 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.GradientLabel.setVisible(False) self.GradientComboBox.setVisible(False) + if theme.font_main_override == u'True': + self.FontMainXSpinBox.setEnabled(False) + self.FontMainYSpinBox.setEnabled(False) + self.FontMainWidthSpinBox.setEnabled(False) + self.FontMainHeightSpinBox.setEnabled(False) + else: + self.FontMainXSpinBox.setEnabled(True) + self.FontMainYSpinBox.setEnabled(True) + self.FontMainWidthSpinBox.setEnabled(True) + self.FontMainHeightSpinBox.setEnabled(True) + + if theme.font_footer_override == u'True': + self.FontFooterXSpinBox.setEnabled(False) + self.FontFooterYSpinBox.setEnabled(False) + self.FontFooterWidthspinBox.setEnabled(False) + self.FontFooterHeightSpinBox.setEnabled(False) + else: + self.FontFooterXSpinBox.setEnabled(True) + self.FontFooterYSpinBox.setEnabled(True) + self.FontFooterWidthspinBox.setEnabled(True) + self.FontFooterHeightSpinBox.setEnabled(True) + + def previewTheme(self, theme): frame = self.thememanager.generateImage(theme) self.ThemePreview.setPixmap(frame) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 70b0bb2e5..992d7b927 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -307,8 +307,8 @@ class ThemeManager(QWidget): else: newtheme.add_background_image(str(t.BackgroundParameter1)) - newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(t.FontProportion * 2), u'False') - newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(12), u'False', u'footer') + newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(t.FontProportion * 2), u'True') + newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(12), u'True', u'footer') outline = False shadow = False if t.Shadow == 1: From 852e24ab357803e57faab5af98909d969b015e2b Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 21 Apr 2009 20:45:50 +0100 Subject: [PATCH 10/17] More Theme Changes State corrections XML boolean fixes --- openlp/core/lib/themexmlhandler.py | 5 +- openlp/core/ui/amendthemedialog.py | 108 ++-- openlp/core/ui/amendthemeform.py | 127 +++- openlp/core/ui/thememanager.py | 4 +- resources/forms/amendthemedialog.ui | 863 ++++++++++++++-------------- 5 files changed, 591 insertions(+), 516 deletions(-) diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index cab3f0f45..3ce3dbce8 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -231,7 +231,10 @@ class ThemeXML(): setattr(self, master + element.tag +u'_'+ e[0], e[1]) else: field = master + e[0] - setattr(self, field, e[1]) + e1 = e[1] + if e[1] == u'True' or e[1] == u'False': + e1 = convertStringToBoolean(e[1]) + setattr(self, field, e1) else: #print "c", element.tag, element.text if element.tag is not None : diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index 0fe2dd27c..c126735a0 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'amendthemedialog.ui' # -# Created: Sun Apr 19 07:51:09 2009 +# Created: Tue Apr 21 06:06:56 2009 # by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! @@ -121,40 +121,40 @@ class Ui_AmendThemeDialog(object): self.MainLeftLayout.setSpacing(8) self.MainLeftLayout.setMargin(0) self.MainLeftLayout.setObjectName("MainLeftLayout") - self.MainFontGroupBox = QtGui.QGroupBox(self.MainLeftWidget) - self.MainFontGroupBox.setObjectName("MainFontGroupBox") - self.MainFontLayout = QtGui.QFormLayout(self.MainFontGroupBox) + self.FontMainGroupBox = QtGui.QGroupBox(self.MainLeftWidget) + self.FontMainGroupBox.setObjectName("FontMainGroupBox") + self.MainFontLayout = QtGui.QFormLayout(self.FontMainGroupBox) self.MainFontLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.MainFontLayout.setMargin(8) self.MainFontLayout.setSpacing(8) self.MainFontLayout.setObjectName("MainFontLayout") - self.MainFontlabel = QtGui.QLabel(self.MainFontGroupBox) - self.MainFontlabel.setObjectName("MainFontlabel") - self.MainFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.MainFontlabel) - self.MainFontComboBox = QtGui.QFontComboBox(self.MainFontGroupBox) - self.MainFontComboBox.setObjectName("MainFontComboBox") - self.MainFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.MainFontComboBox) - self.MainFontColorLabel = QtGui.QLabel(self.MainFontGroupBox) - self.MainFontColorLabel.setObjectName("MainFontColorLabel") - self.MainFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.MainFontColorLabel) - self.MainFontColorPushButton = QtGui.QPushButton(self.MainFontGroupBox) - self.MainFontColorPushButton.setObjectName("MainFontColorPushButton") - self.MainFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.MainFontColorPushButton) - self.MainFontSize = QtGui.QLabel(self.MainFontGroupBox) - self.MainFontSize.setObjectName("MainFontSize") - self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.MainFontSize) - self.MainFontSizeSpinBox = QtGui.QSpinBox(self.MainFontGroupBox) + self.FontMainlabel = QtGui.QLabel(self.FontMainGroupBox) + self.FontMainlabel.setObjectName("FontMainlabel") + self.MainFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.FontMainlabel) + self.FontMainComboBox = QtGui.QFontComboBox(self.FontMainGroupBox) + self.FontMainComboBox.setObjectName("FontMainComboBox") + self.MainFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontMainComboBox) + self.FontMainColorLabel = QtGui.QLabel(self.FontMainGroupBox) + self.FontMainColorLabel.setObjectName("FontMainColorLabel") + self.MainFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FontMainColorLabel) + self.FontMainColorPushButton = QtGui.QPushButton(self.FontMainGroupBox) + self.FontMainColorPushButton.setObjectName("FontMainColorPushButton") + self.MainFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontMainColorPushButton) + self.FontMainSize = QtGui.QLabel(self.FontMainGroupBox) + self.FontMainSize.setObjectName("FontMainSize") + self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontMainSize) + self.FontMainSizeSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.MainFontSizeSpinBox.sizePolicy().hasHeightForWidth()) - self.MainFontSizeSpinBox.setSizePolicy(sizePolicy) - self.MainFontSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) - self.MainFontSizeSpinBox.setMaximum(999) - self.MainFontSizeSpinBox.setProperty("value", QtCore.QVariant(16)) - self.MainFontSizeSpinBox.setObjectName("MainFontSizeSpinBox") - self.MainFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.MainFontSizeSpinBox) - self.MainLeftLayout.addWidget(self.MainFontGroupBox) + sizePolicy.setHeightForWidth(self.FontMainSizeSpinBox.sizePolicy().hasHeightForWidth()) + self.FontMainSizeSpinBox.setSizePolicy(sizePolicy) + self.FontMainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) + self.FontMainSizeSpinBox.setProperty("value", QtCore.QVariant(16)) + self.FontMainSizeSpinBox.setMaximum(999) + self.FontMainSizeSpinBox.setObjectName("FontMainSizeSpinBox") + self.MainFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontMainSizeSpinBox) + self.MainLeftLayout.addWidget(self.FontMainGroupBox) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.MainLeftLayout.addItem(spacerItem1) self.FontMainLayout.addWidget(self.MainLeftWidget) @@ -173,10 +173,10 @@ class Ui_AmendThemeDialog(object): self.DefaultLocationLabel = QtGui.QLabel(self.MainLocationGroupBox) self.DefaultLocationLabel.setObjectName("DefaultLocationLabel") self.MainLocationLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.DefaultLocationLabel) - self.FontMainUseDefault = QtGui.QCheckBox(self.MainLocationGroupBox) - self.FontMainUseDefault.setTristate(False) - self.FontMainUseDefault.setObjectName("FontMainUseDefault") - self.MainLocationLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontMainUseDefault) + self.FontMainDefaultCheckBox = QtGui.QCheckBox(self.MainLocationGroupBox) + self.FontMainDefaultCheckBox.setTristate(False) + self.FontMainDefaultCheckBox.setObjectName("FontMainDefaultCheckBox") + self.MainLocationLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.FontMainDefaultCheckBox) self.FontMainXLabel = QtGui.QLabel(self.MainLocationGroupBox) self.FontMainXLabel.setObjectName("FontMainXLabel") self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.FontMainXLabel) @@ -196,8 +196,8 @@ class Ui_AmendThemeDialog(object): sizePolicy.setHeightForWidth(self.FontMainXSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainXSpinBox.setSizePolicy(sizePolicy) self.FontMainXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.FontMainXSpinBox.setMaximum(9999) self.FontMainXSpinBox.setProperty("value", QtCore.QVariant(0)) + self.FontMainXSpinBox.setMaximum(9999) self.FontMainXSpinBox.setObjectName("FontMainXSpinBox") self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontMainXSpinBox) self.FontMainYSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) @@ -277,8 +277,8 @@ class Ui_AmendThemeDialog(object): sizePolicy.setHeightForWidth(self.FontFooterSizeSpinBox.sizePolicy().hasHeightForWidth()) self.FontFooterSizeSpinBox.setSizePolicy(sizePolicy) self.FontFooterSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) - self.FontFooterSizeSpinBox.setMaximum(999) self.FontFooterSizeSpinBox.setProperty("value", QtCore.QVariant(10)) + self.FontFooterSizeSpinBox.setMaximum(999) self.FontFooterSizeSpinBox.setObjectName("FontFooterSizeSpinBox") self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontFooterSizeSpinBox) self.FooterLeftLayout.addWidget(self.FooterFontGroupBox) @@ -325,8 +325,8 @@ class Ui_AmendThemeDialog(object): sizePolicy.setHeightForWidth(self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth()) self.FontFooterXSpinBox.setSizePolicy(sizePolicy) self.FontFooterXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.FontFooterXSpinBox.setMaximum(9999) self.FontFooterXSpinBox.setProperty("value", QtCore.QVariant(0)) + self.FontFooterXSpinBox.setMaximum(9999) self.FontFooterXSpinBox.setObjectName("FontFooterXSpinBox") self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontFooterXSpinBox) self.FontFooterYSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) @@ -336,15 +336,15 @@ class Ui_AmendThemeDialog(object): sizePolicy.setHeightForWidth(self.FontFooterYSpinBox.sizePolicy().hasHeightForWidth()) self.FontFooterYSpinBox.setSizePolicy(sizePolicy) self.FontFooterYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.FontFooterYSpinBox.setMaximum(9999) self.FontFooterYSpinBox.setProperty("value", QtCore.QVariant(0)) + self.FontFooterYSpinBox.setMaximum(9999) self.FontFooterYSpinBox.setObjectName("FontFooterYSpinBox") self.LocationFooterLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontFooterYSpinBox) - self.FontFooterWidthspinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) - self.FontFooterWidthspinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.FontFooterWidthspinBox.setMaximum(9999) - self.FontFooterWidthspinBox.setObjectName("FontFooterWidthspinBox") - self.LocationFooterLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontFooterWidthspinBox) + self.FontFooterWidthSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) + self.FontFooterWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0)) + self.FontFooterWidthSpinBox.setMaximum(9999) + self.FontFooterWidthSpinBox.setObjectName("FontFooterWidthSpinBox") + self.LocationFooterLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontFooterWidthSpinBox) self.FontFooterHeightSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) self.FontFooterHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontFooterHeightSpinBox.setMaximum(9999) @@ -493,11 +493,11 @@ class Ui_AmendThemeDialog(object): AmendThemeDialog.setTabOrder(self.Color2PushButton, self.ImageLineEdit) AmendThemeDialog.setTabOrder(self.ImageLineEdit, self.ImageToolButton) AmendThemeDialog.setTabOrder(self.ImageToolButton, self.GradientComboBox) - AmendThemeDialog.setTabOrder(self.GradientComboBox, self.MainFontComboBox) - AmendThemeDialog.setTabOrder(self.MainFontComboBox, self.MainFontColorPushButton) - AmendThemeDialog.setTabOrder(self.MainFontColorPushButton, self.MainFontSizeSpinBox) - AmendThemeDialog.setTabOrder(self.MainFontSizeSpinBox, self.FontMainUseDefault) - AmendThemeDialog.setTabOrder(self.FontMainUseDefault, self.FontMainXSpinBox) + AmendThemeDialog.setTabOrder(self.GradientComboBox, self.FontMainComboBox) + AmendThemeDialog.setTabOrder(self.FontMainComboBox, self.FontMainColorPushButton) + AmendThemeDialog.setTabOrder(self.FontMainColorPushButton, self.FontMainSizeSpinBox) + AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox, self.FontMainDefaultCheckBox) + AmendThemeDialog.setTabOrder(self.FontMainDefaultCheckBox, self.FontMainXSpinBox) AmendThemeDialog.setTabOrder(self.FontMainXSpinBox, self.FontMainYSpinBox) AmendThemeDialog.setTabOrder(self.FontMainYSpinBox, self.FontMainWidthSpinBox) AmendThemeDialog.setTabOrder(self.FontMainWidthSpinBox, self.FontMainHeightSpinBox) @@ -507,8 +507,8 @@ class Ui_AmendThemeDialog(object): AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, self.FontFooterDefaultCheckBox) AmendThemeDialog.setTabOrder(self.FontFooterDefaultCheckBox, self.FontFooterXSpinBox) AmendThemeDialog.setTabOrder(self.FontFooterXSpinBox, self.FontFooterYSpinBox) - AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox, self.FontFooterWidthspinBox) - AmendThemeDialog.setTabOrder(self.FontFooterWidthspinBox, self.FontFooterHeightSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox, self.FontFooterWidthSpinBox) + AmendThemeDialog.setTabOrder(self.FontFooterWidthSpinBox, self.FontFooterHeightSpinBox) AmendThemeDialog.setTabOrder(self.FontFooterHeightSpinBox, self.OutlineCheckBox) AmendThemeDialog.setTabOrder(self.OutlineCheckBox, self.OutlineColorPushButton) AmendThemeDialog.setTabOrder(self.OutlineColorPushButton, self.ShadowCheckBox) @@ -534,11 +534,11 @@ class Ui_AmendThemeDialog(object): self.GradientComboBox.setItemText(1, QtGui.QApplication.translate("AmendThemeDialog", "Vertical", None, QtGui.QApplication.UnicodeUTF8)) self.GradientComboBox.setItemText(2, QtGui.QApplication.translate("AmendThemeDialog", "Circular", None, QtGui.QApplication.UnicodeUTF8)) self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.BackgroundTab), QtGui.QApplication.translate("AmendThemeDialog", "Background", None, QtGui.QApplication.UnicodeUTF8)) - self.MainFontGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Main Font", None, QtGui.QApplication.UnicodeUTF8)) - self.MainFontlabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font:", None, QtGui.QApplication.UnicodeUTF8)) - self.MainFontColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color:", None, QtGui.QApplication.UnicodeUTF8)) - self.MainFontSize.setText(QtGui.QApplication.translate("AmendThemeDialog", "Size:", None, QtGui.QApplication.UnicodeUTF8)) - self.MainFontSizeSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "pt", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Main Font", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainlabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainColorLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Font Color:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainSize.setText(QtGui.QApplication.translate("AmendThemeDialog", "Size:", None, QtGui.QApplication.UnicodeUTF8)) + self.FontMainSizeSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "pt", None, QtGui.QApplication.UnicodeUTF8)) self.MainLocationGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Display Location", None, QtGui.QApplication.UnicodeUTF8)) self.DefaultLocationLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Use Default Location:", None, QtGui.QApplication.UnicodeUTF8)) self.FontMainXLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "X Position:", None, QtGui.QApplication.UnicodeUTF8)) @@ -563,7 +563,7 @@ class Ui_AmendThemeDialog(object): self.FontFooterHeightLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Height:", None, QtGui.QApplication.UnicodeUTF8)) self.FontFooterXSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) self.FontFooterYSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) - self.FontFooterWidthspinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) + self.FontFooterWidthSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) self.FontFooterHeightSpinBox.setSuffix(QtGui.QApplication.translate("AmendThemeDialog", "px", None, QtGui.QApplication.UnicodeUTF8)) self.ThemeTabWidget.setTabText(self.ThemeTabWidget.indexOf(self.FontFooterTab), QtGui.QApplication.translate("AmendThemeDialog", "Font Footer", None, QtGui.QApplication.UnicodeUTF8)) self.ShadowGroupBox.setTitle(QtGui.QApplication.translate("AmendThemeDialog", "Shadow && Outline", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index a5d283b8a..587198ce3 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -36,6 +36,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def __init__(self, thememanager, parent=None): QtGui.QDialog.__init__(self, parent) self.thememanager = thememanager + self.theme = ThemeXML() # Needed here as UI setup generates Events self.setupUi(self) #define signals @@ -44,8 +45,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL("pressed()"), self.onColor1PushButtonClicked) QtCore.QObject.connect(self.Color2PushButton , QtCore.SIGNAL("pressed()"), self.onColor2PushButtonClicked) - QtCore.QObject.connect(self.MainFontColorPushButton, - QtCore.SIGNAL("pressed()"), self.onMainFontColorPushButtonClicked) + QtCore.QObject.connect(self.FontMainColorPushButton, + QtCore.SIGNAL("pressed()"), self.onFontMainColorPushButtonClicked) QtCore.QObject.connect(self.FontFooterColorPushButton, QtCore.SIGNAL("pressed()"), self.onFontFooterColorPushButtonClicked) #Combo boxes @@ -55,14 +56,35 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL("activated(int)"), self.onBackgroundTypeComboBoxSelected) QtCore.QObject.connect(self.GradientComboBox, QtCore.SIGNAL("activated(int)"), self.onGradientComboBoxSelected) - QtCore.QObject.connect(self.MainFontComboBox, - QtCore.SIGNAL("activated(int)"), self.onMainFontComboBoxSelected) + QtCore.QObject.connect(self.FontMainComboBox, + QtCore.SIGNAL("activated(int)"), self.onFontMainComboBoxSelected) QtCore.QObject.connect(self.FontFooterComboBox, QtCore.SIGNAL("activated(int)"), self.onFontFooterComboBoxSelected) - QtCore.QObject.connect(self.MainFontSizeSpinBox, - QtCore.SIGNAL("valueChanged(int)"), self.onMainFontSizeSpinBoxChanged) + QtCore.QObject.connect(self.FontMainSizeSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontMainSizeSpinBoxChanged) QtCore.QObject.connect(self.FontFooterSizeSpinBox, QtCore.SIGNAL("valueChanged(int)"), self.onFontFooterSizeSpinBoxChanged) + QtCore.QObject.connect(self.FontMainDefaultCheckBox, + QtCore.SIGNAL("stateChanged(int)"), self.onFontMainDefaultCheckBoxChanged) + QtCore.QObject.connect(self.FontMainXSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontMainXSpinBoxChanged) + QtCore.QObject.connect(self.FontMainYSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontMainYSpinBoxChanged) + QtCore.QObject.connect(self.FontMainWidthSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontMainWidthSpinBoxChanged) + QtCore.QObject.connect(self.FontMainHeightSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontMainHeightSpinBoxChanged) + QtCore.QObject.connect(self.FontFooterDefaultCheckBox, + QtCore.SIGNAL("stateChanged(int)"), self.onFontFooterDefaultCheckBoxChanged) + QtCore.QObject.connect(self.FontFooterXSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontFooterXSpinBoxChanged) + QtCore.QObject.connect(self.FontFooterYSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontFooterYSpinBoxChanged) + QtCore.QObject.connect(self.FontFooterWidthSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontFooterWidthSpinBoxChanged) + QtCore.QObject.connect(self.FontFooterHeightSpinBox, + QtCore.SIGNAL("valueChanged(int)"), self.onFontFooterHeightSpinBoxChanged) + def accept(self): return QtGui.QDialog.accept(self) @@ -71,7 +93,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.path = path def loadTheme(self, theme): - self.theme = ThemeXML() if theme == None: self.theme.parse(self.baseTheme()) else: @@ -84,14 +105,39 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): # #Main Font Tab # - def onMainFontComboBoxSelected(self): - self.theme.font_main_name = self.MainFontComboBox.currentFont().family() + def onFontMainComboBoxSelected(self): + self.theme.font_main_name = self.FontMainComboBox.currentFont().family() self.previewTheme(self.theme) - def onMainFontSizeSpinBoxChanged(self, value): + def onFontMainSizeSpinBoxChanged(self, value): self.theme.font_main_proportion = value self.previewTheme(self.theme) + def onFontMainDefaultCheckBoxChanged(self, value): + if value == 2: # checked + self.theme.font_main_override = False + else: + self.theme.font_main_override = True + self.stateChanging(self.theme) + self.previewTheme(self.theme) + + def onFontMainXSpinBoxChanged(self, value): + self.theme.font_main_x = value + self.previewTheme(self.theme) + + def onFontMainYSpinBoxChanged(self, value): + self.theme.font_main_y = value + self.previewTheme(self.theme) + + def onFontMainWidthSpinBoxChanged(self, value): + self.theme.font_main_width = value + self.previewTheme(self.theme) + + def onFontMainHeightSpinBoxChanged(self, value): + self.theme.font_main_height = value + self.previewTheme(self.theme) + + # #Footer Font Tab # @@ -103,6 +149,34 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.font_footer_proportion = value self.previewTheme(self.theme) + def onFontFooterDefaultCheckBoxChanged(self): + self.stateChanging(self.theme) + self.previewTheme(self.theme) + + def onFontFooterDefaultCheckBoxChanged(self, value): + if value == 2: # checked + self.theme.font_footer_override = False + else: + self.theme.font_footer_override = True + self.stateChanging(self.theme) + self.previewTheme(self.theme) + + def onFontFooterXSpinBoxChanged(self, value): + self.theme.font_footer_x = value + self.previewTheme(self.theme) + + def onFontFooterYSpinBoxChanged(self, value): + self.theme.font_footer_y = value + self.previewTheme(self.theme) + + def onFontFooterWidthSpinBoxChanged(self, value): + self.theme.font_footer_width = value + self.previewTheme(self.theme) + + def onFontFooterHeightSpinBoxChanged(self, value): + self.theme.font_footer_height = value + self.previewTheme(self.theme) + # #Background Tab # @@ -164,11 +238,11 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.previewTheme(self.theme) - def onMainFontColorPushButtonClicked(self): + def onFontMainColorPushButtonClicked(self): self.theme.font_main_color = QtGui.QColorDialog.getColor( QColor(self.theme.font_main_color), self).name() - self.MainFontColorPushButton.setStyleSheet( + self.FontMainColorPushButton.setStyleSheet( 'background-color: %s' % str(self.theme.font_main_color)) self.previewTheme(self.theme) @@ -188,8 +262,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): newtheme = ThemeXML() newtheme.new_document(u'New Theme') newtheme.add_background_solid(str(u'#000000')) - newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(30), u'False') - newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(12), u'False', u'footer') + newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(30), False) + newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(12), False, u'footer') newtheme.add_display(str(False), str(u'#FFFFFF'), str(False), str(u'#FFFFFF'), str(0), str(0), str(0)) @@ -215,7 +289,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): else: self.GradientComboBox.setCurrentIndex(2) - self.MainFontSizeSpinBox.setValue(int(self.theme.font_main_proportion)) + self.FontMainSizeSpinBox.setValue(int(self.theme.font_main_proportion)) self.FontMainXSpinBox.setValue(int(self.theme.font_main_x)) self.FontMainYSpinBox.setValue(int(self.theme.font_main_y)) self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width)) @@ -223,24 +297,22 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.FontFooterSizeSpinBox.setValue(int(self.theme.font_footer_proportion)) self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x)) self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y)) - self.FontFooterWidthspinBox.setValue(int(self.theme.font_footer_width)) + self.FontFooterWidthSpinBox.setValue(int(self.theme.font_footer_width)) self.FontFooterHeightSpinBox.setValue(int(self.theme.font_footer_height)) - self.MainFontColorPushButton.setStyleSheet( + self.FontMainColorPushButton.setStyleSheet( 'background-color: %s' % str(theme.font_main_color)) self.FontFooterColorPushButton.setStyleSheet( 'background-color: %s' % str(theme.font_footer_color)) - if self.theme.font_main_override == u'True': - self.FontMainUseDefault.setChecked(True) + if self.theme.font_main_override == False: + self.FontMainDefaultCheckBox.setChecked(True) else: - self.FontMainUseDefault.setChecked(False) - if self.theme.font_footer_override == u'True': + self.FontMainDefaultCheckBox.setChecked(False) + if self.theme.font_footer_override == False: self.FontFooterDefaultCheckBox.setChecked(True) else: self.FontFooterDefaultCheckBox.setChecked(False) - - def stateChanging(self, theme): if theme.background_type == u'solid': self.Color1PushButton.setStyleSheet( @@ -282,7 +354,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.GradientLabel.setVisible(False) self.GradientComboBox.setVisible(False) - if theme.font_main_override == u'True': + if theme.font_main_override == False: self.FontMainXSpinBox.setEnabled(False) self.FontMainYSpinBox.setEnabled(False) self.FontMainWidthSpinBox.setEnabled(False) @@ -293,18 +365,17 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.FontMainWidthSpinBox.setEnabled(True) self.FontMainHeightSpinBox.setEnabled(True) - if theme.font_footer_override == u'True': + if theme.font_footer_override == False: self.FontFooterXSpinBox.setEnabled(False) self.FontFooterYSpinBox.setEnabled(False) - self.FontFooterWidthspinBox.setEnabled(False) + self.FontFooterWidthSpinBox.setEnabled(False) self.FontFooterHeightSpinBox.setEnabled(False) else: self.FontFooterXSpinBox.setEnabled(True) self.FontFooterYSpinBox.setEnabled(True) - self.FontFooterWidthspinBox.setEnabled(True) + self.FontFooterWidthSpinBox.setEnabled(True) self.FontFooterHeightSpinBox.setEnabled(True) - def previewTheme(self, theme): frame = self.thememanager.generateImage(theme) self.ThemePreview.setPixmap(frame) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 992d7b927..70b0bb2e5 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -307,8 +307,8 @@ class ThemeManager(QWidget): else: newtheme.add_background_image(str(t.BackgroundParameter1)) - newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(t.FontProportion * 2), u'True') - newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(12), u'True', u'footer') + newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(t.FontProportion * 2), u'False') + newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(12), u'False', u'footer') outline = False shadow = False if t.Shadow == 1: diff --git a/resources/forms/amendthemedialog.ui b/resources/forms/amendthemedialog.ui index febdd98bf..84fa8b7bd 100644 --- a/resources/forms/amendthemedialog.ui +++ b/resources/forms/amendthemedialog.ui @@ -1,10 +1,11 @@ - + + AmendThemeDialog - - + + Qt::ApplicationModal - + 0 0 @@ -12,200 +13,200 @@ 651 - + Theme Maintance - - + + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - + true - - + + 8 - + 8 - - - + + + 8 - + 0 - - + + Theme Name: - + - - - + + + 8 - + 0 - - + + 0 - - + + Background - - + + 8 - + 8 - + 8 - - - + + + Background: - - + + - + Opaque - + Transparent - - - + + + Background Type: - - + + - + Solid Color - + Gradient - + Image - - - - <Color1> + + + + <Color1> - - - + + + - - - - <Color2> + + + + <Color2> - - - + + + - - - + + + Image: - - - + + + Gradient : - - + + - + Horizontal - + Vertical - + Circular - - - - + + + + 0 - + 0 - + - - + + - - + + :/images/image_load.png:/images/image_load.png @@ -213,12 +214,12 @@ - - - + + + Qt::Vertical - + 20 40 @@ -228,109 +229,109 @@ - - + + Font Main - - + + 8 - + 8 - - - + + + 8 - + 0 - - + + Main Font - - + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + 8 - + 8 - + 8 - - - + + + Font: - - + + - - - + + + Font Color: - - - + + + - - - + + + Size: - - - - + + + + 0 0 - + 70 0 - - pt - - - 999 - - + 16 + + pt + + + 999 + - - + + Qt::Vertical - + 20 40 @@ -342,161 +343,161 @@ - - - + + + 8 - + 0 - - + + Display Location - - + + 8 - + 8 - + 8 - - - + + + Use Default Location: - - - + + + - + false - - - + + + X Position: - - - + + + Y Position: - - - + + + Width: - - - + + + Height: - - - - + + + + 0 0 - + 78 0 - - px - - - 9999 - - + 0 - - - - - - - 0 - 0 - - - - - 78 - 0 - - - + px - + 9999 - - - - + + + + 0 0 - + 78 0 - + px - + 9999 - - - - + + + + 0 0 - + 78 0 - + px - + + 9999 + + + + + + + + 0 + 0 + + + + + 78 + 0 + + + + px + + 9999 @@ -505,11 +506,11 @@ - - + + Qt::Vertical - + 20 40 @@ -522,112 +523,112 @@ - - + + Font Footer - - + + 8 - + 8 - - - + + + 8 - + 0 - - + + Footer Font - - + + QFormLayout::ExpandingFieldsGrow - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + 8 - + 8 - + 8 - - - + + + Font: - - + + - - - + + + Font Color: - - - + + + - - - + + + Size: - - - - + + + + 0 0 - + 70 0 - + + 10 + + pt - + 999 - - 10 - - - + + Qt::Vertical - + 20 40 @@ -639,158 +640,158 @@ - - - + + + 8 - + 0 - - + + Display Location - - + + QFormLayout::ExpandingFieldsGrow - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + 8 - + 8 - + 8 - - - + + + Use Default Location: - - - + + + - + false - - - + + + X Position: - - - + + + Y Position: - - - + + + Width: - - - + + + Height: - - - - + + + + 0 0 - + 78 0 - + + 0 + + px - + 9999 - - 0 - - - - - + + + + 0 0 - + 78 0 - - px - - - 9999 - - + 0 - - - - - - - 78 - 0 - - - + px - + 9999 - - - + + + 78 0 - + px - + + 9999 + + + + + + + + 78 + 0 + + + + px + + 9999 @@ -799,11 +800,11 @@ - - + + Qt::Vertical - + 20 40 @@ -816,74 +817,74 @@ - - + + Other Options - - + + 8 - + 8 - - - + + + 8 - + 0 - - + + Shadow && Outline - - + + 8 - + 8 - - - + + + 8 - + 8 - + 0 - - - + + + - - - + + + Outline Color: - - - + + + - - - + + + Show Outline: @@ -892,41 +893,41 @@ - - - + + + 8 - + 8 - + 0 - - - + + + - - - + + + Shadow Color: - - - + + + - - - + + + Show Shadow: @@ -938,11 +939,11 @@ - - + + Qt::Vertical - + 20 40 @@ -954,67 +955,67 @@ - - - + + + 8 - + 0 - - + + Alignment - - - - + + + + Horizontal Align: - - + + - + Left - + Right - + Center - - - + + + Vertical Align: - - + + - + Top - + Middle - + Bottom @@ -1024,11 +1025,11 @@ - - + + Qt::Vertical - + 20 40 @@ -1047,23 +1048,23 @@ - - + + Preview - - + + 8 - + 8 - - + + Qt::Horizontal - + 40 20 @@ -1072,42 +1073,42 @@ - - - + + + 0 0 - + 300 225 - + QFrame::WinPanel - + QFrame::Sunken - + 1 - + - + true - - + + Qt::Horizontal - + 40 20 @@ -1119,8 +1120,8 @@ - - + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -1138,10 +1139,10 @@ ImageLineEdit ImageToolButton GradientComboBox - MainFontComboBox - MainFontColorPushButton - MainFontSizeSpinBox - FontMainUseDefault + FontMainComboBox + FontMainColorPushButton + FontMainSizeSpinBox + FontMainDefaultCheckBox FontMainXSpinBox FontMainYSpinBox FontMainWidthSpinBox @@ -1152,7 +1153,7 @@ FontFooterDefaultCheckBox FontFooterXSpinBox FontFooterYSpinBox - FontFooterWidthspinBox + FontFooterWidthSpinBox FontFooterHeightSpinBox OutlineCheckBox OutlineColorPushButton @@ -1162,7 +1163,7 @@ VerticalComboBox - + @@ -1171,11 +1172,11 @@ AmendThemeDialog accept() - + 375 466 - + 375 241 @@ -1187,11 +1188,11 @@ AmendThemeDialog reject() - + 375 466 - + 375 241 From a1368e1f76dd12c934d15b90e1b405f56617ead4 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 22 Apr 2009 18:28:32 +0100 Subject: [PATCH 11/17] Finish Theme Editing --- openlp/core/lib/render.py | 4 +- openlp/core/ui/amendthemeform.py | 95 ++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/render.py b/openlp/core/lib/render.py index 659b61847..8383155ad 100644 --- a/openlp/core/lib/render.py +++ b/openlp/core/lib/render.py @@ -239,9 +239,9 @@ class Renderer: x=rect.left() if int(self._theme.display_verticalAlign) == 0: # top align y = rect.top() - elif int(self._theme.display_verticalAlign) == 1: # bottom align + elif int(self._theme.display_verticalAlign) == 2: # bottom align y=rect.bottom()-bbox.height() - elif int(self._theme.display_verticalAlign) == 2: # centre align + elif int(self._theme.display_verticalAlign) == 1: # centre align y=rect.top()+(rect.height()-bbox.height())/2 else: assert(0, u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 587198ce3..641961610 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -49,6 +49,11 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL("pressed()"), self.onFontMainColorPushButtonClicked) QtCore.QObject.connect(self.FontFooterColorPushButton, QtCore.SIGNAL("pressed()"), self.onFontFooterColorPushButtonClicked) + QtCore.QObject.connect(self.OutlineColorPushButton, + QtCore.SIGNAL("pressed()"), self.onOutlineColorPushButtonClicked) + QtCore.QObject.connect(self.ShadowColorPushButton, + QtCore.SIGNAL("pressed()"), self.onShadowColorPushButtonClicked) + #Combo boxes QtCore.QObject.connect(self.BackgroundComboBox, QtCore.SIGNAL("activated(int)"), self.onBackgroundComboBoxSelected) @@ -60,6 +65,11 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL("activated(int)"), self.onFontMainComboBoxSelected) QtCore.QObject.connect(self.FontFooterComboBox, QtCore.SIGNAL("activated(int)"), self.onFontFooterComboBoxSelected) + QtCore.QObject.connect(self.HorizontalComboBox, + QtCore.SIGNAL("activated(int)"), self.onHorizontalComboBoxSelected) + QtCore.QObject.connect(self.VerticalComboBox, + QtCore.SIGNAL("activated(int)"), self.onVerticalComboBoxSelected) + QtCore.QObject.connect(self.FontMainSizeSpinBox, QtCore.SIGNAL("valueChanged(int)"), self.onFontMainSizeSpinBoxChanged) QtCore.QObject.connect(self.FontFooterSizeSpinBox, @@ -84,6 +94,10 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL("valueChanged(int)"), self.onFontFooterWidthSpinBoxChanged) QtCore.QObject.connect(self.FontFooterHeightSpinBox, QtCore.SIGNAL("valueChanged(int)"), self.onFontFooterHeightSpinBoxChanged) + QtCore.QObject.connect(self.OutlineCheckBox, + QtCore.SIGNAL("stateChanged(int)"), self.onOutlineCheckBoxChanged) + QtCore.QObject.connect(self.ShadowCheckBox, + QtCore.SIGNAL("stateChanged(int)"), self.onShadowCheckBoxChanged) def accept(self): @@ -254,6 +268,50 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): 'background-color: %s' % str(self.theme.font_footer_color)) self.previewTheme(self.theme) + # + #Other Tab + # + def onOutlineCheckBoxChanged(self, value): + if value == 2: # checked + self.theme.display_outline = True + else: + self.theme.display_outline = False + self.stateChanging(self.theme) + self.previewTheme(self.theme) + + def onOutlineColorPushButtonClicked(self): + self.theme.display_outline_color = QtGui.QColorDialog.getColor( + QColor(self.theme.display_outline_color), self).name() + self.OutlineColorPushButton.setStyleSheet( + 'background-color: %s' % str(self.theme.display_outline_color)) + self.previewTheme(self.theme) + + def onShadowCheckBoxChanged(self, value): + if value == 2: # checked + self.theme.display_shadow = True + else: + self.theme.display_shadow = False + self.stateChanging(self.theme) + self.previewTheme(self.theme) + + def onShadowColorPushButtonClicked(self): + self.theme.display_shadow_color = QtGui.QColorDialog.getColor( + QColor(self.theme.display_shadow_color), self).name() + self.ShadowColorPushButton.setStyleSheet( + 'background-color: %s' % str(self.theme.display_shadow_color)) + self.previewTheme(self.theme) + + def onHorizontalComboBoxSelected(self, currentIndex): + self.theme.display_horizontalAlign = currentIndex + self.stateChanging(self.theme) + self.previewTheme(self.theme) + + def onVerticalComboBoxSelected(self, currentIndex): + self.theme.display_verticalAlign = currentIndex + self.stateChanging(self.theme) + self.previewTheme(self.theme) + + # #Local Methods # @@ -272,16 +330,19 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def paintUi(self, theme): print theme # leave as helpful for initial development self.stateChanging(theme) + self.ThemeNameEdit.setText(self.theme.theme_name) if self.theme.background_mode == u'opaque': self.BackgroundComboBox.setCurrentIndex(0) else: self.BackgroundComboBox.setCurrentIndex(1) + if theme.background_type == u'solid': self.BackgroundTypeComboBox.setCurrentIndex(0) elif theme.background_type == u'gradient': self.BackgroundTypeComboBox.setCurrentIndex(1) else: self.BackgroundTypeComboBox.setCurrentIndex(2) + if self.theme.background_direction == u'horizontal': self.GradientComboBox.setCurrentIndex(0) elif self.theme.background_direction == u'vertical': @@ -308,11 +369,34 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.FontMainDefaultCheckBox.setChecked(True) else: self.FontMainDefaultCheckBox.setChecked(False) + if self.theme.font_footer_override == False: self.FontFooterDefaultCheckBox.setChecked(True) else: self.FontFooterDefaultCheckBox.setChecked(False) + self.OutlineColorPushButton.setStyleSheet( + 'background-color: %s' % str(theme.display_outline_color)) + self.ShadowColorPushButton.setStyleSheet( + 'background-color: %s' % str(theme.display_shadow_color)) + + if self.theme.display_outline: + self.OutlineCheckBox.setChecked(True) + self.OutlineColorPushButton.setEnabled(True) + else: + self.OutlineCheckBox.setChecked(False) + self.OutlineColorPushButton.setEnabled(False) + + if self.theme.display_shadow: + self.ShadowCheckBox.setChecked(True) + self.ShadowColorPushButton.setEnabled(True) + else: + self.ShadowCheckBox.setChecked(False) + self.ShadowColorPushButton.setEnabled(False) + + self.HorizontalComboBox.setCurrentIndex(int(self.theme.display_horizontalAlign)) + self.VerticalComboBox.setCurrentIndex(int(self.theme.display_verticalAlign)) + def stateChanging(self, theme): if theme.background_type == u'solid': self.Color1PushButton.setStyleSheet( @@ -376,6 +460,17 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.FontFooterWidthSpinBox.setEnabled(True) self.FontFooterHeightSpinBox.setEnabled(True) + if self.theme.display_outline: + self.OutlineColorPushButton.setEnabled(True) + else: + self.OutlineColorPushButton.setEnabled(False) + + if self.theme.display_shadow: + self.ShadowColorPushButton.setEnabled(True) + else: + self.ShadowColorPushButton.setEnabled(False) + + def previewTheme(self, theme): frame = self.thememanager.generateImage(theme) self.ThemePreview.setPixmap(frame) From d85a0ba29365362fe9dffd23990863b8db8bd893 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 22 Apr 2009 20:46:10 +0100 Subject: [PATCH 12/17] Fix renderer name Introduce rendermanager --- openlp/core/lib/__init__.py | 5 +- openlp/core/lib/{render.py => renderer.py} | 2 +- openlp/core/lib/rendermanager.py | 81 ++++++++++++++++++++++ openlp/core/ui/amendthemeform.py | 35 +++++----- openlp/core/ui/mainwindow.py | 5 +- openlp/core/ui/thememanager.py | 24 ++----- 6 files changed, 110 insertions(+), 42 deletions(-) rename openlp/core/lib/{render.py => renderer.py} (99%) create mode 100644 openlp/core/lib/rendermanager.py diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 30e176f85..306c1d5fd 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -32,8 +32,9 @@ from toolbar import OpenLPToolbar from songxmlhandler import SongXMLBuilder from songxmlhandler import SongXMLParser from themexmlhandler import ThemeXML -from openlp.core.lib.render import Renderer +from renderer import Renderer +from rendermanager import RenderManager __all__ = ['Renderer','PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'EventType' 'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder', - 'SongXMLParser', 'EventManager', 'ThemeXML'] + 'SongXMLParser', 'EventManager', 'ThemeXML', 'RenderManager'] diff --git a/openlp/core/lib/render.py b/openlp/core/lib/renderer.py similarity index 99% rename from openlp/core/lib/render.py rename to openlp/core/lib/renderer.py index 8383155ad..c5528d59d 100644 --- a/openlp/core/lib/render.py +++ b/openlp/core/lib/renderer.py @@ -3,7 +3,7 @@ """ OpenLP - Open Source Lyrics Projection Copyright (c) 2008 Raoul Snyman -Portions copyright (c) 2008 Martin Thompson, Tim Bentley +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py new file mode 100644 index 000000000..a31afd663 --- /dev/null +++ b/openlp/core/lib/rendermanager.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 +""" +OpenLP - Open Source Lyrics Projection +Copyright (c) 2008 Raoul Snyman +Portions copyright (c) 2008 - 2009Martin Thompson, Tim Bentley + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA +""" +import logging +import os, os.path +import sys +from PyQt4 import QtGui, QtCore, Qt +from renderer import Renderer + +class RenderManager: + """ + Class to pull all Renderer interactions into one place. + The plugins will call helper methods to do the rendering but + this class will provide display defense code. + """ + global log + log=logging.getLogger(u'RenderManager') + log.info(u'RenderManager Loaded') + + def __init__(self, screen_list): + log.debug(u'Initilisation started') + self.screen_list = screen_list + self.displays = len(screen_list) + self.current_display = 1 + self.renderer = Renderer() + self.calculate_default(self.screen_list[self.current_display-1][1]) + + def set_theme(self, theme): + self.theme = theme + if theme.font_main_override == False: + pass + if theme.font_footer_override == False: + pass + + + def generate_preview(self): + self.calculate_default(QtCore.QSize(800,600)) + + frame = QtGui.QPixmap(self.width, self.height) + renderer=Renderer(None) + renderer.set_paint_dest(frame) + + renderer.set_theme(self.theme) + renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1), + QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start)) + + lines=[] + lines.append(u'Amazing Grace!') + lines.append(u'How sweet the sound') + lines.append(u'To save a wretch like me;') + lines.append(u'I once was lost but now am found,') + lines.append(u'Was blind, but now I see.') + lines1=[] + lines1.append(u'Amazing Grace (John Newton)' ) + lines1.append(u'CCLI xxx (c)Openlp.org') + answer=renderer.render_lines(lines, lines1) + return frame + + def generate_bible(self): + pass + + def calculate_default(self, screen): + self.width = screen.width() + self.height = screen.height() + self.footer_start = int(self.height*0.95) # 95% is start of footer diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 641961610..b545784c9 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -123,6 +123,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.font_main_name = self.FontMainComboBox.currentFont().family() self.previewTheme(self.theme) + def onFontMainColorPushButtonClicked(self): + self.theme.font_main_color = QtGui.QColorDialog.getColor( + QColor(self.theme.font_main_color), self).name() + + self.FontMainColorPushButton.setStyleSheet( + 'background-color: %s' % str(self.theme.font_main_color)) + self.previewTheme(self.theme) + def onFontMainSizeSpinBoxChanged(self, value): self.theme.font_main_proportion = value self.previewTheme(self.theme) @@ -159,6 +167,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.font_footer_name = self.FontFooterComboBox.currentFont().family() self.previewTheme(self.theme) + def onFontFooterColorPushButtonClicked(self): + self.theme.font_footer_color = QtGui.QColorDialog.getColor( + QColor(self.theme.font_footer_color), self).name() + + self.FontFooterColorPushButton.setStyleSheet( + 'background-color: %s' % str(self.theme.font_footer_color)) + self.previewTheme(self.theme) + def onFontFooterSizeSpinBoxChanged(self, value): self.theme.font_footer_proportion = value self.previewTheme(self.theme) @@ -251,23 +267,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): 'background-color: %s' % str(self.theme.background_endColor)) self.previewTheme(self.theme) - - def onFontMainColorPushButtonClicked(self): - self.theme.font_main_color = QtGui.QColorDialog.getColor( - QColor(self.theme.font_main_color), self).name() - - self.FontMainColorPushButton.setStyleSheet( - 'background-color: %s' % str(self.theme.font_main_color)) - self.previewTheme(self.theme) - - def onFontFooterColorPushButtonClicked(self): - self.theme.font_footer_color = QtGui.QColorDialog.getColor( - QColor(self.theme.font_footer_color), self).name() - - self.FontFooterColorPushButton.setStyleSheet( - 'background-color: %s' % str(self.theme.font_footer_color)) - self.previewTheme(self.theme) - # #Other Tab # @@ -310,8 +309,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.display_verticalAlign = currentIndex self.stateChanging(self.theme) self.previewTheme(self.theme) - - # #Local Methods # diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 40cc153a7..d070b5917 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -28,7 +28,7 @@ from openlp.core.resources import * from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \ SlideController, ServiceManager, ThemeManager -from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, EventManager +from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, EventManager, RenderManager from openlp.core import PluginManager @@ -44,6 +44,7 @@ class MainWindow(object): self.alert_form = AlertForm() self.about_form = AboutForm() self.settings_form = SettingsForm(self.screen_list) + self.RenderManager = RenderManager(self.screen_list) pluginpath = os.path.split(os.path.abspath(__file__))[0] pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins')) @@ -57,6 +58,7 @@ class MainWindow(object): self.plugin_helpers[u'live'] = self.LiveController self.plugin_helpers[u'event'] = self.EventManager self.plugin_helpers[u'theme'] = self.ThemeManagerContents # Theme manger + self.plugin_helpers[u'render'] = self.RenderManager self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers, self.EventManager) # hook methods have to happen after find_plugins. Find plugins needs the controllers @@ -84,6 +86,7 @@ class MainWindow(object): # Once all components are initialised load the Themes log.info(u'Load Themes') self.ThemeManagerContents.setEventManager(self.EventManager) + self.ThemeManagerContents.setRenderManager(self.RenderManager) self.ThemeManagerContents.loadThemes() def setupUi(self): diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 70b0bb2e5..1f04951d6 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -187,6 +187,9 @@ class ThemeManager(QWidget): def setEventManager(self, eventManager): self.eventManager = eventManager + def setRenderManager(self, renderManager): + self.renderManager = renderManager + def onAddTheme(self): self.amendThemeForm.loadTheme(None) self.amendThemeForm.exec_() @@ -335,24 +338,7 @@ class ThemeManager(QWidget): def generateImage(self, theme): log.debug(u'generateImage %s ', theme) - size=QtCore.QSize(800,600) - frame = QtGui.QPixmap(size.width(), size.height()) - renderer=Renderer(self.path) - renderer.set_paint_dest(frame) - - renderer.set_theme(theme) # set default theme - #renderer._render_background() - renderer.set_text_rectangle(QtCore.QRect(0,0, size.width()-1, size.height()-1), QtCore.QRect(10,560, size.width()-1, size.height()-1)) - - lines=[] - lines.append(u'Amazing Grace!') - lines.append(u'How sweet the sound') - lines.append(u'To save a wretch like me;') - lines.append(u'I once was lost but now am found,') - lines.append(u'Was blind, but now I see.') - lines1=[] - lines1.append(u'Amazing Grace (John Newton)' ) - lines1.append(u'CCLI xxx (c)Openlp.org') - answer=renderer.render_lines(lines, lines1) + self.renderManager.set_theme(theme) + frame = self.renderManager.generate_preview() return frame From a3e2bce831dcf10ae6433a2e6f4864c995a3f50a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 23 Apr 2009 19:12:36 +0100 Subject: [PATCH 13/17] now we can save the theme as new or overrite --- openlp/core/lib/renderer.py | 9 ++++--- openlp/core/ui/amendthemeform.py | 41 ++++++++++++++++++++++++++++++++ openlp/core/ui/thememanager.py | 17 +++++++++++-- 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index c5528d59d..8bcd86edb 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -261,8 +261,8 @@ class Renderer: bbox=self._render_lines_unaligned(lines, False, (x, y)) if lines1 is not None: - x, y = self._correctAlignment(self._rect_footer, bbox1) - bbox=self._render_lines_unaligned(lines1, True, (x, y) ) + #x, y = self._correctAlignment(self._rect_footer, bbox1) + bbox=self._render_lines_unaligned(lines1, True, (self._rect_footer.left(), self._rect_footer.top()) ) log.debug(u'render lines DONE') @@ -337,7 +337,10 @@ class Renderer: starty=y rightextent=None t=self._theme - align=t.display_horizontalAlign + if footer: # dont allow alignment messing with footers + align = 0 + else: + align=t.display_horizontalAlign wrapstyle=t.display_wrapStyle diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index b545784c9..82a2c9f3d 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -101,6 +101,23 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): def accept(self): + new_theme = ThemeXML() + theme_name = str(self.ThemeNameEdit.displayText()) + new_theme.new_document(theme_name) + if self.theme.background_type == u'solid': + new_theme.add_background_solid(str(self.theme.background_color)) + elif self.theme.theme.background_type == u'gradient': + new_theme.add_background_gradient(str(self.theme.background_startColor), str(self.theme.background_endColor), self.theme.background_direction) + #else: + #newtheme.add_background_image(str(self.theme.)) + + new_theme.add_font(str(self.theme.font_main_name), str(self.theme.font_main_color), str(self.theme.font_main_proportion), u'False') + new_theme.add_font(str(self.theme.font_footer_name), str(self.theme.font_footer_color), str(self.theme.font_footer_proportion), u'False', u'footer') + new_theme.add_display(str(self.theme.display_shadow), str(self.theme.display_shadow_color), str(self.theme.display_outline), str(self.theme.display_outline_color), + str(self.theme.display_horizontalAlign), str(self.theme.display_verticalAlign), str(self.theme.display_wrapStyle)) + + theme = new_theme.extract_xml() + self.thememanager.saveTheme(theme_name, theme) return QtGui.QDialog.accept(self) def themePath(self, path): @@ -140,6 +157,17 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.font_main_override = False else: self.theme.font_main_override = True + + if int(self.theme.font_main_x) == 0 and int(self.theme.font_main_y) == 0 and \ + int(self.theme.font_main_width) == 0 and int(self.theme.font_main_height) == 0: + self.theme.font_main_x = u'10' + self.theme.font_main_y = u'10' + self.theme.font_main_width = u'1024' + self.theme.font_main_height = u'730' + self.FontMainXSpinBox.setValue(int(self.theme.font_main_x)) + self.FontMainYSpinBox.setValue(int(self.theme.font_main_y)) + self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width)) + self.FontMainHeightSpinBox.setValue(int(self.theme.font_main_height)) self.stateChanging(self.theme) self.previewTheme(self.theme) @@ -188,6 +216,19 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.font_footer_override = False else: self.theme.font_footer_override = True + if int(self.theme.font_footer_x) == 0 and int(self.theme.font_footer_y) == 0 and \ + int(self.theme.font_footer_width) == 0 and int(self.theme.font_footer_height) == 0: + self.theme.font_footer_x = u'10' + self.theme.font_footer_y = u'730' + self.theme.font_footer_width = u'1024' + self.theme.font_footer_height = u'38' + + self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x)) + self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y)) + self.FontFooterWidthSpinBox.setValue(int(self.theme.font_footer_width)) + self.FontFooterHeightSpinBox.setValue(int(self.theme.font_footer_height)) + + self.stateChanging(self.theme) self.previewTheme(self.theme) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 1f04951d6..45b807f21 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -275,7 +275,7 @@ class ThemeManager(QWidget): if self.checkVersion1(xml_data): filexml = self.migrateVersion122(filename, fullpath, xml_data) # upgrade theme xml else: - file_xml = xml_data + filexml = xml_data outfile = open(fullpath, 'w') outfile.write(filexml) outfile.close() @@ -322,6 +322,19 @@ class ThemeManager(QWidget): str(t.HorizontalAlign), str(t.VerticalAlign), str(t.WrapStyle)) return newtheme.extract_xml() + def saveTheme(self, name, theme_xml) : + self.generateAndSaveImage(self.path, name, theme_xml) + theme_dir = os.path.join(self.path, name) + if os.path.exists(theme_dir) == False: + os.mkdir(os.path.join(self.path, name)) + + theme_file = os.path.join(theme_dir, name+u'.xml') + outfile = open(theme_file, 'w') + outfile.write(theme_xml) + outfile.close() + self.Theme_data.clearItems() + self.loadThemes() + def generateAndSaveImage(self, dir, name, theme_xml): log.debug(u'generateImage %s %s %s', dir, name, theme_xml) theme = ThemeXML() @@ -330,7 +343,7 @@ class ThemeManager(QWidget): frame = self.generateImage(theme) im=frame.toImage() - samplepathname=os.path.join(dir, name+u'.png') + samplepathname=os.path.join(self.path, name+u'.png') if os.path.exists(samplepathname): os.unlink(samplepathname) im.save(samplepathname, u'png') From 4696564c0951d49b14a1491f8e24c8d7113556d6 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 23 Apr 2009 19:22:54 +0100 Subject: [PATCH 14/17] Add update to ServiceManager of Themes from ThemeManager --- openlp/core/ui/mainwindow.py | 1 + openlp/core/ui/servicemanager.py | 20 +++++++++++--------- openlp/core/ui/thememanager.py | 7 ++++++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index d070b5917..ec5dce759 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -87,6 +87,7 @@ class MainWindow(object): log.info(u'Load Themes') self.ThemeManagerContents.setEventManager(self.EventManager) self.ThemeManagerContents.setRenderManager(self.RenderManager) + self.ThemeManagerContents.setServiceManager(self.ServiceManagerContents) self.ThemeManagerContents.loadThemes() def setupUi(self): diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index f2f45e5ce..1df8f163d 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -61,7 +61,7 @@ class ServiceData(QAbstractItemModel): self.endRemoveRows() def addRow(self, item): self.insertRow(len(self.items), item) - + def index(self, row, col, parent = QModelIndex()): return self.createIndex(row,col) @@ -90,7 +90,7 @@ class ServiceData(QAbstractItemModel): return QVariant(retval) else: return retval - + def __iter__(self): for i in self.items: yield i @@ -99,7 +99,7 @@ class ServiceData(QAbstractItemModel): log.info("Get Item:%d -> %s" %(row, str(self.items))) return self.items[row] - + class ServiceManager(QWidget): """Manages the orders of service. Currently this involves taking @@ -109,7 +109,7 @@ class ServiceManager(QWidget): Also handles the UI tasks of moving things up and down etc. """ global log - log=logging.getLogger(u'ServiceManager') + log=logging.getLogger(u'ServiceManager') def __init__(self, parent): QWidget.__init__(self) @@ -128,9 +128,6 @@ class ServiceManager(QWidget): self.Toolbar.addSeparator() self.ThemeComboBox = QtGui.QComboBox(self.Toolbar) self.ThemeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) - self.ThemeComboBox.addItem(QtCore.QString()) - self.ThemeComboBox.addItem(QtCore.QString()) - self.ThemeComboBox.addItem(QtCore.QString()) self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar) self.ThemeWidget.setDefaultWidget(self.ThemeComboBox) self.Toolbar.addAction(self.ThemeWidget) @@ -141,7 +138,7 @@ class ServiceManager(QWidget): self.service_data=ServiceData() self.TreeView.setModel(self.service_data) self.Layout.addWidget(self.TreeView) - + def addServiceItem(self, item): """Adds service item""" log.info("addServiceItem") @@ -165,7 +162,7 @@ class ServiceManager(QWidget): self.service_data.addRow(item) else: self.service_data.insertRow(row+1, item) - + def removeServiceItem(self): """Remove currently selected item""" pass @@ -189,3 +186,8 @@ class ServiceManager(QWidget): oosfile.write(self.oos_as_text) oosfile.write("# END OOS\n") oosfile.close() + + def updateThemeList(self, theme_list): + self.ThemeComboBox.clear() + for theme in theme_list: + self.ThemeComboBox.addItem(theme) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 45b807f21..406097d8f 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -31,6 +31,7 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * from openlp.core.ui import AmendThemeForm +from openlp.core.ui import ServiceManager from openlp.core import translate from openlp.core.theme import Theme from openlp.core.lib import Event @@ -41,7 +42,6 @@ from openlp.core.lib import ThemeXML from openlp.core.lib import Renderer from openlp.core.utils import ConfigHelper - import logging class ThemeData(QAbstractItemModel): @@ -190,6 +190,9 @@ class ThemeManager(QWidget): def setRenderManager(self, renderManager): self.renderManager = renderManager + def setServiceManager(self, serviceManager): + self.serviceManager = serviceManager + def onAddTheme(self): self.amendThemeForm.loadTheme(None) self.amendThemeForm.exec_() @@ -240,6 +243,7 @@ class ThemeManager(QWidget): self.Theme_data.addRow(os.path.join(self.path, name)) self.eventManager.post_event(Event(EventType.ThemeListChanged)) + self.serviceManager.updateThemeList(self.getThemes()) def getThemes(self): return self.Theme_data.getList() @@ -323,6 +327,7 @@ class ThemeManager(QWidget): return newtheme.extract_xml() def saveTheme(self, name, theme_xml) : + log.debug(u'saveTheme %s %s', name, theme_xml) self.generateAndSaveImage(self.path, name, theme_xml) theme_dir = os.path.join(self.path, name) if os.path.exists(theme_dir) == False: From aeb79120f46357a4e089cf2df17c4dc83443a1a9 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 25 Apr 2009 07:09:47 +0100 Subject: [PATCH 15/17] Fix name bug --- openlp/plugins/bibles/lib/manager.py | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index c04da6e06..c881c9202 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -52,16 +52,16 @@ class BibleManager(): self.proxyname = self.config.get_config("proxy name") #get proxy name for screen self.bibleSuffix = "sqlite" self.dialogobject = None - + self.reload_bibles() - + def reload_bibles(self): log.debug("Reload bibles") - + files = self.config.get_files(self.bibleSuffix) log.debug("Bible Files %s", files ) - - self.bible_db_cache = {} + + self.bible_db_cache = {} self.bible_http_cache = {} self.book_testaments = {} # books of the bible with testaments @@ -88,17 +88,17 @@ class BibleManager(): nhttp.set_bibleid(bibleid) # tell The Server where to get the verses from. else: self.bible_http_cache [bname] = None # makes the Full / partial code easier. - + if self.web_bibles_present: self.book_testaments = {} # books of the bible linked to bibleid {osis , name} self.book_abbreviations = {} # books of the bible linked to bibleid {osis ,Abbrev } - + filepath = os.path.split(os.path.abspath(__file__))[0] - filepath = os.path.abspath(os.path.join(filepath, '..', 'resources','httpbooks.csv')) + filepath = os.path.abspath(os.path.join(filepath, '..', 'resources','httpbooks.csv')) fbibles=open(filepath, 'r') for line in fbibles: p = line.split(",") - self.book_abbreviations[p[0]] = p[1].replace('\n', '') + self.book_abbreviations[p[0]] = p[1].replace('\n', '') self.book_testaments[p[0]] = p[2].replace('\n', '') log.debug( "Bible Initialised") @@ -136,7 +136,7 @@ class BibleManager(): If the database exists it is deleted and the database is reloaded from scratch. """ - log.debug( "register_CSV_file_bible %s,%s,%s", biblename, booksfile, versefile) + log.debug( "register_CSV_file_bible %s,%s,%s", biblename, booksfile, versefile) if self._is_new_bible(biblename): nbible = BibleDBImpl(self.biblePath, biblename, self.config) # Create new Bible nbible.create_tables() # Create Database @@ -150,7 +150,7 @@ class BibleManager(): If the database exists it is deleted and the database is reloaded from scratch. """ - log.debug( "register_OSIS_file_bible %s , %s", biblename, osisfile) + log.debug( "register_OSIS_file_bible %s , %s", biblename, osisfile) if self._is_new_bible(biblename): nbible = BibleDBImpl(self.biblePath, biblename, self.config) # Create new Bible nbible.create_tables() # Create Database @@ -170,7 +170,7 @@ class BibleManager(): if mode == "full": r.append(b) else: - if self.bible_http_cache [b] == None: # we do not have an http bible + if self.bible_http_cache [b] == None: # we do not have an http bible r.append(b) return r @@ -250,16 +250,16 @@ class BibleManager(): log.debug("New http book %s , %s, %s", book, book.id, book.name) self.bible_db_cache[bible].create_chapter(book.id, \ search_results.get_chapter(),\ - search_results.get_verselist()) + search_results.get_verselist()) else: ## Book exists check chapter and texts only. v = self.bible_db_cache[bible].get_bible_chapter(book.id, chapter) if v == None: self.bible_db_cache[bible].create_chapter(book.id, \ - book_chapter, \ + chapter, \ search_results.get_verselist()) else: - log.debug("get_verse_text : old book") + log.debug("get_verse_text : old book") for chapter in range(schapter, echapter+1): v = self.bible_db_cache[bible].get_bible_chapter(book.id, chapter) if v == None: @@ -267,9 +267,9 @@ class BibleManager(): search_results = self.bible_http_cache [bible].get_bible_chapter(bible, book.id, bookname, chapter) self.bible_db_cache[bible].create_chapter(book.id, \ search_results.get_chapter(),\ - search_results.get_verselist()) + search_results.get_verselist()) except : - log.error("Errow thrown %s", sys.exc_info()[1]) + log.error("Errow thrown %s", sys.exc_info()[1]) if schapter == echapter: text = self.bible_db_cache[bible].get_bible_text(bookname, schapter, sverse, everse) From 2457da9d8868ed1aa54b6f006b9a7049ec6aec29 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 25 Apr 2009 07:11:15 +0100 Subject: [PATCH 16/17] Add version number to splash screem Add ability to preview to preview controller Add render manager to control rendering Fix bugs in renderer Add inital rendering to custom and bible plugins --- openlp.pyw | 2 +- openlp/core/lib/plugin.py | 7 +-- openlp/core/lib/renderer.py | 25 +++++------ openlp/core/lib/rendermanager.py | 54 ++++++++++++++++++----- openlp/core/ui/mainwindow.py | 7 ++- openlp/core/ui/servicemanager.py | 11 +++++ openlp/core/ui/slidecontroller.py | 25 +++++++++-- openlp/core/ui/splashscreen.py | 9 ++-- openlp/core/ui/thememanager.py | 8 ++++ openlp/plugins/bibles/lib/mediaitem.py | 36 ++++++++------- openlp/plugins/custom/lib/mediaitem.py | 54 +++++++++++++++-------- openlp/plugins/videos/lib/filelistdata.py | 4 ++ openlp/plugins/videos/lib/mediaitem.py | 47 +++++++++++--------- 13 files changed, 197 insertions(+), 92 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 49f348556..3ba640de2 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -46,7 +46,7 @@ class OpenLP(QtGui.QApplication): self.setApplicationName(u'openlp.org') self.setApplicationVersion(u'1.9.0') - self.splash = SplashScreen() + self.splash = SplashScreen(self.applicationVersion()) self.splash.show() # make sure Qt really display the splash screen self.processEvents() diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 8436bc8d3..b4edc06fd 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -91,8 +91,9 @@ class Plugin(object): self.preview_controller=plugin_helpers[u'preview'] self.live_controller=plugin_helpers[u'live'] self.theme_manager=plugin_helpers[u'theme'] - self.event_manager=plugin_helpers[u'event'] - + self.event_manager=plugin_helpers[u'event'] + self.render_manager=plugin_helpers[u'render'] + def check_pre_conditions(self): """ Provides the Plugin with a handle to check if it can be loaded. @@ -118,7 +119,7 @@ class Plugin(object): Create a menu item and add it to the "Export" menu. """ pass - + def get_settings_tab(self): """ Create a menu item and add it to the "Import" menu. diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 8bcd86edb..0356e084a 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -97,19 +97,18 @@ class Renderer: if self._bg_image_filename is not None: self.scale_bg_image() - def set_words_openlp(self, words): -# log.debug(u" "set words openlp", words + def format_slide(self, words, footer): + log.debug(u'format_slide %s', words) verses=[] words=words.replace(u'\r\n', u'\n') - verses_text=words.split(u'\n\n') + verses_text = words.split(u'\n') for v in verses_text: lines=v.split(u'\n') - verses.append(self.split_set_of_lines(lines)[0]) - self.words=verses + verses.append(self.split_set_of_lines(lines, footer)[0]) + self.words = verses verses_text=[] for v in verses: verses_text.append(u'\n'.join(v).lstrip()) # remove first \n - return verses_text def render_screen(self, screennum): @@ -172,22 +171,22 @@ class Renderer: p.end() log.debug(u'render background done') - def split_set_of_lines(self, lines): + def split_set_of_lines(self, lines, footer): """Given a list of lines, decide how to split them best if they don't all fit on the screen - this is done by splitting at 1/2, 1/3 or 1/4 of the set If it doesn't fit, even at this size, just split at each opportunity - We'll do this by getting the bounding box of each line, and then summing them appropriately + We'll do this by getting the bounding box of each lline, and then summing them appropriately Returns a list of [lists of lines], one set for each screenful """ -# log.debug(u" "Split set of lines" + log.debug(u'Split set of lines') # Probably ought to save the rendering results to a pseudoDC for redrawing efficiency. But let's not optimse prematurely! bboxes = [] for line in lines: - bboxes.append(self._render_single_line(line)) + bboxes.append(self._render_single_line(line, footer)) numlines=len(lines) bottom=self._rect.bottom() for ratio in (numlines, numlines/2, numlines/3, numlines/4): @@ -281,8 +280,8 @@ class Renderer: brx=x bry=y for line in lines: - if (line == ''): - continue + #if (line == ''): + # continue # render after current bottom, but at original left edge # keep track of right edge to see which is biggest (thisx, bry) = self._render_single_line(line, footer, (x,bry)) @@ -309,7 +308,7 @@ class Renderer: Returns the bottom-right corner (of what was rendered) as a tuple(x, y). """ - #log.debug(u'Render single line %s @ %s '%( line, tlcorner)) + log.debug(u'Render single line %s @ %s '%( line, tlcorner)) x, y=tlcorner # We draw the text to see how big it is and then iterate to make it fit # when we line wrap we do in in the "lyrics" style, so the second line is diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index a31afd663..8df35337e 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -33,33 +33,42 @@ class RenderManager: log=logging.getLogger(u'RenderManager') log.info(u'RenderManager Loaded') - def __init__(self, screen_list): + def __init__(self, theme_manager, screen_list): log.debug(u'Initilisation started') self.screen_list = screen_list + self.theme_manager = theme_manager self.displays = len(screen_list) self.current_display = 1 - self.renderer = Renderer() + self.renderer = Renderer(None) self.calculate_default(self.screen_list[self.current_display-1][1]) + self.frame = None + + def set_default_theme(self, theme): + log.debug("default theme set to %s", theme) + self.default_theme = self.theme_manager.getThemeData(theme) + self.renderer.set_theme(self.default_theme) + + self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1), + QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start)) + def set_theme(self, theme): + log.debug("theme set to %s", theme) self.theme = theme if theme.font_main_override == False: pass if theme.font_footer_override == False: pass - def generate_preview(self): self.calculate_default(QtCore.QSize(800,600)) - frame = QtGui.QPixmap(self.width, self.height) - renderer=Renderer(None) - renderer.set_paint_dest(frame) - - renderer.set_theme(self.theme) - renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1), + self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1), QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start)) + frame = QtGui.QPixmap(self.width, self.height) + self.renderer.set_paint_dest(frame) + lines=[] lines.append(u'Amazing Grace!') lines.append(u'How sweet the sound') @@ -69,13 +78,34 @@ class RenderManager: lines1=[] lines1.append(u'Amazing Grace (John Newton)' ) lines1.append(u'CCLI xxx (c)Openlp.org') - answer=renderer.render_lines(lines, lines1) + answer=self.renderer.render_lines(lines, lines1) return frame - def generate_bible(self): - pass + def format_slide(self, words, footer): + self.calculate_default(QtCore.QSize(800,600)) + + self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1), + QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start)) + + return self.renderer.format_slide(words, footer) + + def generate_slide(self,main_text, footer_text, preview=True): + if preview == True: + self.calculate_default(QtCore.QSize(800,600)) + + self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1), + QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start)) + + #frame = QtGui.QPixmap(self.width, self.height) + #self.renderer.set_paint_dest(frame) + print main_text + answer=self.renderer.render_lines(main_text, footer_text) + return self.frame def calculate_default(self, screen): self.width = screen.width() self.height = screen.height() self.footer_start = int(self.height*0.95) # 95% is start of footer + #update the rederer frame + self.frame = QtGui.QPixmap(self.width, self.height) + self.renderer.set_paint_dest(self.frame) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index ec5dce759..fce956780 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -44,7 +44,6 @@ class MainWindow(object): self.alert_form = AlertForm() self.about_form = AboutForm() self.settings_form = SettingsForm(self.screen_list) - self.RenderManager = RenderManager(self.screen_list) pluginpath = os.path.split(os.path.abspath(__file__))[0] pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins')) @@ -53,6 +52,11 @@ class MainWindow(object): self.setupUi() + #warning cyclic dependency + #RenderManager needs to call ThemeManager and + #ThemeManager needs to call RenderManager + self.RenderManager = RenderManager(self.ThemeManagerContents, self.screen_list) + log.info(u'Load Plugins') self.plugin_helpers[u'preview'] = self.PreviewController self.plugin_helpers[u'live'] = self.LiveController @@ -87,6 +91,7 @@ class MainWindow(object): log.info(u'Load Themes') self.ThemeManagerContents.setEventManager(self.EventManager) self.ThemeManagerContents.setRenderManager(self.RenderManager) + self.ServiceManagerContents.setRenderManager(self.RenderManager) self.ThemeManagerContents.setServiceManager(self.ServiceManagerContents) self.ThemeManagerContents.loadThemes() diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 1df8f163d..81c272d17 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -29,6 +29,7 @@ from PyQt4.QtGui import * # from openlp.core.ui import AboutForm, AlertForm, SettingsForm, SlideController from openlp.core.lib import OpenLPToolbar from openlp.core.lib import ServiceItem +from openlp.core.lib import RenderManager # from openlp.core import PluginManager import logging @@ -138,6 +139,14 @@ class ServiceManager(QWidget): self.service_data=ServiceData() self.TreeView.setModel(self.service_data) self.Layout.addWidget(self.TreeView) + QtCore.QObject.connect(self.ThemeComboBox, + QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected) + + def setRenderManager(self, renderManager): + self.renderManager = renderManager + + def onThemeComboBoxSelected(self, currentIndex): + self.renderManager.set_default_theme(self.ThemeComboBox.currentText()) def addServiceItem(self, item): """Adds service item""" @@ -191,3 +200,5 @@ class ServiceManager(QWidget): self.ThemeComboBox.clear() for theme in theme_list: self.ThemeComboBox.addItem(theme) + self.renderManager.set_default_theme(self.ThemeComboBox.currentText()) + diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 1f11dcf08..08593fe07 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -3,7 +3,7 @@ """ OpenLP - Open Source Lyrics Projection Copyright (c) 2008 Raoul Snyman -Portions copyright (c) 2008 Martin Thompson, Tim Bentley, +Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -27,7 +27,7 @@ class SlideController(QtGui.QWidget): self.Pane = QtGui.QWidget(control_splitter) self.Splitter = QtGui.QSplitter(self.Pane) self.Splitter.setOrientation(QtCore.Qt.Vertical) - + self.PaneLayout = QtGui.QVBoxLayout(self.Pane) self.PaneLayout.addWidget(self.Splitter) self.PaneLayout.setSpacing(50) @@ -41,6 +41,23 @@ class SlideController(QtGui.QWidget): self.Controller.setGeometry(QtCore.QRect(0, 0, 828, 536)) self.Controller.setWidget(self.ControllerContents) - self.Screen = QtGui.QGraphicsView(self.Splitter) - self.Screen.setMaximumSize(QtCore.QSize(16777215, 250)) + #self.Screen = QtGui.QGraphicsView(self.Splitter) + #self.Screen.setMaximumSize(QtCore.QSize(16777215, 250)) + + self.ThemePreview = QtGui.QLabel(self.Splitter) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.ThemePreview.sizePolicy().hasHeightForWidth()) + self.ThemePreview.setSizePolicy(sizePolicy) + self.ThemePreview.setMinimumSize(QtCore.QSize(250, 190)) + self.ThemePreview.setFrameShape(QtGui.QFrame.WinPanel) + self.ThemePreview.setFrameShadow(QtGui.QFrame.Sunken) + self.ThemePreview.setLineWidth(1) + self.ThemePreview.setScaledContents(True) + self.ThemePreview.setObjectName("ThemePreview") + + + def previewFrame(self, frame): + self.ThemePreview.setPixmap(frame) diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index f045a4183..7d4fea3d5 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -20,12 +20,15 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtCore, QtGui -from openlp.core.resources import * +#from openlp.core.resources import * +from openlp.core import translate class SplashScreen(object): - def __init__(self): + def __init__(self, version): self.splash_screen = QtGui.QSplashScreen() self.setupUi() + starting = translate('SplashScreen',u'Starting') + self.message=starting+u'..... '+version def setupUi(self): self.splash_screen.setObjectName("splash_screen") @@ -60,7 +63,7 @@ class SplashScreen(object): def show(self): self.splash_screen.show() - self.splash_screen.showMessage(u'Starting...', QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom, QtCore.Qt.black) + self.splash_screen.showMessage(self.message, QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom, QtCore.Qt.black) self.splash_screen.repaint() def finish(self, widget): diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 406097d8f..01ddf0492 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -33,6 +33,7 @@ from PyQt4.QtGui import * from openlp.core.ui import AmendThemeForm from openlp.core.ui import ServiceManager from openlp.core import translate +from openlp.core import fileToXML from openlp.core.theme import Theme from openlp.core.lib import Event from openlp.core.lib import EventType @@ -248,6 +249,13 @@ class ThemeManager(QWidget): def getThemes(self): return self.Theme_data.getList() + def getThemeData(self, themename): + xml_file = os.path.join(self.path, str(themename), str(themename)+u'.xml') + xml = fileToXML(xml_file) + theme = ThemeXML() + theme.parse(xml) + return theme + def checkThemesExists(self, dir): log.debug(u'check themes') if os.path.exists(dir) == False: diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index a51969ce9..e6fc55ee4 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -48,19 +48,19 @@ class BibleMediaItem(MediaManagerItem): # Create buttons for the toolbar ## New Bible Button ## self.addToolbarButton( - translate(u'BibleMediaItem','New Bible'), + translate(u'BibleMediaItem','New Bible'), translate(u'BibleMediaItem','Register a new Bible'), ':/themes/theme_import.png', self.onBibleNewClick, 'BibleNewItem') ## Separator Line ## self.addToolbarSeparator() ## Preview Bible Button ## self.addToolbarButton( - translate(u'BibleMediaItem','Preview Bible'), + translate(u'BibleMediaItem','Preview Bible'), translate(u'BibleMediaItem','Preview the selected Bible Verse'), ':/system/system_preview.png', self.onBiblePreviewClick, 'BiblePreviewItem') ## Live Bible Button ## self.addToolbarButton( - translate(u'BibleMediaItem','Go Live'), + translate(u'BibleMediaItem','Go Live'), translate(u'BibleMediaItem','Send the selected Bible Verse(s) live'), ':/system/system_live.png', self.onBibleLiveClick, 'BibleLiveItem') ## Add Bible Button ## @@ -183,9 +183,10 @@ class BibleMediaItem(MediaManagerItem): self.BibleListView.setAlternatingRowColors(True) self.BibleListData = TextListData() self.BibleListView.setModel(self.BibleListData) - + self.BibleListView.setSelectionMode(2) + self.PageLayout.addWidget(self.BibleListView) - + # Combo Boxes QtCore.QObject.connect(self.AdvancedVersionComboBox, QtCore.SIGNAL("activated(int)"), self.onAdvancedVersionComboBox) @@ -215,7 +216,7 @@ class BibleMediaItem(MediaManagerItem): translate(u'BibleMediaItem',u'&Add to Service'), self.onBibleAddClick)) def retranslateUi(self): - log.debug(u'retranslateUi') + log.debug(u'retranslateUi') self.QuickVersionLabel.setText(translate(u'BibleMediaItem', u'Version:')) self.QuickSearchLabel.setText(translate(u'BibleMediaItem', u'Search Type:')) self.QuickSearchLabel.setText(translate(u'BibleMediaItem', u'Find:')) @@ -241,15 +242,15 @@ class BibleMediaItem(MediaManagerItem): self.loadBibles() def loadBibles(self): - log.debug(u'Loading Bibles') + log.debug(u'Loading Bibles') self.QuickVersionComboBox.clear() self.AdvancedVersionComboBox.clear() - + bibles = self.parent.biblemanager.get_bibles(u'full') - + for bible in bibles: # load bibles into the combo boxes self.QuickVersionComboBox.addItem(bible) - + bibles = self.parent.biblemanager.get_bibles(u'partial') # Without HTTP first = True for bible in bibles: # load bibles into the combo boxes @@ -328,6 +329,8 @@ class BibleMediaItem(MediaManagerItem): log.debug(u'Bible Preview Button pressed') items = self.BibleListView.selectedIndexes() old_chapter = '' + main_lines=[] + footer_lines = [] for item in items: text = self.BibleListData.getValue(item) verse = text[:text.find("(")] @@ -348,16 +351,19 @@ class BibleMediaItem(MediaManagerItem): else: loc = self.formatVerse(old_chapter, chapter, verse, u'', u'') old_chapter = chapter - print book - print loc - print text + main_lines.append(loc + u' '+text) + if len(footer_lines) <= 1: + footer_lines.append(book) + + frame=self.parent.render_manager.generate_slide(main_lines, footer_lines) + self.parent.preview_controller.previewFrame(frame) def formatVerse(self, old_chapter, chapter, verse, opening, closing): loc = opening if old_chapter != chapter: loc += chapter + u':' - elif not self.parent.bibles_tab.new_chapter_check: - loc += chapter + u':' + elif not self.parent.bibles_tab.show_new_chapters: + loc += chapter + u':' loc += verse loc += closing return loc diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 2f80ea42f..2ca7314eb 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -23,7 +23,7 @@ from PyQt4 import QtCore, QtGui from openlp.core import translate from openlp.core.lib import MediaManagerItem -from openlp.core.resources import * +from openlp.core.lib import SongXMLParser from openlp.plugins.custom.lib import TextListData @@ -44,7 +44,7 @@ class CustomMediaItem(MediaManagerItem): # Create buttons for the toolbar ## New Custom Button ## self.addToolbarButton( - translate('CustomMediaItem',u'New Custom Item'), + translate('CustomMediaItem',u'New Custom Item'), translate('CustomMediaItem',u'Add a new Custom Item'), ':/custom/custom_new.png', self.onCustomNewClick, 'CustomNewItem') ## Edit Custom Button ## @@ -72,7 +72,7 @@ class CustomMediaItem(MediaManagerItem): ## Add Custom Button ## self.addToolbarButton( translate('CustomMediaItem',u'Add Custom To Service'), - translate('CustomMediaItem',u'Add the selected Custom(s) to the service'), + translate('CustomMediaItem',u'Add the selected Custom(s) to the service'), ':/system/system_add.png', self.onCustomAddClick, 'CustomAddItem') # Add the Customlist widget self.CustomWidget = QtGui.QWidget(self) @@ -82,7 +82,7 @@ class CustomMediaItem(MediaManagerItem): sizePolicy.setHeightForWidth(self.CustomWidget.sizePolicy().hasHeightForWidth()) self.CustomWidget.setSizePolicy(sizePolicy) self.CustomWidget.setObjectName(u'CustomWidget') - + # self.SearchLayout = QtGui.QGridLayout(self.CustomWidget) # self.SearchLayout.setObjectName('SearchLayout') # self.SearchTextLabel = QtGui.QLabel(self.CustomWidget) @@ -92,7 +92,7 @@ class CustomMediaItem(MediaManagerItem): # self.SearchTextEdit = QtGui.QLineEdit(self.CustomWidget) # self.SearchTextEdit.setObjectName('SearchTextEdit') # self.SearchLayout.addWidget(self.SearchTextEdit, 2, 1, 1, 2) -# +# # self.ClearTextButton = QtGui.QPushButton(self.CustomWidget) # self.ClearTextButton.setObjectName('ClearTextButton') # @@ -102,22 +102,22 @@ class CustomMediaItem(MediaManagerItem): # self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1) # Add the Custom widget to the page layout self.PageLayout.addWidget(self.CustomWidget) - + self.CustomListView = QtGui.QListView() self.CustomListView.setAlternatingRowColors(True) self.CustomListData = TextListData() self.CustomListView.setModel(self.CustomListData) - + self.PageLayout.addWidget(self.CustomListView) # Signals -# QtCore.QObject.connect(self.SearchTextButton, +# QtCore.QObject.connect(self.SearchTextButton, # QtCore.SIGNAL("pressed()"), self.onSearchTextButtonClick) -# QtCore.QObject.connect(self.ClearTextButton, +# QtCore.QObject.connect(self.ClearTextButton, # QtCore.SIGNAL("pressed()"), self.onClearTextButtonClick) -# QtCore.QObject.connect(self.SearchTextEdit, +# QtCore.QObject.connect(self.SearchTextEdit, # QtCore.SIGNAL("textChanged(const QString&)"), self.onSearchTextEditChanged) -# QtCore.QObject.connect(self.CustomListView, +# QtCore.QObject.connect(self.CustomListView, # QtCore.SIGNAL("itemPressed(QTableWidgetItem * item)"), self.onCustomSelected) #define and add the context menu @@ -135,14 +135,14 @@ class CustomMediaItem(MediaManagerItem): self.CustomListView.addAction(self.contextMenuAction( self.CustomListView, ':/system/system_add.png', translate('CustomMediaItem',u'&Add to Service'), self.onCustomEditClick)) - + # def retranslateUi(self): # self.ClearTextButton.setText(translate('CustomMediaItem', u'Clear')) -# self.SearchTextButton.setText(translate('CustomMediaItem', u'Search')) - +# self.SearchTextButton.setText(translate('CustomMediaItem', u'Search')) + def initialise(self): self.loadCustomList(self.parent.custommanager.get_all_slides()) - + def loadCustomList(self, list): self.CustomListData.resetStore() for CustomSlide in list: @@ -166,9 +166,9 @@ class CustomMediaItem(MediaManagerItem): self._display_results(search_results) def onCustomNewClick(self): - self.parent.edit_custom_form.loadCustom(0) + self.parent.edit_custom_form.loadCustom(0) self.parent.edit_custom_form.exec_() - self.initialise() + self.initialise() def onCustomEditClick(self): indexes = self.CustomListView.selectedIndexes() @@ -185,7 +185,25 @@ class CustomMediaItem(MediaManagerItem): self.CustomListData.deleteRow(index) def onCustomPreviewClick(self): - pass + indexes = self.CustomListView.selectedIndexes() + main_lines=[] + footer_lines = [] + slide = None + for index in indexes: + id = self.CustomListData.getId(index) + customSlide = self.parent.custommanager.get_custom(id) + title = customSlide.title + credit = customSlide.title + + songXML=SongXMLParser(customSlide.text) + verseList = songXML.get_verses() + for verse in verseList: + slide = self.parent.render_manager.format_slide(verse[1], False) + + footer_lines.append(title + u' '+ credit) + + frame=self.parent.render_manager.generate_slide(slide, footer_lines) + self.parent.preview_controller.previewFrame(frame) def onCustomLiveClick(self): pass diff --git a/openlp/plugins/videos/lib/filelistdata.py b/openlp/plugins/videos/lib/filelistdata.py index 303ccb802..df4a5eb69 100644 --- a/openlp/plugins/videos/lib/filelistdata.py +++ b/openlp/plugins/videos/lib/filelistdata.py @@ -80,3 +80,7 @@ class FileListData(QAbstractListModel): def getFilename(self, index): row = index.row() return self.items[row][0] + + def getValue(self, index): + row = index.row() + return self.items[row][0] diff --git a/openlp/plugins/videos/lib/mediaitem.py b/openlp/plugins/videos/lib/mediaitem.py index 07b29ec38..54d9114ae 100644 --- a/openlp/plugins/videos/lib/mediaitem.py +++ b/openlp/plugins/videos/lib/mediaitem.py @@ -24,7 +24,6 @@ from PyQt4 import QtCore, QtGui from openlp.core import translate from openlp.core.lib import MediaManagerItem -from openlp.core.resources import * from openlp.plugins.videos.lib import VideoTab from openlp.plugins.videos.lib import FileListData @@ -40,93 +39,97 @@ class VideoMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): MediaManagerItem.__init__(self, parent, icon, title) - def setupUi(self): + def setupUi(self): # Add a toolbar self.addToolbar() # Create buttons for the toolbar ## New Video Button ## self.addToolbarButton( - translate('VideoMediaItem',u'New Video'), + translate('VideoMediaItem',u'New Video'), translate('VideoMediaItem',u'Load videos into openlp.org'), ':/videos/video_load.png', self.onVideoNewClick, 'VideoNewItem') ## Delete Video Button ## self.addToolbarButton( - translate('VideoMediaItem',u'Delete Video'), + translate('VideoMediaItem',u'Delete Video'), translate('VideoMediaItem',u'Delete the selected video'), ':/videos/video_delete.png', self.onVideoDeleteClick, 'VideoDeleteItem') ## Separator Line ## self.addToolbarSeparator() ## Preview Video Button ## self.addToolbarButton( - translate('VideoMediaItem',u'Preview Video'), + translate('VideoMediaItem',u'Preview Video'), translate('VideoMediaItem',u'Preview the selected video'), ':/system/system_preview.png', self.onVideoPreviewClick, 'VideoPreviewItem') ## Live Video Button ## self.addToolbarButton( - translate('VideoMediaItem',u'Go Live'), + translate('VideoMediaItem',u'Go Live'), translate('VideoMediaItem',u'Send the selected video live'), ':/system/system_live.png', self.onVideoLiveClick, 'VideoLiveItem') ## Add Video Button ## self.addToolbarButton( translate('VideoMediaItem',u'Add Video To Service'), - translate('VideoMediaItem',u'Add the selected video(s) to the service'), + translate('VideoMediaItem',u'Add the selected video(s) to the service'), ':/system/system_add.png',self.onVideoAddClick, 'VideoAddItem') ## Add the videolist widget ## - + self.VideoListView = QtGui.QListView() self.VideoListView.setAlternatingRowColors(True) self.VideoListData = FileListData() self.VideoListView.setModel(self.VideoListData) - + self.PageLayout.addWidget(self.VideoListView) - + #define and add the context menu self.VideoListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.VideoListView.addAction(self.contextMenuAction( - self.VideoListView, ':/system/system_preview.png', + self.VideoListView, ':/system/system_preview.png', translate('VideoMediaItem',u'&Preview Video'), self.onVideoPreviewClick)) self.VideoListView.addAction(self.contextMenuAction( - self.VideoListView, ':/system/system_live.png', + self.VideoListView, ':/system/system_live.png', translate('VideoMediaItem',u'&Show Live'), self.onVideoLiveClick)) self.VideoListView.addAction(self.contextMenuAction( - self.VideoListView, ':/system/system_add.png', + self.VideoListView, ':/system/system_add.png', translate('VideoMediaItem',u'&Add to Service'), self.onVideoAddClick)) - + def initialise(self): list = self.parent.config.load_list(u'videos') self.loadVideoList(list) def onVideoNewClick(self): - files = QtGui.QFileDialog.getOpenFileNames(None, - translate('VideoMediaItem', u'Select Video(s)'), + files = QtGui.QFileDialog.getOpenFileNames(None, + translate('VideoMediaItem', u'Select Video(s)'), self.parent.config.get_last_dir(), u'Images (*.avi *.mpeg)') if len(files) > 0: self.loadVideoList(files) dir, filename = os.path.split(str(files[0])) self.parent.config.set_last_dir(dir) self.parent.config.set_list(u'videos', self.VideoListData.getFileList()) - + def getFileList(self): filelist = [item[0] for item in self.VideoListView]; - return filelist + return filelist def loadVideoList(self, list): for files in list: self.VideoListData.addRow(files) - + def onVideoDeleteClick(self): indexes = self.VideoListView.selectedIndexes() for index in indexes: current_row = int(index.row()) self.VideoListData.removeRow(current_row) - self.parent.config.set_list(u'videos', self.VideoListData.getFileList()) + self.parent.config.set_list(u'videos', self.VideoListData.getFileList()) def onVideoPreviewClick(self): - pass + log.debug(u'Video Preview Button pressed') + items = self.VideoListView.selectedIndexes() + for item in items: + text = self.VideoListData.getValue(item) + print text def onVideoLiveClick(self): pass def onVideoAddClick(self): - pass + pass From 0facad72d64cf67ccdd8db0c6fad132b70057b3d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 25 Apr 2009 07:38:21 +0100 Subject: [PATCH 17/17] Remove Print statement Fix missing Theme bug --- openlp/core/lib/rendermanager.py | 6 +++++- openlp/core/ui/thememanager.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index 8df35337e..9781cf241 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -55,6 +55,10 @@ class RenderManager: def set_theme(self, theme): log.debug("theme set to %s", theme) self.theme = theme + self.renderer.set_theme(self.theme) + + self.renderer.set_text_rectangle(QtCore.QRect(10,0, self.width-1, self.height-1), + QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start)) if theme.font_main_override == False: pass if theme.font_footer_override == False: @@ -98,7 +102,7 @@ class RenderManager: #frame = QtGui.QPixmap(self.width, self.height) #self.renderer.set_paint_dest(frame) - print main_text + #print main_text answer=self.renderer.render_lines(main_text, footer_text) return self.frame diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 01ddf0492..a40fc8af1 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -349,7 +349,7 @@ class ThemeManager(QWidget): self.loadThemes() def generateAndSaveImage(self, dir, name, theme_xml): - log.debug(u'generateImage %s %s %s', dir, name, theme_xml) + log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml) theme = ThemeXML() theme.parse(theme_xml)