diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 6ce51ab60..e35c78559 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -234,10 +234,10 @@ class Renderer(object): serviceItem = ServiceItem() if self.force_page: # make big page for theme edit dialog to get line count - serviceItem.add_from_text(u'', VERSE_FOR_LINE_COUNT) + serviceItem.add_from_text(VERSE_FOR_LINE_COUNT) else: self.image_manager.deleteImage(theme_data.theme_name) - serviceItem.add_from_text(u'', VERSE) + serviceItem.add_from_text(VERSE) serviceItem.renderer = self serviceItem.raw_footer = FOOTER # if No file do not update cache diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 5ee8e6167..1e9555eb9 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -220,20 +220,17 @@ class ServiceItem(object): self.image_border) self._new_item() - def add_from_text(self, title, raw_slide, verse_tag=None): + def add_from_text(self, raw_slide, verse_tag=None): """ Add a text slide to the service item. - ``frame_title`` - The title of the slide in the service item. - ``raw_slide`` The raw text of the slide. """ if verse_tag: verse_tag = verse_tag.upper() self.service_item_type = ServiceItemType.Text - title = title.split(u'\n')[0] + title = raw_slide[:30].split(u'\n')[0] self._raw_frames.append( {u'title': title, u'raw_slide': raw_slide, u'verseTag': verse_tag}) self._new_item() diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index e1209514c..422e2deff 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -63,8 +63,7 @@ class BiblePlugin(Plugin): # unicode(UiStrings().Export)) # Set to invisible until we can export bibles self.exportBibleItem.setVisible(False) - if self.manager.old_bible_databases: - self.toolsUpgradeItem.setVisible(True) + self.toolsUpgradeItem.setVisible(bool(self.manager.old_bible_databases)) def finalise(self): """ diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 84a9f81e2..11edd4228 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -63,6 +63,7 @@ class Verse(BaseModel): """ pass + def init_schema(url): """ Setup a bible database connection and initialise the database schema. diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 6ff622e9d..dcabe360e 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -418,7 +418,7 @@ class BibleMediaItem(MediaManagerItem): ``bible`` The bible to initialise (unicode). - + ``last_book_id`` The "book reference id" of the book which is choosen at the moment. (int) @@ -976,7 +976,7 @@ class BibleMediaItem(MediaManagerItem): else: service_item.theme = self.settings.bible_theme for slide in raw_slides: - service_item.add_from_text(slide[:30], slide) + service_item.add_from_text(slide) return True def formatTitle(self, start_bitem, old_bitem): diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index d2002deb5..3e25fb6c5 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -210,12 +210,12 @@ class CustomMediaItem(MediaManagerItem): theme = customSlide.theme_name if theme: service_item.theme = theme - customXML = CustomXMLParser(customSlide.text) - verseList = customXML.get_verses() - raw_slides = [verse[1] for verse in verseList] + custom_xml = CustomXMLParser(customSlide.text) + verse_list = custom_xml.get_verses() + raw_slides = [verse[1] for verse in verse_list] service_item.title = title for slide in raw_slides: - service_item.add_from_text(slide[:30], slide) + service_item.add_from_text(slide) if Settings().value(self.settingsSection + u'/display footer', QtCore.QVariant(True)).toBool() or credit: service_item.raw_footer.append(u' '.join([title, credit])) diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index 758f76ca8..de82b4dd7 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -57,19 +57,17 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): self.firstNameEdit.setFocus() return QtGui.QDialog.exec_(self) - def onFirstNameEditTextEdited(self, text): + def onFirstNameEditTextEdited(self, display_name): if not self._autoDisplayName: return - display_name = text - if self.lastNameEdit.text() != u'': + if not self.lastNameEdit.text(): display_name = display_name + u' ' + self.lastNameEdit.text() self.displayEdit.setText(display_name) - def onLastNameEditTextEdited(self, text): + def onLastNameEditTextEdited(self, display_name): if not self._autoDisplayName: return - display_name = text - if self.firstNameEdit.text() != u'': + if not self.firstNameEdit.text(): display_name = self.firstNameEdit.text() + u' ' + display_name self.displayEdit.setText(display_name) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 226d8baa1..81f9006ea 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -256,8 +256,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): verse_tags_translated = False if self.song.lyrics.startswith(u' u'1' and verse_tag not in multiple: diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index 44cf8e113..87540ce54 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -193,6 +193,7 @@ class VerseType(object): return default return verse_index + def retrieve_windows_encoding(recommendation=None): """ Determines which encoding to use on an information source. The process uses @@ -252,12 +253,14 @@ def retrieve_windows_encoding(recommendation=None): return None return filter(lambda item: item[1] == choice[0], encodings)[0][0] + def clean_string(string): """ Strips punctuation from the passed string to assist searching """ return WHITESPACE.sub(u' ', APOSTROPHE.sub(u'', string)).lower() + def clean_title(title): """ Cleans the song title by removing Unicode control chars groups C0 & C1, @@ -265,6 +268,7 @@ def clean_title(title): """ return CONTROL_CHARS.sub(u'', title).rstrip() + def clean_song(manager, song): """ Cleans the search title, rebuilds the search lyrics, adds a default author diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index ca3c76353..0999ee763 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -465,14 +465,14 @@ class SongMediaItem(MediaManagerItem): service_item.theme = song.theme_name service_item.edit_id = item_id if song.lyrics.startswith(u'