From a2894b850ff43c3c626ccb741a33ead8eba73e5e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 27 Jan 2011 17:40:17 +0100 Subject: [PATCH 1/2] only allow to select one slide in the slidecontrollers --- openlp/core/ui/slidecontroller.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 7266d197c..916bf68c3 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -119,6 +119,8 @@ class SlideController(QtGui.QWidget): self.previewListWidget.isLive = self.isLive self.previewListWidget.setObjectName(u'PreviewListWidget') self.previewListWidget.setSelectionBehavior(1) + self.previewListWidget.setSelectionMode( + QtGui.QAbstractItemView.SingleSelection) self.previewListWidget.setEditTriggers( QtGui.QAbstractItemView.NoEditTriggers) self.previewListWidget.setHorizontalScrollBarPolicy( From 3d510596e4cf95130b3dbf2a37a48e7886ae7984 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 27 Jan 2011 17:59:15 +0100 Subject: [PATCH 2/2] make curosr busy when merging authors/topics/books --- .../songs/forms/songmaintenanceform.py | 200 ++++++++++-------- 1 file changed, 106 insertions(+), 94 deletions(-) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 93a01623e..6613a050b 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -278,117 +278,129 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def onAuthorEditButtonClick(self): author_id = self._getCurrentItemId(self.authorsListWidget) - if author_id != -1: - author = self.manager.get_object(Author, author_id) - self.authorform.setAutoDisplayName(False) - self.authorform.firstNameEdit.setText(author.first_name) - self.authorform.lastNameEdit.setText(author.last_name) - self.authorform.displayEdit.setText(author.display_name) - # Save the author's first and last name as well as the display name - # for the case that they have to be restored. - temp_first_name = author.first_name - temp_last_name = author.last_name - temp_display_name = author.display_name - if self.authorform.exec_(False): - author.first_name = unicode( - self.authorform.firstNameEdit.text()) - author.last_name = unicode(self.authorform.lastNameEdit.text()) - author.display_name = unicode( - self.authorform.displayEdit.text()) - if self.checkAuthor(author, True): - if self.manager.save_object(author): - self.resetAuthors() - Receiver.send_message(u'songs_load_list') - else: - criticalErrorMessageBox( - message=translate('SongsPlugin.SongMaintenanceForm', - 'Could not save your changes.')) - elif criticalErrorMessageBox(message=unicode(translate( - 'SongsPlugin.SongMaintenanceForm', 'The author %s already ' - 'exists. Would you like to make songs with author %s use ' - 'the existing author %s?')) % (author.display_name, - temp_display_name, author.display_name), - parent=self, question=True) == QtGui.QMessageBox.Yes: - self.mergeAuthors(author) + if author_id == -1: + return + author = self.manager.get_object(Author, author_id) + self.authorform.setAutoDisplayName(False) + self.authorform.firstNameEdit.setText(author.first_name) + self.authorform.lastNameEdit.setText(author.last_name) + self.authorform.displayEdit.setText(author.display_name) + # Save the author's first and last name as well as the display name + # for the case that they have to be restored. + temp_first_name = author.first_name + temp_last_name = author.last_name + temp_display_name = author.display_name + if self.authorform.exec_(False): + author.first_name = unicode( + self.authorform.firstNameEdit.text()) + author.last_name = unicode(self.authorform.lastNameEdit.text()) + author.display_name = unicode( + self.authorform.displayEdit.text()) + if self.checkAuthor(author, True): + if self.manager.save_object(author): self.resetAuthors() Receiver.send_message(u'songs_load_list') else: - # We restore the author's old first and last name as well as - # his display name. - author.first_name = temp_first_name - author.last_name = temp_last_name - author.display_name = temp_display_name criticalErrorMessageBox( message=translate('SongsPlugin.SongMaintenanceForm', - 'Could not save your modified author, because the ' - 'author already exists.')) + 'Could not save your changes.')) + elif criticalErrorMessageBox(message=unicode(translate( + 'SongsPlugin.SongMaintenanceForm', 'The author %s already ' + 'exists. Would you like to make songs with author %s use ' + 'the existing author %s?')) % (author.display_name, + temp_display_name, author.display_name), + parent=self, question=True) == QtGui.QMessageBox.Yes: + Receiver.send_message(u'cursor_busy') + Receiver.send_message(u'openlp_process_events') + self.mergeAuthors(author) + self.resetAuthors() + Receiver.send_message(u'songs_load_list') + Receiver.send_message(u'cursor_normal') + else: + # We restore the author's old first and last name as well as + # his display name. + author.first_name = temp_first_name + author.last_name = temp_last_name + author.display_name = temp_display_name + criticalErrorMessageBox( + message=translate('SongsPlugin.SongMaintenanceForm', + 'Could not save your modified author, because the ' + 'author already exists.')) def onTopicEditButtonClick(self): topic_id = self._getCurrentItemId(self.topicsListWidget) - if topic_id != -1: - topic = self.manager.get_object(Topic, topic_id) - self.topicform.nameEdit.setText(topic.name) - # Save the topic's name for the case that he has to be restored. - temp_name = topic.name - if self.topicform.exec_(False): - topic.name = unicode(self.topicform.nameEdit.text()) - if self.checkTopic(topic, True): - if self.manager.save_object(topic): - self.resetTopics() - else: - criticalErrorMessageBox( - message=translate('SongsPlugin.SongMaintenanceForm', - 'Could not save your changes.')) - elif criticalErrorMessageBox( - message=unicode(translate('SongsPlugin.SongMaintenanceForm', - 'The topic %s already exists. Would you like to make songs ' - 'with topic %s use the existing topic %s?')) % (topic.name, - temp_name, topic.name), - parent=self, question=True) == QtGui.QMessageBox.Yes: - self.mergeTopics(topic) + if topic_id == -1: + return + topic = self.manager.get_object(Topic, topic_id) + self.topicform.nameEdit.setText(topic.name) + # Save the topic's name for the case that he has to be restored. + temp_name = topic.name + if self.topicform.exec_(False): + topic.name = unicode(self.topicform.nameEdit.text()) + if self.checkTopic(topic, True): + if self.manager.save_object(topic): self.resetTopics() else: - # We restore the topics's old name. - topic.name = temp_name criticalErrorMessageBox( message=translate('SongsPlugin.SongMaintenanceForm', - 'Could not save your modified topic, because it ' - 'already exists.')) + 'Could not save your changes.')) + elif criticalErrorMessageBox( + message=unicode(translate('SongsPlugin.SongMaintenanceForm', + 'The topic %s already exists. Would you like to make songs ' + 'with topic %s use the existing topic %s?')) % (topic.name, + temp_name, topic.name), + parent=self, question=True) == QtGui.QMessageBox.Yes: + Receiver.send_message(u'cursor_busy') + Receiver.send_message(u'openlp_process_events') + self.mergeTopics(topic) + self.resetTopics() + Receiver.send_message(u'cursor_normal') + else: + # We restore the topics's old name. + topic.name = temp_name + criticalErrorMessageBox( + message=translate('SongsPlugin.SongMaintenanceForm', + 'Could not save your modified topic, because it ' + 'already exists.')) def onBookEditButtonClick(self): book_id = self._getCurrentItemId(self.booksListWidget) - if book_id != -1: - book = self.manager.get_object(Book, book_id) - if book.publisher is None: - book.publisher = u'' - self.bookform.nameEdit.setText(book.name) - self.bookform.publisherEdit.setText(book.publisher) - # Save the book's name and publisher for the case that they have to - # be restored. - temp_name = book.name - temp_publisher = book.publisher - if self.bookform.exec_(False): - book.name = unicode(self.bookform.nameEdit.text()) - book.publisher = unicode(self.bookform.publisherEdit.text()) - if self.checkBook(book, True): - if self.manager.save_object(book): - self.resetBooks() - else: - criticalErrorMessageBox( - message=translate('SongsPlugin.SongMaintenanceForm', - 'Could not save your changes.')) - elif criticalErrorMessageBox( - message=unicode(translate('SongsPlugin.SongMaintenanceForm', - 'The book %s already exists. Would you like to make songs ' - 'with book %s use the existing book %s?')) % (book.name, - temp_name, book.name), - parent=self, question=True) == QtGui.QMessageBox.Yes: - self.mergeBooks(book) + if book_id == -1: + return + book = self.manager.get_object(Book, book_id) + if book.publisher is None: + book.publisher = u'' + self.bookform.nameEdit.setText(book.name) + self.bookform.publisherEdit.setText(book.publisher) + # Save the book's name and publisher for the case that they have to + # be restored. + temp_name = book.name + temp_publisher = book.publisher + if self.bookform.exec_(False): + book.name = unicode(self.bookform.nameEdit.text()) + book.publisher = unicode(self.bookform.publisherEdit.text()) + if self.checkBook(book, True): + if self.manager.save_object(book): self.resetBooks() else: - # We restore the book's old name and publisher. - book.name = temp_name - book.publisher = temp_publisher + criticalErrorMessageBox( + message=translate('SongsPlugin.SongMaintenanceForm', + 'Could not save your changes.')) + elif criticalErrorMessageBox( + message=unicode(translate('SongsPlugin.SongMaintenanceForm', + 'The book %s already exists. Would you like to make songs ' + 'with book %s use the existing book %s?')) % (book.name, + temp_name, book.name), + parent=self, question=True) == QtGui.QMessageBox.Yes: + Receiver.send_message(u'cursor_busy') + Receiver.send_message(u'openlp_process_events') + self.mergeBooks(book) + self.resetBooks() + Receiver.send_message(u'cursor_normal') + else: + # We restore the book's old name and publisher. + book.name = temp_name + book.publisher = temp_publisher def mergeAuthors(self, old_author): """