← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/tweaks into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/tweaks into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/tweaks/+merge/47704

Hello!

Only trivial changes:
- only allow to select one slide in the slidecontrollers (not possible any longer: http://img69.imageshack.us/i/trunk.png/)
- make curosr busy when merging authors/topics/books
- cosmetic code change (saves 4 spaces all over the methods)
-- 
https://code.launchpad.net/~googol-hush/openlp/tweaks/+merge/47704
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/tweaks into lp:openlp.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-01-22 19:32:02 +0000
+++ openlp/core/ui/slidecontroller.py	2011-01-27 18:38:35 +0000
@@ -119,6 +119,8 @@
         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(

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2011-01-21 22:28:34 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2011-01-27 18:38:35 +0000
@@ -278,117 +278,129 @@
 
     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):
         """


Follow ups