From 4cd23308b8297d9cd0c26285611404e9feea65fb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 18 May 2011 16:26:19 +0200 Subject: [PATCH 1/2] regex clean ups --- openlp/core/lib/theme.py | 6 ++++-- openlp/plugins/songs/lib/xml.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 7f2204c67..25f0094a3 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -207,6 +207,8 @@ class ThemeXML(object): """ A class to encapsulate the Theme XML. """ + FIRST_CAMEL_REGEX = re.compile(u'(.)([A-Z][a-z]+)') + SECOND_CAMEL_REGEX = re.compile(u'([a-z0-9])([A-Z])') def __init__(self): """ Initialise the theme object. @@ -581,8 +583,8 @@ class ThemeXML(object): """ Change Camel Case string to python string """ - sub_name = re.sub(u'(.)([A-Z][a-z]+)', r'\1_\2', name) - return re.sub(u'([a-z0-9])([A-Z])', r'\1_\2', sub_name).lower() + sub_name = ThemeXML.FIRST_CAMEL_REGEX.sub(r'\1_\2', name) + return ThemeXML.SECOND_CAMEL_REGEX.sub(r'\1_\2', sub_name).lower() def _build_xml_from_attrs(self): """ diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index b11338d81..46a3c9d78 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -233,6 +233,7 @@ 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): """ @@ -317,7 +318,7 @@ class OpenLyrics(object): if xml[:5] == u'').sub(u'', xml) + xml = self.chord_regex.sub(u'', xml) song_xml = objectify.fromstring(xml) if hasattr(song_xml, u'properties'): properties = song_xml.properties From e3ca10b46fb17db737d103efdf3bafdbbeaedac5 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 18 May 2011 23:19:36 -0400 Subject: [PATCH 2/2] modified: openlp/plugins/custom/forms/editcustomform.py --- openlp/plugins/custom/forms/editcustomform.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 7b8a15c21..774789fa0 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -65,6 +65,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): QtCore.SIGNAL(u'theme_update_list'), self.loadThemes) QtCore.QObject.connect(self.slideListView, QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged) + QtCore.QObject.connect(self.slideListView, + QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), + self.onEditButtonPressed) def loadThemes(self, themelist): self.themeComboBox.clear()