From a6bcfbf568656738110422d4ece1bb9670c026f5 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 21 Oct 2010 16:31:22 +0100 Subject: [PATCH] Cleanups --- openlp/core/lib/spelltextedit.py | 3 +-- openlp/core/lib/theme.py | 10 +++++----- openlp/core/ui/exceptionform.py | 2 +- openlp/core/ui/filerenameform.py | 1 - openlp/core/ui/thememanager.py | 7 +++---- openlp/core/utils/languagemanager.py | 1 - openlp/plugins/bibles/lib/mediaitem.py | 1 - openlp/plugins/custom/forms/editcustomslideform.py | 1 - openlp/plugins/songs/lib/ewimport.py | 14 +++++++------- openlp/plugins/songs/lib/songbeamerimport.py | 1 - 10 files changed, 17 insertions(+), 24 deletions(-) diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index 07e8ad728..603197c07 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -25,7 +25,6 @@ ############################################################################### import re -import sys try: import enchant from enchant import DictNotFoundError @@ -37,7 +36,7 @@ except ImportError: # 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, context_menu_action +from openlp.core.lib import html_expands, translate class SpellTextEdit(QtGui.QPlainTextEdit): def __init__(self, *args): diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index def6f01cc..ad6ca0f5b 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -87,12 +87,12 @@ class ThemeLevel(object): Service = 2 Song = 3 -boolean_list = [u'italics', u'override', u'outline', u'shadow', \ -u'slide_transition'] +boolean_list = [u'italics', u'override', u'outline', u'shadow', + u'slide_transition'] -integer_list =[u'proportion', u'line_adjustment', u'x', u'height', u'y', \ -u'width', u'shadow_size', u'outline_size', u'horizontal_align', \ -u'vertical_align', u'wrap_style' ] +integer_list = [u'proportion', u'line_adjustment', u'x', u'height', u'y', + u'width', u'shadow_size', u'outline_size', u'horizontal_align', + u'vertical_align', u'wrap_style'] class ThemeXML(object): """ diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 8c344e662..b40c9e063 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -24,7 +24,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -from PyQt4 import QtCore, QtGui +from PyQt4 import QtGui from exceptiondialog import Ui_ExceptionDialog diff --git a/openlp/core/ui/filerenameform.py b/openlp/core/ui/filerenameform.py index d1c339811..2a7f7bd7d 100644 --- a/openlp/core/ui/filerenameform.py +++ b/openlp/core/ui/filerenameform.py @@ -27,7 +27,6 @@ from PyQt4 import QtCore, QtGui from filerenamedialog import Ui_FileRenameDialog -from openlp.core.lib import translate class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog): """ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index ff61b05e8..2f060b12f 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -34,9 +34,8 @@ from PyQt4 import QtCore, QtGui from openlp.core.ui import AmendThemeForm, FileRenameForm from openlp.core.theme import Theme -from openlp.core.lib import OpenLPToolbar, context_menu_action, \ - ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \ - context_menu_separator, SettingsManager, translate, check_item_selected +from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \ + build_icon, Receiver, SettingsManager, translate, check_item_selected from openlp.core.utils import AppLocation, get_filesystem_encoding log = logging.getLogger(__name__) @@ -267,7 +266,7 @@ class ThemeManager(QtGui.QWidget): filename = \ os.path.split(unicode(oldThemeData.background_filename))[1] new_theme.add_background_image(filename) - save_to = os.path.join(self.path, theme_name, filename) + save_to = os.path.join(self.path, newThemeName, filename) save_from = oldThemeData.background_filename new_theme.add_font(unicode(oldThemeData.font_main_name), unicode(oldThemeData.font_main_color), diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index 000328d50..187834beb 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -28,7 +28,6 @@ The :mod:`languagemanager` module provides all the translation settings and language file loading for OpenLP. """ import logging -import os from PyQt4 import QtCore, QtGui diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index d38967e64..bb3c1b26d 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -32,7 +32,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, Receiver, BaseListWithDnD, \ ItemCapabilities, translate from openlp.plugins.bibles.forms import BibleImportForm -from openlp.plugins.bibles.lib.db import BibleDB log = logging.getLogger(__name__) diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py index ff396658f..5f535c8bc 100644 --- a/openlp/plugins/custom/forms/editcustomslideform.py +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -28,7 +28,6 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import Receiver, translate from editcustomslidedialog import Ui_CustomSlideEditDialog log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py index 4188304cd..cb360cf59 100644 --- a/openlp/plugins/songs/lib/ewimport.py +++ b/openlp/plugins/songs/lib/ewimport.py @@ -28,7 +28,6 @@ The :mod:`ewimport` module provides the functionality for importing EasyWorship song databases into the current installation database. """ -import sys import os import struct @@ -192,8 +191,9 @@ class EasyWorshipSongImport(SongImport): num_fields) field_names.pop() field_descs = [] - for i,field_name in enumerate(field_names): - field_type, field_size = struct.unpack_from('BB', field_info, i * 2) + for i, field_name in enumerate(field_names): + field_type, field_size = struct.unpack_from('BB', + field_info, i * 2) field_descs.append(FieldDescEntry(field_name, field_type, field_size)) self.set_record_struct(field_descs) @@ -272,7 +272,7 @@ class EasyWorshipSongImport(SongImport): return success def find_field(self, field_name): - return [i for i,x in enumerate(self.field_descs) \ + return [i for i, x in enumerate(self.field_descs) \ if x.name == field_name][0] def set_record_struct(self, field_descs): @@ -331,7 +331,7 @@ class EasyWorshipSongImport(SongImport): # Memo or Blob block_start, blob_size = \ struct.unpack_from(' 63: - return u''; + return u'' self.memo_file.seek(11 + (5 * sub_block), os.SEEK_CUR) sub_block_start, = struct.unpack('B', self.memo_file.read(1)) self.memo_file.seek(block_start + (sub_block_start * 16)) else: - return u''; + return u'' return self.memo_file.read(blob_size) else: return 0 diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index 505e99a46..8b07d2b32 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -29,7 +29,6 @@ The :mod:`songbeamerimport` module provides the functionality for importing """ import logging import os -import re import chardet import codecs