From 623b56742c291cec32263d8ea6b198f75dc4ebf7 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 7 Jul 2011 19:03:12 +0100 Subject: [PATCH 01/17] Cleanups --- openlp/core/lib/pluginmanager.py | 2 +- openlp/core/lib/spelltextedit.py | 2 +- openlp/core/lib/theme.py | 3 +-- openlp/core/ui/displaytagdialog.py | 2 +- openlp/core/ui/firsttimewizard.py | 6 +++--- openlp/core/ui/settingsform.py | 2 +- openlp/core/ui/slidecontroller.py | 4 ++-- openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/bibles/forms/bibleimportform.py | 3 +-- openlp/plugins/bibles/forms/bibleupgradeform.py | 3 +-- openlp/plugins/bibles/lib/db.py | 2 +- openlp/plugins/bibles/lib/http.py | 4 +--- openlp/plugins/bibles/lib/manager.py | 2 +- openlp/plugins/songs/lib/db.py | 2 +- openlp/plugins/songs/lib/easislidesimport.py | 3 --- openlp/plugins/songs/lib/ewimport.py | 1 - openlp/plugins/songs/lib/songbeamerimport.py | 1 - openlp/plugins/songs/lib/songimport.py | 3 +-- openlp/plugins/songs/lib/wowimport.py | 1 - openlp/plugins/songusage/songusageplugin.py | 2 +- 20 files changed, 19 insertions(+), 31 deletions(-) diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 7a54b4c64..2248d0ddd 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -31,7 +31,7 @@ import os import sys import logging -from openlp.core.lib import Plugin, StringContent, PluginStatus +from openlp.core.lib import Plugin, PluginStatus log = logging.getLogger(__name__) diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index 57a176a69..0d277b9fe 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -57,7 +57,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit): self.dictionary = enchant.Dict() self.highlighter = Highlighter(self.document()) self.highlighter.spellingDictionary = self.dictionary - except Error, DictNotFoundError: + except (Error, DictNotFoundError): ENCHANT_AVAILABLE = False log.debug(u'Could not load default dictionary') diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 7ad50490d..c87f9aa2e 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -34,8 +34,7 @@ import logging from xml.dom.minidom import Document from lxml import etree, objectify -from openlp.core.lib import str_to_bool, translate -from openlp.core.lib.ui import UiStrings +from openlp.core.lib import str_to_bool log = logging.getLogger(__name__) diff --git a/openlp/core/ui/displaytagdialog.py b/openlp/core/ui/displaytagdialog.py index 65e900bbb..328fcd137 100644 --- a/openlp/core/ui/displaytagdialog.py +++ b/openlp/core/ui/displaytagdialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate -from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box +from openlp.core.lib.ui import UiStrings class Ui_DisplayTagDialog(object): diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 3644ed07b..59fe41537 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -49,7 +49,7 @@ class Ui_FirstTimeWizard(object): FirstTimeWizard.resize(550, 386) FirstTimeWizard.setModal(True) FirstTimeWizard.setWizardStyle(QtGui.QWizard.ModernStyle) - FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages| + FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage) self.finishButton = self.button(QtGui.QWizard.FinishButton) @@ -81,9 +81,9 @@ class Ui_FirstTimeWizard(object): self.pluginLayout.addWidget(self.imageCheckBox) self.presentationCheckBox = QtGui.QCheckBox(self.pluginPage) if sys.platform == "darwin": - self.presentationCheckBox.setChecked(False) + self.presentationCheckBox.setChecked(False) else: - self.presentationCheckBox.setChecked(True) + self.presentationCheckBox.setChecked(True) self.presentationCheckBox.setObjectName(u'presentationCheckBox') self.pluginLayout.addWidget(self.presentationCheckBox) self.mediaCheckBox = QtGui.QCheckBox(self.pluginPage) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 711cac7c2..49d27a466 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -29,7 +29,7 @@ The :mod:`settingsform` provides a user interface for the OpenLP settings """ import logging -from PyQt4 import QtGui, QtCore +from PyQt4 import QtGui from openlp.core.lib import Receiver, build_icon, PluginStatus from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 8e2c199a1..03a35b1fb 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -31,8 +31,8 @@ import os from PyQt4 import QtCore, QtGui from PyQt4.phonon import Phonon -from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \ - ItemCapabilities, translate +from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \ + translate from openlp.core.lib.ui import UiStrings, shortcut_action from openlp.core.ui import HideMode, MainDisplay, ScreenList from openlp.core.utils.actions import ActionList, CategoryOrder diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 41c2e2211..19d5107f2 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -27,7 +27,7 @@ import logging -from PyQt4 import QtCore, QtGui +from PyQt4 import QtCore from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib.db import Manager diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index de1574eaa..b5478e514 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -27,7 +27,6 @@ """ The bible import functions for OpenLP """ -import csv import logging import os import os.path @@ -39,7 +38,7 @@ from openlp.core.lib import Receiver, translate from openlp.core.lib.db import delete_database from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings -from openlp.core.utils import AppLocation, string_is_unicode +from openlp.core.utils import AppLocation from openlp.plugins.bibles.lib.manager import BibleFormat from openlp.plugins.bibles.lib.db import BiblesResourcesDB, clean_filename diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 14936a340..d396bce8d 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -28,7 +28,6 @@ The bible import functions for OpenLP """ import logging import os.path -import re import shutil from PyQt4 import QtCore, QtGui @@ -39,7 +38,7 @@ from openlp.core.lib.db import delete_database from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings from openlp.core.utils import AppLocation, delete_file -from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB,\ +from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, \ BiblesResourcesDB, clean_filename from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 68f105dff..5273f670c 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -36,7 +36,7 @@ from sqlalchemy import Column, ForeignKey, or_, Table, types from sqlalchemy.orm import class_mapper, mapper, relation from sqlalchemy.orm.exc import UnmappedClassError -from openlp.core.lib import Receiver, translate, check_directory_exists +from openlp.core.lib import Receiver, translate from openlp.core.lib.db import BaseModel, init_db, Manager from openlp.core.lib.ui import critical_error_message_box from openlp.core.utils import AppLocation diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 03b094e82..8a46b75c4 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -29,9 +29,7 @@ The :mod:`http` module enables OpenLP to retrieve scripture from bible websites. """ import logging -import os import re -import sqlite3 import socket import urllib from HTMLParser import HTMLParseError @@ -40,7 +38,7 @@ from BeautifulSoup import BeautifulSoup, NavigableString, Tag from openlp.core.lib import Receiver, translate from openlp.core.lib.ui import critical_error_message_box -from openlp.core.utils import AppLocation, get_web_page +from openlp.core.utils import get_web_page from openlp.plugins.bibles.lib import SearchResults from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB, \ Book diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 9a0b20820..354332083 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -34,7 +34,7 @@ from openlp.core.lib import Receiver, SettingsManager, translate from openlp.core.lib.ui import critical_error_message_box from openlp.core.utils import AppLocation, delete_file from openlp.plugins.bibles.lib import parse_reference -from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB +from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta from csvbible import CSVBible from http import HTTPBible from opensong import OpenSongBible diff --git a/openlp/plugins/songs/lib/db.py b/openlp/plugins/songs/lib/db.py index 93d56a05a..c5c019c3c 100644 --- a/openlp/plugins/songs/lib/db.py +++ b/openlp/plugins/songs/lib/db.py @@ -29,7 +29,7 @@ The :mod:`db` module provides the database and schema that is the backend for the Songs plugin """ -from sqlalchemy import Column, ForeignKey, Index, Table, types +from sqlalchemy import Column, ForeignKey, Table, types from sqlalchemy.orm import mapper, relation from openlp.core.lib.db import BaseModel, init_db diff --git a/openlp/plugins/songs/lib/easislidesimport.py b/openlp/plugins/songs/lib/easislidesimport.py index b1eaceeaf..b24287130 100644 --- a/openlp/plugins/songs/lib/easislidesimport.py +++ b/openlp/plugins/songs/lib/easislidesimport.py @@ -26,13 +26,10 @@ ############################################################################### import logging -import os import re from lxml import etree, objectify -from openlp.core.lib import translate -from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib.songimport import SongImport diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py index 09f84fbe2..251068fb4 100644 --- a/openlp/plugins/songs/lib/ewimport.py +++ b/openlp/plugins/songs/lib/ewimport.py @@ -33,7 +33,6 @@ import os import struct from openlp.core.lib import translate -from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import retrieve_windows_encoding from songimport import SongImport diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index 3a8d63783..400db8f9a 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -36,7 +36,6 @@ import re from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib.songimport import SongImport -from openlp.plugins.songs.lib.ui import SongStrings log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index 781321fe4..dc45764e4 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -29,9 +29,8 @@ import re from PyQt4 import QtCore -from openlp.core.lib import Receiver, translate, check_directory_exists +from openlp.core.lib import Receiver, translate from openlp.core.ui.wizard import WizardStrings -from openlp.core.utils import AppLocation from openlp.plugins.songs.lib import clean_song, VerseType from openlp.plugins.songs.lib.db import Song, Author, Topic, Book, MediaFile from openlp.plugins.songs.lib.ui import SongStrings diff --git a/openlp/plugins/songs/lib/wowimport.py b/openlp/plugins/songs/lib/wowimport.py index 0648abe66..e2a5820a5 100644 --- a/openlp/plugins/songs/lib/wowimport.py +++ b/openlp/plugins/songs/lib/wowimport.py @@ -31,7 +31,6 @@ Worship songs into the OpenLP database. import os import logging -from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib.songimport import SongImport BLOCK_TYPES = (u'V', u'C', u'B') diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 7304b5196..c94b70554 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Plugin, StringContent, Receiver, build_icon, \ translate from openlp.core.lib.db import Manager -from openlp.core.lib.ui import base_action, shortcut_action, UiStrings +from openlp.core.lib.ui import base_action, shortcut_action from openlp.core.utils.actions import ActionList from openlp.plugins.songusage.forms import SongUsageDetailForm, \ SongUsageDeleteForm From 1899961965967246797083071f1da707099e6d18 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 7 Jul 2011 22:22:41 +0100 Subject: [PATCH 02/17] Long lines --- openlp/core/ui/mainwindow.py | 6 +++--- openlp/core/ui/shortcutlistform.py | 6 ++++-- openlp/plugins/bibles/lib/mediaitem.py | 3 ++- openlp/plugins/remotes/lib/httpserver.py | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index e850ef335..b182452bc 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -291,9 +291,9 @@ class Ui_MainWindow(object): self.onHelpLocalHelpClicked, u':/system/system_about.png', category=UiStrings().Help) self.helpOnlineHelpItem = shortcut_action( - mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'Alt+F1')], - self.onHelpOnlineHelpClicked, u':/system/system_online_help.png', - category=UiStrings().Help) + mainWindow, u'helpOnlineHelpItem', + [QtGui.QKeySequence(u'Alt+F1')], self.onHelpOnlineHelpClicked, + u':/system/system_online_help.png', category=UiStrings().Help) else: self.helpOnlineHelpItem = shortcut_action( mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'F1')], diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index 6bdcc46bc..1eccddc95 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -247,7 +247,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): alternate_label_text = action.defaultShortcuts[1].toString() shortcuts = self._actionShortcuts(action) # We do not want to loose pending changes, that is why we have to - # keep the text when, this function has not been triggered by a signal. + # keep the text when, this function has not been triggered by a + # signal. if item is None: primary_text = self.primaryPushButton.text() alternate_text = self.alternatePushButton.text() @@ -280,7 +281,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): """ Restores all default shortcuts. """ - if self.buttonBox.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole: + if self.buttonBox.buttonRole(button) != \ + QtGui.QDialogButtonBox.ResetRole: return if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'), diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index cb8273327..1c731ec6e 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -983,7 +983,8 @@ class BibleMediaItem(MediaManagerItem): Search for some Bible verses (by reference). """ bible = unicode(self.quickVersionComboBox.currentText()) - search_results = self.plugin.manager.get_verses(bible, string, False, False) + search_results = self.plugin.manager.get_verses( + bible, string, False, False) if search_results: versetext = u' '.join([verse.text for verse in search_results]) return [[string, versetext]] diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 34271019d..836b3d0ae 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -357,7 +357,8 @@ class HttpConnection(object): if ext == u'.html': mimetype = u'text/html' variables = self.template_vars - html = Template(filename=path, input_encoding=u'utf-8', output_encoding=u'utf-8').render(**variables) + html = Template(filename=path, input_encoding=u'utf-8', + output_encoding=u'utf-8').render(**variables) elif ext == u'.css': mimetype = u'text/css' elif ext == u'.js': From a71ea86e4d93bde6ecb7d4e48e4456fbfae3021c Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Sat, 9 Jul 2011 16:51:06 +0200 Subject: [PATCH 03/17] add script to check openlp dependencies --- scripts/check_dependencies.py | 148 ++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100755 scripts/check_dependencies.py diff --git a/scripts/check_dependencies.py b/scripts/check_dependencies.py new file mode 100755 index 000000000..967ff2185 --- /dev/null +++ b/scripts/check_dependencies.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2011 Raoul Snyman # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### + +""" +This script is used to check dependencies of OpenLP. It checks availability +of required python modules and their version. To verify availability of Python +modules, simply run this script:: + + @:~$ ./check_dependencies.py + +""" +import os +import sys + +is_win = sys.platform.startswith('win') + +VERS = { + 'Python': '2.6', + 'PyQt4': '4.6', + 'Qt4': '4.6', + 'sqlalchemy': '0.5', + # pyenchant 1.6 required on Windows + 'enchant': '1.6' if is_win else '1.3' + } + +# pywin32 +WIN32_MODULES = [ + 'win32com', + 'win32ui', + 'pywintypes', + ] + +MODULES = [ + 'PyQt4', + 'PyQt4.QtCore', + 'PyQt4.QtGui', + 'PyQt4.QtNetwork', + 'PyQt4.QtOpenGL', + 'PyQt4.QtSvg', + 'PyQt4.QtTest', + 'PyQt4.QtWebKit', + 'PyQt4.phonon', + 'sqlalchemy', + 'sqlite3', + 'lxml', + 'chardet', + 'enchant', + 'BeautifulSoup', + 'mako', + ] + + +OPTIONAL_MODULES = [ + ('sqlite', ' (SQLite 2 support)'), + ('MySQLdb', ' (MySQL support)'), + ('psycopg2', ' (PostgreSQL support)'), + ] + +w = sys.stdout.write + + +def check_vers(version, required, text): + if type(version) is str: + version = version.split('.') + version = [int(x) for x in version] + if type(required) is str: + required = required.split('.') + required = [int(x) for x in required] + w(' %s >= %s ... ' % (text, '.'.join([str(x) for x in required]))) + if version >= required: + w('.'.join([str(x) for x in version]) + os.linesep) + return True + else: + w('FAIL' + os.linesep) + return False + + +def verify_python(): + if not check_vers(list(sys.version_info), VERS['Python'], text='Python'): + exit(1) + + +def verify_versions(): + print('Verifying version of modules...') + from PyQt4 import QtCore + check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'], + 'PyQt4') + check_vers(QtCore.qVersion(), VERS['Qt4'], + 'Qt4') + check_vers(__import__('sqlalchemy').__version__, VERS['sqlalchemy'], + 'sqlalchemy') + check_vers(__import__('enchant').__version__, VERS['enchant'], + 'enchant') + + +def check_module(mod, text='', indent=' '): + space = (30 - len(mod) - len(text)) * ' ' + w(indent + '%s%s... ' % (mod, text) + space) + try: + __import__(mod) + w('OK') + except ImportError: + w('FAIL') + w(os.linesep) + + +def main(): + + verify_python() + + print('Checking for modules...') + for m in MODULES: + check_module(m) + + print('Checking for optional modules...') + for m in OPTIONAL_MODULES: + check_module(m[0], text=m[1]) + + if sys.platform.startswith('win'): + print('Checking for Windows specific modules...') + for m in WIN32_MODULES: + check_module(m) + + verify_versions() + + +if __name__ == u'__main__': + main() From 5951d2c2a32f90f611f4402dab60cc5919ad41c8 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Sat, 9 Jul 2011 22:13:33 +0200 Subject: [PATCH 04/17] Update script to check openlp dependecies by info about supported image formats, enchant backends and available languages --- scripts/check_dependencies.py | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/scripts/check_dependencies.py b/scripts/check_dependencies.py index 967ff2185..c60bf6842 100755 --- a/scripts/check_dependencies.py +++ b/scripts/check_dependencies.py @@ -107,10 +107,10 @@ def verify_versions(): 'PyQt4') check_vers(QtCore.qVersion(), VERS['Qt4'], 'Qt4') - check_vers(__import__('sqlalchemy').__version__, VERS['sqlalchemy'], - 'sqlalchemy') - check_vers(__import__('enchant').__version__, VERS['enchant'], - 'enchant') + import sqlalchemy + check_vers(sqlalchemy.__version__, VERS['sqlalchemy'], 'sqlalchemy') + import enchant + check_vers(enchant.__version__, VERS['enchant'], 'enchant') def check_module(mod, text='', indent=' '): @@ -124,6 +124,27 @@ def check_module(mod, text='', indent=' '): w(os.linesep) +def verify_pyenchant(): + print('Enchant...') + import enchant + backends = ', '.join([x.name for x in enchant.Broker().describe()]) + print(' available backends: %s' % backends) + langs = ', '.join(enchant.list_languages()) + print(' available languages: %s' % langs) + + +def verify_pyqt(): + print('Qt4 image formats...') + from PyQt4 import QtGui + read_f = ', '.join([unicode(format).lower() \ + for format in QtGui.QImageReader.supportedImageFormats()]) + write_f= ', '.join([unicode(format).lower() \ + for format in QtGui.QImageWriter.supportedImageFormats()]) + print(' read: %s' % read_f) + print(' write: %s' % write_f) + from PyQt4 import phonon + + def main(): verify_python() @@ -142,6 +163,8 @@ def main(): check_module(m) verify_versions() + verify_pyqt() + verify_pyenchant() if __name__ == u'__main__': From 3c63ffd4a67cd6b2ae00dbabdfdc058ac11680e5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Jul 2011 12:45:52 +0200 Subject: [PATCH 05/17] fixed bug 805082 Fixes: https://launchpad.net/bugs/805082 --- openlp/core/ui/mainwindow.py | 45 +++++++++++++----------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index e850ef335..ce5eaf7e9 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -276,29 +276,20 @@ class Ui_MainWindow(object): u'settingsConfigureItem', u':/system/system_settings.png', category=UiStrings().Settings) action_list.add_category(UiStrings().Help, CategoryOrder.standardMenu) - self.helpDocumentationItem = icon_action(mainWindow, - u'helpDocumentationItem', u':/system/system_help_contents.png', - category=None)#UiStrings().Help) - self.helpDocumentationItem.setEnabled(False) self.helpAboutItem = shortcut_action(mainWindow, u'helpAboutItem', [QtGui.QKeySequence(u'Ctrl+F1')], self.onHelpAboutItemClicked, u':/system/system_about.png', category=UiStrings().Help) if os.name == u'nt': self.localHelpFile = os.path.join( AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm') - self.helpLocalHelpItem = shortcut_action( - mainWindow, u'helpLocalHelpItem', [QtGui.QKeySequence(u'F1')], - self.onHelpLocalHelpClicked, u':/system/system_about.png', - category=UiStrings().Help) - self.helpOnlineHelpItem = shortcut_action( - mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'Alt+F1')], - self.onHelpOnlineHelpClicked, u':/system/system_online_help.png', - category=UiStrings().Help) - else: - self.helpOnlineHelpItem = shortcut_action( - mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'F1')], - self.onHelpOnlineHelpClicked, u':/system/system_online_help.png', - category=UiStrings().Help) + self.offlineHelpItem = shortcut_action( + mainWindow, u'offlineHelpItem', [QtGui.QKeySequence(u'F1')], + self.onOfflineHelpClicked, + u':/system/system_help_contents.png', category=UiStrings().Help) + self.onlineHelpItem = shortcut_action( + mainWindow, u'onlineHelpItem', + [QtGui.QKeySequence(u'Alt+F1')], self.onOnlineHelpClicked, + u':/system/system_online_help.png', category=UiStrings().Help) self.helpWebSiteItem = base_action( mainWindow, u'helpWebSiteItem', category=UiStrings().Help) add_actions(self.fileImportMenu, @@ -333,13 +324,12 @@ class Ui_MainWindow(object): add_actions(self.toolsMenu, (self.toolsAddToolItem, None)) add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None)) add_actions(self.toolsMenu, [self.updateThemeImages]) - add_actions(self.helpMenu, (self.helpDocumentationItem, None)) if os.name == u'nt': - add_actions(self.helpMenu, (self.helpLocalHelpItem, - self.helpOnlineHelpItem, None, self.helpWebSiteItem, + add_actions(self.helpMenu, (self.offlineHelpItem, + self.onlineHelpItem, None, self.helpWebSiteItem, self.helpAboutItem)) else: - add_actions(self.helpMenu, (self.helpOnlineHelpItem, None, + add_actions(self.helpMenu, (self.onlineHelpItem, None, self.helpWebSiteItem, self.helpAboutItem)) add_actions(self.menuBar, (self.fileMenu.menuAction(), self.viewMenu.menuAction(), self.toolsMenu.menuAction(), @@ -355,7 +345,6 @@ class Ui_MainWindow(object): self.toolsAddToolItem.setVisible(False) self.importLanguageItem.setVisible(False) self.exportLanguageItem.setVisible(False) - self.helpDocumentationItem.setVisible(False) self.setLockPanel(panelLocked) def retranslateUi(self, mainWindow): @@ -456,15 +445,13 @@ class Ui_MainWindow(object): '&Plugin List')) self.settingsPluginListItem.setStatusTip( translate('OpenLP.MainWindow', 'List the Plugins')) - self.helpDocumentationItem.setText( - translate('OpenLP.MainWindow', '&User Guide')) self.helpAboutItem.setText(translate('OpenLP.MainWindow', '&About')) self.helpAboutItem.setStatusTip( translate('OpenLP.MainWindow', 'More information about OpenLP')) if os.name == u'nt': - self.helpLocalHelpItem.setText( - translate('OpenLP.MainWindow', '&Help')) - self.helpOnlineHelpItem.setText( + self.offlineHelpItem.setText( + translate('OpenLP.MainWindow', '&User Guide')) + self.onlineHelpItem.setText( translate('OpenLP.MainWindow', '&Online Help')) self.helpWebSiteItem.setText( translate('OpenLP.MainWindow', '&Web Site')) @@ -762,13 +749,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): import webbrowser webbrowser.open_new(u'http://openlp.org/') - def onHelpLocalHelpClicked(self): + def onOfflineHelpClicked(self): """ Load the local OpenLP help file """ os.startfile(self.localHelpFile) - def onHelpOnlineHelpClicked(self): + def onOnlineHelpClicked(self): """ Load the online OpenLP manual """ From 50bc672f59a900721b6f1f3f0927b2c8f1f0252b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Jul 2011 12:52:30 +0200 Subject: [PATCH 06/17] removed the trailing 'help' --- openlp/core/ui/mainwindow.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index ce5eaf7e9..c88508672 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -276,8 +276,8 @@ class Ui_MainWindow(object): u'settingsConfigureItem', u':/system/system_settings.png', category=UiStrings().Settings) action_list.add_category(UiStrings().Help, CategoryOrder.standardMenu) - self.helpAboutItem = shortcut_action(mainWindow, u'helpAboutItem', - [QtGui.QKeySequence(u'Ctrl+F1')], self.onHelpAboutItemClicked, + self.aboutItem = shortcut_action(mainWindow, u'aboutItem', + [QtGui.QKeySequence(u'Ctrl+F1')], self.onAboutItemClicked, u':/system/system_about.png', category=UiStrings().Help) if os.name == u'nt': self.localHelpFile = os.path.join( @@ -290,8 +290,8 @@ class Ui_MainWindow(object): mainWindow, u'onlineHelpItem', [QtGui.QKeySequence(u'Alt+F1')], self.onOnlineHelpClicked, u':/system/system_online_help.png', category=UiStrings().Help) - self.helpWebSiteItem = base_action( - mainWindow, u'helpWebSiteItem', category=UiStrings().Help) + self.webSiteItem = base_action( + mainWindow, u'webSiteItem', category=UiStrings().Help) add_actions(self.fileImportMenu, (self.importThemeItem, self.importLanguageItem)) add_actions(self.fileExportMenu, @@ -326,11 +326,11 @@ class Ui_MainWindow(object): add_actions(self.toolsMenu, [self.updateThemeImages]) if os.name == u'nt': add_actions(self.helpMenu, (self.offlineHelpItem, - self.onlineHelpItem, None, self.helpWebSiteItem, - self.helpAboutItem)) + self.onlineHelpItem, None, self.webSiteItem, + self.aboutItem)) else: add_actions(self.helpMenu, (self.onlineHelpItem, None, - self.helpWebSiteItem, self.helpAboutItem)) + self.webSiteItem, self.aboutItem)) add_actions(self.menuBar, (self.fileMenu.menuAction(), self.viewMenu.menuAction(), self.toolsMenu.menuAction(), self.settingsMenu.menuAction(), self.helpMenu.menuAction())) @@ -445,15 +445,15 @@ class Ui_MainWindow(object): '&Plugin List')) self.settingsPluginListItem.setStatusTip( translate('OpenLP.MainWindow', 'List the Plugins')) - self.helpAboutItem.setText(translate('OpenLP.MainWindow', '&About')) - self.helpAboutItem.setStatusTip( + self.aboutItem.setText(translate('OpenLP.MainWindow', '&About')) + self.aboutItem.setStatusTip( translate('OpenLP.MainWindow', 'More information about OpenLP')) if os.name == u'nt': self.offlineHelpItem.setText( translate('OpenLP.MainWindow', '&User Guide')) self.onlineHelpItem.setText( translate('OpenLP.MainWindow', '&Online Help')) - self.helpWebSiteItem.setText( + self.webSiteItem.setText( translate('OpenLP.MainWindow', '&Web Site')) for item in self.languageGroup.actions(): item.setText(item.objectName()) @@ -542,7 +542,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.QObject.connect(self.themeManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'), self.viewThemeManagerItem.setChecked) - QtCore.QObject.connect(self.helpWebSiteItem, + QtCore.QObject.connect(self.webSiteItem, QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked) QtCore.QObject.connect(self.toolsOpenDataFolder, QtCore.SIGNAL(u'triggered()'), self.onToolsOpenDataFolderClicked) @@ -762,7 +762,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): import webbrowser webbrowser.open_new(u'http://manual.openlp.org/') - def onHelpAboutItemClicked(self): + def onAboutItemClicked(self): """ Show the About form """ From cfb1a06bd3fc2398a1c1f94a1dd8b987aeb37794 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Sun, 10 Jul 2011 14:00:58 +0200 Subject: [PATCH 07/17] Update script to check openlp dependecies - catching all imports properly --- scripts/check_dependencies.py | 71 +++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/scripts/check_dependencies.py b/scripts/check_dependencies.py index c60bf6842..4abd1504d 100755 --- a/scripts/check_dependencies.py +++ b/scripts/check_dependencies.py @@ -95,6 +95,10 @@ def check_vers(version, required, text): return False +def print_vers_fail(required, text): + print(' %s >= %s ... FAIL' % (text, required)) + + def verify_python(): if not check_vers(list(sys.version_info), VERS['Python'], text='Python'): exit(1) @@ -102,15 +106,25 @@ def verify_python(): def verify_versions(): print('Verifying version of modules...') - from PyQt4 import QtCore - check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'], - 'PyQt4') - check_vers(QtCore.qVersion(), VERS['Qt4'], - 'Qt4') - import sqlalchemy - check_vers(sqlalchemy.__version__, VERS['sqlalchemy'], 'sqlalchemy') - import enchant - check_vers(enchant.__version__, VERS['enchant'], 'enchant') + try: + from PyQt4 import QtCore + check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'], + 'PyQt4') + check_vers(QtCore.qVersion(), VERS['Qt4'], + 'Qt4') + except ImportError: + print_vers_fail(VERS['PyQt4'], 'PyQt4') + print_vers_fail(VERS['Qt4'], 'Qt4') + try: + import sqlalchemy + check_vers(sqlalchemy.__version__, VERS['sqlalchemy'], 'sqlalchemy') + except ImportError: + print_vers_fail(VERS['sqlalchemy'], 'sqlalchemy') + try: + import enchant + check_vers(enchant.__version__, VERS['enchant'], 'enchant') + except ImportError: + print_vers_fail(VERS['enchant'], 'enchant') def check_module(mod, text='', indent=' '): @@ -125,24 +139,31 @@ def check_module(mod, text='', indent=' '): def verify_pyenchant(): - print('Enchant...') - import enchant - backends = ', '.join([x.name for x in enchant.Broker().describe()]) - print(' available backends: %s' % backends) - langs = ', '.join(enchant.list_languages()) - print(' available languages: %s' % langs) + w('Enchant (spell checker)... ') + try: + import enchant + w(os.linesep) + backends = ', '.join([x.name for x in enchant.Broker().describe()]) + print(' available backends: %s' % backends) + langs = ', '.join(enchant.list_languages()) + print(' available languages: %s' % langs) + except ImportError: + w('FAIL' + os.linesep) def verify_pyqt(): - print('Qt4 image formats...') - from PyQt4 import QtGui - read_f = ', '.join([unicode(format).lower() \ - for format in QtGui.QImageReader.supportedImageFormats()]) - write_f= ', '.join([unicode(format).lower() \ - for format in QtGui.QImageWriter.supportedImageFormats()]) - print(' read: %s' % read_f) - print(' write: %s' % write_f) - from PyQt4 import phonon + w('Qt4 image formats... ') + try: + from PyQt4 import QtGui + read_f = ', '.join([unicode(format).lower() \ + for format in QtGui.QImageReader.supportedImageFormats()]) + write_f= ', '.join([unicode(format).lower() \ + for format in QtGui.QImageWriter.supportedImageFormats()]) + w(os.linesep) + print(' read: %s' % read_f) + print(' write: %s' % write_f) + except ImportError: + w('FAIL' + os.linesep) def main(): @@ -157,7 +178,7 @@ def main(): for m in OPTIONAL_MODULES: check_module(m[0], text=m[1]) - if sys.platform.startswith('win'): + if is_win: print('Checking for Windows specific modules...') for m in WIN32_MODULES: check_module(m) From b83048ff4e7ee43a5699d793a4b2513dd819931e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 11 Jul 2011 17:32:25 +0100 Subject: [PATCH 08/17] Fix outstanding strings in Error for translations Fixes: https://launchpad.net/bugs/796440 --- openlp/core/ui/firsttimewizard.py | 2 +- openlp/core/ui/generaltab.py | 2 +- openlp/core/ui/themestab.py | 2 +- openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/alerts/forms/alertform.py | 8 +++--- openlp/plugins/bibles/bibleplugin.py | 4 +-- .../plugins/bibles/forms/bibleupgradeform.py | 6 ++-- openlp/plugins/bibles/lib/csvbible.py | 7 +++-- openlp/plugins/bibles/lib/http.py | 28 +++++++++---------- openlp/plugins/bibles/lib/mediaitem.py | 8 +++--- 10 files changed, 35 insertions(+), 34 deletions(-) diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 3644ed07b..64d9cbf8d 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -209,7 +209,7 @@ class Ui_FirstTimeWizard(object): 'Select the Plugins you wish to use. ')) self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs')) self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard', - 'Custom Text')) + 'Custom Slides')) self.bibleCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Bible')) self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Images')) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 925e3d31f..9a241473a 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -44,7 +44,7 @@ class GeneralTab(SettingsTab): """ self.screens = ScreenList.get_instance() self.icon_path = u':/icon/openlp-logo-16x16.png' - generalTranslated = translate('GeneralTab', 'General') + generalTranslated = translate('OpenLP.GeneralTab', 'General') SettingsTab.__init__(self, parent, u'General', generalTranslated) def setupUi(self): diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 86087e82f..572efdf4b 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -37,7 +37,7 @@ class ThemesTab(SettingsTab): """ def __init__(self, parent, mainwindow): self.mainwindow = mainwindow - generalTranslated = translate('ThemeTab', 'Themes') + generalTranslated = translate('OpenLP.ThemesTab', 'Themes') SettingsTab.__init__(self, parent, u'Themes', generalTranslated) self.icon_path = u':/themes/theme_new.png' diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 41c2e2211..f0bf2d93e 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -104,7 +104,7 @@ class AlertsPlugin(Plugin): def about(self): about_text = translate('AlertsPlugin', 'Alerts Plugin' '
The alert plugin controls the displaying of nursery alerts ' - 'on the display screen') + 'on the display screen.') return about_text def setPluginTextStrings(self): diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index 8de7744aa..45d283f28 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -176,8 +176,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): # We found '<>' in the alert text, but the ParameterEdit field is empty. if text.find(u'<>') != -1 and not self.parameterEdit.text() and \ QtGui.QMessageBox.question(self, - translate('AlertPlugin.AlertForm', 'No Parameter Found'), - translate('AlertPlugin.AlertForm', 'You have not entered a ' + translate('AlertsPlugin.AlertForm', 'No Parameter Found'), + translate('AlertsPlugin.AlertForm', 'You have not entered a ' 'parameter to be replaced.\nDo you want to continue anyway?'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: @@ -187,8 +187,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): # in the alert text. elif text.find(u'<>') == -1 and self.parameterEdit.text() and \ QtGui.QMessageBox.question(self, - translate('AlertPlugin.AlertForm', 'No Placeholder Found'), - translate('AlertPlugin.AlertForm', 'The alert text does not' + translate('AlertsPlugin.AlertForm', 'No Placeholder Found'), + translate('AlertsPlugin.AlertForm', 'The alert text does not' ' contain \'<>\'.\nDo you want to continue anyway?'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index a5abc32d2..da7658c12 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -117,9 +117,9 @@ class BiblePlugin(Plugin): self.toolsUpgradeItem = QtGui.QAction(tools_menu) self.toolsUpgradeItem.setObjectName(u'toolsUpgradeItem') self.toolsUpgradeItem.setText( - translate('BiblePlugin', '&Upgrade older Bibles')) + translate('BiblesPlugin', '&Upgrade older Bibles')) self.toolsUpgradeItem.setStatusTip( - translate('BiblePlugin', 'Upgrade the Bible databases to the ' + translate('BiblesPlugin', 'Upgrade the Bible databases to the ' 'latest format.')) tools_menu.addAction(self.toolsUpgradeItem) QtCore.QObject.connect(self.toolsUpgradeItem, diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 14936a340..14e20e37f 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -413,7 +413,7 @@ class BibleUpgradeForm(OpenLPWizard): if not backup_path: critical_error_message_box(UiStrings().EmptyField, translate('BiblesPlugin.UpgradeWizardForm', - 'You need to specify a Backup Directory for your ' + 'You need to specify a backup Directory for your ' 'Bibles.')) self.backupDirectoryEdit.setFocus() return False @@ -520,7 +520,7 @@ class BibleUpgradeForm(OpenLPWizard): OpenLPWizard.preWizard(self) self.progressLabel.setText(translate( 'BiblesPlugin.UpgradeWizardForm', - 'Starting Bible upgrade...')) + 'Starting upgrade...')) Receiver.send_message(u'openlp_process_events') def performWizard(self): @@ -532,7 +532,7 @@ class BibleUpgradeForm(OpenLPWizard): if self.maxBibles == 0: self.progressLabel.setText( translate('BiblesPlugin.UpgradeWizardForm', 'There are no ' - 'Bibles available to upgrade.')) + 'Bibles that need to be upgraded.')) self.progressBar.hide() return self.maxBibles = 0 diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py index 83b52971c..6735a7344 100644 --- a/openlp/plugins/bibles/lib/csvbible.py +++ b/openlp/plugins/bibles/lib/csvbible.py @@ -115,7 +115,8 @@ class CSVBible(BibleDB): if self.stop_import_flag: break self.wizard.incrementProgressBar(unicode( - translate('BibleDB.Wizard', 'Importing books... %s')) % + translate('BiblesPlugin.CSVBible', + 'Importing books... %s')) % unicode(line[2], details['encoding'])) book_ref_id = self.get_book_ref_id_by_name( unicode(line[2], details['encoding']), 67, language_id) @@ -155,7 +156,7 @@ class CSVBible(BibleDB): book = self.get_book(line_book) book_ptr = book.name self.wizard.incrementProgressBar(unicode(translate( - 'BibleDB.Wizard', 'Importing verses from %s...', + 'BiblesPlugin.CSVBible', 'Importing verses from %s...', 'Importing verses from ...')) % book.name) self.session.commit() try: @@ -163,7 +164,7 @@ class CSVBible(BibleDB): except UnicodeError: verse_text = unicode(line[3], u'cp1252') self.create_verse(book.id, line[1], line[2], verse_text) - self.wizard.incrementProgressBar(translate('BibleDB.Wizard', + self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible', 'Importing verses... done.')) Receiver.send_message(u'openlp_process_events') self.session.commit() diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 28ceaad68..ee644a8d5 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -69,10 +69,10 @@ class BGExtract(object): ``chapter`` Chapter number. """ - log.debug(u'BGExtract.get_bible_chapter("%s", "%s", "%s")', version, + log.debug(u'BGExtract.get_bible_chapter("%s", "%s", "%s")', version, bookname, chapter) urlbookname = urllib.quote(bookname.encode("utf-8")) - url_params = u'search=%s+%s&version=%s' % (urlbookname, chapter, + url_params = u'search=%s+%s&version=%s' % (urlbookname, chapter, version) cleaner = [(re.compile(' |
|\'\+\''), lambda match: '')] soup = get_soup_for_bible_ref( @@ -203,7 +203,7 @@ class BSExtract(object): ``chapter`` Chapter number """ - log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version, + log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version, bookname, chapter) urlversion = urllib.quote(version.encode("utf-8")) urlbookname = urllib.quote(bookname.encode("utf-8")) @@ -230,7 +230,7 @@ class BSExtract(object): def get_books_from_http(self, version): """ - Load a list of all books a Bible contains from Bibleserver mobile + Load a list of all books a Bible contains from Bibleserver mobile website. ``version`` @@ -276,7 +276,7 @@ class CWExtract(object): ``chapter`` Chapter number """ - log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version, + log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version, bookname, chapter) urlbookname = bookname.replace(u' ', u'-') urlbookname = urlbookname.lower() @@ -389,7 +389,7 @@ class HTTPBible(BibleDB): """ self.wizard.progressBar.setMaximum(68) self.wizard.incrementProgressBar(unicode(translate( - 'BiblesPlugin.HTTPBible', + 'BiblesPlugin.HTTPBible', 'Registering Bible and loading books...'))) self.create_meta(u'download source', self.download_source) self.create_meta(u'download name', self.download_name) @@ -415,7 +415,7 @@ class HTTPBible(BibleDB): self.wizard.progressBar.setMaximum(len(books)+2) self.wizard.incrementProgressBar(unicode(translate( 'BiblesPlugin.HTTPBible', 'Registering Language...'))) - bible = BiblesResourcesDB.get_webbible(self.download_name, + bible = BiblesResourcesDB.get_webbible(self.download_name, self.download_source.lower()) if bible[u'language_id']: language_id = bible[u'language_id'] @@ -432,14 +432,14 @@ class HTTPBible(BibleDB): self.wizard.incrementProgressBar(unicode(translate( 'BiblesPlugin.HTTPBible', 'Importing %s...', 'Importing ...')) % book) - book_ref_id = self.get_book_ref_id_by_name(book, len(books), + book_ref_id = self.get_book_ref_id_by_name(book, len(books), language_id) if not book_ref_id: log.exception(u'Importing books from %s - download name: "%s" '\ 'failed' % (self.download_source, self.download_name)) return False book_details = BiblesResourcesDB.get_book_by_id(book_ref_id) - log.debug(u'Book details: Name:%s; id:%s; testament_id:%s', + log.debug(u'Book details: Name:%s; id:%s; testament_id:%s', book, book_ref_id, book_details[u'testament_id']) self.create_book(book, book_ref_id, book_details[u'testament_id']) if self.stop_import_flag: @@ -524,7 +524,7 @@ class HTTPBible(BibleDB): def get_chapter_count(self, book): """ Return the number of chapters in a particular book. - + ``book`` The book object to get the chapter count for. """ @@ -597,14 +597,14 @@ def send_error_message(error_type): """ if error_type == u'download': critical_error_message_box( - translate('BiblePlugin.HTTPBible', 'Download Error'), - translate('BiblePlugin.HTTPBible', 'There was a ' + translate('BiblesPlugin.HTTPBible', 'Download Error'), + translate('BiblesPlugin.HTTPBible', 'There was a ' 'problem downloading your verse selection. Please check your ' 'Internet connection, and if this error continues to occur ' 'please consider reporting a bug.')) elif error_type == u'parse': critical_error_message_box( - translate('BiblePlugin.HTTPBible', 'Parse Error'), - translate('BiblePlugin.HTTPBible', 'There was a ' + translate('BiblesPlugin.HTTPBible', 'Parse Error'), + translate('BiblesPlugin.HTTPBible', 'There was a ' 'problem extracting your verse selection. If this error continues ' 'to occur please consider reporting a bug.')) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 0734df818..82ee4430c 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -87,7 +87,7 @@ class BibleMediaItem(MediaManagerItem): not second_bible: self.displayResults(bible, second_bible) elif critical_error_message_box( - message=translate('BiblePlugin.MediaItem', + message=translate('BiblesPlugin.MediaItem', 'You cannot combine single and dual Bible verse search results. ' 'Do you want to delete your search results and start a new ' 'search?'), @@ -437,7 +437,7 @@ class BibleMediaItem(MediaManagerItem): if verse_count == 0: self.advancedSearchButton.setEnabled(False) critical_error_message_box( - message=translate('BiblePlugin.MediaItem', + message=translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.')) else: self.advancedSearchButton.setEnabled(True) @@ -694,8 +694,8 @@ class BibleMediaItem(MediaManagerItem): verse.verse, verse.verse)) if passage_not_found: QtGui.QMessageBox.information(self, - translate('BiblePlugin.MediaItem', 'Information'), - unicode(translate('BiblePlugin.MediaItem', + translate('BiblesPlugin.MediaItem', 'Information'), + unicode(translate('BiblesPlugin.MediaItem', 'The second Bible does not contain all the verses ' 'that are in the main Bible. Only verses found in both ' 'Bibles will be shown. %d verses have not been ' From b98e36aff28298b3c28c06e7ecc07adc9efd5d32 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 13 Jul 2011 15:32:19 +0200 Subject: [PATCH 09/17] regex clean ups --- openlp/core/utils/__init__.py | 7 +++---- openlp/plugins/bibles/forms/bibleupgradeform.py | 6 ++---- openlp/plugins/songs/forms/editverseform.py | 7 ++++--- openlp/plugins/songs/lib/xml.py | 5 +++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 317083799..081870587 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -53,6 +53,7 @@ APPLICATION_VERSION = {} IMAGES_FILTER = None UNO_CONNECTION_TYPE = u'pipe' #UNO_CONNECTION_TYPE = u'socket' +VERSION_SPLITTER = re.compile(r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))?') class VersionThread(QtCore.QThread): """ @@ -61,8 +62,6 @@ class VersionThread(QtCore.QThread): """ def __init__(self, parent): QtCore.QThread.__init__(self, parent) - self.version_splitter = re.compile( - r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))?') def run(self): """ @@ -73,7 +72,7 @@ class VersionThread(QtCore.QThread): version = check_latest_version(app_version) remote_version = {} local_version = {} - match = self.version_splitter.match(version) + match = VERSION_SPLITTER.match(version) if match: remote_version[u'major'] = int(match.group(1)) remote_version[u'minor'] = int(match.group(2)) @@ -82,7 +81,7 @@ class VersionThread(QtCore.QThread): remote_version[u'revision'] = int(match.group(4)) else: return - match = self.version_splitter.match(app_version[u'full']) + match = VERSION_SPLITTER.match(app_version[u'full']) if match: local_version[u'major'] = int(match.group(1)) local_version[u'minor'] = int(match.group(2)) diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 14936a340..aeff6f3cc 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -27,8 +27,7 @@ The bible import functions for OpenLP """ import logging -import os.path -import re +import os import shutil from PyQt4 import QtCore, QtGui @@ -70,8 +69,7 @@ class BibleUpgradeForm(OpenLPWizard): self.mediaItem = bibleplugin.mediaItem self.suffix = u'.sqlite' self.settingsSection = u'bibles' - self.path = AppLocation.get_section_data_path( - self.settingsSection) + self.path = AppLocation.get_section_data_path(self.settingsSection) self.files = self.manager.old_bible_databases self.success = {} self.newbibles = {} diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py index 79b2b295a..1845bc0e3 100644 --- a/openlp/plugins/songs/forms/editverseform.py +++ b/openlp/plugins/songs/forms/editverseform.py @@ -37,6 +37,8 @@ from editversedialog import Ui_EditVerseDialog log = logging.getLogger(__name__) +VERSE_REGEX = re.compile(r'---\[(.+):\D*(\d*)\D*.*\]---') + class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog): """ This is the form that is used to edit the verses of the song. @@ -60,7 +62,6 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog): QtCore.QObject.connect(self.verseTypeComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onVerseTypeComboBoxChanged) - self.verse_regex = re.compile(r'---\[(.+):\D*(\d*)\D*.*\]---') def contextMenu(self, point): item = self.serviceManagerList.itemAt(point) @@ -105,7 +106,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog): if position == -1: return text = text[:position + 4] - match = self.verse_regex.match(text) + match = VERSE_REGEX.match(text) if match: verse_tag = match.group(1) try: @@ -136,7 +137,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog): if position == -1: return text = text[:position + 4] - match = self.verse_regex.match(text) + match = VERSE_REGEX.match(text) if match: verse_type = match.group(1) verse_type_index = VerseType.from_loose_input(verse_type) diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index c5bf85ad8..3635fd7e7 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -73,6 +73,8 @@ from openlp.core.utils import get_application_version log = logging.getLogger(__name__) +CHORD_REGEX = re.compile(u'') + class SongXML(object): """ This class builds and parses the XML used to describe songs. @@ -234,7 +236,6 @@ class OpenLyrics(object): IMPLEMENTED_VERSION = u'0.7' def __init__(self, manager): self.manager = manager - self.chord_regex = re.compile(u'') def song_to_xml(self, song): """ @@ -319,7 +320,7 @@ class OpenLyrics(object): if xml[:5] == u' Date: Wed, 13 Jul 2011 15:41:32 +0200 Subject: [PATCH 10/17] use map instead of list comprehension; blank lines --- scripts/check_dependencies.py | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/scripts/check_dependencies.py b/scripts/check_dependencies.py index 4abd1504d..bf9e97d88 100755 --- a/scripts/check_dependencies.py +++ b/scripts/check_dependencies.py @@ -74,44 +74,38 @@ OPTIONAL_MODULES = [ ('sqlite', ' (SQLite 2 support)'), ('MySQLdb', ' (MySQL support)'), ('psycopg2', ' (PostgreSQL support)'), - ] +] w = sys.stdout.write - def check_vers(version, required, text): if type(version) is str: version = version.split('.') - version = [int(x) for x in version] + version = map(int, version) if type(required) is str: required = required.split('.') - required = [int(x) for x in required] - w(' %s >= %s ... ' % (text, '.'.join([str(x) for x in required]))) + required = map(int, required) + w(' %s >= %s ... ' % (text, '.'.join(map(str, required)))) if version >= required: - w('.'.join([str(x) for x in version]) + os.linesep) + w('.'.join(map(str, version)) + os.linesep) return True else: w('FAIL' + os.linesep) return False - def print_vers_fail(required, text): print(' %s >= %s ... FAIL' % (text, required)) - def verify_python(): if not check_vers(list(sys.version_info), VERS['Python'], text='Python'): exit(1) - def verify_versions(): print('Verifying version of modules...') try: from PyQt4 import QtCore - check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'], - 'PyQt4') - check_vers(QtCore.qVersion(), VERS['Qt4'], - 'Qt4') + check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'], 'PyQt4') + check_vers(QtCore.qVersion(), VERS['Qt4'], 'Qt4') except ImportError: print_vers_fail(VERS['PyQt4'], 'PyQt4') print_vers_fail(VERS['Qt4'], 'Qt4') @@ -126,7 +120,6 @@ def verify_versions(): except ImportError: print_vers_fail(VERS['enchant'], 'enchant') - def check_module(mod, text='', indent=' '): space = (30 - len(mod) - len(text)) * ' ' w(indent + '%s%s... ' % (mod, text) + space) @@ -137,7 +130,6 @@ def check_module(mod, text='', indent=' '): w('FAIL') w(os.linesep) - def verify_pyenchant(): w('Enchant (spell checker)... ') try: @@ -150,14 +142,13 @@ def verify_pyenchant(): except ImportError: w('FAIL' + os.linesep) - def verify_pyqt(): w('Qt4 image formats... ') try: from PyQt4 import QtGui - read_f = ', '.join([unicode(format).lower() \ + read_f = ', '.join([unicode(format).lower() for format in QtGui.QImageReader.supportedImageFormats()]) - write_f= ', '.join([unicode(format).lower() \ + write_f = ', '.join([unicode(format).lower() for format in QtGui.QImageWriter.supportedImageFormats()]) w(os.linesep) print(' read: %s' % read_f) @@ -165,9 +156,7 @@ def verify_pyqt(): except ImportError: w('FAIL' + os.linesep) - def main(): - verify_python() print('Checking for modules...') @@ -187,6 +176,5 @@ def main(): verify_pyqt() verify_pyenchant() - if __name__ == u'__main__': main() From f1cf256d99890f53b6d8d7aa3ad9717d5c89de65 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 13 Jul 2011 18:41:37 +0100 Subject: [PATCH 11/17] Fix --- openlp/plugins/bibles/forms/bibleupgradeform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 14e20e37f..85f3437a4 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -413,7 +413,7 @@ class BibleUpgradeForm(OpenLPWizard): if not backup_path: critical_error_message_box(UiStrings().EmptyField, translate('BiblesPlugin.UpgradeWizardForm', - 'You need to specify a backup Directory for your ' + 'You need to specify a backup directory for your ' 'Bibles.')) self.backupDirectoryEdit.setFocus() return False From 42acff98abd19c13b40dbc90f60f712fabedb267 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 13 Jul 2011 22:00:35 +0100 Subject: [PATCH 12/17] Unused import --- openlp/core/lib/serviceitem.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 1245988b4..2aa1efbc2 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -36,7 +36,6 @@ import os import uuid from openlp.core.lib import build_icon, clean_tags, expand_tags, translate -from openlp.core.lib.ui import UiStrings log = logging.getLogger(__name__) From 3d3114b56dabc026d35793c71a879c41bf788d95 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 15 Jul 2011 19:38:09 +0200 Subject: [PATCH 13/17] fixed copyright Fixes: https://launchpad.net/bugs/810633 --- scripts/check_dependencies.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/check_dependencies.py b/scripts/check_dependencies.py index bf9e97d88..7048ceeab 100755 --- a/scripts/check_dependencies.py +++ b/scripts/check_dependencies.py @@ -5,7 +5,12 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2011 Raoul Snyman # +# Copyright (c) 2008-2011 Raoul Snyman # +# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Millar, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, 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 # From bc5d2cce46768b25d23067619fdd7ad4e94eb31d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 15 Jul 2011 20:18:11 +0200 Subject: [PATCH 14/17] removed zip support for OpenSong importer Fixes: https://launchpad.net/bugs/795027 --- openlp/plugins/songs/lib/opensongimport.py | 44 ++-------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/opensongimport.py index 3c8b46d4e..834255fd0 100644 --- a/openlp/plugins/songs/lib/opensongimport.py +++ b/openlp/plugins/songs/lib/opensongimport.py @@ -28,7 +28,6 @@ import logging import os import re -from zipfile import ZipFile from lxml import objectify from lxml.etree import Error, LxmlError @@ -110,48 +109,13 @@ class OpenSongImport(SongImport): SongImport.__init__(self, manager, **kwargs) def do_import(self): - """ - Import either each of the files in self.import_source - each element of - which can be either a single opensong file, or a zipfile containing - multiple opensong files. - """ - numfiles = 0 - for filename in self.import_source: - ext = os.path.splitext(filename)[1] - if ext.lower() == u'.zip': - z = ZipFile(filename, u'r') - numfiles += len(z.infolist()) - z.close() - else: - numfiles += 1 - log.debug(u'Total number of files: %d', numfiles) - self.import_wizard.progressBar.setMaximum(numfiles) + self.import_wizard.progressBar.setMaximum(len(self.import_source)) for filename in self.import_source: if self.stop_import_flag: return - ext = os.path.splitext(filename)[1] - if ext.lower() == u'.zip': - log.debug(u'Zipfile found %s', filename) - z = ZipFile(filename, u'r') - for song in z.infolist(): - if self.stop_import_flag: - z.close() - return - parts = os.path.split(song.filename) - if parts[-1] == u'': - # No final part => directory - continue - log.info(u'Zip importing %s', parts[-1]) - song_file = z.open(song) - self.do_import_file(song_file) - song_file.close() - z.close() - else: - # not a zipfile - log.info(u'Direct import %s', filename) - song_file = open(filename) - self.do_import_file(song_file) - song_file.close() + song_file = open(filename) + self.do_import_file(song_file) + song_file.close() def do_import_file(self, file): """ From b51f9b2a0c524502d951ba20d026941465f8b565 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Jul 2011 09:20:13 +0200 Subject: [PATCH 15/17] - do not set a service modified when using the up/down arrows to change the selected service item - only set the service modified when an item is selected while using the 'move button' and 'delete button' --- openlp/core/ui/servicemanager.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index f6c069525..c6dfe77aa 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -802,7 +802,6 @@ class ServiceManager(QtGui.QWidget): # Top Item was selected so set the last one if setLastItem: lastItem.setSelected(True) - self.setModified() def onMoveSelectionDown(self): """ @@ -824,7 +823,6 @@ class ServiceManager(QtGui.QWidget): serviceIterator += 1 if setSelected: firstItem.setSelected(True) - self.setModified() def onCollapseAll(self): """ @@ -863,12 +861,12 @@ class ServiceManager(QtGui.QWidget): Move the current ServiceItem to the top of the list. """ item, child = self.findServiceItem() - if item < len(self.serviceItems) and item is not -1: + if item < len(self.serviceItems) and item != -1: temp = self.serviceItems[item] self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.insert(0, temp) self.repaintServiceList(0, child) - self.setModified() + self.setModified() def onServiceUp(self): """ @@ -880,31 +878,31 @@ class ServiceManager(QtGui.QWidget): self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.insert(item - 1, temp) self.repaintServiceList(item - 1, child) - self.setModified() + self.setModified() def onServiceDown(self): """ Move the current ServiceItem one position down in the list. """ item, child = self.findServiceItem() - if item < len(self.serviceItems) and item is not -1: + if item < len(self.serviceItems) and item != -1: temp = self.serviceItems[item] self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.insert(item + 1, temp) self.repaintServiceList(item + 1, child) - self.setModified() + self.setModified() def onServiceEnd(self): """ Move the current ServiceItem to the bottom of the list. """ item, child = self.findServiceItem() - if item < len(self.serviceItems) and item is not -1: + if item < len(self.serviceItems) and item != -1: temp = self.serviceItems[item] self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.insert(len(self.serviceItems), temp) self.repaintServiceList(len(self.serviceItems) - 1, child) - self.setModified() + self.setModified() def onDeleteFromService(self): """ @@ -914,7 +912,7 @@ class ServiceManager(QtGui.QWidget): if item != -1: self.serviceItems.remove(self.serviceItems[item]) self.repaintServiceList(item - 1, -1) - self.setModified() + self.setModified() def repaintServiceList(self, serviceItem, serviceItemChild): """ From 0f89b9f771fa3210353b28512e98ff3b6124c372 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sun, 17 Jul 2011 13:59:26 +0100 Subject: [PATCH 16/17] Unused import --- openlp/plugins/songs/lib/opensongimport.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/opensongimport.py index 834255fd0..7fca88262 100644 --- a/openlp/plugins/songs/lib/opensongimport.py +++ b/openlp/plugins/songs/lib/opensongimport.py @@ -26,7 +26,6 @@ ############################################################################### import logging -import os import re from lxml import objectify From 4ae1a12b59305ed8e31296631b82462380e0f93b Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sun, 17 Jul 2011 16:09:30 +0100 Subject: [PATCH 17/17] Unused function: string_is_unicode --- openlp/core/utils/__init__.py | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 081870587..b0a28962c 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -459,25 +459,6 @@ def file_is_unicode(filename): return None return ucsfile -def string_is_unicode(test_string): - """ - Makes sure a string is unicode. - - ``test_string`` - The string to confirm is unicode. - """ - return_string = u'' - if not test_string: - return return_string - if isinstance(test_string, unicode): - return_string = test_string - if not isinstance(test_string, unicode): - try: - return_string = unicode(test_string, u'utf-8') - except UnicodeError: - log.exception("Error encoding string to unicode") - return return_string - def get_uno_command(): """ Returns the UNO command to launch an openoffice.org instance. @@ -510,5 +491,5 @@ from actions import ActionList __all__ = [u'AppLocation', u'get_application_version', u'check_latest_version', u'add_actions', u'get_filesystem_encoding', u'LanguageManager', - u'ActionList', u'get_web_page', u'file_is_unicode', u'string_is_unicode', - u'get_uno_command', u'get_uno_instance', u'delete_file'] + u'ActionList', u'get_web_page', u'file_is_unicode', u'get_uno_command', + u'get_uno_instance', u'delete_file']