From 6c047fc83ef2bd95d52240dca7215c55e15a6ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20K=C3=B6hler?= Date: Tue, 12 Apr 2011 13:33:29 +0200 Subject: [PATCH 1/9] changed content of book drop list in advanced search. If a second bible is choosen the combobox only contains books which both bibles (first and second) contains. changed autocomplete in quick search. If a second bible is choosen it now suggest only books which both bibles contains. --- openlp/plugins/bibles/lib/manager.py | 1 + openlp/plugins/bibles/lib/mediaitem.py | 38 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index dd1669b23..75db89af2 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -214,6 +214,7 @@ class BibleManager(object): books.append( { u'name': book.name, + u'book_reference_id': book.book_reference_id, u'chapters': self.db_cache[bible].get_chapter_count(book.book_reference_id) }) return books diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 9f43b99cc..279ecc1cf 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -202,8 +202,14 @@ class BibleMediaItem(MediaManagerItem): # Add the search tab widget to the page layout. self.pageLayout.addWidget(self.searchTabWidget) # Combo Boxes + QtCore.QObject.connect(self.quickVersionComboBox, + QtCore.SIGNAL(u'activated(int)'), self.onQuickVersionComboBox) + QtCore.QObject.connect(self.quickSecondComboBox, + QtCore.SIGNAL(u'activated(int)'), self.onQuickSecondComboBox) QtCore.QObject.connect(self.advancedVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox) + QtCore.QObject.connect(self.advancedSecondComboBox, + QtCore.SIGNAL(u'activated(int)'), self.onAdvancedSecondComboBox) QtCore.QObject.connect(self.advancedBookComboBox, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox) QtCore.QObject.connect(self.advancedFromChapter, @@ -346,6 +352,16 @@ class BibleMediaItem(MediaManagerItem): """ log.debug(u'initialiseAdvancedBible %s', bible) book_data = self.parent.manager.get_books(bible) + secondbible = unicode(self.advancedSecondComboBox.currentText()) + if secondbible != u'': + secondbook_data = self.parent.manager.get_books(secondbible) + book_data_temp = [] + for book in book_data: + for secondbook in secondbook_data: + if book['book_reference_id'] == \ + secondbook['book_reference_id']: + book_data_temp.append(book) + book_data = book_data_temp self.advancedBookComboBox.clear() first = True for book in book_data: @@ -395,16 +411,38 @@ class BibleMediaItem(MediaManagerItem): bible = unicode(self.quickVersionComboBox.currentText()) if bible: book_data = bibles[bible].get_books() + secondbible = unicode(self.quickSecondComboBox.currentText()) + if secondbible != u'': + secondbook_data = bibles[secondbible].get_books() + book_data_temp = [] + for book in book_data: + for secondbook in secondbook_data: + if book.book_reference_id == \ + secondbook.book_reference_id: + book_data_temp.append(book) + book_data = book_data_temp books = [book.name for book in book_data] books.sort() add_widget_completer(books, self.quickSearchEdit) + def onQuickVersionComboBox(self): + self.updateAutoCompleter() + + def onQuickSecondComboBox(self): + self.updateAutoCompleter() + def onAdvancedVersionComboBox(self): QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible', QtCore.QVariant(self.advancedVersionComboBox.currentText())) self.initialiseAdvancedBible( unicode(self.advancedVersionComboBox.currentText())) + def onAdvancedSecondComboBox(self): + QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible', + QtCore.QVariant(self.advancedVersionComboBox.currentText())) + self.initialiseAdvancedBible( + unicode(self.advancedVersionComboBox.currentText())) + def onAdvancedBookComboBox(self): item = int(self.advancedBookComboBox.currentIndex()) self.initialiseChapterVerse( From e550665b23a0632e1210a391d88c5e3ef42e6189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20K=C3=B6hler?= Date: Fri, 27 May 2011 23:11:53 +0200 Subject: [PATCH 2/9] bug fix --- openlp/plugins/bibles/lib/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 50a64ca42..2a3858afc 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -221,7 +221,7 @@ class BibleManager(object): { u'name': book.name, u'book_reference_id': book.book_reference_id, - u'chapters': self.db_cache[bible].get_chapter_count(book.book_reference_id) + u'chapters': self.db_cache[bible].get_chapter_count(book) } for book in self.db_cache[bible].get_books() ] From 22ad88d3ee36c284e67d0d9dd35729bd4a9606e4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 29 May 2011 08:26:14 +0200 Subject: [PATCH 4/9] fix for bug #789618 Fixes: https://launchpad.net/bugs/789618 --- openlp/core/ui/printserviceform.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 09ae8857f..b1147731b 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -56,7 +56,9 @@ http://doc.trolltech.com/4.7/richtext-html-subset.html#css-properties font-size:large; } -.itemText {} +.itemText { + margin-top:10px; +} .itemFooter { font-size:8px; @@ -85,7 +87,7 @@ http://doc.trolltech.com/4.7/richtext-html-subset.html#css-properties .imageList {} .customNotes { - margin-top: 10px; + margin-top:10px; } .customNotesTitle { @@ -212,11 +214,11 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): verse_def = None for slide in item.get_frames(): if not verse_def or verse_def != slide[u'verseTag']: - p = self._addElement(u'div', parent=div, + text_div = self._addElement(u'div', parent=div, classId=u'itemText') else: - self._addElement(u'br', parent=p) - self._addElement(u'p', slide[u'html'], p) + self._addElement(u'br', parent=text_div) + self._addElement(u'span', slide[u'html'], text_div) verse_def = slide[u'verseTag'] # Break the page before the div element. if index != 0 and self.pageBreakAfterText.isChecked(): From a8ea8d668a5067af5f2b975f0ba5545811e3e028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20K=C3=B6hler?= Date: Sun, 29 May 2011 21:32:37 +0200 Subject: [PATCH 5/9] correct indent --- openlp/plugins/bibles/lib/manager.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 2cbd2f919..2a3858afc 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -219,9 +219,9 @@ class BibleManager(object): log.debug(u'BibleManager.get_books("%s")', bible) return [ { - u'name': book.name, - u'book_reference_id': book.book_reference_id, - u'chapters': self.db_cache[bible].get_chapter_count(book) + u'name': book.name, + u'book_reference_id': book.book_reference_id, + u'chapters': self.db_cache[bible].get_chapter_count(book) } for book in self.db_cache[bible].get_books() ] From 0a2d97021cf97e04336fd271d33b0f2002ef70fc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 30 May 2011 07:03:46 +0200 Subject: [PATCH 6/9] added spaces --- openlp/core/ui/printserviceform.py | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index b1147731b..ccd1eb18c 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -42,44 +42,44 @@ http://doc.trolltech.com/4.7/richtext-html-subset.html#css-properties */ .serviceTitle { - font-weight:600; - font-size:x-large; - color:black; + font-weight: 600; + font-size: x-large; + color: black; } .item { - color:black; + color: black; } .itemTitle { - font-weight:600; - font-size:large; + font-weight: 600; + font-size: large; } .itemText { - margin-top:10px; + margin-top: 10px; } .itemFooter { - font-size:8px; + font-size: 8px; } .itemNotes {} .itemNotesTitle { - font-weight:bold; - font-size:12px; + font-weight: bold; + font-size: 12px; } .itemNotesText { - font-size:11px; + font-size: 11px; } .media {} .mediaTitle { - font-weight:bold; - font-size:11px; + font-weight: bold; + font-size: 11px; } .mediaText {} @@ -87,20 +87,20 @@ http://doc.trolltech.com/4.7/richtext-html-subset.html#css-properties .imageList {} .customNotes { - margin-top:10px; + margin-top: 10px; } .customNotesTitle { - font-weight:bold; - font-size:11px; + font-weight: bold; + font-size: 11px; } .customNotesText { - font-size:11px; + font-size: 11px; } .newPage { - page-break-before:always; + page-break-before: always; } """ From 30ec309ff8550cab242331aabcaf2f27cfbd7ff6 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 30 May 2011 08:45:58 +0200 Subject: [PATCH 7/9] Fixed up various index errors on InnoDB tables. --- openlp/plugins/songs/lib/db.py | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/openlp/plugins/songs/lib/db.py b/openlp/plugins/songs/lib/db.py index ced98537e..9a332e994 100644 --- a/openlp/plugins/songs/lib/db.py +++ b/openlp/plugins/songs/lib/db.py @@ -165,7 +165,7 @@ def init_schema(url): Column(u'id', types.Integer, primary_key=True), Column(u'first_name', types.Unicode(128)), Column(u'last_name', types.Unicode(128)), - Column(u'display_name', types.Unicode(255), nullable=False) + Column(u'display_name', types.Unicode(255), index=True, nullable=False) ) # Definition of the "media_files" table @@ -186,7 +186,7 @@ def init_schema(url): songs_table = Table(u'songs', metadata, Column(u'id', types.Integer, primary_key=True), Column(u'song_book_id', types.Integer, - ForeignKey(u'song_books.id'), default=0), + ForeignKey(u'song_books.id'), default=None), Column(u'title', types.Unicode(255), nullable=False), Column(u'alternate_title', types.Unicode(255)), Column(u'lyrics', types.UnicodeText, nullable=False), @@ -203,7 +203,7 @@ def init_schema(url): # Definition of the "topics" table topics_table = Table(u'topics', metadata, Column(u'id', types.Integer, primary_key=True), - Column(u'name', types.Unicode(128), nullable=False) + Column(u'name', types.Unicode(128), index=True, nullable=False) ) # Definition of the "authors_songs" table @@ -230,27 +230,6 @@ def init_schema(url): ForeignKey(u'topics.id'), primary_key=True) ) - # Define table indexes - Index(u'authors_id', authors_table.c.id) - Index(u'authors_display_name_id', authors_table.c.display_name, - authors_table.c.id) - Index(u'media_files_id', media_files_table.c.id) - Index(u'song_books_id', song_books_table.c.id) - Index(u'songs_id', songs_table.c.id) - Index(u'topics_id', topics_table.c.id) - Index(u'authors_songs_author', authors_songs_table.c.author_id, - authors_songs_table.c.song_id) - Index(u'authors_songs_song', authors_songs_table.c.song_id, - authors_songs_table.c.author_id) - Index(u'media_files_songs_file', media_files_songs_table.c.media_file_id, - media_files_songs_table.c.song_id) - Index(u'media_files_songs_song', media_files_songs_table.c.song_id, - media_files_songs_table.c.media_file_id) - Index(u'topics_song_topic', songs_topics_table.c.topic_id, - songs_topics_table.c.song_id) - Index(u'topics_song_song', songs_topics_table.c.song_id, - songs_topics_table.c.topic_id) - mapper(Author, authors_table) mapper(Book, song_books_table) mapper(MediaFile, media_files_table) From 99ae60aba318fc9b50bcaa1552ccac61cae593a4 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 30 May 2011 13:17:23 +0200 Subject: [PATCH 8/9] Fixed up loading a song from a service. --- openlp/plugins/songs/lib/mediaitem.py | 1 + openlp/plugins/songs/lib/xml.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 3d9a9ef76..65e2289cd 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -27,6 +27,7 @@ import logging import locale +import re from PyQt4 import QtCore, QtGui from sqlalchemy.sql import or_ diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 7bcf56aa1..f5ec28103 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -514,7 +514,7 @@ class OpenLyrics(object): ``song`` The song object. """ - song.song_book_id = 0 + song.song_book_id = None song.song_number = u'' if hasattr(properties, u'songbooks'): for songbook in properties.songbooks.songbook: From ab3896ce6fd431de6ac946ae5b4a416ec4e44e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20K=C3=B6hler?= Date: Mon, 30 May 2011 21:41:02 +0200 Subject: [PATCH 9/9] removed unnecessary code --- openlp/plugins/bibles/lib/mediaitem.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 2ade16e6d..d6911b936 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -534,8 +534,6 @@ class BibleMediaItem(MediaManagerItem): unicode(self.advancedVersionComboBox.currentText())) def onAdvancedSecondComboBox(self): - QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible', - QtCore.QVariant(self.advancedVersionComboBox.currentText())) self.initialiseAdvancedBible( unicode(self.advancedVersionComboBox.currentText()))