← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bugs into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bugs into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)
Related bugs:
  #691952 To create a songs fails
  https://bugs.launchpad.net/bugs/691952


Songs being edited must have an Author
Songs being edited must have text in a verse.
-- 
https://code.launchpad.net/~trb143/openlp/bugs/+merge/44234
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2010-12-16 18:20:46 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2010-12-20 14:22:14 +0000
@@ -547,14 +547,11 @@
         if self.AuthorsListView.count() == 0:
             self.SongTabWidget.setCurrentIndex(1)
             self.AuthorsListView.setFocus()
-            answer = QtGui.QMessageBox.warning(self,
+            QtGui.QMessageBox.critical(self,
                 translate('SongsPlugin.EditSongForm', 'Warning'),
                 translate('SongsPlugin.EditSongForm',
-                'You have not added any authors for this song. Do you '
-                'want to add an author now?'),
-                QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
-            if answer == QtGui.QMessageBox.Yes:
-                return False
+                'You need to have an author for this song.'))
+            return False
         if self.song.verse_order:
             order = []
             order_names = self.song.verse_order.split()

=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py	2010-11-18 17:57:51 +0000
+++ openlp/plugins/songs/forms/editverseform.py	2010-12-20 14:22:14 +0000
@@ -29,7 +29,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.plugins.songs.lib import VerseType
+from openlp.plugins.songs.lib import VerseType, translate
 
 from editversedialog import Ui_EditVerseDialog
 
@@ -131,6 +131,7 @@
 
     def setVerse(self, text, single=False,
         tag=u'%s:1' % VerseType.to_string(VerseType.Verse)):
+        self.hasSingleVerse = single
         if single:
             verse_type, verse_number = tag.split(u':')
             verse_type_index = VerseType.from_string(verse_type)
@@ -159,3 +160,16 @@
             text = u'---[%s:1]---\n%s' % (VerseType.to_string(VerseType.Verse),
                 text)
         return text
+
+    def accept(self):
+        if self.hasSingleVerse:
+            value = unicode(self.getVerse()[0])
+        else:
+            value = self.getVerse()[0].split(u'\n')[1]
+        if len(value) == 0:
+            QtGui.QMessageBox.critical(self,
+                translate('SongsPlugin.EditSongForm', 'Error'),
+                translate('SongsPlugin.EditSongForm',
+                'You need to type some text in to the verse.'))
+            return False
+        QtGui.QDialog.accept(self)


Follow ups