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'