From d53f7b65114d505e52ef684e15e97cf538966e34 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 12 Apr 2012 12:48:54 +0200 Subject: [PATCH 1/2] fixed bug 977835 (Advanced search of Bibles is not working.) Fixes: https://launchpad.net/bugs/977835 --- openlp/plugins/bibles/lib/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/__init__.py b/openlp/plugins/bibles/lib/__init__.py index 587e7b8b0..4eccc087f 100644 --- a/openlp/plugins/bibles/lib/__init__.py +++ b/openlp/plugins/bibles/lib/__init__.py @@ -386,7 +386,7 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False): if bible.get_book_by_book_ref_id(value[u'id']): book_ref_id = value[u'id'] break - elif bible.get_book_by_book_ref_id(book_ref_id): + elif not bible.get_book_by_book_ref_id(book_ref_id): book_ref_id = False ranges = match.group(u'ranges') range_list = get_reference_match(u'range_separator').split(ranges) From cf069afe926e03b26b94a2aefdbe4ea8e44f1f00 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Fri, 13 Apr 2012 22:47:15 +0100 Subject: [PATCH 2/2] Implements the progress bar for all media items for which it is possible. This shows OpenLP is doing 'something' rather than just hung. --- openlp/plugins/images/lib/mediaitem.py | 11 +++++++++-- openlp/plugins/presentations/lib/mediaitem.py | 7 +++++++ openlp/plugins/songs/lib/mediaitem.py | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 053f4d689..702bc7e96 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -105,26 +105,30 @@ class ImageMediaItem(MediaManagerItem): 'You must select an image to delete.')): row_list = [item.row() for item in self.listView.selectedIndexes()] row_list.sort(reverse=True) + Receiver.send_message(u'cursor_busy') + self.plugin.formparent.displayProgressBar(len(row_list)) for row in row_list: text = self.listView.item(row) if text: delete_file(os.path.join(self.servicePath, unicode(text.text()))) self.listView.takeItem(row) + self.plugin.formparent.incrementProgressBar() SettingsManager.set_list(self.settingsSection, u'images', self.getFileList()) + self.plugin.formparent.finishedProgressBar() + Receiver.send_message(u'cursor_normal') self.listView.blockSignals(False) def loadList(self, images, initialLoad=False): if not initialLoad: + Receiver.send_message(u'cursor_busy') self.plugin.formparent.displayProgressBar(len(images)) # Sort the themes by its filename considering language specific # characters. lower() is needed for windows! images.sort(cmp=locale.strcoll, key=lambda filename: os.path.split(unicode(filename))[1].lower()) for imageFile in images: - if not initialLoad: - self.plugin.formparent.incrementProgressBar() filename = os.path.split(unicode(imageFile))[1] thumb = os.path.join(self.servicePath, filename) if not os.path.exists(unicode(imageFile)): @@ -139,8 +143,11 @@ class ImageMediaItem(MediaManagerItem): item_name.setToolTip(imageFile) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile)) self.listView.addItem(item_name) + if not initialLoad: + self.plugin.formparent.incrementProgressBar() if not initialLoad: self.plugin.formparent.finishedProgressBar() + Receiver.send_message(u'cursor_normal') def generateSlideData(self, service_item, item=None, xmlVersion=False, remote=False): diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 45d14f8cc..a94929b45 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -165,6 +165,7 @@ class PresentationMediaItem(MediaManagerItem): titles = [os.path.split(file)[1] for file in currlist] Receiver.send_message(u'cursor_busy') if not initialLoad: + Receiver.send_message(u'cursor_busy') self.plugin.formparent.displayProgressBar(len(files)) # Sort the themes by its filename considering language specific # characters. lower() is needed for windows! @@ -217,6 +218,7 @@ class PresentationMediaItem(MediaManagerItem): Receiver.send_message(u'cursor_normal') if not initialLoad: self.plugin.formparent.finishedProgressBar() + Receiver.send_message(u'cursor_normal') def onDeleteClick(self): """ @@ -226,6 +228,8 @@ class PresentationMediaItem(MediaManagerItem): items = self.listView.selectedIndexes() row_list = [item.row() for item in items] row_list.sort(reverse=True) + Receiver.send_message(u'cursor_busy') + self.plugin.formparent.displayProgressBar(len(row_list)) for item in items: filepath = unicode(item.data( QtCore.Qt.UserRole).toString()) @@ -233,6 +237,9 @@ class PresentationMediaItem(MediaManagerItem): doc = self.controllers[cidx].add_document(filepath) doc.presentation_deleted() doc.close_presentation() + self.plugin.formparent.incrementProgressBar() + self.plugin.formparent.finishedProgressBar() + Receiver.send_message(u'cursor_normal') for row in row_list: self.listView.takeItem(row) SettingsManager.set_list(self.settingsSection, diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 38f5db956..dd398ec1c 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -408,6 +408,8 @@ class SongMediaItem(MediaManagerItem): QtGui.QMessageBox.No), QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No: return + Receiver.send_message(u'cursor_busy') + self.plugin.formparent.displayProgressBar(len(items)) for item in items: item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] media_files = self.plugin.manager.get_all_objects(MediaFile, @@ -426,6 +428,9 @@ class SongMediaItem(MediaManagerItem): except OSError: log.exception(u'Could not remove directory: %s', save_path) self.plugin.manager.delete_object(Song, item_id) + self.plugin.formparent.incrementProgressBar() + self.plugin.formparent.finishedProgressBar() + Receiver.send_message(u'cursor_normal') self.onSearchTextButtonClicked() def onCloneClick(self):