forked from openlp/openlp
- removed hard coded verse tags
- the reindex tool to convert pre 1.9.5 verse tags (this also fixes translated tags, as long as the user is running a localised version) - now only one row/verse in the song editor can be selected bzr-revno: 1405
This commit is contained in:
commit
3550b77b61
@ -117,7 +117,8 @@ class SlideController(QtGui.QWidget):
|
||||
self.previewListWidget.setColumnWidth(0, self.controller.width())
|
||||
self.previewListWidget.isLive = self.isLive
|
||||
self.previewListWidget.setObjectName(u'PreviewListWidget')
|
||||
self.previewListWidget.setSelectionBehavior(1)
|
||||
self.previewListWidget.setSelectionBehavior(
|
||||
QtGui.QAbstractItemView.SelectRows)
|
||||
self.previewListWidget.setSelectionMode(
|
||||
QtGui.QAbstractItemView.SingleSelection)
|
||||
self.previewListWidget.setEditTriggers(
|
||||
|
@ -71,6 +71,8 @@ class Ui_EditSongDialog(object):
|
||||
self.verseListWidget.setColumnCount(1)
|
||||
self.verseListWidget.setSelectionBehavior(
|
||||
QtGui.QAbstractItemView.SelectRows)
|
||||
self.verseListWidget.setSelectionMode(
|
||||
QtGui.QAbstractItemView.SingleSelection)
|
||||
self.verseListWidget.setEditTriggers(
|
||||
QtGui.QAbstractItemView.NoEditTriggers)
|
||||
self.verseListWidget.setObjectName(u'verseListWidget')
|
||||
|
@ -543,6 +543,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
|
||||
def onVerseDeleteButtonClicked(self):
|
||||
self.verseListWidget.removeRow(self.verseListWidget.currentRow())
|
||||
if not self.verseListWidget.selectedItems():
|
||||
self.verseEditButton.setEnabled(False)
|
||||
self.verseDeleteButton.setEnabled(False)
|
||||
|
||||
|
@ -271,6 +271,18 @@ def clean_song(manager, song):
|
||||
verses = SongXML().get_verses(song.lyrics)
|
||||
lyrics = u' '.join([whitespace.sub(u' ', verse[1]) for verse in verses])
|
||||
song.search_lyrics = lyrics.lower()
|
||||
# We need a new and clean SongXML instance.
|
||||
sxml = SongXML()
|
||||
# Rebuild the song's verses, to remove any wrong verse names (for example
|
||||
# translated ones), which might have been added prior to 1.9.5.
|
||||
for verse in verses:
|
||||
sxml.add_verse_to_lyrics(
|
||||
VerseType.Tags[VerseType.from_loose_input(verse[0][u'type'])],
|
||||
verse[0][u'label'],
|
||||
verse[1],
|
||||
verse[0][u'lang'] if verse[0].has_key(u'lang') else None
|
||||
)
|
||||
song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
|
||||
# The song does not have any author, add one.
|
||||
if not song.authors:
|
||||
name = SongStrings.AuthorUnknown
|
||||
|
@ -34,30 +34,31 @@ import os
|
||||
import re
|
||||
|
||||
from openlp.core.ui.wizard import WizardStrings
|
||||
from openlp.plugins.songs.lib import VerseType
|
||||
from openlp.plugins.songs.lib.songimport import SongImport
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class SongBeamerTypes(object):
|
||||
MarkTypes = {
|
||||
u'Refrain': u'C',
|
||||
u'Chorus': u'C',
|
||||
u'Vers': u'V',
|
||||
u'Verse': u'V',
|
||||
u'Strophe': u'V',
|
||||
u'Intro': u'I',
|
||||
u'Coda': u'E',
|
||||
u'Ending': u'E',
|
||||
u'Bridge': u'B',
|
||||
u'Interlude': u'B',
|
||||
u'Zwischenspiel': u'B',
|
||||
u'Pre-Chorus': u'P',
|
||||
u'Pre-Refrain': u'P',
|
||||
u'Pre-Bridge': u'O',
|
||||
u'Pre-Coda': u'O',
|
||||
u'Unbekannt': u'O',
|
||||
u'Unknown': u'O',
|
||||
u'Unbenannt': u'O'
|
||||
u'Refrain': VerseType.Tags[VerseType.Chorus],
|
||||
u'Chorus': VerseType.Tags[VerseType.Chorus],
|
||||
u'Vers': VerseType.Tags[VerseType.Verse],
|
||||
u'Verse': VerseType.Tags[VerseType.Verse],
|
||||
u'Strophe': VerseType.Tags[VerseType.Verse],
|
||||
u'Intro': VerseType.Tags[VerseType.Intro],
|
||||
u'Coda': VerseType.Tags[VerseType.Ending],
|
||||
u'Ending': VerseType.Tags[VerseType.Ending],
|
||||
u'Bridge': VerseType.Tags[VerseType.Bridge],
|
||||
u'Interlude': VerseType.Tags[VerseType.Bridge],
|
||||
u'Zwischenspiel': VerseType.Tags[VerseType.Bridge],
|
||||
u'Pre-Chorus': VerseType.Tags[VerseType.PreChorus],
|
||||
u'Pre-Refrain': VerseType.Tags[VerseType.PreChorus],
|
||||
u'Pre-Bridge': VerseType.Tags[VerseType.Other],
|
||||
u'Pre-Coda': VerseType.Tags[VerseType.Other],
|
||||
u'Unbekannt': VerseType.Tags[VerseType.Other],
|
||||
u'Unknown': VerseType.Tags[VerseType.Other],
|
||||
u'Unbenannt': VerseType.Tags[VerseType.Other]
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +85,7 @@ class SongBeamerImport(SongImport):
|
||||
# TODO: check that it is a valid SongBeamer file
|
||||
self.set_defaults()
|
||||
self.current_verse = u''
|
||||
self.current_verse_type = u'V'
|
||||
self.current_verse_type = VerseType.Tags[VerseType.Verse]
|
||||
read_verses = False
|
||||
file_name = os.path.split(file)[1]
|
||||
self.import_wizard.incrementProgressBar(
|
||||
@ -111,7 +112,7 @@ class SongBeamerImport(SongImport):
|
||||
self.add_verse(self.current_verse,
|
||||
self.current_verse_type)
|
||||
self.current_verse = u''
|
||||
self.current_verse_type = u'V'
|
||||
self.current_verse_type = VerseType.Tags[VerseType.Verse]
|
||||
read_verses = True
|
||||
verse_start = True
|
||||
elif read_verses:
|
||||
|
@ -31,7 +31,7 @@ The basic XML for storing the lyrics in the song database looks like this::
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<song version="1.0">
|
||||
<lyrics>
|
||||
<verse type="Chorus" label="1" lang="en">
|
||||
<verse type="c" label="1" lang="en">
|
||||
<![CDATA[ ... ]]>
|
||||
</verse>
|
||||
</lyrics>
|
||||
|
Loading…
Reference in New Issue
Block a user