From d3bfffa4b15a93d3245e431a5a7ae26078cb575e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 22:12:57 +0200 Subject: [PATCH 1/3] removed not used imports --- openlp/plugins/bibles/lib/db.py | 1 - openlp/plugins/images/lib/imagetab.py | 1 - openlp/plugins/presentations/lib/presentationcontroller.py | 2 +- openlp/plugins/presentations/presentationplugin.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/openlyricsexport.py | 1 - openlp/plugins/songs/lib/upgrade.py | 2 +- openlp/plugins/songusage/forms/songusagedeletedialog.py | 1 - 8 files changed, 4 insertions(+), 8 deletions(-) diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index e5962664b..9ec5b45b2 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -28,7 +28,6 @@ import logging import chardet import os -import re import sqlite3 from PyQt4 import QtCore diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 98fbd203f..1aa39b63c 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, translate, Receiver -from openlp.core.lib.ui import UiStrings, create_valign_combo class ImageTab(SettingsTab): """ diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 55823dfd2..a9d384c81 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -32,7 +32,7 @@ import shutil from PyQt4 import QtCore from openlp.core.lib import Receiver, check_directory_exists, create_thumb, \ - resize_image, validate_thumb + validate_thumb from openlp.core.utils import AppLocation log = logging.getLogger(__name__) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index a97f82159..643ad14ad 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -87,7 +87,7 @@ class PresentationPlugin(Plugin): to close down their applications and release resources. """ log.info(u'Plugin Finalise') - #Ask each controller to tidy up + # Ask each controller to tidy up. for key in self.controllers: controller = self.controllers[key] if controller.enabled(): diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 98b2d3f24..f20c02903 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -397,7 +397,7 @@ class SongMediaItem(MediaManagerItem): try: os.remove(media_file.file_name) except: - log.exception('Could not remove file: %s', audio) + log.exception('Could not remove file: %s', media_file) try: save_path = os.path.join(AppLocation.get_section_data_path( self.plugin.name), 'audio', str(item_id)) diff --git a/openlp/plugins/songs/lib/openlyricsexport.py b/openlp/plugins/songs/lib/openlyricsexport.py index ec5677ea4..515674618 100644 --- a/openlp/plugins/songs/lib/openlyricsexport.py +++ b/openlp/plugins/songs/lib/openlyricsexport.py @@ -30,7 +30,6 @@ songs from the database to the OpenLyrics format. """ import logging import os -import re from lxml import etree diff --git a/openlp/plugins/songs/lib/upgrade.py b/openlp/plugins/songs/lib/upgrade.py index fae3400c2..21988c267 100644 --- a/openlp/plugins/songs/lib/upgrade.py +++ b/openlp/plugins/songs/lib/upgrade.py @@ -29,7 +29,7 @@ The :mod:`upgrade` module provides a way for the database and schema that is the backend for the Songs plugin """ -from sqlalchemy import Column, ForeignKey, Table, types +from sqlalchemy import Column, Table, types from sqlalchemy.sql.expression import func from migrate import changeset from migrate.changeset.constraint import ForeignKeyConstraint diff --git a/openlp/plugins/songusage/forms/songusagedeletedialog.py b/openlp/plugins/songusage/forms/songusagedeletedialog.py index 28f18d578..a6f7fb2b0 100644 --- a/openlp/plugins/songusage/forms/songusagedeletedialog.py +++ b/openlp/plugins/songusage/forms/songusagedeletedialog.py @@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate -from openlp.core.lib.ui import create_accept_reject_button_box class Ui_SongUsageDeleteDialog(object): def setupUi(self, songUsageDeleteDialog): From 91c20c42713b8dcbf28efecfb0bf628241042b99 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 22:26:51 +0200 Subject: [PATCH 2/3] more clean ups --- openlp/plugins/bibles/lib/http.py | 9 ++++++--- openlp/plugins/songs/lib/cclifileimport.py | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 2d8e16c4c..228d4758c 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -82,13 +82,16 @@ class BGExtract(object): Receiver.send_message(u'openlp_process_events') footnotes = soup.findAll(u'sup', u'footnote') if footnotes: - [footnote.extract() for footnote in footnotes] + for footnote in footnotes: + footnote.extract() crossrefs = soup.findAll(u'sup', u'xref') if crossrefs: - [crossref.extract() for crossref in crossrefs] + for crossref in crossrefs: + crossref.extract() headings = soup.findAll(u'h5') if headings: - [heading.extract() for heading in headings] + for heading in headings: + heading.extract() cleanup = [(re.compile('\s+'), lambda match: ' ')] verses = BeautifulSoup(str(soup), markupMassage=cleanup) verse_list = {} diff --git a/openlp/plugins/songs/lib/cclifileimport.py b/openlp/plugins/songs/lib/cclifileimport.py index e15f898ab..624256290 100644 --- a/openlp/plugins/songs/lib/cclifileimport.py +++ b/openlp/plugins/songs/lib/cclifileimport.py @@ -333,5 +333,6 @@ class CCLIFileImport(SongImport): if len(author_list) < 2: author_list = song_author.split(u'|') # Clean spaces before and after author names. - [self.addAuthor(author_name.strip()) for author_name in author_list] + for author_name in author_list: + self.addAuthor(author_name.strip()) return self.finish() From 947b31d2c412b7ec66f8182080a1439b004be485 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 3 Oct 2011 22:28:17 +0200 Subject: [PATCH 3/3] fixed name --- openlp/plugins/songs/lib/mediaitem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index f20c02903..d98a55c00 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -397,7 +397,8 @@ class SongMediaItem(MediaManagerItem): try: os.remove(media_file.file_name) except: - log.exception('Could not remove file: %s', media_file) + log.exception('Could not remove file: %s', + media_file.file_name) try: save_path = os.path.join(AppLocation.get_section_data_path( self.plugin.name), 'audio', str(item_id))