From 1c11cab27b5ac5f65df30295a8beb45617f5395a Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 24 Nov 2010 01:51:08 +0000 Subject: [PATCH 1/3] Whitespace & unused imports --- openlp/core/lib/__init__.py | 4 ++-- openlp/core/lib/htmlbuilder.py | 15 ++++++++------- openlp/core/lib/mediamanageritem.py | 6 +++--- openlp/core/lib/spelltextedit.py | 2 +- openlp/core/lib/theme.py | 14 ++++++++------ openlp/core/ui/advancedtab.py | 3 ++- openlp/core/ui/themeform.py | 2 +- openlp/core/ui/thememanager.py | 3 ++- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index b6946a628..90ee64a46 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -303,8 +303,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..9a042ed10 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,22 +382,22 @@ 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 \ - (BackgroundGradientType.LeftBottom): + 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 \ - (BackgroundGradientType.Vertical): + elif theme.background_direction == BackgroundGradientType.to_string( + BackgroundGradientType.Vertical): background = \ u'background: -webkit-gradient(linear, left top, ' \ u'right top, from(%s), to(%s))' % \ diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 3eae97238..c559c3e4b 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -474,8 +474,8 @@ class MediaManagerItem(QtGui.QWidget): translate('OpenLP.MediaManagerItem', 'You must select one or more items.')) else: - # Is it posssible to process multiple list items to generate multiple - # service items? + # Is it posssible to process multiple list items to generate + # multiple service items? if self.singleServiceItem or self.remoteTriggered: log.debug(self.plugin.name + u' Add requested') service_item = self.buildServiceItem() @@ -504,7 +504,7 @@ class MediaManagerItem(QtGui.QWidget): log.debug(self.plugin.name + u' Add requested') service_item = self.parent.serviceManager.getServiceItem() if not service_item: - QtGui.QMessageBox.information(self, + QtGui.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'No Service Item Selected'), translate('OpenLP.MediaManagerItem', diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index 603197c07..8a9a20a18 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -33,7 +33,7 @@ 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 diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index f211048e3..302a271a1 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 @@ -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. @@ -441,7 +441,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 +457,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 +472,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, diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index dc126d863..f46f8fae8 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/themeform.py b/openlp/core/ui/themeform.py index 0ea5f057f..5bb0cbb7b 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -596,5 +596,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 0f0802bf2..d9e89e6d6 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -630,7 +630,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 From 9291516b59aef0842c968ad3f621a22b7fc4b91e Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 6 Dec 2010 23:37:55 +0000 Subject: [PATCH 2/3] Fix v2 import bug --- openlp/plugins/songs/lib/olpimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'@') From 7f60e706aad28b4dc0079d6d7226fe5f8d928be8 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 6 Dec 2010 23:59:01 +0000 Subject: [PATCH 3/3] Unused imports --- openlp/plugins/custom/lib/customxmlhandler.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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__)