← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/ticket-502 into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/ticket-502 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol/openlp/ticket-502/+merge/107532

Hello,

I have fixed two bugs:

- When you add a new author to a song, go to the song maintenance and delete the author, you will get a traceback when you attempt to save the song (www.support.openlp.org/issues/502)

- when you merge two authors used by one song you get a traceback when saving the song with its changes
-- 
https://code.launchpad.net/~googol/openlp/ticket-502/+merge/107532
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/ticket-502 into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2012-05-01 11:00:02 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2012-05-26 20:12:19 +0000
@@ -707,7 +707,7 @@
         text = unicode(self.songBookComboBox.currentText())
         if item == 0 and text:
             temp_song_book = text
-        self.mediaitem.songMaintenanceForm.exec_()
+        self.mediaitem.songMaintenanceForm.exec_(True)
         self.loadAuthors()
         self.loadBooks()
         self.loadTopics()
@@ -865,12 +865,16 @@
         for row in xrange(self.authorsListView.count()):
             item = self.authorsListView.item(row)
             authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
-            self.song.authors.append(self.manager.get_object(Author, authorId))
+            author = self.manager.get_object(Author, authorId)
+            if author is not None:
+                self.song.authors.append(author)
         self.song.topics = []
         for row in xrange(self.topicsListView.count()):
             item = self.topicsListView.item(row)
             topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
-            self.song.topics.append(self.manager.get_object(Topic, topicId))
+            topic = self.manager.get_object(Topic, topicId)
+            if topic is not None:
+                self.song.topics.append(topic)
         # Save the song here because we need a valid id for the audio files.
         clean_song(self.manager, self.song)
         self.manager.save_object(self.song)

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2012-04-29 15:31:56 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2012-05-26 20:12:19 +0000
@@ -87,7 +87,15 @@
             QtCore.SIGNAL(u'currentRowChanged(int)'),
             self.onBooksListRowChanged)
 
-    def exec_(self):
+    def exec_(self, from_song_edit=False):
+        """
+        Show the dialog.
+
+        ``from_song_edit``
+            Indicates if the maintenance dialog has been opened from song edit
+            or from the media manager. Defaults to **False**.
+        """
+        self.from_song_edit = from_song_edit
         self.typeListWidget.setCurrentRow(0)
         self.resetAuthors()
         self.resetTopics()
@@ -275,7 +283,8 @@
             if self.checkAuthor(author, True):
                 if self.manager.save_object(author):
                     self.resetAuthors()
-                    Receiver.send_message(u'songs_load_list')
+                    if not self.from_song_edit:
+                        Receiver.send_message(u'songs_load_list')
                 else:
                     critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm',
@@ -373,7 +382,8 @@
         Receiver.send_message(u'cursor_busy')
         merge(dbObject)
         reset()
-        Receiver.send_message(u'songs_load_list')
+        if not self.from_song_edit:
+            Receiver.send_message(u'songs_load_list')
         Receiver.send_message(u'cursor_normal')
 
     def mergeAuthors(self, old_author):


Follow ups