← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~erik-lundin/openlp/song-edit into lp:openlp

 

Erik Lundin has proposed merging lp:~erik-lundin/openlp/song-edit into lp:openlp.

Commit message:
Fixed bug #841752 'song editor: increment verse number automatically'.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #841752 in OpenLP: "song editor: increment verse number automatically"
  https://bugs.launchpad.net/openlp/+bug/841752

For more details, see:
https://code.launchpad.net/~erik-lundin/openlp/song-edit/+merge/141520

Fixed bug #841752 'song editor: increment verse number automatically'.

* Automatically set the number of the verse/chorus etc. next to be inserted to the previous number found in the text plus one.
* Don't update the verse type automatically. This is intentional, since I find that I more often need to insert a tag of the same verse type I last inserted, rather than the previous verse type found in the text.
* Let the different verse types only care about found numbers of the same kind (a chorus tag shouldn't care about verses, bridges or any other tags).
* Bonus: get rid of some duplicate code.
* Tested while adding hundreds of songs.
-- 
https://code.launchpad.net/~erik-lundin/openlp/song-edit/+merge/141520
Your team OpenLP Core is requested to review the proposed merge of lp:~erik-lundin/openlp/song-edit into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py	2012-12-29 20:56:56 +0000
+++ openlp/plugins/songs/forms/editverseform.py	2012-12-31 12:55:26 +0000
@@ -93,6 +93,12 @@
             self.verseNumberBox.value())
 
     def onVerseTypeComboBoxChanged(self):
+        self.updateSuggestedVerseNumber()
+
+    def onCursorPositionChanged(self):
+        self.updateSuggestedVerseNumber()
+
+    def updateSuggestedVerseNumber(self):
         """
         Adjusts the verse number SpinBox in regard to the selected verse type
         and the cursor's position.
@@ -116,9 +122,10 @@
         if match:
             verse_tag = match.group(1)
             try:
-                verse_num = int(match.group(2))
+                verse_num = int(match.group(2)) + 1
             except ValueError:
                 verse_num = 1
+<<<<<<< TREE
             if VerseType.from_loose_input(verse_tag, False):
                 self.verseNumberBox.setValue(verse_num)
 
@@ -153,6 +160,9 @@
             if verse_type_index is not None:
                 self.verseTypeComboBox.setCurrentIndex(verse_type_index)
                 self.verseNumberBox.setValue(verse_number)
+=======
+            self.verseNumberBox.setValue(verse_num)
+>>>>>>> MERGE-SOURCE
 
     def setVerse(self, text, single=False,
         tag=u'%s1' % VerseType.Tags[VerseType.Verse]):


Follow ups