diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index b6946a628..956b6c787 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -38,48 +38,51 @@ log = logging.getLogger(__name__) # TODO make external and configurable in alpha 4 via a settings dialog html_expands = [] -html_expands.append({u'desc':u'Red', u'start tag':u'{r}', - u'start html':u'', - u'end tag':u'{/r}', u'end html':u'', u'protected':False}) -html_expands.append({u'desc':u'Black', u'start tag':u'{b}', - u'start html':u'', - u'end tag':u'{/b}', u'end html':u'', u'protected':False}) -html_expands.append({u'desc':u'Blue', u'start tag':u'{bl}', - u'start html':u'', - u'end tag':u'{/bl}', u'end html':u'', u'protected':False}) -html_expands.append({u'desc':u'Yellow', u'start tag':u'{y}', - u'start html':u'', - u'end tag':u'{/y}', u'end html':u'', u'protected':False}) -html_expands.append({u'desc':u'Green', u'start tag':u'{g}', - u'start html':u'', - u'end tag':u'{/g}', u'end html':u'', u'protected':False}) -html_expands.append({u'desc':u'Pink', u'start tag':u'{pk}', - u'start html':u'', - u'end tag':u'{/pk}', u'end html':u'', u'protected':False}) -html_expands.append({u'desc':u'Orange', u'start tag':u'{o}', - u'start html':u'', - u'end tag':u'{/o}', u'end html':u'', u'protected':False}) -html_expands.append({u'desc':u'Purple', u'start tag':u'{pp}', - u'start html':u'', - u'end tag':u'{/pp}', u'end html':u'', u'protected':False}) -html_expands.append({u'desc':u'White', u'start tag':u'{w}', - u'start html':u'', - u'end tag':u'{/w}', u'end html':u'', u'protected':False}) -html_expands.append({u'desc':u'Superscript', u'start tag':u'{su}', - u'start html':u'', u'end tag':u'{/su}', u'end html':u'', - u'protected':True}) -html_expands.append({u'desc':u'Subscript', u'start tag':u'{sb}', - u'start html':u'', u'end tag':u'{/sb}', u'end html':u'', - u'protected':True}) -html_expands.append({u'desc':u'Paragraph', u'start tag':u'{p}', - u'start html':u'

', u'end tag':u'{/p}', u'end html':u'

', - u'protected':True}) -html_expands.append({u'desc':u'Bold', u'start tag':u'{st}', - u'start html':u'', u'end tag':u'{/st}', u'end html':u'', - u'protected':True}) -html_expands.append({u'desc':u'Italics', u'start tag':u'{it}', - u'start html':u'', u'end tag':u'{/it}', u'end html':u'', - u'protected':True}) +html_expands.append({u'desc': u'Red', u'start tag': u'{r}', + u'start html': u'', + u'end tag': u'{/r}', u'end html': u'', u'protected': False}) +html_expands.append({u'desc': u'Black', u'start tag': u'{b}', + u'start html': u'', + u'end tag': u'{/b}', u'end html': u'', u'protected': False}) +html_expands.append({u'desc': u'Blue', u'start tag': u'{bl}', + u'start html': u'', + u'end tag': u'{/bl}', u'end html': u'', u'protected': False}) +html_expands.append({u'desc': u'Yellow', u'start tag': u'{y}', + u'start html': u'', + u'end tag': u'{/y}', u'end html': u'', u'protected': False}) +html_expands.append({u'desc': u'Green', u'start tag': u'{g}', + u'start html': u'', + u'end tag': u'{/g}', u'end html': u'', u'protected': False}) +html_expands.append({u'desc': u'Pink', u'start tag': u'{pk}', + u'start html': u'', + u'end tag': u'{/pk}', u'end html': u'', u'protected': False}) +html_expands.append({u'desc': u'Orange', u'start tag': u'{o}', + u'start html': u'', + u'end tag': u'{/o}', u'end html': u'', u'protected': False}) +html_expands.append({u'desc': u'Purple', u'start tag': u'{pp}', + u'start html': u'', + u'end tag': u'{/pp}', u'end html': u'', u'protected': False}) +html_expands.append({u'desc': u'White', u'start tag': u'{w}', + u'start html': u'', + u'end tag': u'{/w}', u'end html': u'', u'protected': False}) +html_expands.append({u'desc': u'Superscript', u'start tag': u'{su}', + u'start html': u'', u'end tag': u'{/su}', u'end html': u'', + u'protected': True}) +html_expands.append({u'desc': u'Subscript', u'start tag': u'{sb}', + u'start html': u'', u'end tag': u'{/sb}', u'end html': u'', + u'protected': True}) +html_expands.append({u'desc': u'Paragraph', u'start tag': u'{p}', + u'start html': u'

', u'end tag': u'{/p}', u'end html': u'

', + u'protected': True}) +html_expands.append({u'desc': u'Bold', u'start tag': u'{st}', + u'start html': u'', u'end tag': u'{/st}', u'end html': u'', + u'protected': True}) +html_expands.append({u'desc': u'Italics', u'start tag': u'{it}', + u'start html': u'', u'end tag': u'{/it}', u'end html': u'', + u'protected': True}) +html_expands.append({u'desc': u'Underline', u'start tag': u'{u}', + u'start html': u'', + u'end tag': u'{/u}', u'end html': u'', u'protected': True}) def translate(context, text, comment=None): """ @@ -303,8 +306,8 @@ def expand_tags(text): text = text.replace(tag[u'end tag'], tag[u'end html']) return text -from theme import ThemeLevel, ThemeXML, BackgroundGradientType, BackgroundType, \ - HorizontalType, VerticalType +from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \ + BackgroundType, HorizontalType, VerticalType from spelltextedit import SpellTextEdit from eventreceiver import Receiver from imagemanager import ImageManager diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index b2f46e655..9bbaa65d1 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -371,7 +371,8 @@ def build_background_css(item, width, height): theme = item.themedata background = u'background-color: black' if theme: - if theme.background_type == BackgroundType.to_string(BackgroundType.Solid): + if theme.background_type == \ + BackgroundType.to_string(BackgroundType.Solid): background = u'background-color: %s' % theme.background_color else: if theme.background_direction == BackgroundGradientType.to_string \ @@ -381,21 +382,24 @@ def build_background_css(item, width, height): u'-webkit-gradient(linear, left top, left bottom, ' \ 'from(%s), to(%s))' % (theme.background_start_color, theme.background_end_color) - elif theme.background_direction == BackgroundGradientType.to_string \ - (BackgroundGradientType.LeftTop): + elif theme.background_direction == \ + BackgroundGradientType.to_string( \ + BackgroundGradientType.LeftTop): background = \ u'background: ' \ u'-webkit-gradient(linear, left top, right bottom, ' \ 'from(%s), to(%s))' % (theme.background_start_color, theme.background_end_color) - elif theme.background_direction == BackgroundGradientType.to_string \ + elif theme.background_direction == \ + BackgroundGradientType.to_string \ (BackgroundGradientType.LeftBottom): background = \ u'background: ' \ u'-webkit-gradient(linear, left bottom, right top, ' \ 'from(%s), to(%s))' % (theme.background_start_color, theme.background_end_color) - elif theme.background_direction == BackgroundGradientType.to_string \ + elif theme.background_direction == \ + BackgroundGradientType.to_string \ (BackgroundGradientType.Vertical): background = \ u'background: -webkit-gradient(linear, left top, ' \ diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 0e0660bda..307ee84df 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -46,13 +46,13 @@ class ImageThread(QtCore.QThread): """ def __init__(self, manager): QtCore.QThread.__init__(self, None) - self.image_mamager = manager + self.imageManager = manager def run(self): """ Run the thread. """ - self.image_mamager.process() + self.imageManager.process() class Image(object): diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 130da0c0e..acf24ae22 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -508,7 +508,7 @@ class MediaManagerItem(QtGui.QWidget): log.debug(self.plugin.name + u' Add requested') serviceItem = self.parent.serviceManager.getServiceItem() if not serviceItem: - QtGui.QMessageBox.information(self, + QtGui.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'No Service Item Selected'), translate('OpenLP.MediaManagerItem', diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 8de42e7a0..048751006 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -87,8 +87,12 @@ class SettingsTab(QtGui.QWidget): """ pass - def postSetUp(self): + def postSetUp(self, postUpdate=False): """ Changes which need to be made after setup of application + + ``postUpdate`` + Indicates if called before or after updates. + """ pass diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index 603197c07..76271b6a7 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -33,12 +33,15 @@ except ImportError: enchant_available = False # based on code from -# http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/ +# http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check from PyQt4 import QtCore, QtGui from openlp.core.lib import html_expands, translate class SpellTextEdit(QtGui.QPlainTextEdit): + """ + Spell checking widget based on QPlanTextEdit. + """ def __init__(self, *args): QtGui.QPlainTextEdit.__init__(self, *args) # Default dictionary based on the current locale. @@ -60,7 +63,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit): QtGui.QPlainTextEdit.mousePressEvent(self, event) def contextMenuEvent(self, event): - popup_menu = self.createStandardContextMenu() + popupMenu = self.createStandardContextMenu() # Select the word under the cursor. cursor = self.textCursor() # only select text if not already selected @@ -81,17 +84,17 @@ class SpellTextEdit(QtGui.QPlainTextEdit): # Only add the spelling suggests to the menu if there are # suggestions. if len(spell_menu.actions()) != 0: - popup_menu.insertSeparator(popup_menu.actions()[0]) - popup_menu.insertMenu(popup_menu.actions()[0], spell_menu) - tag_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', + popupMenu.insertSeparator(popupMenu.actions()[0]) + popupMenu.insertMenu(popupMenu.actions()[0], spell_menu) + tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags')) for html in html_expands: - action = SpellAction( html[u'desc'], tag_menu) + action = SpellAction( html[u'desc'], tagMenu) action.correct.connect(self.htmlTag) - tag_menu.addAction(action) - popup_menu.insertSeparator(popup_menu.actions()[0]) - popup_menu.insertMenu(popup_menu.actions()[0], tag_menu) - popup_menu.exec_(event.globalPos()) + tagMenu.addAction(action) + popupMenu.insertSeparator(popupMenu.actions()[0]) + popupMenu.insertMenu(popupMenu.actions()[0], tagMenu) + popupMenu.exec_(event.globalPos()) def correctWord(self, word): """ diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index f211048e3..130eb817d 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -31,7 +31,6 @@ import re import logging from xml.dom.minidom import Document -from xml.etree.ElementTree import ElementTree, XML from lxml import etree, objectify from openlp.core.lib import str_to_bool @@ -56,7 +55,7 @@ BLANK_THEME_XML = \ Arial #FFFFFF - 30 + 40 False False 0 @@ -261,8 +260,9 @@ class ThemeXML(object): def add_font(self, name, color, size, override, fonttype=u'main', bold=u'False', italics=u'False', line_adjustment=0, - xpos=0, ypos=0, width=0, height=0 , outline=u'False', outline_color=u'#ffffff', - outline_pixel=2, shadow=u'False', shadow_color=u'#ffffff', shadow_pixel=5): + xpos=0, ypos=0, width=0, height=0 , outline=u'False', + outline_color=u'#ffffff', outline_pixel=2, shadow=u'False', + shadow_color=u'#ffffff', shadow_pixel=5): """ Add a Font. @@ -317,7 +317,6 @@ class ThemeXML(object): ``shadow_size`` How big the Shadow is - """ background = self.theme_xml.createElement(u'font') background.setAttribute(u'type', fonttype) @@ -325,7 +324,7 @@ class ThemeXML(object): # Create Font name element self.child_element(background, u'name', name) # Create Font color element - self.child_element(background, u'color', color) + self.child_element(background, u'color', unicode(color)) # Create Proportion name element self.child_element(background, u'size', unicode(size)) # Create weight name element @@ -441,7 +440,7 @@ class ThemeXML(object): if line: xml = xml[line + 2:] try: - theme_xml = objectify.fromstring(xml) + theme_xml = objectify.fromstring(xml) except etree.XMLSyntaxError: log.exception(u'Invalid xml %s', xml) return @@ -457,7 +456,8 @@ class ThemeXML(object): if element.getparent().tag == u'display': if element.tag.startswith(u'shadow') or \ element.tag.startswith(u'outline'): - self._create_attr(u'font_main', element.tag, element.text) + self._create_attr(u'font_main', element.tag, + element.text) master = element.getparent().tag if element.getparent().tag == u'background': master = element.getparent().tag @@ -471,7 +471,8 @@ class ThemeXML(object): for attr in element.attrib: base_element = attr # correction for the shadow and outline tags - if element.tag == u'shadow' or element.tag == u'outline': + if element.tag == u'shadow' or \ + element.tag == u'outline': if not attr.startswith(element.tag): base_element = element.tag + u'_' + attr self._create_attr(master, base_element, @@ -540,8 +541,8 @@ class ThemeXML(object): """ Change Camel Case string to python string """ - s1 = re.sub(u'(.)([A-Z][a-z]+)', r'\1_\2', name) - return re.sub(u'([a-z0-9])([A-Z])', r'\1_\2', s1).lower() + sub_name = re.sub(u'(.)([A-Z][a-z]+)', r'\1_\2', name) + return re.sub(u'([a-z0-9])([A-Z])', r'\1_\2', sub_name).lower() def _build_xml_from_attrs(self): """ diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index a390780ca..df3add595 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -82,7 +82,8 @@ class AdvancedTab(SettingsTab): self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox') self.uiLayout.addWidget(self.doubleClickLiveCheckBox) # self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox) -# self.expandServiceItemCheckBox.setObjectName(u'expandServiceItemCheckBox') +# self.expandServiceItemCheckBox.setObjectName( +# u'expandServiceItemCheckBox') # self.uiLayout.addWidget(self.expandServiceItemCheckBox) self.leftLayout.addWidget(self.uiGroupBox) self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox) diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py deleted file mode 100644 index b77c9cfff..000000000 --- a/openlp/core/ui/amendthemedialog.py +++ /dev/null @@ -1,799 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # -# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # -# Carsten Tinggaard, Frode Woldsund # -# --------------------------------------------------------------------------- # -# 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 # -############################################################################### - -from PyQt4 import QtCore, QtGui - -from openlp.core.lib import build_icon, translate - -class Ui_AmendThemeDialog(object): - def setupUi(self, amendThemeDialog): - amendThemeDialog.setObjectName(u'amendThemeDialog') - amendThemeDialog.setWindowModality(QtCore.Qt.ApplicationModal) - amendThemeDialog.resize(586, 651) - icon = build_icon(u':/icon/openlp-logo-16x16.png') - amendThemeDialog.setWindowIcon(icon) - amendThemeDialog.setModal(True) - self.amendThemeLayout = QtGui.QVBoxLayout(amendThemeDialog) - self.amendThemeLayout.setSpacing(8) - self.amendThemeLayout.setMargin(8) - self.amendThemeLayout.setObjectName(u'amendThemeLayout') - self.themeNameWidget = QtGui.QWidget(amendThemeDialog) - self.themeNameWidget.setObjectName(u'themeNameWidget') - self.themeNameLayout = QtGui.QHBoxLayout(self.themeNameWidget) - self.themeNameLayout.setSpacing(8) - self.themeNameLayout.setMargin(0) - self.themeNameLayout.setObjectName(u'themeNameLayout') - self.themeNameLabel = QtGui.QLabel(self.themeNameWidget) - self.themeNameLabel.setObjectName(u'themeNameLabel') - self.themeNameLayout.addWidget(self.themeNameLabel) - self.themeNameEdit = QtGui.QLineEdit(self.themeNameWidget) - self.themeNameEdit.setObjectName(u'themeNameEdit') - self.themeNameLabel.setBuddy(self.themeNameEdit) - self.themeNameLayout.addWidget(self.themeNameEdit) - self.amendThemeLayout.addWidget(self.themeNameWidget) - self.contentWidget = QtGui.QWidget(amendThemeDialog) - self.contentWidget.setObjectName(u'contentWidget') - self.contentLayout = QtGui.QHBoxLayout(self.contentWidget) - self.contentLayout.setSpacing(8) - self.contentLayout.setMargin(0) - self.contentLayout.setObjectName(u'contentLayout') - self.themeTabWidget = QtGui.QTabWidget(self.contentWidget) - self.themeTabWidget.setObjectName(u'themeTabWidget') - self.backgroundTab = QtGui.QWidget() - self.backgroundTab.setObjectName(u'backgroundTab') - self.backgroundLayout = QtGui.QFormLayout(self.backgroundTab) - self.backgroundLayout.setMargin(8) - self.backgroundLayout.setSpacing(8) - self.backgroundLayout.setObjectName(u'backgroundLayout') - self.backgroundTypeLabel = QtGui.QLabel(self.backgroundTab) - self.backgroundTypeLabel.setObjectName(u'backgroundTypeLabel') - self.backgroundLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.backgroundTypeLabel) - self.backgroundTypeComboBox = QtGui.QComboBox(self.backgroundTab) - self.backgroundTypeComboBox.setObjectName(u'backgroundTypeComboBox') - self.backgroundTypeComboBox.addItem(QtCore.QString()) - self.backgroundTypeComboBox.addItem(QtCore.QString()) - self.backgroundTypeComboBox.addItem(QtCore.QString()) - self.backgroundLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.backgroundTypeComboBox) - self.color1Label = QtGui.QLabel(self.backgroundTab) - self.color1Label.setObjectName(u'color1Label') - self.backgroundLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.color1Label) - self.color1PushButton = QtGui.QPushButton(self.backgroundTab) - self.color1PushButton.setObjectName(u'color1PushButton') - self.backgroundLayout.setWidget(2, QtGui.QFormLayout.FieldRole, - self.color1PushButton) - self.color2Label = QtGui.QLabel(self.backgroundTab) - self.color2Label.setObjectName(u'color2Label') - self.backgroundLayout.setWidget(3, QtGui.QFormLayout.LabelRole, - self.color2Label) - self.color2PushButton = QtGui.QPushButton(self.backgroundTab) - self.color2PushButton.setObjectName(u'color2PushButton') - self.backgroundLayout.setWidget(3, QtGui.QFormLayout.FieldRole, - self.color2PushButton) - self.imageLabel = QtGui.QLabel(self.backgroundTab) - self.imageLabel.setObjectName(u'imageLabel') - self.backgroundLayout.setWidget(4, QtGui.QFormLayout.LabelRole, - self.imageLabel) - self.gradientLabel = QtGui.QLabel(self.backgroundTab) - self.gradientLabel.setObjectName(u'gradientLabel') - self.backgroundLayout.setWidget(6, QtGui.QFormLayout.LabelRole, - self.gradientLabel) - self.gradientComboBox = QtGui.QComboBox(self.backgroundTab) - self.gradientComboBox.setObjectName(u'gradientComboBox') - self.gradientComboBox.addItem(QtCore.QString()) - self.gradientComboBox.addItem(QtCore.QString()) - self.gradientComboBox.addItem(QtCore.QString()) - self.backgroundLayout.setWidget(6, QtGui.QFormLayout.FieldRole, - self.gradientComboBox) - self.imageFilenameWidget = QtGui.QWidget(self.backgroundTab) - self.imageFilenameWidget.setObjectName(u'imageFilenameWidget') - self.horizontalLayout2 = QtGui.QHBoxLayout(self.imageFilenameWidget) - self.horizontalLayout2.setSpacing(0) - self.horizontalLayout2.setMargin(0) - self.horizontalLayout2.setObjectName(u'horizontalLayout2') - self.imageLineEdit = QtGui.QLineEdit(self.imageFilenameWidget) - self.imageLineEdit.setObjectName(u'imageLineEdit') - self.horizontalLayout2.addWidget(self.imageLineEdit) - self.imageToolButton = QtGui.QToolButton(self.imageFilenameWidget) - self.imageToolButton.setIcon(build_icon(u':/general/general_open.png')) - self.imageToolButton.setObjectName(u'imageToolButton') - self.imageToolButton.setAutoRaise(True) - self.horizontalLayout2.addWidget(self.imageToolButton) - self.backgroundLayout.setWidget(4, QtGui.QFormLayout.FieldRole, - self.imageFilenameWidget) - self.themeTabWidget.addTab(self.backgroundTab, u'') - self.fontMainTab = QtGui.QWidget() - self.fontMainTab.setObjectName(u'fontMainTab') - self.fontMainLayout = QtGui.QHBoxLayout(self.fontMainTab) - self.fontMainLayout.setSpacing(8) - self.fontMainLayout.setMargin(8) - self.fontMainLayout.setObjectName(u'fontMainLayout') - self.mainLeftWidget = QtGui.QWidget(self.fontMainTab) - self.mainLeftWidget.setObjectName(u'mainLeftWidget') - self.mainLeftLayout = QtGui.QVBoxLayout(self.mainLeftWidget) - self.mainLeftLayout.setSpacing(8) - self.mainLeftLayout.setMargin(0) - self.mainLeftLayout.setObjectName(u'mainLeftLayout') - self.fontMainGroupBox = QtGui.QGroupBox(self.mainLeftWidget) - self.fontMainGroupBox.setObjectName(u'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(u'mainFontLayout') - self.fontMainlabel = QtGui.QLabel(self.fontMainGroupBox) - self.fontMainlabel.setObjectName(u'fontMainlabel') - self.mainFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.fontMainlabel) - self.fontMainComboBox = QtGui.QFontComboBox(self.fontMainGroupBox) - self.fontMainComboBox.setObjectName(u'fontMainComboBox') - self.mainFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.fontMainComboBox) - self.fontMainColorLabel = QtGui.QLabel(self.fontMainGroupBox) - self.fontMainColorLabel.setObjectName(u'fontMainColorLabel') - self.mainFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.fontMainColorLabel) - self.fontMainColorPushButton = QtGui.QPushButton(self.fontMainGroupBox) - self.fontMainColorPushButton.setObjectName(u'fontMainColorPushButton') - self.mainFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.fontMainColorPushButton) - self.fontMainSize = QtGui.QLabel(self.fontMainGroupBox) - self.fontMainSize.setObjectName(u'fontMainSize') - self.mainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.fontMainSize) - self.fontMainSizeSpinBox = QtGui.QSpinBox(self.fontMainGroupBox) - defaultSizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Fixed) - defaultSizePolicy.setHeightForWidth( - self.fontMainSizeSpinBox.sizePolicy().hasHeightForWidth()) - self.fontMainSizeSpinBox.setSizePolicy(defaultSizePolicy) - self.fontMainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) - self.fontMainSizeSpinBox.setProperty(u'value', QtCore.QVariant(16)) - self.fontMainSizeSpinBox.setMaximum(999) - self.fontMainSizeSpinBox.setObjectName(u'fontMainSizeSpinBox') - self.mainFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, - self.fontMainSizeSpinBox) - self.fontMainWeightComboBox = QtGui.QComboBox(self.fontMainGroupBox) - self.fontMainWeightComboBox.setObjectName(u'fontMainWeightComboBox') - self.fontMainWeightComboBox.addItem(QtCore.QString()) - self.fontMainWeightComboBox.addItem(QtCore.QString()) - self.fontMainWeightComboBox.addItem(QtCore.QString()) - self.fontMainWeightComboBox.addItem(QtCore.QString()) - self.mainFontLayout.setWidget(3, QtGui.QFormLayout.FieldRole, - self.fontMainWeightComboBox) - self.fontMainWeightLabel = QtGui.QLabel(self.fontMainGroupBox) - self.fontMainWeightLabel.setObjectName(u'fontMainWeightLabel') - self.mainFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, - self.fontMainWeightLabel) - self.mainLeftLayout.addWidget(self.fontMainGroupBox) - self.fontMainWrapLineAdjustmentLabel = QtGui.QLabel( - self.fontMainGroupBox) - self.fontMainWrapLineAdjustmentLabel.setObjectName( - u'fontMainWrapLineAdjustmentLabel') - self.mainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, - self.fontMainWrapLineAdjustmentLabel) - self.fontMainLineAdjustmentSpinBox = QtGui.QSpinBox( - self.fontMainGroupBox) - self.fontMainLineAdjustmentSpinBox.setObjectName( - u'fontMainLineAdjustmentSpinBox') - self.fontMainLineAdjustmentSpinBox.setMinimum(-99) - self.mainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, - self.fontMainLineAdjustmentSpinBox) - self.fontMainLinesPageLabel = QtGui.QLabel(self.fontMainGroupBox) - self.fontMainLinesPageLabel.setObjectName(u'fontMainLinesPageLabel') - self.mainFontLayout.addRow(self.fontMainLinesPageLabel) - 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(u'mainRightWidget') - self.mainRightLayout = QtGui.QVBoxLayout(self.mainRightWidget) - self.mainRightLayout.setSpacing(8) - self.mainRightLayout.setMargin(0) - self.mainRightLayout.setObjectName(u'mainRightLayout') - self.mainLocationGroupBox = QtGui.QGroupBox(self.mainRightWidget) - self.mainLocationGroupBox.setObjectName(u'mainLocationGroupBox') - self.mainLocationLayout = QtGui.QFormLayout(self.mainLocationGroupBox) - self.mainLocationLayout.setMargin(8) - self.mainLocationLayout.setSpacing(8) - self.mainLocationLayout.setObjectName(u'mainLocationLayout') - self.defaultLocationLabel = QtGui.QLabel(self.mainLocationGroupBox) - self.defaultLocationLabel.setObjectName(u'defaultLocationLabel') - self.mainLocationLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.defaultLocationLabel) - self.fontMainDefaultCheckBox = QtGui.QCheckBox( - self.mainLocationGroupBox) - self.fontMainDefaultCheckBox.setTristate(False) - self.fontMainDefaultCheckBox.setObjectName(u'fontMainDefaultCheckBox') - self.mainLocationLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.fontMainDefaultCheckBox) - self.fontMainXLabel = QtGui.QLabel(self.mainLocationGroupBox) - self.fontMainXLabel.setObjectName(u'fontMainXLabel') - self.mainLocationLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.fontMainXLabel) - self.fontMainYLabel = QtGui.QLabel(self.mainLocationGroupBox) - self.fontMainYLabel.setObjectName(u'fontMainYLabel') - self.mainLocationLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.fontMainYLabel) - self.fontMainWidthLabel = QtGui.QLabel(self.mainLocationGroupBox) - self.fontMainWidthLabel.setObjectName(u'fontMainWidthLabel') - self.mainLocationLayout.setWidget(3, QtGui.QFormLayout.LabelRole, - self.fontMainWidthLabel) - self.fontMainHeightLabel = QtGui.QLabel(self.mainLocationGroupBox) - self.fontMainHeightLabel.setObjectName(u'fontMainHeightLabel') - self.mainLocationLayout.setWidget(4, QtGui.QFormLayout.LabelRole, - self.fontMainHeightLabel) - self.fontMainXSpinBox = QtGui.QSpinBox(self.mainLocationGroupBox) - defaultSizePolicy.setHeightForWidth( - self.fontMainXSpinBox.sizePolicy().hasHeightForWidth()) - self.fontMainXSpinBox.setSizePolicy(defaultSizePolicy) - self.fontMainXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.fontMainXSpinBox.setProperty(u'value', QtCore.QVariant(0)) - self.fontMainXSpinBox.setMaximum(9999) - self.fontMainXSpinBox.setObjectName(u'fontMainXSpinBox') - self.mainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.fontMainXSpinBox) - self.fontMainYSpinBox = QtGui.QSpinBox(self.mainLocationGroupBox) - defaultSizePolicy.setHeightForWidth( - self.fontMainYSpinBox.sizePolicy().hasHeightForWidth()) - self.fontMainYSpinBox.setSizePolicy(defaultSizePolicy) - self.fontMainYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.fontMainYSpinBox.setMaximum(9999) - self.fontMainYSpinBox.setObjectName(u'fontMainYSpinBox') - self.mainLocationLayout.setWidget(2, QtGui.QFormLayout.FieldRole, - self.fontMainYSpinBox) - self.fontMainWidthSpinBox = QtGui.QSpinBox(self.mainLocationGroupBox) - defaultSizePolicy.setHeightForWidth( - self.fontMainWidthSpinBox.sizePolicy().hasHeightForWidth()) - self.fontMainWidthSpinBox.setSizePolicy(defaultSizePolicy) - self.fontMainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.fontMainWidthSpinBox.setMaximum(9999) - self.fontMainWidthSpinBox.setObjectName(u'fontMainWidthSpinBox') - self.mainLocationLayout.setWidget(3, QtGui.QFormLayout.FieldRole, - self.fontMainWidthSpinBox) - self.fontMainHeightSpinBox = QtGui.QSpinBox(self.mainLocationGroupBox) - defaultSizePolicy.setHeightForWidth( - self.fontMainHeightSpinBox.sizePolicy().hasHeightForWidth()) - self.fontMainHeightSpinBox.setSizePolicy(defaultSizePolicy) - self.fontMainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.fontMainHeightSpinBox.setMaximum(9999) - self.fontMainHeightSpinBox.setObjectName(u'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, u'') - self.fontFooterTab = QtGui.QWidget() - self.fontFooterTab.setObjectName(u'fontFooterTab') - self.fontFooterLayout = QtGui.QHBoxLayout(self.fontFooterTab) - self.fontFooterLayout.setSpacing(8) - self.fontFooterLayout.setMargin(8) - self.fontFooterLayout.setObjectName(u'fontFooterLayout') - self.footerLeftWidget = QtGui.QWidget(self.fontFooterTab) - self.footerLeftWidget.setObjectName(u'footerLeftWidget') - self.footerLeftLayout = QtGui.QVBoxLayout(self.footerLeftWidget) - self.footerLeftLayout.setSpacing(8) - self.footerLeftLayout.setMargin(0) - self.footerLeftLayout.setObjectName(u'footerLeftLayout') - self.footerFontGroupBox = QtGui.QGroupBox(self.footerLeftWidget) - self.footerFontGroupBox.setObjectName(u'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(u'footerFontLayout') - self.fontFooterLabel = QtGui.QLabel(self.footerFontGroupBox) - self.fontFooterLabel.setObjectName(u'fontFooterLabel') - self.footerFontLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.fontFooterLabel) - self.fontFooterComboBox = QtGui.QFontComboBox(self.footerFontGroupBox) - self.fontFooterComboBox.setObjectName(u'fontFooterComboBox') - self.footerFontLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.fontFooterComboBox) - self.fontFooterColorLabel = QtGui.QLabel(self.footerFontGroupBox) - self.fontFooterColorLabel.setObjectName(u'fontFooterColorLabel') - self.footerFontLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.fontFooterColorLabel) - self.fontFooterColorPushButton = QtGui.QPushButton( - self.footerFontGroupBox) - self.fontFooterColorPushButton.setObjectName( - u'fontFooterColorPushButton') - self.footerFontLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.fontFooterColorPushButton) - self.fontFooterSizeLabel = QtGui.QLabel(self.footerFontGroupBox) - self.fontFooterSizeLabel.setObjectName(u'fontFooterSizeLabel') - self.footerFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.fontFooterSizeLabel) - self.fontFooterSizeSpinBox = QtGui.QSpinBox(self.footerFontGroupBox) - defaultSizePolicy.setHeightForWidth( - self.fontFooterSizeSpinBox.sizePolicy().hasHeightForWidth()) - self.fontFooterSizeSpinBox.setSizePolicy(defaultSizePolicy) - self.fontFooterSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) - self.fontFooterSizeSpinBox.setProperty(u'value', QtCore.QVariant(10)) - self.fontFooterSizeSpinBox.setMaximum(999) - self.fontFooterSizeSpinBox.setObjectName(u'fontFooterSizeSpinBox') - self.footerFontLayout.setWidget(2, QtGui.QFormLayout.FieldRole, - self.fontFooterSizeSpinBox) - self.fontFooterWeightComboBox = QtGui.QComboBox(self.footerFontGroupBox) - self.fontFooterWeightComboBox.setObjectName(u'fontFooterWeightComboBox') - self.fontFooterWeightComboBox.addItem(QtCore.QString()) - self.fontFooterWeightComboBox.addItem(QtCore.QString()) - self.fontFooterWeightComboBox.addItem(QtCore.QString()) - self.fontFooterWeightComboBox.addItem(QtCore.QString()) - self.footerFontLayout.setWidget(3, QtGui.QFormLayout.FieldRole, - self.fontFooterWeightComboBox) - self.fontFooterWeightLabel = QtGui.QLabel(self.footerFontGroupBox) - self.fontFooterWeightLabel.setObjectName(u'fontFooterWeightLabel') - self.footerFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, - self.fontFooterWeightLabel) - 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(u'footerRightWidget') - self.footerRightLayout = QtGui.QVBoxLayout(self.footerRightWidget) - self.footerRightLayout.setSpacing(8) - self.footerRightLayout.setMargin(0) - self.footerRightLayout.setObjectName(u'footerRightLayout') - self.locationFooterGroupBox = QtGui.QGroupBox(self.footerRightWidget) - self.locationFooterGroupBox.setObjectName(u'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(u'locationFooterLayout') - self.fontFooterDefaultLabel = QtGui.QLabel(self.locationFooterGroupBox) - self.fontFooterDefaultLabel.setObjectName(u'fontFooterDefaultLabel') - self.locationFooterLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.fontFooterDefaultLabel) - self.fontFooterDefaultCheckBox = QtGui.QCheckBox( - self.locationFooterGroupBox) - self.fontFooterDefaultCheckBox.setTristate(False) - self.fontFooterDefaultCheckBox.setObjectName( - u'fontFooterDefaultCheckBox') - self.locationFooterLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.fontFooterDefaultCheckBox) - self.fontFooterXLabel = QtGui.QLabel(self.locationFooterGroupBox) - self.fontFooterXLabel.setObjectName(u'fontFooterXLabel') - self.locationFooterLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.fontFooterXLabel) - self.fontFooterYLabel = QtGui.QLabel(self.locationFooterGroupBox) - self.fontFooterYLabel.setObjectName(u'fontFooterYLabel') - self.locationFooterLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.fontFooterYLabel) - self.fontFooterWidthLabel = QtGui.QLabel(self.locationFooterGroupBox) - self.fontFooterWidthLabel.setObjectName(u'fontFooterWidthLabel') - self.locationFooterLayout.setWidget(3, QtGui.QFormLayout.LabelRole, - self.fontFooterWidthLabel) - self.fontFooterHeightLabel = QtGui.QLabel(self.locationFooterGroupBox) - self.fontFooterHeightLabel.setObjectName(u'fontFooterHeightLabel') - self.locationFooterLayout.setWidget(4, QtGui.QFormLayout.LabelRole, - self.fontFooterHeightLabel) - self.fontFooterXSpinBox = QtGui.QSpinBox(self.locationFooterGroupBox) - defaultSizePolicy.setHeightForWidth( - self.fontFooterXSpinBox.sizePolicy().hasHeightForWidth()) - self.fontFooterXSpinBox.setSizePolicy(defaultSizePolicy) - self.fontFooterXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.fontFooterXSpinBox.setProperty(u'value', QtCore.QVariant(0)) - self.fontFooterXSpinBox.setMaximum(9999) - self.fontFooterXSpinBox.setObjectName(u'fontFooterXSpinBox') - self.locationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.fontFooterXSpinBox) - self.fontFooterYSpinBox = QtGui.QSpinBox(self.locationFooterGroupBox) - defaultSizePolicy.setHeightForWidth( - self.fontFooterXSpinBox.sizePolicy().hasHeightForWidth()) - self.fontFooterYSpinBox.setSizePolicy(defaultSizePolicy) - self.fontFooterYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) - self.fontFooterYSpinBox.setProperty(u'value', QtCore.QVariant(0)) - self.fontFooterYSpinBox.setMaximum(9999) - self.fontFooterYSpinBox.setObjectName(u'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(u'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(u'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, u'') - self.otherOptionsTab = QtGui.QWidget() - self.otherOptionsTab.setObjectName(u'otherOptionsTab') - self.otherOptionsLayout = QtGui.QHBoxLayout(self.otherOptionsTab) - self.otherOptionsLayout.setSpacing(8) - self.otherOptionsLayout.setMargin(8) - self.otherOptionsLayout.setObjectName(u'otherOptionsLayout') - self.optionsLeftWidget = QtGui.QWidget(self.otherOptionsTab) - self.optionsLeftWidget.setObjectName(u'optionsLeftWidget') - self.optionsLeftLayout = QtGui.QVBoxLayout(self.optionsLeftWidget) - self.optionsLeftLayout.setSpacing(8) - self.optionsLeftLayout.setMargin(0) - self.optionsLeftLayout.setObjectName(u'optionsLeftLayout') - self.outlineGroupBox = QtGui.QGroupBox(self.optionsLeftWidget) - self.outlineGroupBox.setObjectName(u'outlineGroupBox') - self.verticalLayout = QtGui.QVBoxLayout(self.outlineGroupBox) - self.verticalLayout.setSpacing(8) - self.verticalLayout.setMargin(8) - self.verticalLayout.setObjectName(u'verticalLayout') - self.outlineWidget = QtGui.QWidget(self.outlineGroupBox) - self.outlineWidget.setObjectName(u'outlineWidget') - self.outlineLayout = QtGui.QFormLayout(self.outlineWidget) - self.outlineLayout.setMargin(0) - self.outlineLayout.setSpacing(8) - self.outlineLayout.setObjectName(u'outlineLayout') - self.outlineCheckBox = QtGui.QCheckBox(self.outlineWidget) - self.outlineCheckBox.setObjectName(u'outlineCheckBox') - self.outlineLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.outlineCheckBox) - self.outlineSpinBox = QtGui.QSpinBox(self.outlineWidget) - self.outlineSpinBox.setObjectName(u'outlineSpinBox') - self.outlineSpinBox.setMaximum(10) - self.outlineLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.outlineSpinBox) - self.outlineSpinBoxLabel = QtGui.QLabel(self.outlineWidget) - self.outlineSpinBoxLabel.setObjectName(u'outlineSpinBoxLabel') - self.outlineLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.outlineSpinBoxLabel) - self.outlineColorLabel = QtGui.QLabel(self.outlineWidget) - self.outlineColorLabel.setObjectName(u'outlineColorLabel') - self.outlineLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.outlineColorLabel) - self.outlineColorPushButton = QtGui.QPushButton(self.outlineWidget) - self.outlineColorPushButton.setObjectName(u'outlineColorPushButton') - self.outlineLayout.setWidget(2, QtGui.QFormLayout.FieldRole, - self.outlineColorPushButton) - self.outlineEnabledLabel = QtGui.QLabel(self.outlineWidget) - self.outlineEnabledLabel.setObjectName(u'outlineEnabledLabel') - self.outlineLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.outlineEnabledLabel) - self.verticalLayout.addWidget(self.outlineWidget) - self.optionsLeftLayout.addWidget(self.outlineGroupBox) - self.shadowGroupBox = QtGui.QGroupBox(self.optionsLeftWidget) - self.shadowGroupBox.setObjectName(u'shadowGroupBox') - self.verticalLayout = QtGui.QVBoxLayout(self.shadowGroupBox) - self.verticalLayout.setSpacing(8) - self.verticalLayout.setMargin(8) - self.verticalLayout.setObjectName(u'verticalLayout') - self.shadowWidget = QtGui.QWidget(self.shadowGroupBox) - self.shadowWidget.setObjectName(u'shadowWidget') - self.shadowLayout = QtGui.QFormLayout(self.shadowWidget) - self.shadowLayout.setMargin(0) - self.shadowLayout.setSpacing(8) - self.shadowLayout.setObjectName(u'shadowLayout') - self.shadowCheckBox = QtGui.QCheckBox(self.shadowWidget) - self.shadowCheckBox.setObjectName(u'shadowCheckBox') - self.shadowLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.shadowCheckBox) - self.shadowSpinBox = QtGui.QSpinBox(self.outlineWidget) - self.shadowSpinBox.setObjectName(u'shadowSpinBox') - self.shadowSpinBox.setMaximum(10) - self.shadowLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.shadowSpinBox) - self.shadowSpinBoxLabel = QtGui.QLabel(self.outlineWidget) - self.shadowSpinBoxLabel.setObjectName(u'shadowSpinBoxLabel') - self.shadowLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.shadowSpinBoxLabel) - self.shadowColorLabel = QtGui.QLabel(self.shadowWidget) - self.shadowColorLabel.setObjectName(u'shadowColorLabel') - self.shadowLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.shadowColorLabel) - self.shadowColorPushButton = QtGui.QPushButton(self.shadowWidget) - self.shadowColorPushButton.setObjectName(u'shadowColorPushButton') - self.shadowLayout.setWidget(2, QtGui.QFormLayout.FieldRole, - self.shadowColorPushButton) - self.shadowEnabledLabel = QtGui.QLabel(self.shadowWidget) - self.shadowEnabledLabel.setObjectName(u'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(u'optionsRightWidget') - self.optionsRightLayout = QtGui.QVBoxLayout(self.optionsRightWidget) - self.optionsRightLayout.setSpacing(8) - self.optionsRightLayout.setMargin(0) - self.optionsRightLayout.setObjectName(u'optionsRightLayout') - self.alignmentGroupBox = QtGui.QGroupBox(self.optionsRightWidget) - self.alignmentGroupBox.setObjectName(u'alignmentGroupBox') - self.gridLayout4 = QtGui.QGridLayout(self.alignmentGroupBox) - self.gridLayout4.setObjectName(u'gridLayout4') - self.horizontalLabel = QtGui.QLabel(self.alignmentGroupBox) - self.horizontalLabel.setObjectName(u'horizontalLabel') - self.gridLayout4.addWidget(self.horizontalLabel, 0, 0, 1, 1) - self.horizontalComboBox = QtGui.QComboBox(self.alignmentGroupBox) - self.horizontalComboBox.setObjectName(u'horizontalComboBox') - self.horizontalComboBox.addItem(QtCore.QString()) - self.horizontalComboBox.addItem(QtCore.QString()) - self.horizontalComboBox.addItem(QtCore.QString()) - self.gridLayout4.addWidget(self.horizontalComboBox, 0, 1, 1, 1) - self.verticalLabel = QtGui.QLabel(self.alignmentGroupBox) - self.verticalLabel.setObjectName(u'verticalLabel') - self.gridLayout4.addWidget(self.verticalLabel, 1, 0, 1, 1) - self.verticalComboBox = QtGui.QComboBox(self.alignmentGroupBox) - self.verticalComboBox.setObjectName(u'verticalComboBox') - self.verticalComboBox.addItem(QtCore.QString()) - self.verticalComboBox.addItem(QtCore.QString()) - self.verticalComboBox.addItem(QtCore.QString()) - self.gridLayout4.addWidget(self.verticalComboBox, 1, 1, 1, 1) - self.optionsRightLayout.addWidget(self.alignmentGroupBox) - self.transitionGroupBox = QtGui.QGroupBox(self.optionsRightWidget) - self.transitionGroupBox.setObjectName(u'transitionGroupBox') - self.gridLayout5 = QtGui.QGridLayout(self.transitionGroupBox) - self.gridLayout5.setObjectName(u'gridLayout5') - self.slideTransitionCheckBoxLabel = QtGui.QLabel( - self.transitionGroupBox) - self.slideTransitionCheckBoxLabel.setObjectName( - u'slideTransitionCheckBoxLabel') - self.gridLayout5.addWidget( - self.slideTransitionCheckBoxLabel, 0, 0, 1, 1) - self.slideTransitionCheckBox = QtGui.QCheckBox(self.alignmentGroupBox) - self.slideTransitionCheckBox.setTristate(False) - self.gridLayout5.addWidget(self.slideTransitionCheckBox, 0, 1, 1, 1) - self.optionsRightLayout.addWidget(self.transitionGroupBox) - 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, u'') - self.contentLayout.addWidget(self.themeTabWidget) - self.amendThemeLayout.addWidget(self.contentWidget) - self.previewGroupBox = QtGui.QGroupBox(amendThemeDialog) - self.previewGroupBox.setObjectName(u'previewGroupBox') - self.themePreviewLayout = QtGui.QHBoxLayout(self.previewGroupBox) - self.themePreviewLayout.setSpacing(8) - self.themePreviewLayout.setMargin(8) - self.themePreviewLayout.setObjectName(u'themePreviewLayout') - spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - 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.setMaximumSize(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(u'themePreview') - self.themePreviewLayout.addWidget(self.themePreview) - spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - 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(u'themeButtonBox') - self.amendThemeLayout.addWidget(self.themeButtonBox) - - self.retranslateUi(amendThemeDialog) - self.themeTabWidget.setCurrentIndex(0) - QtCore.QObject.connect(self.themeButtonBox, - QtCore.SIGNAL(u'accepted()'), amendThemeDialog.accept) - QtCore.QObject.connect(self.themeButtonBox, - QtCore.SIGNAL(u'rejected()'), amendThemeDialog.reject) - QtCore.QMetaObject.connectSlotsByName(amendThemeDialog) - - def retranslateUi(self, amendThemeDialog): - amendThemeDialog.setWindowTitle( - translate('OpenLP.AmendThemeForm', 'Theme Maintenance')) - self.themeNameLabel.setText( - translate('OpenLP.AmendThemeForm', 'Theme &name:')) - self.backgroundTypeLabel.setText( - translate('OpenLP.AmendThemeForm', 'Type:')) - self.backgroundTypeComboBox.setItemText(0, - translate('OpenLP.AmendThemeForm', 'Solid Color')) - self.backgroundTypeComboBox.setItemText(1, - translate('OpenLP.AmendThemeForm', 'Gradient')) - self.backgroundTypeComboBox.setItemText(2, - translate('OpenLP.AmendThemeForm', 'Image')) - self.color1Label.setText(u':') - self.color2Label.setText(u':') - self.imageLabel.setText( - translate('OpenLP.AmendThemeForm', 'Image:')) - self.gradientLabel.setText( - translate('OpenLP.AmendThemeForm', 'Gradient:')) - self.gradientComboBox.setItemText(0, - translate('OpenLP.AmendThemeForm', 'Horizontal')) - self.gradientComboBox.setItemText(1, - translate('OpenLP.AmendThemeForm', 'Vertical')) - self.gradientComboBox.setItemText(2, - translate('OpenLP.AmendThemeForm', 'Circular')) - self.themeTabWidget.setTabText( - self.themeTabWidget.indexOf(self.backgroundTab), - translate('OpenLP.AmendThemeForm', '&Background')) - self.fontMainGroupBox.setTitle( - translate('OpenLP.AmendThemeForm', 'Main Font')) - self.fontMainlabel.setText( - translate('OpenLP.AmendThemeForm', 'Font:')) - self.fontMainColorLabel.setText( - translate('OpenLP.AmendThemeForm', 'Color:')) - self.fontMainSize.setText( - translate('OpenLP.AmendThemeForm', 'Size:')) - self.fontMainSizeSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'pt')) - self.fontMainWrapLineAdjustmentLabel.setText( - translate('OpenLP.AmendThemeForm', 'Adjust line spacing:')) - self.fontMainWeightComboBox.setItemText(0, - translate('OpenLP.AmendThemeForm', 'Normal')) - self.fontMainWeightComboBox.setItemText(1, - translate('OpenLP.AmendThemeForm', 'Bold')) - self.fontMainWeightComboBox.setItemText(2, - translate('OpenLP.AmendThemeForm', 'Italics')) - self.fontMainWeightComboBox.setItemText(3, - translate('OpenLP.AmendThemeForm', 'Bold/Italics')) - self.fontMainWeightLabel.setText( - translate('OpenLP.AmendThemeForm', 'Style:')) - self.mainLocationGroupBox.setTitle( - translate('OpenLP.AmendThemeForm', 'Display Location')) - self.defaultLocationLabel.setText( - translate('OpenLP.AmendThemeForm', 'Use default location')) - self.fontMainXLabel.setText( - translate('OpenLP.AmendThemeForm', 'X position:')) - self.fontMainYLabel.setText( - translate('OpenLP.AmendThemeForm', 'Y position:')) - self.fontMainWidthLabel.setText( - translate('OpenLP.AmendThemeForm', 'Width:')) - self.fontMainHeightLabel.setText( - translate('OpenLP.AmendThemeForm', 'Height:')) - self.fontMainXSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.fontMainYSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.fontMainWidthSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.fontMainHeightSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.themeTabWidget.setTabText( - self.themeTabWidget.indexOf(self.fontMainTab), - translate('OpenLP.AmendThemeForm', '&Main Font')) - self.footerFontGroupBox.setTitle( - translate('OpenLP.AmendThemeForm', 'Footer Font')) - self.fontFooterLabel.setText( - translate('OpenLP.AmendThemeForm', 'Font:')) - self.fontFooterColorLabel.setText( - translate('OpenLP.AmendThemeForm', 'Color:')) - self.fontFooterSizeLabel.setText( - translate('OpenLP.AmendThemeForm', 'Size:')) - self.fontFooterSizeSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'pt')) - self.fontFooterWeightComboBox.setItemText(0, - translate('OpenLP.AmendThemeForm', 'Normal')) - self.fontFooterWeightComboBox.setItemText(1, - translate('OpenLP.AmendThemeForm', 'Bold')) - self.fontFooterWeightComboBox.setItemText(2, - translate('OpenLP.AmendThemeForm', 'Italics')) - self.fontFooterWeightComboBox.setItemText(3, - translate('OpenLP.AmendThemeForm', 'Bold/Italics')) - self.fontFooterWeightLabel.setText( - translate('OpenLP.AmendThemeForm', 'Style:')) - self.locationFooterGroupBox.setTitle( - translate('OpenLP.AmendThemeForm', 'Display Location')) - self.fontFooterDefaultLabel.setText( - translate('OpenLP.AmendThemeForm', 'Use default location')) - self.fontFooterXLabel.setText( - translate('OpenLP.AmendThemeForm', 'X position:')) - self.fontFooterYLabel.setText( - translate('OpenLP.AmendThemeForm', 'Y position:')) - self.fontFooterWidthLabel.setText( - translate('OpenLP.AmendThemeForm', 'Width:')) - self.fontFooterHeightLabel.setText( - translate('OpenLP.AmendThemeForm', 'Height:')) - self.fontFooterXSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.fontFooterYSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.fontFooterWidthSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.fontFooterHeightSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.themeTabWidget.setTabText( - self.themeTabWidget.indexOf(self.fontFooterTab), - translate('OpenLP.AmendThemeForm', '&Footer Font')) - self.outlineGroupBox.setTitle( - translate('OpenLP.AmendThemeForm', 'Outline')) - self.outlineSpinBoxLabel.setText( - translate('OpenLP.AmendThemeForm', 'Outline size:')) - self.outlineSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.outlineColorLabel.setText( - translate('OpenLP.AmendThemeForm', 'Outline color:')) - self.outlineEnabledLabel.setText( - translate('OpenLP.AmendThemeForm', 'Show outline:')) - self.shadowGroupBox.setTitle( - translate('OpenLP.AmendThemeForm', 'Shadow')) - self.shadowSpinBoxLabel.setText( - translate('OpenLP.AmendThemeForm', 'Shadow size:')) - self.shadowSpinBox.setSuffix( - translate('OpenLP.AmendThemeForm', 'px')) - self.shadowColorLabel.setText( - translate('OpenLP.AmendThemeForm', 'Shadow color:')) - self.shadowEnabledLabel.setText( - translate('OpenLP.AmendThemeForm', 'Show shadow:')) - self.alignmentGroupBox.setTitle( - translate('OpenLP.AmendThemeForm', 'Alignment')) - self.horizontalLabel.setText( - translate('OpenLP.AmendThemeForm', 'Horizontal align:')) - self.horizontalComboBox.setItemText(0, - translate('OpenLP.AmendThemeForm', 'Left')) - self.horizontalComboBox.setItemText(1, - translate('OpenLP.AmendThemeForm', 'Right')) - self.horizontalComboBox.setItemText(2, - translate('OpenLP.AmendThemeForm', 'Center')) - self.verticalLabel.setText( - translate('OpenLP.AmendThemeForm', 'Vertical align:')) - self.verticalComboBox.setItemText(0, - translate('OpenLP.AmendThemeForm', 'Top')) - self.verticalComboBox.setItemText(1, - translate('OpenLP.AmendThemeForm', 'Middle')) - self.verticalComboBox.setItemText(2, - translate('OpenLP.AmendThemeForm', 'Bottom')) - self.transitionGroupBox.setTitle( - translate('OpenLP.AmendThemeForm', 'Slide Transition')) - self.slideTransitionCheckBoxLabel.setText( - translate('OpenLP.AmendThemeForm', 'Transition active')) - self.themeTabWidget.setTabText( - self.themeTabWidget.indexOf(self.otherOptionsTab), - translate('OpenLP.AmendThemeForm', '&Other Options')) - self.previewGroupBox.setTitle( - translate('OpenLP.AmendThemeForm', 'Preview')) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py deleted file mode 100644 index 1a7871f22..000000000 --- a/openlp/core/ui/amendthemeform.py +++ /dev/null @@ -1,722 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # -# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # -# Carsten Tinggaard, Frode Woldsund # -# --------------------------------------------------------------------------- # -# 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 -import os.path - -from PyQt4 import QtCore, QtGui - -from openlp.core.lib import ThemeXML, translate -from openlp.core.utils import get_images_filter -from amendthemedialog import Ui_AmendThemeDialog - -log = logging.getLogger(u'AmendThemeForm') - -class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): - """ - The :class:`AmendThemeForm` class provides the user interface to set up - new and edit existing themes. - """ - def __init__(self, parent): - """ - Initialise the theme editor user interface - """ - QtGui.QDialog.__init__(self, parent) - self.thememanager = parent - self.path = None - self.theme = ThemeXML() - self.setupUi(self) - # Buttons - QtCore.QObject.connect(self.color1PushButton, - QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked) - QtCore.QObject.connect(self.color2PushButton, - QtCore.SIGNAL(u'pressed()'), self.onColor2PushButtonClicked) - QtCore.QObject.connect(self.fontMainColorPushButton, - QtCore.SIGNAL(u'pressed()'), self.onFontMainColorPushButtonClicked) - QtCore.QObject.connect(self.fontFooterColorPushButton, - QtCore.SIGNAL(u'pressed()'), - self.onFontFooterColorPushButtonClicked) - QtCore.QObject.connect(self.outlineColorPushButton, - QtCore.SIGNAL(u'pressed()'), self.onOutlineColorPushButtonClicked) - QtCore.QObject.connect(self.shadowColorPushButton, - QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked) - QtCore.QObject.connect(self.imageToolButton, - QtCore.SIGNAL(u'clicked()'), self.onImageToolButtonClicked) - # Combo boxes - QtCore.QObject.connect(self.backgroundTypeComboBox, - QtCore.SIGNAL(u'activated(int)'), - self.onBackgroundTypeComboBoxSelected) - QtCore.QObject.connect(self.gradientComboBox, - QtCore.SIGNAL(u'activated(int)'), self.onGradientComboBoxSelected) - QtCore.QObject.connect(self.fontMainComboBox, - QtCore.SIGNAL(u'activated(int)'), self.onFontMainComboBoxSelected) - QtCore.QObject.connect(self.fontMainWeightComboBox, - QtCore.SIGNAL(u'activated(int)'), - self.onFontMainWeightComboBoxSelected) - QtCore.QObject.connect(self.fontFooterComboBox, - QtCore.SIGNAL(u'activated(int)'), self.onFontFooterComboBoxSelected) - QtCore.QObject.connect(self.fontFooterWeightComboBox, - QtCore.SIGNAL(u'activated(int)'), - self.onFontFooterWeightComboBoxSelected) - QtCore.QObject.connect(self.horizontalComboBox, - QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected) - QtCore.QObject.connect(self.verticalComboBox, - QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected) - # Spin boxes - QtCore.QObject.connect(self.fontMainSizeSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontMainSizeSpinBoxChanged) - QtCore.QObject.connect(self.fontMainLineAdjustmentSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontMainLineAdjustmentSpinBoxChanged) - QtCore.QObject.connect(self.shadowSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onShadowSpinBoxChanged) - QtCore.QObject.connect(self.outlineSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onOutlineSpinBoxChanged) - - QtCore.QObject.connect(self.fontFooterSizeSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontFooterSizeSpinBoxChanged) - QtCore.QObject.connect(self.fontMainXSpinBox, - QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged) - QtCore.QObject.connect(self.fontMainYSpinBox, - QtCore.SIGNAL(u'editingFinished()'), self.onFontMainYSpinBoxChanged) - QtCore.QObject.connect(self.fontMainWidthSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontMainWidthSpinBoxChanged) - QtCore.QObject.connect(self.fontMainHeightSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontMainHeightSpinBoxChanged) - QtCore.QObject.connect(self.fontMainLineAdjustmentSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontMainLineAdjustmentSpinBoxChanged) - QtCore.QObject.connect(self.fontFooterXSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontFooterXSpinBoxChanged) - QtCore.QObject.connect(self.fontFooterYSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontFooterYSpinBoxChanged) - QtCore.QObject.connect(self.fontFooterWidthSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontFooterWidthSpinBoxChanged) - QtCore.QObject.connect(self.fontFooterHeightSpinBox, - QtCore.SIGNAL(u'editingFinished()'), - self.onFontFooterHeightSpinBoxChanged) - - # CheckBoxes - QtCore.QObject.connect(self.fontMainDefaultCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), - self.onFontMainDefaultCheckBoxChanged) - QtCore.QObject.connect(self.fontFooterDefaultCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), - self.onFontFooterDefaultCheckBoxChanged) - QtCore.QObject.connect(self.outlineCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged) - QtCore.QObject.connect(self.shadowCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged) - QtCore.QObject.connect(self.slideTransitionCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), - self.onSlideTransitionCheckBoxChanged) - - def accept(self): - new_theme = ThemeXML() - theme_name = unicode(self.themeNameEdit.text()) - new_theme.new_document(theme_name) - save_from = None - save_to = None - if self.theme.background_type == u'solid': - new_theme.add_background_solid( - unicode(self.theme.background_color)) - elif self.theme.background_type == u'gradient': - new_theme.add_background_gradient( - unicode(self.theme.background_start_color), - unicode(self.theme.background_end_color), - self.theme.background_direction) - else: - filename = \ - os.path.split(unicode(self.theme.background_filename))[1] - new_theme.add_background_image(filename) - save_to = os.path.join(self.path, theme_name, filename) - save_from = self.theme.background_filename - new_theme.add_font(unicode(self.theme.font_main_name), - unicode(self.theme.font_main_color), - unicode(self.theme.font_main_proportion), - unicode(self.theme.font_main_override), u'main', - unicode(self.theme.font_main_weight), - unicode(self.theme.font_main_italics), - unicode(self.theme.font_main_line_adjustment), - unicode(self.theme.font_main_x), - unicode(self.theme.font_main_y), - unicode(self.theme.font_main_width), - unicode(self.theme.font_main_height)) - new_theme.add_font(unicode(self.theme.font_footer_name), - unicode(self.theme.font_footer_color), - unicode(self.theme.font_footer_proportion), - unicode(self.theme.font_footer_override), u'footer', - unicode(self.theme.font_footer_weight), - unicode(self.theme.font_footer_italics), - 0, # line adjustment - unicode(self.theme.font_footer_x), - unicode(self.theme.font_footer_y), - unicode(self.theme.font_footer_width), - unicode(self.theme.font_footer_height)) - new_theme.add_display(unicode(self.theme.display_shadow), - unicode(self.theme.display_shadow_color), - unicode(self.theme.display_outline), - unicode(self.theme.display_outline_color), - unicode(self.theme.display_horizontal_align), - unicode(self.theme.display_vertical_align), - unicode(self.theme.display_wrap_style), - unicode(self.theme.display_slide_transition), - unicode(self.theme.display_shadow_size), - unicode(self.theme.display_outline_size)) - theme = new_theme.extract_xml() - pretty_theme = new_theme.extract_formatted_xml() - if self.thememanager.saveTheme(theme_name, theme, pretty_theme, - save_from, save_to) is not False: - return QtGui.QDialog.accept(self) - - def loadTheme(self, theme): - log.debug(u'LoadTheme %s', theme) - self.theme = theme - # Stop the initial screen setup generating 1 preview per field! - self.allowPreview = False - self.paintUi(self.theme) - self.allowPreview = True - self.previewTheme() - - def onImageToolButtonClicked(self): - images_filter = get_images_filter() - images_filter = '%s;;%s (*.*) (*)' % (images_filter, - translate('OpenLP.AmendThemeForm', 'All Files')) - filename = QtGui.QFileDialog.getOpenFileName(self, - translate('OpenLP.AmendThemeForm', 'Select Image'), u'', - images_filter) - if filename: - self.imageLineEdit.setText(filename) - self.theme.background_filename = filename - self.previewTheme() - # - # Main Font Tab - # - def onFontMainComboBoxSelected(self): - self.theme.font_main_name = self.fontMainComboBox.currentFont().family() - self.previewTheme() - - def onFontMainWeightComboBoxSelected(self, value): - if value == 0: - self.theme.font_main_weight = u'Normal' - self.theme.font_main_italics = False - elif value == 1: - self.theme.font_main_weight = u'Bold' - self.theme.font_main_italics = False - elif value == 2: - self.theme.font_main_weight = u'Normal' - self.theme.font_main_italics = True - else: - self.theme.font_main_weight = u'Bold' - self.theme.font_main_italics = True - self.previewTheme() - - def onFontMainColorPushButtonClicked(self): - new_color = QtGui.QColorDialog.getColor( - QtGui.QColor(self.theme.font_main_color), self) - if new_color.isValid(): - self.theme.font_main_color = new_color.name() - self.fontMainColorPushButton.setStyleSheet( - u'background-color: %s' % unicode(self.theme.font_main_color)) - self.previewTheme() - - def onFontMainSizeSpinBoxChanged(self): - if self.theme.font_main_proportion != self.fontMainSizeSpinBox.value(): - self.theme.font_main_proportion = self.fontMainSizeSpinBox.value() - self.previewTheme() - - def onFontMainDefaultCheckBoxChanged(self, value): - if value == 2: # checked - self.theme.font_main_override = False - else: - self.theme.font_main_override = True - - if not self.theme.font_main_x and not self.theme.font_main_y and \ - not self.theme.font_main_width and not self.theme.font_main_height: - 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(self.theme.font_main_x) - self.fontMainYSpinBox.setValue(self.theme.font_main_y) - self.fontMainWidthSpinBox.setValue(self.theme.font_main_width) - self.fontMainHeightSpinBox.setValue(self.theme.font_main_height) - self.fontMainLineAdjustmentSpinBox.setValue( - self.theme.font_main_line_adjustment) - self.stateChanging(self.theme) - self.previewTheme() - - def onFontMainXSpinBoxChanged(self): - if self.theme.font_main_x != self.fontMainXSpinBox.value(): - self.theme.font_main_x = self.fontMainXSpinBox.value() - self.previewTheme() - - def onFontMainYSpinBoxChanged(self): - if self.theme.font_main_y != self.fontMainYSpinBox.value(): - self.theme.font_main_y = self.fontMainYSpinBox.value() - self.previewTheme() - - def onFontMainWidthSpinBoxChanged(self): - if self.theme.font_main_width != self.fontMainWidthSpinBox.value(): - self.theme.font_main_width = self.fontMainWidthSpinBox.value() - self.previewTheme() - - def onFontMainLineAdjustmentSpinBoxChanged(self): - if self.theme.font_main_line_adjustment != \ - self.fontMainLineAdjustmentSpinBox.value(): - self.theme.font_main_line_adjustment = \ - self.fontMainLineAdjustmentSpinBox.value() - self.previewTheme() - - def onFontMainHeightSpinBoxChanged(self): - if self.theme.font_main_height != self.fontMainHeightSpinBox.value(): - self.theme.font_main_height = self.fontMainHeightSpinBox.value() - self.previewTheme() - # - # Footer Font Tab - # - def onFontFooterComboBoxSelected(self): - self.theme.font_footer_name = \ - self.fontFooterComboBox.currentFont().family() - self.previewTheme() - - def onFontFooterWeightComboBoxSelected(self, value): - if value == 0: - self.theme.font_footer_weight = u'Normal' - self.theme.font_footer_italics = False - elif value == 1: - self.theme.font_footer_weight = u'Bold' - self.theme.font_footer_italics = False - elif value == 2: - self.theme.font_footer_weight = u'Normal' - self.theme.font_footer_italics = True - else: - self.theme.font_footer_weight = u'Bold' - self.theme.font_footer_italics = True - self.previewTheme() - - def onFontFooterColorPushButtonClicked(self): - new_color = QtGui.QColorDialog.getColor( - QtGui.QColor(self.theme.font_footer_color), self) - if new_color.isValid(): - self.theme.font_footer_color = new_color.name() - self.fontFooterColorPushButton.setStyleSheet( - u'background-color: %s' % unicode(self.theme.font_footer_color)) - self.previewTheme() - - def onFontFooterSizeSpinBoxChanged(self): - if self.theme.font_footer_proportion != \ - self.fontFooterSizeSpinBox.value(): - self.theme.font_footer_proportion = \ - self.fontFooterSizeSpinBox.value() - self.previewTheme() - - def onFontFooterDefaultCheckBoxChanged(self, value): - if value == 2: # checked - self.theme.font_footer_override = False - else: - self.theme.font_footer_override = True - if not self.theme.font_footer_x and not self.theme.font_footer_y and \ - not self.theme.font_footer_width and \ - not self.theme.font_footer_height: - 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(self.theme.font_footer_x) - self.fontFooterYSpinBox.setValue(self.theme.font_footer_y) - self.fontFooterWidthSpinBox.setValue(self.theme.font_footer_width) - self.fontFooterHeightSpinBox.setValue( - self.theme.font_footer_height) - self.stateChanging(self.theme) - self.previewTheme() - - def onFontFooterXSpinBoxChanged(self): - if self.theme.font_footer_x != self.fontFooterXSpinBox.value(): - self.theme.font_footer_x = self.fontFooterXSpinBox.value() - self.previewTheme() - - def onFontFooterYSpinBoxChanged(self): - if self.theme.font_footer_y != self.fontFooterYSpinBox.value(): - self.theme.font_footer_y = self.fontFooterYSpinBox.value() - self.previewTheme() - - def onFontFooterWidthSpinBoxChanged(self): - if self.theme.font_footer_width != self.fontFooterWidthSpinBox.value(): - self.theme.font_footer_width = self.fontFooterWidthSpinBox.value() - self.previewTheme() - - def onFontFooterHeightSpinBoxChanged(self): - if self.theme.font_footer_height != \ - self.fontFooterHeightSpinBox.value(): - self.theme.font_footer_height = \ - self.fontFooterHeightSpinBox.value() - self.previewTheme() - # - # Background Tab - # - def onGradientComboBoxSelected(self, currentIndex): - self.setBackground(self.backgroundTypeComboBox.currentIndex(), - currentIndex) - - def onBackgroundTypeComboBoxSelected(self, currentIndex): - 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' - self.imageLineEdit.setText(u'') - elif background == 1: # Gradient - self.theme.background_type = u'gradient' - 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_start_color is None: - self.theme.background_start_color = u'#000000' - if self.theme.background_end_color is None: - self.theme.background_end_color = u'#ff0000' - self.imageLineEdit.setText(u'') - else: - self.theme.background_type = u'image' - self.stateChanging(self.theme) - self.previewTheme() - - def onColor1PushButtonClicked(self): - if self.theme.background_type == u'solid': - new_color = QtGui.QColorDialog.getColor( - QtGui.QColor(self.theme.background_color), self) - if new_color.isValid(): - self.theme.background_color = new_color.name() - self.color1PushButton.setStyleSheet(u'background-color: %s' % - unicode(self.theme.background_color)) - else: - new_color = QtGui.QColorDialog.getColor( - QtGui.QColor(self.theme.background_start_color), self) - if new_color.isValid(): - self.theme.background_start_color = new_color.name() - self.color1PushButton.setStyleSheet(u'background-color: %s' % - unicode(self.theme.background_start_color)) - self.previewTheme() - - def onColor2PushButtonClicked(self): - new_color = QtGui.QColorDialog.getColor( - QtGui.QColor(self.theme.background_end_color), self) - if new_color.isValid(): - self.theme.background_end_color = new_color.name() - self.color2PushButton.setStyleSheet(u'background-color: %s' % - unicode(self.theme.background_end_color)) - self.previewTheme() - # - # 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() - - def onOutlineSpinBoxChanged(self): - if self.theme.display_outline_size != self.outlineSpinBox.value(): - self.theme.display_outline_size = self.outlineSpinBox.value() - self.previewTheme() - - def onShadowSpinBoxChanged(self): - if self.theme.display_shadow_size != self.shadowSpinBox.value(): - self.theme.display_shadow_size = self.shadowSpinBox.value() - self.previewTheme() - - def onOutlineColorPushButtonClicked(self): - new_color = QtGui.QColorDialog.getColor( - QtGui.QColor(self.theme.display_outline_color), self) - if new_color.isValid(): - self.theme.display_outline_color = new_color.name() - self.outlineColorPushButton.setStyleSheet(u'background-color: %s' % - unicode(self.theme.display_outline_color)) - self.previewTheme() - - 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() - - def onSlideTransitionCheckBoxChanged(self, value): - if value == 2: # checked - self.theme.display_slide_transition = True - else: - self.theme.display_slide_transition = False - self.stateChanging(self.theme) - self.previewTheme() - - def onShadowColorPushButtonClicked(self): - new_color = QtGui.QColorDialog.getColor( - QtGui.QColor(self.theme.display_shadow_color), self) - if new_color.isValid(): - self.theme.display_shadow_color = new_color.name() - self.shadowColorPushButton.setStyleSheet(u'background-color: %s' % - unicode(self.theme.display_shadow_color)) - self.previewTheme() - - def onHorizontalComboBoxSelected(self, currentIndex): - self.theme.display_horizontal_align = currentIndex - self.stateChanging(self.theme) - self.previewTheme() - - def onVerticalComboBoxSelected(self, currentIndex): - self.theme.display_vertical_align = currentIndex - self.stateChanging(self.theme) - self.previewTheme() - # - # Local Methods - # - def paintUi(self, theme): - self.stateChanging(theme) - self.themeNameEdit.setText(self.theme.theme_name) - # Background Tab - self.imageLineEdit.setText(u'') - 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.imageLineEdit.setText(self.theme.background_filename) - 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) - # Font Main Tab - self.mainFontComboBox.setCurrentFont( - QtGui.QFont(self.theme.font_main_name)) - self.fontMainSizeSpinBox.setValue(self.theme.font_main_proportion) - if not self.theme.font_main_italics and \ - self.theme.font_main_weight == u'Normal': - self.fontMainWeightComboBox.setCurrentIndex(0) - elif not self.theme.font_main_italics and \ - self.theme.font_main_weight == u'Bold': - self.fontMainWeightComboBox.setCurrentIndex(1) - elif self.theme.font_main_italics and \ - self.theme.font_main_weight == u'Normal': - self.fontMainWeightComboBox.setCurrentIndex(2) - else: - self.fontMainWeightComboBox.setCurrentIndex(3) - self.fontMainXSpinBox.setValue(self.theme.font_main_x) - self.fontMainYSpinBox.setValue(self.theme.font_main_y) - self.fontMainWidthSpinBox.setValue(self.theme.font_main_width) - self.fontMainHeightSpinBox.setValue(self.theme.font_main_height) - # Font Footer Tab - self.fontFooterComboBox.setCurrentFont( - QtGui.QFont(self.theme.font_footer_name)) - self.fontFooterSizeSpinBox.setValue( - self.theme.font_footer_proportion) - if not self.theme.font_footer_italics and \ - self.theme.font_footer_weight == u'Normal': - self.fontFooterWeightComboBox.setCurrentIndex(0) - elif not self.theme.font_footer_italics and \ - self.theme.font_footer_weight == u'Bold': - self.fontFooterWeightComboBox.setCurrentIndex(1) - elif self.theme.font_footer_italics and \ - self.theme.font_footer_weight == u'Normal': - self.fontFooterWeightComboBox.setCurrentIndex(2) - else: - self.fontFooterWeightComboBox.setCurrentIndex(3) - self.fontFooterXSpinBox.setValue(self.theme.font_footer_x) - self.fontFooterYSpinBox.setValue(self.theme.font_footer_y) - self.fontFooterWidthSpinBox.setValue(self.theme.font_footer_width) - self.fontFooterHeightSpinBox.setValue(self.theme.font_footer_height) - self.fontMainColorPushButton.setStyleSheet( - u'background-color: %s' % unicode(theme.font_main_color)) - self.fontFooterColorPushButton.setStyleSheet( - u'background-color: %s' % unicode(theme.font_footer_color)) - if not self.theme.font_main_override: - self.fontMainDefaultCheckBox.setChecked(True) - else: - self.fontMainDefaultCheckBox.setChecked(False) - if not self.theme.font_footer_override: - self.fontFooterDefaultCheckBox.setChecked(True) - else: - self.fontFooterDefaultCheckBox.setChecked(False) - self.outlineColorPushButton.setStyleSheet( - u'background-color: %s' % unicode(theme.display_outline_color)) - self.shadowColorPushButton.setStyleSheet( - u'background-color: %s' % unicode(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) - self.outlineSpinBox.setValue(int(self.theme.display_outline_size)) - if self.theme.display_shadow: - self.shadowCheckBox.setChecked(True) - self.shadowColorPushButton.setEnabled(True) - else: - self.shadowCheckBox.setChecked(False) - self.shadowColorPushButton.setEnabled(False) - self.shadowSpinBox.setValue(int(self.theme.display_shadow_size)) - if self.theme.display_slide_transition: - self.slideTransitionCheckBox.setCheckState(QtCore.Qt.Checked) - else: - self.slideTransitionCheckBox.setCheckState(QtCore.Qt.Unchecked) - self.horizontalComboBox.setCurrentIndex( - self.theme.display_horizontal_align) - self.verticalComboBox.setCurrentIndex(self.theme.display_vertical_align) - - def stateChanging(self, theme): - self.backgroundTypeComboBox.setVisible(True) - self.backgroundTypeLabel.setVisible(True) - if theme.background_type == u'solid': - self.color1PushButton.setStyleSheet( - u'background-color: %s' % unicode(theme.background_color)) - self.color1Label.setText( - translate('OpenLP.AmendThemeForm', '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(u'background-color: %s' \ - % unicode(theme.background_start_color)) - self.color2PushButton.setStyleSheet(u'background-color: %s' \ - % unicode(theme.background_end_color)) - self.color1Label.setText( - translate('OpenLP.AmendThemeForm', 'First color:')) - self.color2Label.setText( - translate('OpenLP.AmendThemeForm', 'Second color:')) - self.color1Label.setVisible(True) - 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) - if not theme.font_main_override: - 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 not theme.font_footer_override: - 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) - - 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): - if self.allowPreview: - #calculate main number of rows - metrics = self._getThemeMetrics() - line_height = metrics.height() \ - + int(self.theme.font_main_line_adjustment) - if self.theme.display_shadow: - line_height += int(self.theme.display_shadow_size) - if self.theme.display_outline: - # pixels top/bottom - line_height += 2 * int(self.theme.display_outline_size) - page_length = \ - ((self.fontMainHeightSpinBox.value()) / line_height ) - log.debug(u'Page Length area height %s, metrics %s, lines %s' % - (self.fontMainHeightSpinBox.value(), metrics.height(), - page_length)) - page_length_text = unicode( - translate('OpenLP.AmendThemeForm', 'Slide height is %s rows.')) - self.fontMainLinesPageLabel.setText(page_length_text % page_length) - frame = self.thememanager.generateImage(self.theme) - self.themePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) - - def _getThemeMetrics(self): - main_weight = 50 - if self.theme.font_main_weight == u'Bold': - main_weight = 75 - mainFont = QtGui.QFont(self.theme.font_main_name, - self.theme.font_main_proportion, # size - main_weight, # weight - self.theme.font_main_italics)# italic - mainFont.setPixelSize(self.theme.font_main_proportion) - metrics = QtGui.QFontMetrics(mainFont) - # Validate that the screen width is big enough to display the text - if self.theme.font_main_width < metrics.maxWidth() * 2 + 64: - self.theme.font_main_width = metrics.maxWidth() * 2 + 64 - self.fontMainWidthSpinBox.setValue(self.theme.font_main_width) - return metrics diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index dd483c14e..8b7a3f9b2 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -23,7 +23,8 @@ # 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 @@ -236,7 +237,7 @@ class MainDisplay(DisplayWidget): """ API for replacement backgrounds so Images are added directly to cache """ - image = self.imageManager.add_image(name, path) + self.imageManager.add_image(name, path) self.image(name) def image(self, name): diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 82fb0a5a2..6db8125ef 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -627,7 +627,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # warning cyclic dependency # RenderManager needs to call ThemeManager and # ThemeManager needs to call RenderManager - self.RenderManager = RenderManager( + self.renderManager = RenderManager( self.ThemeManagerContents, self.screens) # Define the media Dock Manager self.mediaDockManager = MediaDockManager(self.MediaToolBox) @@ -635,7 +635,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # make the controllers available to the plugins self.plugin_helpers[u'preview'] = self.PreviewController self.plugin_helpers[u'live'] = self.LiveController - self.plugin_helpers[u'render'] = self.RenderManager + self.plugin_helpers[u'render'] = self.renderManager self.plugin_helpers[u'service'] = self.ServiceManagerContents self.plugin_helpers[u'settings form'] = self.settingsForm self.plugin_helpers[u'toolbox'] = self.mediaDockManager @@ -809,7 +809,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): their locations """ log.debug(u'screenChanged') - self.RenderManager.update_display() + self.renderManager.update_display() self.setFocus() self.activateWindow() diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index d85cc5533..d2589416a 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -782,7 +782,7 @@ class ServiceManager(QtGui.QWidget): self.onNewService() for item in items: serviceitem = ServiceItem() - serviceitem.render_manager = self.parent.RenderManager + serviceitem.render_manager = self.parent.renderManager serviceitem.set_from_service(item, self.servicePath) self.validateItem(serviceitem) self.addServiceItem(serviceitem) @@ -843,7 +843,7 @@ class ServiceManager(QtGui.QWidget): """ log.debug(u'onThemeComboBoxSelected') self.service_theme = unicode(self.themeComboBox.currentText()) - self.parent.RenderManager.set_service_theme(self.service_theme) + self.parent.renderManager.set_service_theme(self.service_theme) QtCore.QSettings().setValue( self.parent.serviceSettingsSection + u'/service theme', QtCore.QVariant(self.service_theme)) @@ -855,7 +855,7 @@ class ServiceManager(QtGui.QWidget): sure the theme combo box is in the correct state. """ log.debug(u'themeChange') - if self.parent.RenderManager.theme_level == ThemeLevel.Global: + if self.parent.renderManager.theme_level == ThemeLevel.Global: self.toolbar.actions[u'ThemeLabel'].setVisible(False) self.toolbar.actions[u'ThemeWidget'].setVisible(False) else: @@ -869,7 +869,7 @@ class ServiceManager(QtGui.QWidget): """ log.debug(u'regenerateServiceItems') # force reset of renderer as theme data has changed - self.parent.RenderManager.themedata = None + self.parent.renderManager.themedata = None if self.serviceItems: tempServiceItems = self.serviceItems self.serviceManagerList.clear() @@ -1111,7 +1111,7 @@ class ServiceManager(QtGui.QWidget): index = 0 self.service_theme = u'' self.themeComboBox.setCurrentIndex(index) - self.parent.RenderManager.set_service_theme(self.service_theme) + self.parent.renderManager.set_service_theme(self.service_theme) self.regenerateServiceItems() def onThemeChangeAction(self): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index ab86bfa10..4c7639826 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -497,7 +497,7 @@ class SlideController(QtGui.QWidget): log.debug(u'screenSizeChanged live = %s' % self.isLive) # rebuild display as screen size changed self.display = MainDisplay(self, self.screens, self.isLive) - self.display.imageManager = self.parent.RenderManager.image_manager + self.display.imageManager = self.parent.renderManager.image_manager self.display.alertTab = self.alertTab self.ratio = float(self.screens.current[u'size'].width()) / \ float(self.screens.current[u'size'].height()) @@ -517,7 +517,7 @@ class SlideController(QtGui.QWidget): """ log.debug(u'widthChanged live = %s' % self.isLive) width = self.parent.ControlSplitter.sizes()[self.split] - height = width * self.parent.RenderManager.screen_ratio + height = width * self.parent.renderManager.screen_ratio self.PreviewListWidget.setColumnWidth(0, width) # Sort out image heights (Songs, bibles excluded) if self.serviceItem and not self.serviceItem.is_text(): @@ -696,14 +696,14 @@ class SlideController(QtGui.QWidget): label.setScaledContents(True) if self.serviceItem.is_command(): image = resize_image(frame[u'image'], - self.parent.RenderManager.width, - self.parent.RenderManager.height) + self.parent.renderManager.width, + self.parent.renderManager.height) else: - image = self.parent.RenderManager.image_manager. \ + image = self.parent.renderManager.image_manager. \ get_image(frame[u'title']) label.setPixmap(QtGui.QPixmap.fromImage(image)) self.PreviewListWidget.setCellWidget(framenumber, 0, label) - slideHeight = width * self.parent.RenderManager.screen_ratio + slideHeight = width * self.parent.renderManager.screen_ratio row += 1 text.append(unicode(row)) self.PreviewListWidget.setItem(framenumber, 0, item) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index cc52abafc..b091427bf 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -55,30 +55,34 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.setupUi(self) self.registerFields() self.accepted = False + self.updateThemeAllowed = True QtCore.QObject.connect(self.backgroundTypeComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onBackgroundComboBox) QtCore.QObject.connect(self.gradientComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onGradientComboBox) - QtCore.QObject.connect(self.color1PushButton, + QtCore.QObject.connect(self.colorButton, QtCore.SIGNAL(u'pressed()'), - self.onColor1PushButtonClicked) - QtCore.QObject.connect(self.color2PushButton, + self.onColorButtonClicked) + QtCore.QObject.connect(self.gradientStartButton, QtCore.SIGNAL(u'pressed()'), - self.onColor2PushButtonClicked) + self.onGradientStartButtonClicked) + QtCore.QObject.connect(self.gradientEndButton, + QtCore.SIGNAL(u'pressed()'), + self.onGradientEndButtonClicked) QtCore.QObject.connect(self.imageBrowseButton, QtCore.SIGNAL(u'pressed()'), - self.onImageBrowseButtonClicked) + self.onImageBrowseButtonClicked) QtCore.QObject.connect(self.mainColorPushButton, QtCore.SIGNAL(u'pressed()'), - self.onMainColourPushButtonClicked) + self.onMainColourPushButtonClicked) QtCore.QObject.connect(self.outlineColorPushButton, QtCore.SIGNAL(u'pressed()'), - self.onOutlineColourPushButtonClicked) + self.onOutlineColourPushButtonClicked) QtCore.QObject.connect(self.shadowColorPushButton, QtCore.SIGNAL(u'pressed()'), - self.onShadowColourPushButtonClicked) + self.onShadowColourPushButtonClicked) QtCore.QObject.connect(self.outlineCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckCheckBoxChanged) @@ -157,15 +161,15 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.backgroundPage.registerField( u'background_type', self.backgroundTypeComboBox) self.backgroundPage.registerField( - u'color_1', self.color1PushButton) + u'color', self.colorButton) self.backgroundPage.registerField( - u'color_2', self.color2PushButton) + u'grandient_start', self.gradientStartButton) + self.backgroundPage.registerField( + u'grandient_end', self.gradientEndButton) self.backgroundPage.registerField( u'background_image', self.imageLineEdit) self.backgroundPage.registerField( u'gradient', self.gradientComboBox) - self.mainAreaPage.registerField( - u'mainFontComboBox', self.mainFontComboBox) self.mainAreaPage.registerField( u'mainColorPushButton', self.mainColorPushButton) self.mainAreaPage.registerField( @@ -281,11 +285,15 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.footerHeightSpinBox.setEnabled(self.theme.font_footer_override) self.footerWidthSpinBox.setEnabled(self.theme.font_footer_override) - def exec_(self): + def exec_(self, edit=False): """ Run the wizard. """ + self.updateThemeAllowed = False self.setDefaults() + self.updateThemeAllowed = True + if edit: + self.next() return QtGui.QWizard.exec_(self) def initializePage(self, id): @@ -311,54 +319,19 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ if self.theme.background_type == \ BackgroundType.to_string(BackgroundType.Solid): - self.setField(u'background_type', QtCore.QVariant(0)) - self.color1PushButton.setVisible(True) - self.color1Label.setVisible(True) - self.color1PushButton.setStyleSheet(u'background-color: %s' % + self.colorButton.setStyleSheet(u'background-color: %s' % self.theme.background_color) - self.color1Label.setText( - translate('OpenLP.ThemeForm', 'Color:')) - self.color2PushButton.setVisible(False) - self.color2Label.setVisible(False) - self.gradientLabel.setVisible(False) - self.gradientComboBox.setVisible(False) - self.imageLabel.setVisible(False) - self.imageLineEdit.setVisible(False) - self.imageBrowseButton.setVisible(False) - self.imageLineEdit.setText(u'') + self.setField(u'background_type', QtCore.QVariant(0)) elif self.theme.background_type == \ BackgroundType.to_string(BackgroundType.Gradient): - self.setField(u'background_type', QtCore.QVariant(1)) - self.color1PushButton.setVisible(True) - self.color1Label.setVisible(True) - self.color1PushButton.setStyleSheet(u'background-color: %s' % + self.gradientStartButton.setStyleSheet(u'background-color: %s' % self.theme.background_start_color) - self.color1Label.setText( - translate('OpenLP.ThemeForm', 'First color:')) - self.color2PushButton.setVisible(True) - self.color2Label.setVisible(True) - self.color2PushButton.setStyleSheet(u'background-color: %s' % + self.gradientEndButton.setStyleSheet(u'background-color: %s' % self.theme.background_end_color) - self.color2Label.setText( - translate('OpenLP.ThemeForm', 'Second color:')) - self.gradientLabel.setVisible(True) - self.gradientComboBox.setVisible(True) - self.imageLabel.setVisible(False) - self.imageLineEdit.setVisible(False) - self.imageBrowseButton.setVisible(False) - self.imageLineEdit.setText(u'') + self.setField(u'background_type', QtCore.QVariant(1)) else: - self.setField(u'background_type', QtCore.QVariant(2)) - self.color1PushButton.setVisible(False) - self.color1Label.setVisible(False) - self.color2PushButton.setVisible(False) - self.color2Label.setVisible(False) - self.gradientLabel.setVisible(False) - self.gradientComboBox.setVisible(False) - self.imageLineEdit.setVisible(True) - self.imageLabel.setVisible(True) - self.imageBrowseButton.setVisible(True) self.imageLineEdit.setText(self.theme.background_filename) + self.setField(u'background_type', QtCore.QVariant(2)) if self.theme.background_direction == \ BackgroundGradientType.to_string(BackgroundGradientType.Horizontal): self.setField(u'gradient', QtCore.QVariant(0)) @@ -491,20 +464,23 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): BackgroundGradientType.to_string(index) self.setBackgroundTabValues() - def onColor1PushButtonClicked(self): + def onColorButtonClicked(self): """ Background / Gradient 1 Color button pushed. """ - if self.theme.background_type == \ - BackgroundType.to_string(BackgroundType.Solid): - self.theme.background_color = \ - self._colorButton(self.theme.background_color) - else: - self.theme.background_start_color = \ - self._colorButton(self.theme.background_start_color) + self.theme.background_color = \ + self._colorButton(self.theme.background_color) self.setBackgroundTabValues() - def onColor2PushButtonClicked(self): + def onGradientStartButtonClicked(self): + """ + Gradient 2 Color button pushed. + """ + self.theme.background_start_color = \ + self._colorButton(self.theme.background_start_color) + self.setBackgroundTabValues() + + def onGradientEndButtonClicked(self): """ Gradient 2 Color button pushed. """ @@ -526,12 +502,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.theme.background_filename = unicode(filename) self.setBackgroundTabValues() - def onMainFontComboBox(self): - """ - Main Font Combo box changed - """ - self.theme.font_main_name = self.mainFontComboBox.currentFont().family() - def onMainColourPushButtonClicked(self): self.theme.font_main_color = \ self._colorButton(self.theme.font_main_color) @@ -557,6 +527,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): Update the theme object from the UI for fields not already updated when the are changed. """ + if not self.updateThemeAllowed: + return log.debug(u'updateTheme') # main page self.theme.font_main_name = \ @@ -606,7 +578,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): # Hack to stop it for now. if self.accepted: return - self.accepted = True # Save the theme name self.theme.theme_name = \ unicode(self.field(u'name').toString()) @@ -628,6 +599,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): (QtGui.QMessageBox.Ok), QtGui.QMessageBox.Ok) return + self.accepted = True saveFrom = None saveTo = None if self.theme.background_type == \ @@ -646,5 +618,5 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): new_color = QtGui.QColorDialog.getColor( QtGui.QColor(field), self) if new_color.isValid(): - field = new_color.name() + field = new_color.name() return field diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 65913a9f6..da8597cc0 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -280,7 +280,7 @@ class ThemeManager(QtGui.QWidget): self.saveThemeName = unicode( item.data(QtCore.Qt.UserRole).toString()) self.themeForm.theme = theme - self.themeForm.exec_() + self.themeForm.exec_(True) def onDeleteTheme(self): """ @@ -627,7 +627,8 @@ class ThemeManager(QtGui.QWidget): newtheme.font_main_shadow_color = unicode(theme.ShadowColor.name()) if theme.Outline == 1: newtheme.font_main_outline = True - newtheme.font_main_outline_color = unicode(theme.OutlineColor.name()) + newtheme.font_main_outline_color = \ + unicode(theme.OutlineColor.name()) vAlignCorrection = 0 if theme.VerticalAlign == 2: vAlignCorrection = 1 @@ -749,7 +750,7 @@ class ThemeManager(QtGui.QWidget): Flag to tell message lines per page need to be generated. """ log.debug(u'generateImage \n%s ', themeData) - return self.parent.RenderManager.generate_preview(themeData, forcePage) + return self.parent.renderManager.generate_preview(themeData, forcePage) def getPreviewImage(self, theme): """ diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 853865bb5..294d521dc 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -153,7 +153,7 @@ class ThemesTab(SettingsTab): settings.setValue(u'global theme', QtCore.QVariant(self.global_theme)) settings.endGroup() - self.parent.RenderManager.set_global_theme( + self.parent.renderManager.set_global_theme( self.global_theme, self.theme_level) Receiver.send_message(u'theme_update_global', self.global_theme) @@ -171,7 +171,7 @@ class ThemesTab(SettingsTab): def onDefaultComboBoxChanged(self, value): self.global_theme = unicode(self.DefaultComboBox.currentText()) - self.parent.RenderManager.set_global_theme( + self.parent.renderManager.set_global_theme( self.global_theme, self.theme_level) image = self.parent.ThemeManagerContents.getPreviewImage( self.global_theme) @@ -183,9 +183,14 @@ class ThemesTab(SettingsTab): def updateThemeList(self, theme_list): """ - Called from ThemeManager when the Themes have changed + Called from ThemeManager when the Themes have changed. + + ``theme_list`` + The list of available themes:: + + [u'Bible Theme', u'Song Theme'] """ - #reload as may have been triggered by the ThemeManager + # Reload as may have been triggered by the ThemeManager. self.global_theme = unicode(QtCore.QSettings().value( self.settingsSection + u'/global theme', QtCore.QVariant(u'')).toString()) @@ -198,7 +203,7 @@ class ThemesTab(SettingsTab): id = 0 # Not Found self.global_theme = u'' self.DefaultComboBox.setCurrentIndex(id) - self.parent.RenderManager.set_global_theme( + self.parent.renderManager.set_global_theme( self.global_theme, self.theme_level) if self.global_theme is not u'': image = self.parent.ThemeManagerContents.getPreviewImage( diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index b3af9df98..234c9de5e 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -30,135 +30,216 @@ from openlp.core.lib import translate, build_icon class Ui_ThemeWizard(object): def setupUi(self, ThemeWizard): - ThemeWizard.setObjectName(u'ThemeWizard') + ThemeWizard.setObjectName(u'OpenLP.ThemeWizard') ThemeWizard.resize(550, 386) ThemeWizard.setModal(True) ThemeWizard.setWizardStyle(QtGui.QWizard.ModernStyle) - ThemeWizard.setOptions(QtGui.QWizard.IndependentPages|QtGui.QWizard.NoBackButtonOnStartPage) + ThemeWizard.setOptions( + QtGui.QWizard.IndependentPages | + QtGui.QWizard.NoBackButtonOnStartPage) self.welcomePage = QtGui.QWizardPage() self.welcomePage.setTitle(u'') self.welcomePage.setSubTitle(u'') self.welcomePage.setObjectName(u'welcomePage') + self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, + QtGui.QPixmap(u':/wizards/wizard_createtheme.bmp')) self.welcomeLayout = QtGui.QHBoxLayout(self.welcomePage) self.welcomeLayout.setSpacing(8) self.welcomeLayout.setMargin(0) self.welcomeLayout.setObjectName(u'welcomeLayout') - self.importBibleImage = QtGui.QLabel(self.welcomePage) - self.importBibleImage.setMinimumSize(QtCore.QSize(163, 0)) - self.importBibleImage.setMaximumSize(QtCore.QSize(163, 16777215)) - self.importBibleImage.setLineWidth(0) - self.importBibleImage.setText(u'') - self.importBibleImage.setPixmap(QtGui.QPixmap(u':/wizards/wizard_importbible.bmp')) - self.importBibleImage.setIndent(0) - self.importBibleImage.setObjectName(u'importBibleImage') - self.welcomeLayout.addWidget(self.importBibleImage) self.welcomePageLayout = QtGui.QVBoxLayout() self.welcomePageLayout.setSpacing(8) self.welcomePageLayout.setObjectName(u'welcomePageLayout') self.titleLabel = QtGui.QLabel(self.welcomePage) self.titleLabel.setObjectName(u'titleLabel') self.welcomePageLayout.addWidget(self.titleLabel) - spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.welcomePageLayout.addItem(spacerItem) + self.welcomeTopSpacer = QtGui.QSpacerItem(20, 40, + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.welcomePageLayout.addItem(self.welcomeTopSpacer) self.informationLabel = QtGui.QLabel(self.welcomePage) self.informationLabel.setWordWrap(True) self.informationLabel.setMargin(10) self.informationLabel.setObjectName(u'informationLabel') self.welcomePageLayout.addWidget(self.informationLabel) - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.welcomePageLayout.addItem(spacerItem1) + self.welcomeBottomSpacer = QtGui.QSpacerItem(20, 40, + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.welcomePageLayout.addItem(self.welcomeBottomSpacer) self.welcomeLayout.addLayout(self.welcomePageLayout) ThemeWizard.addPage(self.welcomePage) self.backgroundPage = QtGui.QWizardPage() self.backgroundPage.setObjectName(u'backgroundPage') - self.backgroundLayout = QtGui.QFormLayout(self.backgroundPage) - self.backgroundLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) - self.backgroundLayout.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.backgroundLayout.setMargin(20) + self.backgroundLayout = QtGui.QVBoxLayout(self.backgroundPage) self.backgroundLayout.setSpacing(8) + self.backgroundLayout.setMargin(20) self.backgroundLayout.setObjectName(u'backgroundLayout') + self.backgroundTypeLayout = QtGui.QHBoxLayout() + self.backgroundTypeLayout.setSpacing(8) + self.backgroundTypeLayout.setObjectName(u'backgroundTypeLayout') self.backgroundTypeLabel = QtGui.QLabel(self.backgroundPage) self.backgroundTypeLabel.setObjectName(u'backgroundTypeLabel') - self.backgroundLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.backgroundTypeLabel) + self.backgroundTypeLayout.addWidget(self.backgroundTypeLabel) self.backgroundTypeComboBox = QtGui.QComboBox(self.backgroundPage) self.backgroundTypeComboBox.setObjectName(u'backgroundTypeComboBox') self.backgroundTypeComboBox.addItem(u'') self.backgroundTypeComboBox.addItem(u'') self.backgroundTypeComboBox.addItem(u'') - self.backgroundLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.backgroundTypeComboBox) - self.color1Label = QtGui.QLabel(self.backgroundPage) - self.color1Label.setObjectName(u'color1Label') - self.backgroundLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.color1Label) - self.color1PushButton = QtGui.QPushButton(self.backgroundPage) - self.color1PushButton.setText(u'') - self.color1PushButton.setObjectName(u'color1PushButton') - self.backgroundLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.color1PushButton) - self.color2Label = QtGui.QLabel(self.backgroundPage) - self.color2Label.setObjectName(u'color2Label') - self.backgroundLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.color2Label) - self.color2PushButton = QtGui.QPushButton(self.backgroundPage) - self.color2PushButton.setText(u'') - self.color2PushButton.setObjectName(u'color2PushButton') - self.backgroundLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.color2PushButton) - self.imageLabel = QtGui.QLabel(self.backgroundPage) - self.imageLabel.setObjectName(u'imageLabel') - self.backgroundLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.imageLabel) - self.imageLayout = QtGui.QHBoxLayout() - self.imageLayout.setSpacing(8) - self.imageLayout.setObjectName(u'imageLayout') - self.imageLineEdit = QtGui.QLineEdit(self.backgroundPage) - self.imageLineEdit.setObjectName(u'imageLineEdit') - self.imageLayout.addWidget(self.imageLineEdit) - self.imageBrowseButton = QtGui.QToolButton(self.backgroundPage) - self.imageBrowseButton.setText(u'') - self.imageBrowseButton.setIcon(build_icon(u':/general/general_open.png')) - self.imageBrowseButton.setObjectName(u'imageBrowseButton') - self.imageLayout.addWidget(self.imageBrowseButton) - self.backgroundLayout.setLayout(3, QtGui.QFormLayout.FieldRole, self.imageLayout) - self.gradientLabel = QtGui.QLabel(self.backgroundPage) - self.gradientLabel.setObjectName(u'gradientLabel') - self.backgroundLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.gradientLabel) - self.gradientComboBox = QtGui.QComboBox(self.backgroundPage) + self.backgroundTypeLayout.addWidget(self.backgroundTypeComboBox) + self.backgroundTypeSpacer = QtGui.QSpacerItem(40, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.backgroundTypeLayout.addItem(self.backgroundTypeSpacer) + self.backgroundLayout.addLayout(self.backgroundTypeLayout) + self.backgroundStackedWidget = QtGui.QStackedWidget( + self.backgroundPage) + self.backgroundStackedWidget.setObjectName(u'backgroundStackedWidget') + self.colorPage = QtGui.QWidget() + self.colorPage.setObjectName(u'colorPage') + self.colorLayout = QtGui.QFormLayout(self.colorPage) + self.colorLayout.setMargin(0) + self.colorLayout.setSpacing(8) + self.colorLayout.setObjectName(u'colorLayout') + self.colorLabel = QtGui.QLabel(self.colorPage) + self.colorLabel.setMinimumSize(QtCore.QSize(103, 0)) + self.colorLabel.setAlignment(QtCore.Qt.AlignRight | + QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.colorLabel.setObjectName(u'colorLabel') + self.colorLayout.setWidget(0, + QtGui.QFormLayout.LabelRole, self.colorLabel) + self.colorButton = QtGui.QPushButton(self.colorPage) + self.colorButton.setText(u'') + self.colorButton.setObjectName(u'colorButton') + self.colorLayout.setWidget(0, + QtGui.QFormLayout.FieldRole, self.colorButton) + self.backgroundStackedWidget.addWidget(self.colorPage) + self.gradientPage = QtGui.QWidget() + self.gradientPage.setObjectName(u'gradientPage') + self.gradientLayout = QtGui.QFormLayout(self.gradientPage) + self.gradientLayout.setMargin(0) + self.gradientLayout.setSpacing(8) + self.gradientLayout.setObjectName(u'gradientLayout') + self.gradientStartLabel = QtGui.QLabel(self.gradientPage) + self.gradientStartLabel.setMinimumSize(QtCore.QSize(103, 0)) + self.gradientStartLabel.setAlignment(QtCore.Qt.AlignRight | + QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.gradientStartLabel.setObjectName(u'gradientStartLabel') + self.gradientLayout.setWidget(0, + QtGui.QFormLayout.LabelRole, self.gradientStartLabel) + self.gradientStartButton = QtGui.QPushButton(self.gradientPage) + self.gradientStartButton.setText(u'') + self.gradientStartButton.setObjectName(u'gradientStartButton') + self.gradientLayout.setWidget(0, + QtGui.QFormLayout.FieldRole, self.gradientStartButton) + self.gradientEndLabel = QtGui.QLabel(self.gradientPage) + self.gradientEndLabel.setMinimumSize(QtCore.QSize(103, 0)) + self.gradientEndLabel.setAlignment(QtCore.Qt.AlignRight | + QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.gradientEndLabel.setObjectName(u'gradientEndLabel') + self.gradientLayout.setWidget(1, + QtGui.QFormLayout.LabelRole, self.gradientEndLabel) + self.gradientEndButton = QtGui.QPushButton(self.gradientPage) + self.gradientEndButton.setText(u'') + self.gradientEndButton.setObjectName(u'gradientEndButton') + self.gradientLayout.setWidget(1, + QtGui.QFormLayout.FieldRole, self.gradientEndButton) + self.gradientTypeLabel = QtGui.QLabel(self.gradientPage) + self.gradientTypeLabel.setMinimumSize(QtCore.QSize(103, 0)) + self.gradientTypeLabel.setAlignment(QtCore.Qt.AlignRight | + QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.gradientTypeLabel.setObjectName(u'gradientTypeLabel') + self.gradientLayout.setWidget(2, + QtGui.QFormLayout.LabelRole, self.gradientTypeLabel) + self.gradientComboBox = QtGui.QComboBox(self.gradientPage) self.gradientComboBox.setObjectName(u'gradientComboBox') self.gradientComboBox.addItem(u'') self.gradientComboBox.addItem(u'') self.gradientComboBox.addItem(u'') self.gradientComboBox.addItem(u'') self.gradientComboBox.addItem(u'') - self.backgroundLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.gradientComboBox) + self.gradientLayout.setWidget(2, + QtGui.QFormLayout.FieldRole, self.gradientComboBox) + self.backgroundStackedWidget.addWidget(self.gradientPage) + self.imagePage = QtGui.QWidget() + self.imagePage.setObjectName(u'imagePage') + self.imageLayout = QtGui.QFormLayout(self.imagePage) + self.imageLayout.setMargin(0) + self.imageLayout.setSpacing(8) + self.imageLayout.setObjectName(u'imageLayout') + self.imageLabel = QtGui.QLabel(self.imagePage) + self.imageLabel.setMinimumSize(QtCore.QSize(103, 0)) + self.imageLabel.setAlignment(QtCore.Qt.AlignRight | + QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) + self.imageLabel.setObjectName(u'imageLabel') + self.imageLayout.setWidget(0, + QtGui.QFormLayout.LabelRole, self.imageLabel) + self.imageFileLayout = QtGui.QHBoxLayout() + self.imageFileLayout.setSpacing(8) + self.imageFileLayout.setObjectName(u'imageFileLayout') + self.imageLineEdit = QtGui.QLineEdit(self.imagePage) + self.imageLineEdit.setObjectName(u'imageLineEdit') + self.imageFileLayout.addWidget(self.imageLineEdit) + self.imageBrowseButton = QtGui.QToolButton(self.imagePage) + self.imageBrowseButton.setText(u'') + self.imageBrowseButton.setIcon( + build_icon(u':/general/general_open.png')) + self.imageBrowseButton.setObjectName(u'imageBrowseButton') + self.imageFileLayout.addWidget(self.imageBrowseButton) + self.imageLayout.setLayout(0, + QtGui.QFormLayout.FieldRole, self.imageFileLayout) + self.backgroundStackedWidget.addWidget(self.imagePage) + self.backgroundLayout.addWidget(self.backgroundStackedWidget) ThemeWizard.addPage(self.backgroundPage) self.mainAreaPage = QtGui.QWizardPage() self.mainAreaPage.setObjectName(u'mainAreaPage') - self.formLayout = QtGui.QFormLayout(self.mainAreaPage) - self.formLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.formLayout.setContentsMargins(-1, 20, 20, 20) - self.formLayout.setSpacing(8) - self.formLayout.setObjectName(u'formLayout') + self.mainAreaLayout = QtGui.QFormLayout(self.mainAreaPage) + self.mainAreaLayout.setFormAlignment(QtCore.Qt.AlignLeading | + QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) + self.mainAreaLayout.setMargin(20) + self.mainAreaLayout.setSpacing(8) + self.mainAreaLayout.setObjectName(u'mainAreaLayout') self.mainFontLabel = QtGui.QLabel(self.mainAreaPage) + self.mainFontLabel.setMinimumSize(QtCore.QSize(103, 0)) + self.mainFontLabel.setAlignment(QtCore.Qt.AlignRight | + QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.mainFontLabel.setObjectName(u'mainFontLabel') - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.mainFontLabel) + self.mainAreaLayout.setWidget(0, + QtGui.QFormLayout.LabelRole, self.mainFontLabel) self.mainFontComboBox = QtGui.QFontComboBox(self.mainAreaPage) self.mainFontComboBox.setObjectName(u'mainFontComboBox') - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.mainFontComboBox) + self.mainAreaLayout.setWidget(0, + QtGui.QFormLayout.FieldRole, self.mainFontComboBox) self.mainColorLabel = QtGui.QLabel(self.mainAreaPage) self.mainColorLabel.setObjectName(u'mainColorLabel') - self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.mainColorLabel) + self.mainAreaLayout.setWidget(1, + QtGui.QFormLayout.LabelRole, self.mainColorLabel) + self.fontPropertiesLayout = QtGui.QHBoxLayout() + self.fontPropertiesLayout.setSpacing(24) + self.fontPropertiesLayout.setObjectName(u'fontPropertiesLayout') self.mainColorPushButton = QtGui.QPushButton(self.mainAreaPage) self.mainColorPushButton.setText(u'') self.mainColorPushButton.setObjectName(u'mainColorPushButton') - self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.mainColorPushButton) + self.fontPropertiesLayout.addWidget(self.mainColorPushButton) + self.boldCheckBox = QtGui.QCheckBox(self.mainAreaPage) + self.boldCheckBox.setObjectName(u'boldCheckBox') + self.fontPropertiesLayout.addWidget(self.boldCheckBox) + self.italicsCheckBox = QtGui.QCheckBox(self.mainAreaPage) + self.italicsCheckBox.setObjectName(u'italicsCheckBox') + self.fontPropertiesLayout.addWidget(self.italicsCheckBox) + self.mainAreaLayout.setLayout(1, + QtGui.QFormLayout.FieldRole, self.fontPropertiesLayout) self.mainSizeLabel = QtGui.QLabel(self.mainAreaPage) self.mainSizeLabel.setObjectName(u'mainSizeLabel') - self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.mainSizeLabel) + self.mainAreaLayout.setWidget(2, + QtGui.QFormLayout.LabelRole, self.mainSizeLabel) self.mainSizeLayout = QtGui.QHBoxLayout() self.mainSizeLayout.setSpacing(8) self.mainSizeLayout.setMargin(0) self.mainSizeLayout.setObjectName(u'mainSizeLayout') self.mainSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.mainSizeSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.mainSizeSpinBox.sizePolicy().hasHeightForWidth()) self.mainSizeSpinBox.setSizePolicy(sizePolicy) self.mainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) self.mainSizeSpinBox.setMaximum(999) @@ -168,18 +249,22 @@ class Ui_ThemeWizard(object): self.mainLineCountLabel = QtGui.QLabel(self.mainAreaPage) self.mainLineCountLabel.setObjectName(u'mainLineCountLabel') self.mainSizeLayout.addWidget(self.mainLineCountLabel) - self.formLayout.setLayout(2, QtGui.QFormLayout.FieldRole, self.mainSizeLayout) + self.mainAreaLayout.setLayout(2, + QtGui.QFormLayout.FieldRole, self.mainSizeLayout) self.lineSpacingLabel = QtGui.QLabel(self.mainAreaPage) self.lineSpacingLabel.setObjectName(u'lineSpacingLabel') - self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lineSpacingLabel) + self.mainAreaLayout.setWidget(3, + QtGui.QFormLayout.LabelRole, self.lineSpacingLabel) self.lineSpacingSpinBox = QtGui.QSpinBox(self.mainAreaPage) self.lineSpacingSpinBox.setMinimum(-50) self.lineSpacingSpinBox.setMaximum(50) self.lineSpacingSpinBox.setObjectName(u'lineSpacingSpinBox') - self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lineSpacingSpinBox) + self.mainAreaLayout.setWidget(3, + QtGui.QFormLayout.FieldRole, self.lineSpacingSpinBox) self.outlineCheckBox = QtGui.QCheckBox(self.mainAreaPage) self.outlineCheckBox.setObjectName(u'outlineCheckBox') - self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.outlineCheckBox) + self.mainAreaLayout.setWidget(4, + QtGui.QFormLayout.LabelRole, self.outlineCheckBox) self.outlineLayout = QtGui.QHBoxLayout() self.outlineLayout.setObjectName(u'outlineLayout') self.outlineColorPushButton = QtGui.QPushButton(self.mainAreaPage) @@ -193,10 +278,12 @@ class Ui_ThemeWizard(object): self.outlineSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage) self.outlineSizeSpinBox.setObjectName(u'outlineSizeSpinBox') self.outlineLayout.addWidget(self.outlineSizeSpinBox) - self.formLayout.setLayout(4, QtGui.QFormLayout.FieldRole, self.outlineLayout) + self.mainAreaLayout.setLayout(4, + QtGui.QFormLayout.FieldRole, self.outlineLayout) self.shadowCheckBox = QtGui.QCheckBox(self.mainAreaPage) self.shadowCheckBox.setObjectName(u'shadowCheckBox') - self.formLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.shadowCheckBox) + self.mainAreaLayout.setWidget(5, + QtGui.QFormLayout.LabelRole, self.shadowCheckBox) self.shadowLayout = QtGui.QHBoxLayout() self.shadowLayout.setObjectName(u'shadowLayout') self.shadowColorPushButton = QtGui.QPushButton(self.mainAreaPage) @@ -210,83 +297,99 @@ class Ui_ThemeWizard(object): self.shadowSizeSpinBox = QtGui.QSpinBox(self.mainAreaPage) self.shadowSizeSpinBox.setObjectName(u'shadowSizeSpinBox') self.shadowLayout.addWidget(self.shadowSizeSpinBox) - self.formLayout.setLayout(5, QtGui.QFormLayout.FieldRole, self.shadowLayout) - self.boldCheckBox = QtGui.QCheckBox(self.mainAreaPage) - self.boldCheckBox.setObjectName(u'boldCheckBox') - self.formLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.boldCheckBox) - self.italicsCheckBox = QtGui.QCheckBox(self.mainAreaPage) - self.italicsCheckBox.setObjectName(u'italicsCheckBox') - self.formLayout.setWidget(7, QtGui.QFormLayout.FieldRole, self.italicsCheckBox) + self.mainAreaLayout.setLayout(5, + QtGui.QFormLayout.FieldRole, self.shadowLayout) ThemeWizard.addPage(self.mainAreaPage) self.footerAreaPage = QtGui.QWizardPage() self.footerAreaPage.setObjectName(u'footerAreaPage') self.footerLayout = QtGui.QFormLayout(self.footerAreaPage) - self.footerLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) - self.footerLayout.setContentsMargins(50, 20, 20, 20) + self.footerLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.ExpandingFieldsGrow) + self.footerLayout.setMargin(20) self.footerLayout.setSpacing(8) self.footerLayout.setObjectName(u'footerLayout') self.footerFontLabel = QtGui.QLabel(self.footerAreaPage) + self.footerFontLabel.setMinimumSize(QtCore.QSize(103, 0)) + self.footerFontLabel.setAlignment(QtCore.Qt.AlignRight | + QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.footerFontLabel.setObjectName(u'footerFontLabel') - self.footerLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.footerFontLabel) + self.footerLayout.setWidget(0, + QtGui.QFormLayout.LabelRole, self.footerFontLabel) self.footerFontComboBox = QtGui.QFontComboBox(self.footerAreaPage) self.footerFontComboBox.setObjectName(u'footerFontComboBox') - self.footerLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.footerFontComboBox) + self.footerLayout.setWidget(0, + QtGui.QFormLayout.FieldRole, self.footerFontComboBox) self.footerColorLabel = QtGui.QLabel(self.footerAreaPage) self.footerColorLabel.setObjectName(u'footerColorLabel') - self.footerLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.footerColorLabel) + self.footerLayout.setWidget(1, + QtGui.QFormLayout.LabelRole, self.footerColorLabel) self.footerColorPushButton = QtGui.QPushButton(self.footerAreaPage) self.footerColorPushButton.setText(u'') self.footerColorPushButton.setObjectName(u'footerColorPushButton') - self.footerLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.footerColorPushButton) + self.footerLayout.setWidget(1, + QtGui.QFormLayout.FieldRole, self.footerColorPushButton) self.footerSizeLabel = QtGui.QLabel(self.footerAreaPage) self.footerSizeLabel.setObjectName(u'footerSizeLabel') - self.footerLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.footerSizeLabel) + self.footerLayout.setWidget(2, + QtGui.QFormLayout.LabelRole, self.footerSizeLabel) self.footerSizeSpinBox = QtGui.QSpinBox(self.footerAreaPage) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.footerSizeSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.footerSizeSpinBox.sizePolicy().hasHeightForWidth()) self.footerSizeSpinBox.setSizePolicy(sizePolicy) self.footerSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) self.footerSizeSpinBox.setMaximum(999) self.footerSizeSpinBox.setProperty(u'value', 10) self.footerSizeSpinBox.setObjectName(u'footerSizeSpinBox') - self.footerLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.footerSizeSpinBox) + self.footerLayout.setWidget(2, + QtGui.QFormLayout.FieldRole, self.footerSizeSpinBox) ThemeWizard.addPage(self.footerAreaPage) self.alignmentPage = QtGui.QWizardPage() self.alignmentPage.setObjectName(u'alignmentPage') - self.formLayout_2 = QtGui.QFormLayout(self.alignmentPage) - self.formLayout_2.setMargin(20) - self.formLayout_2.setObjectName(u'formLayout_2') + self.alignmentLayout = QtGui.QFormLayout(self.alignmentPage) + self.alignmentLayout.setMargin(20) + self.alignmentLayout.setSpacing(8) + self.alignmentLayout.setObjectName(u'alignmentLayout') self.horizontalLabel = QtGui.QLabel(self.alignmentPage) + self.horizontalLabel.setMinimumSize(QtCore.QSize(103, 0)) + self.horizontalLabel.setAlignment(QtCore.Qt.AlignRight | + QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.horizontalLabel.setObjectName(u'horizontalLabel') - self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.horizontalLabel) + self.alignmentLayout.setWidget(0, + QtGui.QFormLayout.LabelRole, self.horizontalLabel) self.horizontalComboBox = QtGui.QComboBox(self.alignmentPage) self.horizontalComboBox.setEditable(False) self.horizontalComboBox.setObjectName(u'horizontalComboBox') self.horizontalComboBox.addItem(u'') self.horizontalComboBox.addItem(u'') self.horizontalComboBox.addItem(u'') - self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.horizontalComboBox) + self.alignmentLayout.setWidget(0, + QtGui.QFormLayout.FieldRole, self.horizontalComboBox) self.verticalLabel = QtGui.QLabel(self.alignmentPage) self.verticalLabel.setObjectName(u'verticalLabel') - self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.verticalLabel) + self.alignmentLayout.setWidget(1, + QtGui.QFormLayout.LabelRole, self.verticalLabel) self.verticalComboBox = QtGui.QComboBox(self.alignmentPage) self.verticalComboBox.setObjectName(u'verticalComboBox') self.verticalComboBox.addItem(u'') self.verticalComboBox.addItem(u'') self.verticalComboBox.addItem(u'') - self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.verticalComboBox) + self.alignmentLayout.setWidget(1, + QtGui.QFormLayout.FieldRole, self.verticalComboBox) self.transitionsCheckBox = QtGui.QCheckBox(self.alignmentPage) self.transitionsCheckBox.setObjectName(u'transitionsCheckBox') - self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.transitionsCheckBox) + self.alignmentLayout.setWidget(2, + QtGui.QFormLayout.FieldRole, self.transitionsCheckBox) ThemeWizard.addPage(self.alignmentPage) self.areaPositionPage = QtGui.QWizardPage() self.areaPositionPage.setObjectName(u'areaPositionPage') - self.gridLayout_2 = QtGui.QGridLayout(self.areaPositionPage) - self.gridLayout_2.setMargin(20) - self.gridLayout_2.setSpacing(8) - self.gridLayout_2.setObjectName(u'gridLayout_2') + self.areaPositionLayout = QtGui.QGridLayout(self.areaPositionPage) + self.areaPositionLayout.setMargin(20) + self.areaPositionLayout.setSpacing(8) + self.areaPositionLayout.setObjectName(u'areaPositionLayout') self.mainPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage) self.mainPositionGroupBox.setMinimumSize(QtCore.QSize(248, 0)) self.mainPositionGroupBox.setObjectName(u'mainPositionGroupBox') @@ -294,254 +397,361 @@ class Ui_ThemeWizard(object): self.mainPositionLayout.setMargin(8) self.mainPositionLayout.setSpacing(8) self.mainPositionLayout.setObjectName(u'mainPositionLayout') - self.mainDefaultPositionCheckBox = QtGui.QCheckBox(self.mainPositionGroupBox) + self.mainDefaultPositionCheckBox = QtGui.QCheckBox( + self.mainPositionGroupBox) self.mainDefaultPositionCheckBox.setChecked(True) self.mainDefaultPositionCheckBox.setTristate(False) - self.mainDefaultPositionCheckBox.setObjectName(u'mainDefaultPositionCheckBox') - self.mainPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.mainDefaultPositionCheckBox) + self.mainDefaultPositionCheckBox.setObjectName( + u'mainDefaultPositionCheckBox') + self.mainPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.mainDefaultPositionCheckBox) self.nainXLabel = QtGui.QLabel(self.mainPositionGroupBox) self.nainXLabel.setObjectName(u'nainXLabel') - self.mainPositionLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.nainXLabel) + self.mainPositionLayout.setWidget(1, + QtGui.QFormLayout.LabelRole, self.nainXLabel) self.mainXSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox) self.mainXSpinBox.setEnabled(False) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.mainXSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.mainXSpinBox.sizePolicy().hasHeightForWidth()) self.mainXSpinBox.setSizePolicy(sizePolicy) self.mainXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.mainXSpinBox.setMaximum(9999) self.mainXSpinBox.setProperty(u'value', 0) self.mainXSpinBox.setObjectName(u'mainXSpinBox') - self.mainPositionLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.mainXSpinBox) + self.mainPositionLayout.setWidget(1, + QtGui.QFormLayout.FieldRole, self.mainXSpinBox) self.mainYSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox) self.mainYSpinBox.setEnabled(False) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.mainYSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.mainYSpinBox.sizePolicy().hasHeightForWidth()) self.mainYSpinBox.setSizePolicy(sizePolicy) self.mainYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.mainYSpinBox.setMaximum(9999) self.mainYSpinBox.setObjectName(u'mainYSpinBox') - self.mainPositionLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.mainYSpinBox) + self.mainPositionLayout.setWidget(2, + QtGui.QFormLayout.FieldRole, self.mainYSpinBox) self.mainYLabel = QtGui.QLabel(self.mainPositionGroupBox) self.mainYLabel.setObjectName(u'mainYLabel') - self.mainPositionLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.mainYLabel) + self.mainPositionLayout.setWidget(2, + QtGui.QFormLayout.LabelRole, self.mainYLabel) self.mainWidthSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox) self.mainWidthSpinBox.setEnabled(False) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.mainWidthSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.mainWidthSpinBox.sizePolicy().hasHeightForWidth()) self.mainWidthSpinBox.setSizePolicy(sizePolicy) self.mainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.mainWidthSpinBox.setMaximum(9999) self.mainWidthSpinBox.setObjectName(u'mainWidthSpinBox') - self.mainPositionLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.mainWidthSpinBox) + self.mainPositionLayout.setWidget(3, + QtGui.QFormLayout.FieldRole, self.mainWidthSpinBox) self.mainWidthLabel = QtGui.QLabel(self.mainPositionGroupBox) self.mainWidthLabel.setObjectName(u'mainWidthLabel') - self.mainPositionLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.mainWidthLabel) + self.mainPositionLayout.setWidget(3, + QtGui.QFormLayout.LabelRole, self.mainWidthLabel) self.mainHeightSpinBox = QtGui.QSpinBox(self.mainPositionGroupBox) self.mainHeightSpinBox.setEnabled(False) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.mainHeightSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.mainHeightSpinBox.sizePolicy().hasHeightForWidth()) self.mainHeightSpinBox.setSizePolicy(sizePolicy) self.mainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.mainHeightSpinBox.setMaximum(9999) self.mainHeightSpinBox.setObjectName(u'mainHeightSpinBox') - self.mainPositionLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.mainHeightSpinBox) + self.mainPositionLayout.setWidget(4, + QtGui.QFormLayout.FieldRole, self.mainHeightSpinBox) self.mainHeightLabel = QtGui.QLabel(self.mainPositionGroupBox) self.mainHeightLabel.setObjectName(u'mainHeightLabel') - self.mainPositionLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.mainHeightLabel) - self.gridLayout_2.addWidget(self.mainPositionGroupBox, 1, 0, 1, 1) + self.mainPositionLayout.setWidget(4, + QtGui.QFormLayout.LabelRole, self.mainHeightLabel) + self.areaPositionLayout.addWidget( + self.mainPositionGroupBox, 1, 0, 1, 1) self.footerPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage) self.footerPositionGroupBox.setMinimumSize(QtCore.QSize(248, 0)) self.footerPositionGroupBox.setObjectName(u'footerPositionGroupBox') - self.footerPositionLayout = QtGui.QFormLayout(self.footerPositionGroupBox) + self.footerPositionLayout = QtGui.QFormLayout( + self.footerPositionGroupBox) self.footerPositionLayout.setMargin(8) self.footerPositionLayout.setSpacing(8) self.footerPositionLayout.setObjectName(u'footerPositionLayout') self.footerXLabel = QtGui.QLabel(self.footerPositionGroupBox) self.footerXLabel.setObjectName(u'footerXLabel') - self.footerPositionLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.footerXLabel) + self.footerPositionLayout.setWidget(1, + QtGui.QFormLayout.LabelRole, self.footerXLabel) self.footerXSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox) self.footerXSpinBox.setEnabled(False) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.footerXSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.footerXSpinBox.sizePolicy().hasHeightForWidth()) self.footerXSpinBox.setSizePolicy(sizePolicy) self.footerXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.footerXSpinBox.setMaximum(9999) self.footerXSpinBox.setProperty(u'value', 0) self.footerXSpinBox.setObjectName(u'footerXSpinBox') - self.footerPositionLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.footerXSpinBox) + self.footerPositionLayout.setWidget(1, + QtGui.QFormLayout.FieldRole, self.footerXSpinBox) self.footerYLabel = QtGui.QLabel(self.footerPositionGroupBox) self.footerYLabel.setObjectName(u'footerYLabel') - self.footerPositionLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.footerYLabel) + self.footerPositionLayout.setWidget(2, + QtGui.QFormLayout.LabelRole, self.footerYLabel) self.footerYSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox) self.footerYSpinBox.setEnabled(False) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.footerYSpinBox.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.footerYSpinBox.sizePolicy().hasHeightForWidth()) self.footerYSpinBox.setSizePolicy(sizePolicy) self.footerYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.footerYSpinBox.setMaximum(9999) self.footerYSpinBox.setProperty(u'value', 0) self.footerYSpinBox.setObjectName(u'footerYSpinBox') - self.footerPositionLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.footerYSpinBox) + self.footerPositionLayout.setWidget(2, + QtGui.QFormLayout.FieldRole, self.footerYSpinBox) self.footerWidthLabel = QtGui.QLabel(self.footerPositionGroupBox) self.footerWidthLabel.setObjectName(u'footerWidthLabel') - self.footerPositionLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.footerWidthLabel) + self.footerPositionLayout.setWidget(3, + QtGui.QFormLayout.LabelRole, self.footerWidthLabel) self.footerWidthSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox) self.footerWidthSpinBox.setEnabled(False) self.footerWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.footerWidthSpinBox.setMaximum(9999) self.footerWidthSpinBox.setObjectName(u'footerWidthSpinBox') - self.footerPositionLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.footerWidthSpinBox) + self.footerPositionLayout.setWidget(3, + QtGui.QFormLayout.FieldRole, self.footerWidthSpinBox) self.footerHeightLabel = QtGui.QLabel(self.footerPositionGroupBox) self.footerHeightLabel.setObjectName(u'footerHeightLabel') - self.footerPositionLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.footerHeightLabel) + self.footerPositionLayout.setWidget(4, + QtGui.QFormLayout.LabelRole, self.footerHeightLabel) self.footerHeightSpinBox = QtGui.QSpinBox(self.footerPositionGroupBox) self.footerHeightSpinBox.setEnabled(False) self.footerHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.footerHeightSpinBox.setMaximum(9999) self.footerHeightSpinBox.setObjectName(u'footerHeightSpinBox') - self.footerPositionLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.footerHeightSpinBox) - self.footerDefaultPositionCheckBox = QtGui.QCheckBox(self.footerPositionGroupBox) + self.footerPositionLayout.setWidget(4, + QtGui.QFormLayout.FieldRole, self.footerHeightSpinBox) + self.footerDefaultPositionCheckBox = QtGui.QCheckBox( + self.footerPositionGroupBox) self.footerDefaultPositionCheckBox.setChecked(True) - self.footerDefaultPositionCheckBox.setObjectName(u'footerDefaultPositionCheckBox') - self.footerPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.footerDefaultPositionCheckBox) - self.gridLayout_2.addWidget(self.footerPositionGroupBox, 1, 1, 1, 1) + self.footerDefaultPositionCheckBox.setObjectName( + u'footerDefaultPositionCheckBox') + self.footerPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.footerDefaultPositionCheckBox) + self.areaPositionLayout.addWidget(self.footerPositionGroupBox, 1, 1, 1, 1) ThemeWizard.addPage(self.areaPositionPage) self.previewPage = QtGui.QWizardPage() self.previewPage.setObjectName(u'previewPage') + self.previewLayout = QtGui.QVBoxLayout(self.previewPage) + self.previewLayout.setSpacing(8) + self.previewLayout.setMargin(20) + self.previewLayout.setObjectName(u'previewLayout') + self.themeNameLayout = QtGui.QHBoxLayout() + self.themeNameLayout.setSpacing(8) + self.themeNameLayout.setObjectName(u'themeNameLayout') self.themeNameLabel = QtGui.QLabel(self.previewPage) - self.themeNameLabel.setGeometry(QtCore.QRect(20, 10, 82, 16)) + self.themeNameLabel.setMinimumSize(QtCore.QSize(103, 0)) self.themeNameLabel.setTextFormat(QtCore.Qt.PlainText) + self.themeNameLabel.setAlignment(QtCore.Qt.AlignRight | + QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.themeNameLabel.setObjectName(u'themeNameLabel') - self.previewLabel = QtGui.QLabel(self.previewPage) - self.previewLabel.setGeometry(QtCore.QRect(250, 60, 48, 16)) - self.previewLabel.setAlignment(QtCore.Qt.AlignCenter) - self.previewLabel.setObjectName(u'previewLabel') + self.themeNameLayout.addWidget(self.themeNameLabel) self.themeNameEdit = QtGui.QLineEdit(self.previewPage) - self.themeNameEdit.setGeometry(QtCore.QRect(117, 4, 351, 23)) self.themeNameEdit.setObjectName(u'themeNameEdit') - self.groupBox = QtGui.QGroupBox(self.previewPage) - self.groupBox.setGeometry(QtCore.QRect(40, 80, 464, 214)) - self.groupBox.setTitle(u'') - self.groupBox.setObjectName(u'groupBox') - self.horizontalLayout = QtGui.QHBoxLayout(self.groupBox) - self.horizontalLayout.setObjectName(u'horizontalLayout') - spacerItem2 = QtGui.QSpacerItem(58, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem2) - self.previewBoxLabel = QtGui.QLabel(self.groupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.themeNameLayout.addWidget(self.themeNameEdit) + self.previewLayout.addLayout(self.themeNameLayout) + self.previewPaneLayout = QtGui.QHBoxLayout() + self.previewPaneLayout.setSpacing(0) + self.previewPaneLayout.setObjectName(u'previewPaneLayout') + self.previewLeftSpacer = QtGui.QSpacerItem(58, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.previewPaneLayout.addItem(self.previewLeftSpacer) + self.previewBoxLabel = QtGui.QLabel(self.previewPage) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.previewBoxLabel.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.previewBoxLabel.sizePolicy().hasHeightForWidth()) self.previewBoxLabel.setSizePolicy(sizePolicy) - self.previewBoxLabel.setMinimumSize(QtCore.QSize(300, 200)) + self.previewBoxLabel.setMinimumSize(QtCore.QSize(100, 150)) self.previewBoxLabel.setFrameShape(QtGui.QFrame.WinPanel) self.previewBoxLabel.setFrameShadow(QtGui.QFrame.Sunken) self.previewBoxLabel.setLineWidth(1) self.previewBoxLabel.setText(u'') self.previewBoxLabel.setScaledContents(True) self.previewBoxLabel.setObjectName(u'previewBoxLabel') - self.horizontalLayout.addWidget(self.previewBoxLabel) - spacerItem3 = QtGui.QSpacerItem(78, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem3) + self.previewPaneLayout.addWidget(self.previewBoxLabel) + self.previewRightSpacer = QtGui.QSpacerItem(78, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.previewPaneLayout.addItem(self.previewRightSpacer) + self.previewLayout.addLayout(self.previewPaneLayout) ThemeWizard.addPage(self.previewPage) self.themeNameLabel.setBuddy(self.themeNameEdit) self.retranslateUi(ThemeWizard) - QtCore.QObject.connect(ThemeWizard, QtCore.SIGNAL(u'accepted()'), ThemeWizard.accept) + self.backgroundStackedWidget.setCurrentIndex(0) + QtCore.QObject.connect( + ThemeWizard, + QtCore.SIGNAL(u'accepted()'), + ThemeWizard.accept) + QtCore.QObject.connect( + self.backgroundTypeComboBox, + QtCore.SIGNAL(u'currentIndexChanged(int)'), + self.backgroundStackedWidget.setCurrentIndex) QtCore.QMetaObject.connectSlotsByName(ThemeWizard) def retranslateUi(self, ThemeWizard): - ThemeWizard.setWindowTitle(translate('OpenLP.ThemeForm', 'Theme Wizard')) - self.titleLabel.setText(translate('OpenLP.ThemeForm', '\n' -'\n' -'

Welcome to the Theme Wizard

')) - self.informationLabel.setText(translate('OpenLP.ThemeForm', 'This wizard will help you to maintain Themes . Click the next button below to start the process by setting up your background.')) - self.backgroundPage.setTitle(translate('OpenLP.ThemeForm', 'Set Up Background')) - self.backgroundPage.setSubTitle(translate('OpenLP.ThemeForm', 'Set up your theme\'s background according to the parameters below.')) - self.backgroundTypeLabel.setText(translate('OpenLP.ThemeForm', 'Background type:')) - self.backgroundTypeComboBox.setItemText(0, translate('OpenLP.ThemeForm', 'Solid Color')) - self.backgroundTypeComboBox.setItemText(1, translate('OpenLP.ThemeForm', 'Gradient')) - self.backgroundTypeComboBox.setItemText(2, translate('OpenLP.ThemeForm', 'Image')) - self.color1Label.setText(translate('OpenLP.ThemeForm', '')) - self.color2Label.setText(translate('OpenLP.ThemeForm', '')) - self.imageLabel.setText(translate('OpenLP.ThemeForm', 'Image:')) - self.gradientLabel.setText(translate('OpenLP.ThemeForm', 'Gradient:')) - self.gradientComboBox.setItemText(0, translate('OpenLP.ThemeForm', 'Horizontal')) - self.gradientComboBox.setItemText(1, translate('OpenLP.ThemeForm', 'Vertical')) - self.gradientComboBox.setItemText(2, translate('OpenLP.ThemeForm', 'Circular')) - self.gradientComboBox.setItemText(3, translate('OpenLP.ThemeForm', 'Top Left - Bottom Right')) - self.gradientComboBox.setItemText(4, translate('OpenLP.ThemeForm', 'Bottom Left - Top Right')) - self.mainAreaPage.setTitle(translate('OpenLP.ThemeForm', 'Main Area Font Details')) - self.mainAreaPage.setSubTitle(translate('OpenLP.ThemeForm', 'Define the font and display characteristics for the Display text')) - self.mainFontLabel.setText(translate('OpenLP.ThemeForm', 'Font:')) - self.mainColorLabel.setText(translate('OpenLP.ThemeForm', 'Color:')) - self.mainSizeLabel.setText(translate('OpenLP.ThemeForm', 'Size:')) - self.mainSizeSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt')) - self.mainLineCountLabel.setText(translate('OpenLP.ThemeForm', '(%d lines per slide)')) - self.lineSpacingLabel.setText(translate('OpenLP.ThemeForm', 'Line Spacing:')) - self.lineSpacingSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt')) - self.outlineCheckBox.setText(translate('OpenLP.ThemeForm', '&Outline:')) - self.outlineSizeLabel.setText(translate('OpenLP.ThemeForm', 'Size:')) - self.outlineSizeSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt')) - self.shadowCheckBox.setText(translate('OpenLP.ThemeForm', '&Shadow:')) - self.shadowSizeLabel.setText(translate('OpenLP.ThemeForm', 'Size:')) - self.shadowSizeSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt')) - self.boldCheckBox.setText(translate('OpenLP.ThemeForm', 'Bold Display')) - self.italicsCheckBox.setText(translate('OpenLP.ThemeForm', 'Italic Display')) - self.footerAreaPage.setTitle(translate('OpenLP.ThemeForm', 'Footer Area Font Details')) - self.footerAreaPage.setSubTitle(translate('OpenLP.ThemeForm', 'Define the font and display characteristics for the Footer text')) - self.footerFontLabel.setText(translate('OpenLP.ThemeForm', 'Font:')) - self.footerColorLabel.setText(translate('OpenLP.ThemeForm', 'Color:')) - self.footerSizeLabel.setText(translate('OpenLP.ThemeForm', 'Size:')) - self.footerSizeSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'pt')) - self.alignmentPage.setTitle(translate('OpenLP.ThemeForm', 'Text Formatting Details')) - self.alignmentPage.setSubTitle(translate('OpenLP.ThemeForm', 'Allows additional display formatting information to be defined')) - self.horizontalLabel.setText(translate('OpenLP.ThemeForm', 'Horizontal Align:')) - self.horizontalComboBox.setItemText(0, translate('OpenLP.ThemeForm', 'Left')) - self.horizontalComboBox.setItemText(1, translate('OpenLP.ThemeForm', 'Right')) - self.horizontalComboBox.setItemText(2, translate('OpenLP.ThemeForm', 'Center')) - self.verticalLabel.setText(translate('OpenLP.ThemeForm', 'Vertcal Align:')) - self.verticalComboBox.setItemText(0, translate('OpenLP.ThemeForm', 'Top')) - self.verticalComboBox.setItemText(1, translate('OpenLP.ThemeForm', 'Middle')) - self.verticalComboBox.setItemText(2, translate('OpenLP.ThemeForm', 'Bottom')) - self.transitionsCheckBox.setText(translate('OpenLP.ThemeForm', 'Transitions')) - self.areaPositionPage.setTitle(translate('OpenLP.ThemeForm', 'Output Area Locations')) - self.areaPositionPage.setSubTitle(translate('OpenLP.ThemeForm', 'Allows you to change and move the Main and Footer areas.')) - self.mainPositionGroupBox.setTitle(translate('OpenLP.ThemeForm', '&Main Area')) - self.mainDefaultPositionCheckBox.setText(translate('OpenLP.ThemeForm', '&Use default location')) - self.nainXLabel.setText(translate('OpenLP.ThemeForm', 'X position:')) - self.mainXSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px')) - self.mainYSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px')) - self.mainYLabel.setText(translate('OpenLP.ThemeForm', 'Y position:')) - self.mainWidthSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px')) - self.mainWidthLabel.setText(translate('OpenLP.ThemeForm', 'Width:')) - self.mainHeightSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px')) - self.mainHeightLabel.setText(translate('OpenLP.ThemeForm', 'Height:')) - self.footerPositionGroupBox.setTitle(translate('OpenLP.ThemeForm', 'Footer Area')) - self.footerXLabel.setText(translate('OpenLP.ThemeForm', 'X position:')) - self.footerXSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px')) - self.footerYLabel.setText(translate('OpenLP.ThemeForm', 'Y position:')) - self.footerYSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px')) - self.footerWidthLabel.setText(translate('OpenLP.ThemeForm', 'Width:')) - self.footerWidthSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px')) - self.footerHeightLabel.setText(translate('OpenLP.ThemeForm', 'Height:')) - self.footerHeightSpinBox.setSuffix(translate('OpenLP.ThemeForm', 'px')) - self.footerDefaultPositionCheckBox.setText(translate('OpenLP.ThemeForm', 'Use default location')) - self.previewPage.setTitle(translate('OpenLP.ThemeForm', 'Save and Preview')) - self.previewPage.setSubTitle(translate('OpenLP.ThemeForm', 'View the theme and save it replacing the current one or change the name to create a new theme')) - self.themeNameLabel.setText(translate('OpenLP.ThemeForm', 'Theme name:')) - self.previewLabel.setText(translate('OpenLP.ThemeForm', 'Preview')) + ThemeWizard.setWindowTitle( + translate('OpenLP.ThemeWizard', 'Theme Wizard')) + self.titleLabel.setText( + u'%s' % \ + translate('OpenLP.ThemeWizard', 'Welcome to the Theme Wizard')) + self.informationLabel.setText( + translate('OpenLP.ThemeWizard', 'This wizard will help you to ' + 'create and edit your themes . Click the next button below to ' + 'start the process by setting up your background.')) + self.backgroundPage.setTitle( + translate('OpenLP.ThemeWizard', 'Set Up Background')) + self.backgroundPage.setSubTitle( + translate('OpenLP.ThemeWizard', 'Set up your theme\'s background ' + 'according to the parameters below.')) + self.backgroundTypeLabel.setText( + translate('OpenLP.ThemeWizard', 'Background type:')) + self.backgroundTypeComboBox.setItemText(0, + translate('OpenLP.ThemeWizard', 'Solid Color')) + self.backgroundTypeComboBox.setItemText(1, + translate('OpenLP.ThemeWizard', 'Gradient')) + self.backgroundTypeComboBox.setItemText(2, + translate('OpenLP.ThemeWizard', 'Image')) + self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:')) + self.gradientStartLabel.setText( + translate(u'OpenLP.ThemeWizard', 'Starting color:')) + self.gradientEndLabel.setText( + translate(u'OpenLP.ThemeWizard', 'Ending color:')) + self.gradientTypeLabel.setText( + translate('OpenLP.ThemeWizard', 'Gradient:')) + self.gradientComboBox.setItemText(0, + translate('OpenLP.ThemeWizard', 'Horizontal')) + self.gradientComboBox.setItemText(1, + translate('OpenLP.ThemeWizard', 'Vertical')) + self.gradientComboBox.setItemText(2, + translate('OpenLP.ThemeWizard', 'Circular')) + self.gradientComboBox.setItemText(3, + translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right')) + self.gradientComboBox.setItemText(4, + translate('OpenLP.ThemeWizard', 'Bottom Left - Top Right')) + self.imageLabel.setText(translate('OpenLP.ThemeWizard', 'Image:')) + self.mainAreaPage.setTitle( + translate('OpenLP.ThemeWizard', 'Main Area Font Details')) + self.mainAreaPage.setSubTitle( + translate('OpenLP.ThemeWizard', 'Define the font and display ' + 'characteristics for the Display text')) + self.mainFontLabel.setText( + translate('OpenLP.ThemeWizard', 'Font:')) + self.mainColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:')) + self.mainSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:')) + self.mainSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt')) + self.mainLineCountLabel.setText( + translate('OpenLP.ThemeWizard', '(%d lines per slide)')) + self.lineSpacingLabel.setText( + translate('OpenLP.ThemeWizard', 'Line Spacing:')) + self.lineSpacingSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt')) + self.outlineCheckBox.setText( + translate('OpenLP.ThemeWizard', '&Outline:')) + self.outlineSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:')) + self.outlineSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt')) + self.shadowCheckBox.setText(translate('OpenLP.ThemeWizard', '&Shadow:')) + self.shadowSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:')) + self.shadowSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt')) + self.boldCheckBox.setText( + translate('OpenLP.ThemeWizard', 'Bold')) + self.italicsCheckBox.setText( + translate('OpenLP.ThemeWizard', 'Italic')) + self.footerAreaPage.setTitle( + translate('OpenLP.ThemeWizard', 'Footer Area Font Details')) + self.footerAreaPage.setSubTitle( + translate('OpenLP.ThemeWizard', 'Define the font and display ' + 'characteristics for the Footer text')) + self.footerFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:')) + self.footerColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:')) + self.footerSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:')) + self.footerSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt')) + self.alignmentPage.setTitle( + translate('OpenLP.ThemeWizard', 'Text Formatting Details')) + self.alignmentPage.setSubTitle( + translate('OpenLP.ThemeWizard', 'Allows additional display ' + 'formatting information to be defined')) + self.horizontalLabel.setText( + translate('OpenLP.ThemeWizard', 'Horizontal Align:')) + self.horizontalComboBox.setItemText(0, + translate('OpenLP.ThemeWizard', 'Left')) + self.horizontalComboBox.setItemText(1, + translate('OpenLP.ThemeWizard', 'Right')) + self.horizontalComboBox.setItemText(2, + translate('OpenLP.ThemeWizard', 'Center')) + self.verticalLabel.setText( + translate('OpenLP.ThemeWizard', 'Vertical Align:')) + self.verticalComboBox.setItemText(0, + translate('OpenLP.ThemeWizard', 'Top')) + self.verticalComboBox.setItemText(1, + translate('OpenLP.ThemeWizard', 'Middle')) + self.verticalComboBox.setItemText(2, + translate('OpenLP.ThemeWizard', 'Bottom')) + self.transitionsCheckBox.setText( + translate('OpenLP.ThemeWizard', 'Transitions')) + self.areaPositionPage.setTitle( + translate('OpenLP.ThemeWizard', 'Output Area Locations')) + self.areaPositionPage.setSubTitle( + translate('OpenLP.ThemeWizard', 'Allows you to change and move the ' + 'main and footer areas.')) + self.mainPositionGroupBox.setTitle( + translate('OpenLP.ThemeWizard', '&Main Area')) + self.mainDefaultPositionCheckBox.setText( + translate('OpenLP.ThemeWizard', '&Use default location')) + self.nainXLabel.setText(translate('OpenLP.ThemeWizard', 'X position:')) + self.mainXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) + self.mainYSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) + self.mainYLabel.setText(translate('OpenLP.ThemeWizard', 'Y position:')) + self.mainWidthSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) + self.mainWidthLabel.setText(translate('OpenLP.ThemeWizard', 'Width:')) + self.mainHeightSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) + self.mainHeightLabel.setText(translate('OpenLP.ThemeWizard', 'Height:')) + self.footerPositionGroupBox.setTitle( + translate('OpenLP.ThemeWizard', 'Footer Area')) + self.footerXLabel.setText(translate('OpenLP.ThemeWizard', 'X position:')) + self.footerXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) + self.footerYLabel.setText(translate('OpenLP.ThemeWizard', 'Y position:')) + self.footerYSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) + self.footerWidthLabel.setText(translate('OpenLP.ThemeWizard', 'Width:')) + self.footerWidthSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) + self.footerHeightLabel.setText( + translate('OpenLP.ThemeWizard', 'Height:')) + self.footerHeightSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) + self.footerDefaultPositionCheckBox.setText( + translate('OpenLP.ThemeWizard', 'Use default location')) + self.previewPage.setTitle( + translate('OpenLP.ThemeWizard', 'Save and Preview')) + self.previewPage.setSubTitle( + translate('OpenLP.ThemeWizard', 'View the theme and save it ' + 'replacing the current one or change the name to create a ' + 'new theme')) + self.themeNameLabel.setText( + translate('OpenLP.ThemeWizard', 'Theme name:')) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 2e11c30ad..749f1f938 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -133,7 +133,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): self.OSISLocationEdit.setFocus() return False elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV: - if self.field(u'csv_booksfile').toString() == u'': + if not self.field(u'csv_booksfile').toString(): QtGui.QMessageBox.critical(self, translate('BiblesPlugin.ImportWizardForm', 'Invalid Books File'), @@ -142,7 +142,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): 'the Bible to use in the import.')) self.BooksLocationEdit.setFocus() return False - elif self.field(u'csv_versefile').toString() == u'': + elif not self.field(u'csv_versefile').toString(): QtGui.QMessageBox.critical(self, translate('BiblesPlugin.ImportWizardForm', 'Invalid Verse File'), @@ -153,7 +153,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): return False elif self.field(u'source_format').toInt()[0] == \ BibleFormat.OpenSong: - if self.field(u'opensong_file').toString() == u'': + if not self.field(u'opensong_file').toString(): QtGui.QMessageBox.critical(self, translate('BiblesPlugin.ImportWizardForm', 'Invalid OpenSong Bible'), @@ -168,7 +168,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): license_version = unicode(self.field(u'license_version').toString()) license_copyright = \ unicode(self.field(u'license_copyright').toString()) - if license_version == u'': + if not license_version: QtGui.QMessageBox.critical(self, translate('BiblesPlugin.ImportWizardForm', 'Empty Version Name'), @@ -176,7 +176,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): 'You need to specify a version name for your Bible.')) self.VersionNameEdit.setFocus() return False - elif license_copyright == u'': + elif not license_copyright: QtGui.QMessageBox.critical(self, translate('BiblesPlugin.ImportWizardForm', 'Empty Copyright'), @@ -207,9 +207,11 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): The index of the combo box. """ self.BibleComboBox.clear() - for bible in self.web_bible_list[index].keys(): - self.BibleComboBox.addItem(unicode( - translate('BiblesPlugin.ImportWizardForm', bible))) + bibles = [unicode(translate('BiblesPlugin.ImportWizardForm', bible)) for + bible in self.web_bible_list[index].keys()] + bibles.sort() + for bible in bibles: + self.BibleComboBox.addItem(bible) def onOsisFileButtonClicked(self): """ @@ -317,7 +319,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): """ Load the list of Crosswalk and BibleGateway bibles. """ - #Load and store Crosswalk Bibles + # Load and store Crosswalk Bibles. filepath = AppLocation.get_directory(AppLocation.PluginsDir) filepath = os.path.join(filepath, u'bibles', u'resources') books_file = None @@ -341,7 +343,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): finally: if books_file: books_file.close() - #Load and store BibleGateway Bibles + # Load and store BibleGateway Bibles. books_file = None try: self.web_bible_list[WebDownload.BibleGateway] = {} @@ -379,12 +381,18 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): Receiver.send_message(u'openlp_process_events') def preImport(self): + bible_type = self.field(u'source_format').toInt()[0] self.finishButton.setVisible(False) self.ImportProgressBar.setMinimum(0) self.ImportProgressBar.setMaximum(1188) self.ImportProgressBar.setValue(0) - self.ImportProgressLabel.setText( - translate('BiblesPlugin.ImportWizardForm', 'Starting import...')) + if bible_type == BibleFormat.WebDownload: + self.ImportProgressLabel.setText(translate( + 'BiblesPlugin.ImportWizardForm', + 'Starting Registering bible...')) + else: + self.ImportProgressLabel.setText(translate( + 'BiblesPlugin.ImportWizardForm', 'Starting import...')) Receiver.send_message(u'openlp_process_events') def performImport(self): @@ -395,26 +403,26 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): unicode(self.field(u'license_permissions').toString()) importer = None if bible_type == BibleFormat.OSIS: - # Import an OSIS bible + # Import an OSIS bible. importer = self.manager.import_bible(BibleFormat.OSIS, name=license_version, filename=unicode(self.field(u'osis_location').toString()) ) elif bible_type == BibleFormat.CSV: - # Import a CSV bible + # Import a CSV bible. importer = self.manager.import_bible(BibleFormat.CSV, name=license_version, booksfile=unicode(self.field(u'csv_booksfile').toString()), versefile=unicode(self.field(u'csv_versefile').toString()) ) elif bible_type == BibleFormat.OpenSong: - # Import an OpenSong bible + # Import an OpenSong bible. importer = self.manager.import_bible(BibleFormat.OpenSong, name=license_version, filename=unicode(self.field(u'opensong_file').toString()) ) elif bible_type == BibleFormat.WebDownload: - # Import a bible from the web + # Import a bible from the web. self.ImportProgressBar.setMaximum(1) download_location = self.field(u'web_location').toInt()[0] bible_version = unicode(self.BibleComboBox.currentText()) @@ -438,8 +446,14 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): self.manager.save_meta_data(license_version, license_version, license_copyright, license_permissions) self.manager.reload_bibles() - self.ImportProgressLabel.setText( - translate('BiblesPlugin.ImportWizardForm', 'Finished import.')) + if bible_type == BibleFormat.WebDownload: + self.ImportProgressLabel.setText( + translate('BiblesPlugin.ImportWizardForm', 'Registered ' + 'bible. Please note, that verses will be downloaded on\n' + 'demand and thus an internet connection is required.')) + else: + self.ImportProgressLabel.setText(translate( + 'BiblesPlugin.ImportWizardForm', 'Finished import.')) else: self.ImportProgressLabel.setText( translate('BiblesPlugin.ImportWizardForm', diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index b7d1b9bde..a52c31fb7 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -110,9 +110,9 @@ class BiblesTab(SettingsTab): self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox') self.BibleThemeComboBox.addItem(QtCore.QString()) self.BibleThemeLayout.addWidget(self.BibleThemeComboBox) - self.BibleDualCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) - self.BibleDualCheckBox.setObjectName(u'BibleDualCheckBox') - self.VerseDisplayLayout.addWidget(self.BibleDualCheckBox, 3, 0, 1, 1) + self.BibleSecondCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) + self.BibleSecondCheckBox.setObjectName(u'BibleSecondCheckBox') + self.VerseDisplayLayout.addWidget(self.BibleSecondCheckBox, 3, 0, 1, 1) self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 4, 0, 1, 1) self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox) self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel') @@ -143,8 +143,8 @@ class BiblesTab(SettingsTab): self.LayoutStyleComboBox, QtCore.SIGNAL(u'activated(int)'), self.onLayoutStyleComboBoxChanged) QtCore.QObject.connect( - self.BibleDualCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), - self.onBibleDualCheckBox) + self.BibleSecondCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), + self.onBibleSecondCheckBox) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList) @@ -176,8 +176,8 @@ class BiblesTab(SettingsTab): translate('BiblesPlugin.BiblesTab', '[ And ]')) self.ChangeNoteLabel.setText(translate('BiblesPlugin.BiblesTab', 'Note:\nChanges do not affect verses already in the service.')) - self.BibleDualCheckBox.setText( - translate('BiblesPlugin.BiblesTab', 'Display dual Bible verses')) + self.BibleSecondCheckBox.setText( + translate('BiblesPlugin.BiblesTab', 'Display second Bible verses')) def onBibleThemeComboBoxChanged(self): self.bible_theme = self.BibleThemeComboBox.currentText() @@ -190,15 +190,15 @@ class BiblesTab(SettingsTab): def onNewChaptersCheckBoxChanged(self, check_state): self.show_new_chapters = False - # we have a set value convert to True/False + # We have a set value convert to True/False. if check_state == QtCore.Qt.Checked: self.show_new_chapters = True - def onBibleDualCheckBox(self, check_state): - self.dual_bibles = False - # we have a set value convert to True/False + def onBibleSecondCheckBox(self, check_state): + self.second_bibles = False + # We have a set value convert to True/False. if check_state == QtCore.Qt.Checked: - self.dual_bibles = True + self.second_bibles = True def load(self): settings = QtCore.QSettings() @@ -211,12 +211,12 @@ class BiblesTab(SettingsTab): u'verse layout style', QtCore.QVariant(0)).toInt()[0] self.bible_theme = unicode( settings.value(u'bible theme', QtCore.QVariant(u'')).toString()) - self.dual_bibles = settings.value( - u'dual bibles', QtCore.QVariant(True)).toBool() + self.second_bibles = settings.value( + u'second bibles', QtCore.QVariant(True)).toBool() self.NewChaptersCheckBox.setChecked(self.show_new_chapters) self.DisplayStyleComboBox.setCurrentIndex(self.display_style) self.LayoutStyleComboBox.setCurrentIndex(self.layout_style) - self.BibleDualCheckBox.setChecked(self.dual_bibles) + self.BibleSecondCheckBox.setChecked(self.second_bibles) settings.endGroup() def save(self): @@ -228,13 +228,18 @@ class BiblesTab(SettingsTab): QtCore.QVariant(self.display_style)) settings.setValue(u'verse layout style', QtCore.QVariant(self.layout_style)) - settings.setValue(u'dual bibles', QtCore.QVariant(self.dual_bibles)) + settings.setValue(u'second bibles', QtCore.QVariant(self.second_bibles)) settings.setValue(u'bible theme', QtCore.QVariant(self.bible_theme)) settings.endGroup() def updateThemeList(self, theme_list): """ - Called from ThemeManager when the Themes have changed + Called from ThemeManager when the Themes have changed. + + ``theme_list`` + The list of available themes:: + + [u'Bible Theme', u'Song Theme'] """ self.BibleThemeComboBox.clear() self.BibleThemeComboBox.addItem(u'') @@ -243,7 +248,7 @@ class BiblesTab(SettingsTab): index = self.BibleThemeComboBox.findText( unicode(self.bible_theme), QtCore.Qt.MatchExactly) if index == -1: - # Not Found + # Not Found. index = 0 self.bible_theme = u'' self.BibleThemeComboBox.setCurrentIndex(index) diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 8f5c7dc79..9852ed16b 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -44,24 +44,28 @@ class BibleMeta(BaseModel): """ pass + class Testament(BaseModel): """ Bible Testaments """ pass + class Book(BaseModel): """ Song model """ pass + class Verse(BaseModel): """ Topic model """ pass + def init_schema(url): """ Setup a bible database connection and initialise the database schema. @@ -240,7 +244,7 @@ class BibleDB(QtCore.QObject, Manager): and the value is the verse text. """ log.debug(u'create_chapter %s,%s', book_id, chapter) - # text list has book and chapter as first two elements of the array + # Text list has book and chapter as first two elements of the array. for verse_number, verse_text in textlist.iteritems(): verse = Verse.populate( book_id = book_id, diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 235862ae8..fa47dd7f5 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -364,12 +364,11 @@ class HTTPBible(BibleDB): if self.proxy_server: self.create_meta(u'proxy server', self.proxy_server) if self.proxy_username: - # store the proxy userid + # Store the proxy userid. self.create_meta(u'proxy username', self.proxy_username) if self.proxy_password: - # store the proxy password + # Store the proxy password. self.create_meta(u'proxy password', self.proxy_password) - self.wizard.incrementProgressBar('Registered.') return True def get_verses(self, reference_list): @@ -417,7 +416,7 @@ class HTTPBible(BibleDB): ## to request ac and get Acts back. bookname = search_results.book Receiver.send_message(u'openlp_process_events') - # check to see if book/chapter exists + # Check to see if book/chapter exists. db_book = self.get_book(bookname) self.create_chapter(db_book.id, search_results.chapter, search_results.verselist) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 9afc4a4b2..6b4d7c800 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -257,17 +257,34 @@ class BibleManager(object): 'Book Chapter:Verse-Chapter:Verse')) return None - def verse_search(self, bible, text): + def verse_search(self, bible, second_bible, text): """ Does a verse search for the given bible and text. ``bible`` The bible to seach in (unicode). + ``second_bible`` + The second bible (unicode). We do not search in this bible. + ``text`` The text to search for (unicode). """ - log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text) + log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text) + # Check if the bible or second_bible is a web bible. + webbible = self.db_cache[bible].get_object(BibleMeta, + u'download source') + second_webbible = u'' + if second_bible: + second_webbible = self.db_cache[second_bible].get_object(BibleMeta, + u'download source') + if webbible or second_webbible: + QtGui.QMessageBox.information(self.parent.mediaItem, + translate('BiblesPlugin.BibleManager', + 'Web Bible cannot be used'), + translate('BiblesPlugin.BibleManager', 'Text Search is not ' + 'available with Web Bibles.')) + return None if text: return self.db_cache[bible].verse_search(text) else: @@ -317,4 +334,3 @@ class BibleManager(object): """ for bible in self.db_cache: self.db_cache[bible].finalise() - diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 0e1850485..949035c0b 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -47,21 +47,22 @@ class BibleListView(BaseListWithDnD): self.parent().onListViewResize(event.size().width(), event.size().width()) + class BibleMediaItem(MediaManagerItem): """ This is the custom media manager item for Bibles. """ log.info(u'Bible Media Item loaded') - def __init__(self, parent, icon, title): + def __init__(self, parent, plugin, icon): self.PluginNameShort = u'Bible' self.pluginNameVisible = translate('BiblesPlugin.MediaItem', 'Bible') self.IconPath = u'songs/song' self.ListViewWithDnD_class = BibleListView - MediaManagerItem.__init__(self, parent, icon, title) - # place to store the search results for both bibles + MediaManagerItem.__init__(self, parent, plugin, icon) + # Place to store the search results for both bibles. self.search_results = {} - self.dual_search_results = {} + self.second_search_results = {} QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles) @@ -83,7 +84,7 @@ class BibleMediaItem(MediaManagerItem): self.SearchTabWidget.sizePolicy().hasHeightForWidth()) self.SearchTabWidget.setSizePolicy(sizePolicy) self.SearchTabWidget.setObjectName(u'SearchTabWidget') - # Add the Quick Search tab + # Add the Quick Search tab. self.QuickTab = QtGui.QWidget() self.QuickTab.setObjectName(u'QuickTab') self.QuickLayout = QtGui.QGridLayout(self.QuickTab) @@ -144,7 +145,7 @@ class BibleMediaItem(MediaManagerItem): QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.QuickLayout.addItem(QuickSpacerItem, 6, 2, 1, 1) - # Add the Advanced Search tab + # Add the Advanced Search tab. self.AdvancedTab = QtGui.QWidget() self.AdvancedTab.setObjectName(u'AdvancedTab') self.AdvancedLayout = QtGui.QGridLayout(self.AdvancedTab) @@ -226,7 +227,7 @@ class BibleMediaItem(MediaManagerItem): self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3) self.SearchTabWidget.addTab(self.AdvancedTab, translate('BiblesPlugin.MediaItem', 'Advanced')) - # Add the search tab widget to the page layout + # Add the search tab widget to the page layout. self.pageLayout.addWidget(self.SearchTabWidget) # Combo Boxes QtCore.QObject.connect(self.AdvancedVersionComboBox, @@ -239,6 +240,10 @@ class BibleMediaItem(MediaManagerItem): QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse) QtCore.QObject.connect(self.AdvancedToChapter, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter) + QtCore.QObject.connect(self.QuickSearchComboBox, + QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) + QtCore.QObject.connect(self.QuickVersionComboBox, + QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) # Buttons QtCore.QObject.connect(self.AdvancedSearchButton, QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton) @@ -270,7 +275,7 @@ class BibleMediaItem(MediaManagerItem): def configUpdated(self): log.debug(u'configUpdated') - if QtCore.QSettings().value(self.settingsSection + u'/dual bibles', + if QtCore.QSettings().value(self.settingsSection + u'/second bibles', QtCore.QVariant(True)).toBool(): self.AdvancedSecondBibleLabel.setVisible(True) self.AdvancedSecondBibleComboBox.setVisible(True) @@ -287,7 +292,7 @@ class BibleMediaItem(MediaManagerItem): self.QuickVersionLabel.setText( translate('BiblesPlugin.MediaItem', 'Version:')) self.QuickSecondVersionLabel.setText( - translate('BiblesPlugin.MediaItem', 'Dual:')) + translate('BiblesPlugin.MediaItem', 'Second:')) self.QuickSearchLabel.setText( translate('BiblesPlugin.MediaItem', 'Search type:')) self.QuickSearchLabel.setText( @@ -299,7 +304,7 @@ class BibleMediaItem(MediaManagerItem): self.AdvancedVersionLabel.setText( translate('BiblesPlugin.MediaItem', 'Version:')) self.AdvancedSecondBibleLabel.setText( - translate('BiblesPlugin.MediaItem', 'Dual:')) + translate('BiblesPlugin.MediaItem', 'Second:')) self.AdvancedBookLabel.setText( translate('BiblesPlugin.MediaItem', 'Book:')) self.AdvancedChapterLabel.setText( @@ -331,6 +336,7 @@ class BibleMediaItem(MediaManagerItem): log.debug(u'bible manager initialise') self.parent.manager.media = self self.loadBibles() + self.updateAutoCompleter() self.configUpdated() log.debug(u'bible manager initialise complete') @@ -338,7 +344,7 @@ class BibleMediaItem(MediaManagerItem): self.QuickMessage.setText(text) self.AdvancedMessage.setText(text) Receiver.send_message(u'openlp_process_events') - # minor delay to get the events processed + # Minor delay to get the events processed. time.sleep(0.1) def onListViewResize(self, width, height): @@ -358,13 +364,15 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'No Book Found'), translate('BiblesPlugin.MediaItem', 'No matching book could be found in this Bible.')) + self.AdvancedSearchButton.setEnabled(True) def onImportClick(self): if not hasattr(self, u'import_wizard'): self.import_wizard = BibleImportForm(self, self.parent.manager, self.parent) - self.import_wizard.exec_() - self.reloadBibles() + # If the import was not canceled then reload. + if self.import_wizard.exec_(): + self.reloadBibles() def loadBibles(self): log.debug(u'Loading Bibles') @@ -374,8 +382,10 @@ class BibleMediaItem(MediaManagerItem): self.AdvancedSecondBibleComboBox.clear() self.QuickSecondBibleComboBox.addItem(u'') self.AdvancedSecondBibleComboBox.addItem(u'') + # Get all bibles and sort the list. bibles = self.parent.manager.get_bibles().keys() - # load bibles into the combo boxes + bibles.sort() + # Load the bibles into the combo boxes. first = True for bible in bibles: if bible: @@ -393,6 +403,15 @@ class BibleMediaItem(MediaManagerItem): self.loadBibles() def initialiseBible(self, bible): + """ + This initialises the given bible, which means that its book names and + their chapter numbers is added to the combo boxes on the + 'Advanced Search' Tab. This is not of any importance of the + 'Quick Search' Tab. + + ``bible`` + The bible to initialise (unicode). + """ log.debug(u'initialiseBible %s', bible) book_data = self.parent.manager.get_books(bible) self.AdvancedBookComboBox.clear() @@ -423,6 +442,25 @@ class BibleMediaItem(MediaManagerItem): self.adjustComboBox(1, verse_count, self.AdvancedFromVerse) self.adjustComboBox(1, verse_count, self.AdvancedToVerse) + def updateAutoCompleter(self): + """ + This updates the bible book completion list for the search field. The + completion depends on the bible. It is only updated when we are doing a + verse search, otherwise the auto completion list is removed. + """ + books = [] + # We have to do a 'Verse Search'. + if self.QuickSearchComboBox.currentIndex() == 0: + bibles = self.parent.manager.get_bibles() + bible = unicode(self.QuickVersionComboBox.currentText()) + if bible: + book_data = bibles[bible].get_books() + books = [book.name for book in book_data] + books.sort() + completer = QtGui.QCompleter(books) + completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) + self.QuickSearchEdit.setCompleter(completer) + def onAdvancedVersionComboBox(self): self.initialiseBible( unicode(self.AdvancedVersionComboBox.currentText())) @@ -482,6 +520,17 @@ class BibleMediaItem(MediaManagerItem): def adjustComboBox(self, range_from, range_to, combo, restore=False): """ + Adjusts the given como box to the given values. + + ``range_from`` + The first number of the range (int). + + ``range_to`` + The last number of the range (int). + + ``combo`` + The combo box itself (QComboBox). + ``restore`` If True, then the combo's currentText will be restored after adjusting (if possible). @@ -490,16 +539,19 @@ class BibleMediaItem(MediaManagerItem): if restore: old_text = unicode(combo.currentText()) combo.clear() - for i in range(int(range_from), int(range_to) + 1): + for i in range(range_from, range_to + 1): combo.addItem(unicode(i)) if restore and combo.findText(old_text) != -1: combo.setCurrentIndex(combo.findText(old_text)) def onAdvancedSearchButton(self): + """ + Does an advanced search and saves the search results. + """ log.debug(u'Advanced Search Button pressed') self.AdvancedSearchButton.setEnabled(False) bible = unicode(self.AdvancedVersionComboBox.currentText()) - dual_bible = unicode(self.AdvancedSecondBibleComboBox.currentText()) + second_bible = unicode(self.AdvancedSecondBibleComboBox.currentText()) book = unicode(self.AdvancedBookComboBox.currentText()) chapter_from = int(self.AdvancedFromChapter.currentText()) chapter_to = int(self.AdvancedToChapter.currentText()) @@ -508,74 +560,81 @@ class BibleMediaItem(MediaManagerItem): versetext = u'%s %s:%s-%s:%s' % (book, chapter_from, verse_from, chapter_to, verse_to) self.search_results = self.parent.manager.get_verses(bible, versetext) - if dual_bible: - self.dual_search_results = self.parent.manager.get_verses( - dual_bible, versetext) + if second_bible: + self.second_search_results = self.parent.manager.get_verses( + second_bible, versetext) if self.ClearAdvancedSearchComboBox.currentIndex() == 0: self.listView.clear() if self.listView.count() != 0: + # Check if the first item is a second bible item or not. bitem = self.listView.item(0) - item_dual_bible = self._decodeQtObject(bitem, 'dual_bible') - if item_dual_bible and dual_bible or not item_dual_bible and \ - not dual_bible: - self.displayResults(bible, dual_bible) + item_second_bible = self._decodeQtObject(bitem, 'second_bible') + if item_second_bible and second_bible or not item_second_bible and \ + not second_bible: + self.displayResults(bible, second_bible) elif QtGui.QMessageBox.critical(self, translate('BiblePlugin.MediaItem', 'Error'), translate('BiblePlugin.MediaItem', 'You cannot combine single ' - 'and dual bible verses. Do you want to delete your search ' + 'and second bible verses. Do you want to delete your search ' 'results and start a new search?'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes: self.listView.clear() - self.displayResults(bible, dual_bible) + self.displayResults(bible, second_bible) else: - self.displayResults(bible, dual_bible) + self.displayResults(bible, second_bible) self.AdvancedSearchButton.setEnabled(True) def onQuickSearchButton(self): + """ + Does a quick search and saves the search results. Quick search can + either be "Verse Search" or "Text Search". + """ log.debug(u'Quick Search Button pressed') self.QuickSearchButton.setEnabled(False) bible = unicode(self.QuickVersionComboBox.currentText()) - dual_bible = unicode(self.QuickSecondBibleComboBox.currentText()) + second_bible = unicode(self.QuickSecondBibleComboBox.currentText()) text = unicode(self.QuickSearchEdit.text()) if self.QuickSearchComboBox.currentIndex() == 0: # We are doing a 'Verse Search'. self.search_results = self.parent.manager.get_verses(bible, text) - if dual_bible and self.search_results: - self.dual_search_results = self.parent.manager.get_verses( - dual_bible, text) + if second_bible and self.search_results: + self.second_search_results = self.parent.manager.get_verses( + second_bible, text) else: # We are doing a 'Text Search'. bibles = self.parent.manager.get_bibles() - self.search_results = self.parent.manager.verse_search(bible, text) - if dual_bible and self.search_results: + self.search_results = self.parent.manager.verse_search(bible, + second_bible, text) + if second_bible and self.search_results: text = [] for verse in self.search_results: text.append((verse.book.name, verse.chapter, verse.verse, verse.verse)) - self.dual_search_results = bibles[dual_bible].get_verses(text) + self.second_search_results = \ + bibles[second_bible].get_verses(text) if self.ClearQuickSearchComboBox.currentIndex() == 0: self.listView.clear() if self.listView.count() != 0 and self.search_results: bitem = self.listView.item(0) - item_dual_bible = self._decodeQtObject(bitem, 'dual_bible') - if item_dual_bible and dual_bible or not item_dual_bible and \ - not dual_bible: - self.displayResults(bible, dual_bible) + item_second_bible = self._decodeQtObject(bitem, 'second_bible') + if item_second_bible and second_bible or not item_second_bible and \ + not second_bible: + self.displayResults(bible, second_bible) elif QtGui.QMessageBox.critical(self, translate('BiblePlugin.MediaItem', 'Error'), translate('BiblePlugin.MediaItem', 'You cannot combine single ' - 'and dual bible verses. Do you want to delete your search ' + 'and second bible verses. Do you want to delete your search ' 'results and start a new search?'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes: self.listView.clear() - self.displayResults(bible, dual_bible) + self.displayResults(bible, second_bible) elif self.search_results: - self.displayResults(bible, dual_bible) + self.displayResults(bible, second_bible) self.QuickSearchButton.setEnabled(True) - def displayResults(self, bible, dual_bible=u''): + def displayResults(self, bible, second_bible=u''): """ Displays the search results in the media manager. All data needed for further action is saved for/in each row. @@ -583,38 +642,41 @@ class BibleMediaItem(MediaManagerItem): version = self.parent.manager.get_meta_data(bible, u'Version') copyright = self.parent.manager.get_meta_data(bible, u'Copyright') permissions = self.parent.manager.get_meta_data(bible, u'Permissions') - if dual_bible: - dual_version = self.parent.manager.get_meta_data(dual_bible, + if second_bible: + second_version = self.parent.manager.get_meta_data(second_bible, u'Version') - dual_copyright = self.parent.manager.get_meta_data(dual_bible, + second_copyright = self.parent.manager.get_meta_data(second_bible, u'Copyright') - dual_permissions = self.parent.manager.get_meta_data(dual_bible, + second_permissions = self.parent.manager.get_meta_data(second_bible, u'Permissions') - if not dual_permissions: - dual_permissions = u'' - # We count the number of rows which are maybe already present. - start_count = self.listView.count() + if not second_permissions: + second_permissions = u'' for count, verse in enumerate(self.search_results): - if dual_bible: - vdict = { - 'book': QtCore.QVariant(verse.book.name), - 'chapter': QtCore.QVariant(verse.chapter), - 'verse': QtCore.QVariant(verse.verse), - 'bible': QtCore.QVariant(bible), - 'version': QtCore.QVariant(version.value), - 'copyright': QtCore.QVariant(copyright.value), - 'permissions': QtCore.QVariant(permissions.value), - 'text': QtCore.QVariant(verse.text), - 'dual_bible': QtCore.QVariant(dual_bible), - 'dual_version': QtCore.QVariant(dual_version.value), - 'dual_copyright': QtCore.QVariant(dual_copyright.value), - 'dual_permissions': QtCore.QVariant(dual_permissions.value), - 'dual_text': QtCore.QVariant( - self.dual_search_results[count].text) - } + if second_bible: + try: + vdict = { + 'book': QtCore.QVariant(verse.book.name), + 'chapter': QtCore.QVariant(verse.chapter), + 'verse': QtCore.QVariant(verse.verse), + 'bible': QtCore.QVariant(bible), + 'version': QtCore.QVariant(version.value), + 'copyright': QtCore.QVariant(copyright.value), + 'permissions': QtCore.QVariant(permissions.value), + 'text': QtCore.QVariant(verse.text), + 'second_bible': QtCore.QVariant(second_bible), + 'second_version': QtCore.QVariant(second_version.value), + 'second_copyright': QtCore.QVariant( + second_copyright.value), + 'second_permissions': QtCore.QVariant( + second_permissions.value), + 'second_text': QtCore.QVariant( + self.second_search_results[count].text) + } + except IndexError: + break bible_text = u' %s %d:%d (%s, %s)' % (verse.book.name, verse.chapter, verse.verse, version.value, - dual_version.value) + second_version.value) else: vdict = { 'book': QtCore.QVariant(verse.book.name), @@ -625,22 +687,20 @@ class BibleMediaItem(MediaManagerItem): 'copyright': QtCore.QVariant(copyright.value), 'permissions': QtCore.QVariant(permissions.value), 'text': QtCore.QVariant(verse.text), - 'dual_bible': QtCore.QVariant(u''), - 'dual_version': QtCore.QVariant(u''), - 'dual_copyright': QtCore.QVariant(u''), - 'dual_permissions': QtCore.QVariant(u''), - 'dual_text': QtCore.QVariant(u'') + 'second_bible': QtCore.QVariant(u''), + 'second_version': QtCore.QVariant(u''), + 'second_copyright': QtCore.QVariant(u''), + 'second_permissions': QtCore.QVariant(u''), + 'second_text': QtCore.QVariant(u'') } - bible_text = u' %s %d:%d (%s)' % (verse.book.name, + bible_text = u'%s %d:%d (%s)' % (verse.book.name, verse.chapter, verse.verse, version.value) bible_verse = QtGui.QListWidgetItem(bible_text) bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict)) self.listView.addItem(bible_verse) - row = self.listView.setCurrentRow(count + start_count) - if row: - row.setSelected(True) + self.listView.selectAll() self.search_results = {} - self.dual_search_results = {} + self.second_search_results = {} def _decodeQtObject(self, bitem, key): reference = bitem.data(QtCore.Qt.UserRole) @@ -661,7 +721,7 @@ class BibleMediaItem(MediaManagerItem): if len(items) == 0: return False bible_text = u'' - old_chapter = u'' + old_chapter = -1 raw_footer = [] raw_slides = [] raw_title = [] @@ -676,22 +736,22 @@ class BibleMediaItem(MediaManagerItem): copyright = self._decodeQtObject(bitem, 'copyright') permissions = self._decodeQtObject(bitem, 'permissions') text = self._decodeQtObject(bitem, 'text') - dual_bible = self._decodeQtObject(bitem, 'dual_bible') - dual_version = self._decodeQtObject(bitem, 'dual_version') - dual_copyright = self._decodeQtObject(bitem, 'dual_copyright') - dual_permissions = self._decodeQtObject(bitem, 'dual_permissions') - dual_text = self._decodeQtObject(bitem, 'dual_text') + second_bible = self._decodeQtObject(bitem, 'second_bible') + second_version = self._decodeQtObject(bitem, 'second_version') + second_copyright = self._decodeQtObject(bitem, 'second_copyright') + second_permissions = self._decodeQtObject(bitem, 'second_permissions') + second_text = self._decodeQtObject(bitem, 'second_text') verse_text = self.formatVerse(old_chapter, chapter, verse) footer = u'%s (%s %s %s)' % (book, version, copyright, permissions) if footer not in raw_footer: raw_footer.append(footer) - if dual_bible: - footer = u'%s (%s %s %s)' % (book, dual_version, dual_copyright, - dual_permissions) + if second_bible: + footer = u'%s (%s %s %s)' % (book, second_version, + second_copyright, second_permissions) if footer not in raw_footer: raw_footer.append(footer) bible_text = u'%s %s\n\n%s %s' % (verse_text, text, verse_text, - dual_text) + second_text) raw_slides.append(bible_text) bible_text = u'' # If we are 'Verse Per Slide' then create a new slide. @@ -719,7 +779,7 @@ class BibleMediaItem(MediaManagerItem): raw_slides.append(bible_text) bible_text = u'' # Service Item: Capabilities - if self.parent.settings_tab.layout_style == 2 and not dual_bible: + if self.parent.settings_tab.layout_style == 2 and not second_bible: # Split the line but do not replace line breaks in renderer. service_item.add_capability(ItemCapabilities.NoLineBreaks) service_item.add_capability(ItemCapabilities.AllowsPreview) @@ -749,6 +809,12 @@ class BibleMediaItem(MediaManagerItem): This methode is called, when we have to change the title, because we are at the end of a verse range. E. g. if we want to add Genesis 1:1-6 as well as Daniel 2:14. + + ``start_item`` + The first item of a range. + + ``old_item`` + The last item of a range. """ old_bitem = self.listView.item(old_item.row()) old_chapter = int(self._decodeQtObject(old_bitem, 'chapter')) @@ -758,18 +824,18 @@ class BibleMediaItem(MediaManagerItem): start_chapter = int(self._decodeQtObject(start_bitem, 'chapter')) start_verse = int(self._decodeQtObject(start_bitem, 'verse')) start_bible = self._decodeQtObject(start_bitem, 'bible') - start_dual_bible = self._decodeQtObject(start_bitem, 'dual_bible') - if start_dual_bible: + start_second_bible = self._decodeQtObject(start_bitem, 'second_bible') + if start_second_bible: if start_verse == old_verse and start_chapter == old_chapter: title = u'%s %s:%s (%s, %s)' % (start_book, start_chapter, - start_verse, start_bible, start_dual_bible) + start_verse, start_bible, start_second_bible) elif start_chapter == old_chapter: title = u'%s %s:%s-%s (%s, %s)' % (start_book, start_chapter, - start_verse, old_verse, start_bible, start_dual_bible) + start_verse, old_verse, start_bible, start_second_bible) else: title = u'%s %s:%s-%s:%s (%s, %s)' % (start_book, start_chapter, start_verse, old_chapter, old_verse, start_bible, - start_dual_bible) + start_second_bible) else: if start_verse == old_verse and start_chapter == old_chapter: title = u'%s %s:%s (%s)' % (start_book, start_chapter, @@ -785,34 +851,62 @@ class BibleMediaItem(MediaManagerItem): def checkTitle(self, item, old_item): """ This methode checks if we are at the end of an verse range. If that is - the case, we return True, else False. E. g. if we added Genesis 1:1-6, - but the next verse is Daniel 2:14. + the case, we return True, otherwise False. E. g. if we added + Genesis 1:1-6, but the next verse is Daniel 2:14, we return True. + + ``item`` + The item we are dealing with at the moment. + + ``old_item`` + The item we were previously dealing with. """ + # Get all the necessary meta data. bitem = self.listView.item(item.row()) book = self._decodeQtObject(bitem, 'book') chapter = int(self._decodeQtObject(bitem, 'chapter')) verse = int(self._decodeQtObject(bitem, 'verse')) bible = self._decodeQtObject(bitem, 'bible') - dual_bible = self._decodeQtObject(bitem, 'dual_bible') + second_bible = self._decodeQtObject(bitem, 'second_bible') old_bitem = self.listView.item(old_item.row()) old_book = self._decodeQtObject(old_bitem, 'book') old_chapter = int(self._decodeQtObject(old_bitem, 'chapter')) old_verse = int(self._decodeQtObject(old_bitem, 'verse')) old_bible = self._decodeQtObject(old_bitem, 'bible') - old_dual_bible = self._decodeQtObject(old_bitem, 'dual_bible') - if old_bible != bible or old_dual_bible != dual_bible or \ + old_second_bible = self._decodeQtObject(old_bitem, 'second_bible') + if old_bible != bible or old_second_bible != second_bible or \ old_book != book: + # The bible, second bible or book has changed. return True elif old_verse + 1 != verse and old_chapter == chapter: + # We are still in the same chapter, but a verse has been skipped. return True elif old_chapter + 1 == chapter and (verse != 1 or old_verse != self.parent.manager.get_verse_count( old_bible, old_book, old_chapter)): + # We are in the following chapter, but the last verse was not the + # last verse of the chapter or the current verse is not the + # first one of the chapter. return True else: return False def formatVerse(self, old_chapter, chapter, verse): + """ + Formats and returns the text, each verse starts with, for the given + chapter and verse. The text is either surrounded by round, square, + curly brackets or no brackets at all. For example:: + + u'{su}1:1{/su}' + + ``old_chapter`` + The previous verse's chapter number (int). + + ``chapter`` + The chapter number (int). + + ``verse`` + The verse number (int). + """ if not self.parent.settings_tab.show_new_chapters or \ old_chapter != chapter: verse_text = u'%s:%s' % (chapter, verse) diff --git a/openlp/plugins/custom/lib/customxmlhandler.py b/openlp/plugins/custom/lib/customxmlhandler.py index 907c3470d..14ca23ee0 100644 --- a/openlp/plugins/custom/lib/customxmlhandler.py +++ b/openlp/plugins/custom/lib/customxmlhandler.py @@ -42,9 +42,8 @@ The basic XML is of the format:: import logging from xml.dom.minidom import Document -from xml.etree.ElementTree import ElementTree, XML, dump +from xml.etree.ElementTree import dump from lxml import etree, objectify -from xml.parsers.expat import ExpatError log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 014c66a51..67ef4d8c1 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -507,8 +507,7 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): filenames=self.getListOfFiles( self.songBeamerFileListWidget) ) - success = importer.do_import() - if success: + if importer.do_import(): # reload songs self.importProgressLabel.setText( translate('SongsPlugin.SongImportForm', 'Finished import.')) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 7c13e0989..e057bb516 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -405,7 +405,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def mergeAuthors(self, old_author): """ Merges two authors into one author. - + ``old_author`` The author which will be deleted afterwards. """ @@ -427,7 +427,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def mergeTopics(self, old_topic): """ Merges two topics into one topic. - + ``old_topic`` The topic which will be deleted afterwards. """ @@ -447,7 +447,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def mergeBooks(self, old_book): """ Merges two books into one book. - + ``old_book`` The book which will be deleted afterwards. """ diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 6b993994c..662a94f5b 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -152,7 +152,7 @@ class OpenLPSongImport(SongImport): u'Importing song %s of %s' % (song_count, song_total)) new_song = Song() new_song.title = song.title - if has_media_files: + if has_media_files and hasattr(song, 'alternate_title'): new_song.alternate_title = song.alternate_title else: old_titles = song.search_title.split(u'@') diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index 8b07d2b32..44e8805c9 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -57,15 +57,17 @@ class SongBeamerTypes(object): u'Unknown': u'O' } + class SongBeamerImport(SongImport): """ - Import Song Beamer files(s) - Song Beamer file format is text based - in the beginning are one or more control tags written + Import Song Beamer files(s) + Song Beamer file format is text based + in the beginning are one or more control tags written """ def __init__(self, master_manager, **kwargs): """ Initialise the import. + ``master_manager`` The song manager for the running OpenLP installation. """ @@ -88,6 +90,7 @@ class SongBeamerImport(SongImport): # TODO: check that it is a valid SongBeamer file self.current_verse = u'' self.current_verse_type = u'V' + read_verses = False self.file_name = os.path.split(file)[1] self.import_wizard.incrementProgressBar( "Importing %s" % (self.file_name), 0) @@ -100,134 +103,182 @@ class SongBeamerImport(SongImport): else: return False for line in self.songData: - line = line.strip() - if line.startswith('#'): - log.debug(u'find tag: %s' % line) - if not self.parse_tags(line): - return False - elif line.startswith('---'): - log.debug(u'find ---') - if len(self.current_verse) > 0: - self.add_verse(self.current_verse, + # Just make sure that the line is of the type 'Unicode'. + line = unicode(line).strip() + if line.startswith(u'#') and not read_verses: + self.parse_tags(line) + elif line.startswith(u'---'): + if self.current_verse: + self.replace_html_tags() + self.add_verse(self.current_verse, self.current_verse_type) self.current_verse = u'' self.current_verse_type = u'V' - self.read_verse = True - self.verse_start = True - elif self.read_verse: - if self.verse_start: - self.check_verse_marks(line) - self.verse_start = False + read_verses = True + verse_start = True + elif read_verses: + if verse_start: + verse_start = False + if not self.check_verse_marks(line): + self.current_verse = u'%s\n' % line else: self.current_verse += u'%s\n' % line - if len(self.current_verse) > 0: + if self.current_verse: + self.replace_html_tags() self.add_verse(self.current_verse, self.current_verse_type) self.finish() self.import_wizard.incrementProgressBar( "Importing %s" % (self.file_name)) return True + def replace_html_tags(self): + """ + This can be called to replace SongBeamer's specific (html) tags with + OpenLP's specific (html) tags. + """ + tag_pairs = [ + (u'', u'{st}'), + (u'', u'{/st}'), + (u'', u'{it}'), + (u'', u'{/it}'), + (u'', u'{u}'), + (u'', u'{/u}'), + (u'
', u'{st}'), + (u'
', u'{st}'), + (u'', u'{st}'), + (u'

', u'{p}'), + (u'

', u'{/p}'), + (u'', u'{su}'), + (u'', u'{/su}'), + (u'', u'{sb}'), + (u'', u'{/sb}'), + (u'', u''), + (u'', u''), + (u'', u''), + (u'', u'') + ] + for pair in tag_pairs: + self.current_verse = self.current_verse.replace(pair[0], pair[1]) + # TODO: check for unsupported tags (see wiki) and remove them as well. + def parse_tags(self, line): - tag_val = line.split('=') - if len(tag_val[0]) == 0 or len(tag_val[1]) == 0: - return True - if tag_val[0] == '#(c)': + """ + Parses a meta data line. + + ``line`` + The line in the file. It should consist of a tag and a value + for this tag (unicode):: + + u'#Title=Nearer my God to Thee' + """ + tag_val = line.split(u'=', 1) + if len(tag_val) == 1: + return + if not tag_val[0] or not tag_val[1]: + return + if tag_val[0] == u'#(c)': self.add_copyright(tag_val[1]) - elif tag_val[0] == '#AddCopyrightInfo': + elif tag_val[0] == u'#AddCopyrightInfo': pass - elif tag_val[0] == '#Author': - #TODO split Authors - self.add_author(tag_val[1]) - elif tag_val[0] == '#BackgroundImage': + elif tag_val[0] == u'#Author': + self.parse_author(tag_val[1]) + elif tag_val[0] == u'#BackgroundImage': pass - elif tag_val[0] == '#Bible': + elif tag_val[0] == u'#Bible': pass - elif tag_val[0] == '#Categories': + elif tag_val[0] == u'#Categories': self.topics = line.split(',') - elif tag_val[0] == '#CCLI': + elif tag_val[0] == u'#CCLI': self.ccli_number = tag_val[1] - elif tag_val[0] == '#Chords': + elif tag_val[0] == u'#Chords': pass - elif tag_val[0] == '#ChurchSongID': + elif tag_val[0] == u'#ChurchSongID': pass - elif tag_val[0] == '#ColorChords': + elif tag_val[0] == u'#ColorChords': pass - elif tag_val[0] == '#Comments': + elif tag_val[0] == u'#Comments': self.comments = tag_val[1] - elif tag_val[0] == '#Editor': + elif tag_val[0] == u'#Editor': pass - elif tag_val[0] == '#Font': + elif tag_val[0] == u'#Font': pass - elif tag_val[0] == '#FontLang2': + elif tag_val[0] == u'#FontLang2': pass - elif tag_val[0] == '#FontSize': + elif tag_val[0] == u'#FontSize': pass - elif tag_val[0] == '#Format': + elif tag_val[0] == u'#Format': pass - elif tag_val[0] == '#Format_PreLine': + elif tag_val[0] == u'#Format_PreLine': pass - elif tag_val[0] == '#Format_PrePage': + elif tag_val[0] == u'#Format_PrePage': pass - elif tag_val[0] == '#ID': + elif tag_val[0] == u'#ID': pass - elif tag_val[0] == '#Key': + elif tag_val[0] == u'#Key': pass - elif tag_val[0] == '#Keywords': + elif tag_val[0] == u'#Keywords': pass - elif tag_val[0] == '#LangCount': + elif tag_val[0] == u'#LangCount': pass - elif tag_val[0] == '#Melody': - #TODO split Authors - self.add_author(tag_val[1]) - elif tag_val[0] == '#NatCopyright': + elif tag_val[0] == u'#Melody': + self.parse_author(tag_val[1]) + elif tag_val[0] == u'#NatCopyright': pass - elif tag_val[0] == '#OTitle': + elif tag_val[0] == u'#OTitle': pass - elif tag_val[0] == '#OutlineColor': + elif tag_val[0] == u'#OutlineColor': pass - elif tag_val[0] == '#OutlinedFont': + elif tag_val[0] == u'#OutlinedFont': pass - elif tag_val[0] == '#QuickFind': + elif tag_val[0] == u'#QuickFind': pass - elif tag_val[0] == '#Rights': + elif tag_val[0] == u'#Rights': song_book_pub = tag_val[1] - elif tag_val[0] == '#Songbook': + elif tag_val[0] == u'#Songbook': book_num = tag_val[1].split(' / ') self.song_book_name = book_num[0] if len(book_num) == book_num[1]: self.song_number = u'' - elif tag_val[0] == '#Speed': + elif tag_val[0] == u'#Speed': pass - elif tag_val[0] == '#TextAlign': + elif tag_val[0] == u'#TextAlign': pass - elif tag_val[0] == '#Title': + elif tag_val[0] == u'#Title': self.title = u'%s' % tag_val[1] - elif tag_val[0] == '#TitleAlign': + elif tag_val[0] == u'#TitleAlign': pass - elif tag_val[0] == '#TitleFontSize': + elif tag_val[0] == u'#TitleFontSize': pass - elif tag_val[0] == '#TitleLang2': + elif tag_val[0] == u'#TitleLang2': pass - elif tag_val[0] == '#TitleLang3': + elif tag_val[0] == u'#TitleLang3': pass - elif tag_val[0] == '#TitleLang4': + elif tag_val[0] == u'#TitleLang4': pass - elif tag_val[0] == '#Translation': + elif tag_val[0] == u'#Translation': pass - elif tag_val[0] == '#Transpose': + elif tag_val[0] == u'#Transpose': pass - elif tag_val[0] == '#TransposeAccidental': + elif tag_val[0] == u'#TransposeAccidental': pass - elif tag_val[0] == '#Version': + elif tag_val[0] == u'#Version': pass - else: - pass - return True def check_verse_marks(self, line): - marks = line.split(' ') + """ + Check and add the verse's MarkType. Returns ``True`` if the given line + contains a correct verse mark otherwise ``False``. + + ``line`` + The line to check for marks (unicode). + """ + marks = line.split(u' ') if len(marks) <= 2 and marks[0] in SongBeamerTypes.MarkTypes: self.current_verse_type = SongBeamerTypes.MarkTypes[marks[0]] if len(marks) == 2: - #TODO: may check, because of only digits are allowed - self.current_verse_type += marks[1] + # If we have a digit, we append it to current_verse_type. + if marks[1].isdigit(): + self.current_verse_type += marks[1] + return True + else: + return False diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index 2c1de83a2..ea36d55b5 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -254,7 +254,8 @@ class SongImport(QtCore.QObject): All fields have been set to this song. Write it away """ if not self.authors: - self.authors.append(u'Author unknown') + self.authors.append(unicode(translate('SongsPlugin.SongImport', + 'Author unknown'))) self.commit_song() def commit_song(self): diff --git a/resources/forms/themewizard.ui b/resources/forms/themewizard.ui index 4ca7271d3..9e1f8f9e8 100644 --- a/resources/forms/themewizard.ui +++ b/resources/forms/themewizard.ui @@ -133,138 +133,254 @@ p, li { white-space: pre-wrap; } Set up your theme's background according to the parameters below. - - - QFormLayout::ExpandingFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 8 - - + + 8 20 - - - - Background type: - - - - - - - - Solid Color - - - - - Gradient - - - - - Image - - - - - - - - <Color1> - - - - - - - - - - - - - - <Color2> - - - - - - - - - - - - - - Image: - - - - - + + 8 - - - - + - - - - - :/general/general_open.png:/general/general_open.png + Background type: + + + + + Solid Color + + + + + Gradient + + + + + Image + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - - Gradient: + + + + 0 - - - - - - - Horizontal - - - - - Vertical - - - - - Circular - - - - - Top Left - Bottom Right - - - - - Bottom Left - Top Right - - + + + + 8 + + + 8 + + + 0 + + + + + + 103 + 0 + + + + Color: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + + 8 + + + 8 + + + 0 + + + + + + 103 + 0 + + + + Starting color: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + 103 + 0 + + + + Ending color: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + 103 + 0 + + + + Gradient: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + Horizontal + + + + + Vertical + + + + + Circular + + + + + Top Left - Bottom Right + + + + + Bottom Left - Top Right + + + + + + + + + + 8 + + + 8 + + + 0 + + + + + + 103 + 0 + + + + Image: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 8 + + + + + + + + + + + + :/general/general_open.png:/general/general_open.png + + + + + + + @@ -276,30 +392,30 @@ p, li { white-space: pre-wrap; } Define the font and display characteristics for the Display text - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - + 8 8 - - 20 - - - 20 - - + 20 + + + 103 + 0 + + Font: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -313,11 +429,32 @@ p, li { white-space: pre-wrap; } - - - + + + 24 - + + + + + + + + + + + Bold + + + + + + + Italic + + + + @@ -458,20 +595,6 @@ p, li { white-space: pre-wrap; } - - - - Bold Display - - - - - - - Italic Display - - - @@ -491,23 +614,23 @@ p, li { white-space: pre-wrap; } 8 - - 50 - - - 20 - - - 20 - - + 20 + + + 103 + 0 + + Font: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -569,14 +692,29 @@ p, li { white-space: pre-wrap; } Allows additional display formatting information to be defined + + 8 + + + 8 + 20 + + + 103 + 0 + + Horizontal Align: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -643,7 +781,7 @@ p, li { white-space: pre-wrap; } Allows you to change and move the Main and Footer areas. - + 20 @@ -983,129 +1121,114 @@ p, li { white-space: pre-wrap; } View the theme and save it replacing the current one or change the name to create a new theme - - - - 20 - 10 - 82 - 16 - + + + 8 - - Theme name: + + 20 - - Qt::PlainText - - - themeNameEdit - - - - - - 250 - 60 - 48 - 16 - - - - Preview - - - Qt::AlignCenter - - - - - - 117 - 4 - 351 - 23 - - - - - - - 40 - 80 - 464 - 214 - - - - - - - - - - Qt::Horizontal - - - - 58 - 20 - - - - - - - - - 0 - 0 - - - - - 300 - 200 - - - - QFrame::WinPanel - - - QFrame::Sunken - - - 1 - - - - - - true - - - - - - - Qt::Horizontal - - - - 78 - 20 - - - - - - + + + + 8 + + + + + + 103 + 0 + + + + Theme name: + + + Qt::PlainText + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + themeNameEdit + + + + + + + + + + + + 0 + + + + + Qt::Horizontal + + + + 58 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 150 + + + + QFrame::WinPanel + + + QFrame::Sunken + + + 1 + + + + + + true + + + + + + + Qt::Horizontal + + + + 78 + 20 + + + + + + + - - @@ -1124,5 +1247,21 @@ p, li { white-space: pre-wrap; } + + backgroundTypeComboBox + currentIndexChanged(int) + backgroundStackedWidget + setCurrentIndex(int) + + + 178 + 78 + + + 249 + 199 + + + diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc index 0ecb87bca..2a3282461 100644 --- a/resources/images/openlp-2.qrc +++ b/resources/images/openlp-2.qrc @@ -81,6 +81,7 @@ wizard_importsong.bmp wizard_importbible.bmp + wizard_createtheme.bmp service_collapse_all.png diff --git a/resources/images/wizard_createtheme.bmp b/resources/images/wizard_createtheme.bmp new file mode 100644 index 000000000..092c61ad4 Binary files /dev/null and b/resources/images/wizard_createtheme.bmp differ