← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/trivialfixes into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Slightly shorter fix to save a song book if the book has been entered manually
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/30385
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2010-07-03 21:50:42 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2010-07-20 11:21:44 +0000
@@ -382,23 +382,7 @@
         self.TopicsListView.takeItem(row)
 
     def onSongBookComboChanged(self, item):
-        item = int(self.SongbookCombo.currentIndex())
-        text = unicode(self.SongbookCombo.currentText())
-        if item == 0 and text:
-            if QtGui.QMessageBox.question(self,
-                translate('SongsPlugin.EditSongForm', 'Add Book'),
-                translate('SongsPlugin.EditSongForm', 'This song book does '
-                    'not exist, do you want to add it?'),
-                QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
-                QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
-                book = Book.populate(name=text)
-                self.songmanager.save_object(book)
-                self.song.book = book
-                self.loadBooks()
-            else:
-                return
-        elif item >= 1:
-            item = int(self.SongbookCombo.currentIndex())
+        if item >= 1:
             self.song.song_book_id = \
                 (self.SongbookCombo.itemData(item)).toInt()[0]
         else:
@@ -616,6 +600,21 @@
 
     def accept(self):
         log.debug(u'accept')
+        item = int(self.SongbookCombo.currentIndex())
+        text = unicode(self.SongbookCombo.currentText())
+        if item == 0 and text:
+            if QtGui.QMessageBox.question(self,
+                translate('SongsPlugin.EditSongForm', 'Add Book'),
+                translate('SongsPlugin.EditSongForm', 'This song book does '
+                    'not exist, do you want to add it?'),
+                QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
+                QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
+                book = Book.populate(name=text)
+                self.songmanager.save_object(book)
+                self.song.book = book
+                self.loadBooks()
+            else:
+                return
         if self.saveSong():
             Receiver.send_message(u'songs_load_list')
             self.close()


Follow ups