forked from openlp/openlp
fixed Song Book publisher
fixed Authors like "0123hallo" which cannot be splitted
This commit is contained in:
parent
a835338939
commit
2691636e71
|
@ -48,7 +48,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
"""
|
"""
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
#can this be automated?
|
# can this be automated?
|
||||||
self.width = 400
|
self.width = 400
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
# Connecting signals and slots
|
# Connecting signals and slots
|
||||||
|
@ -171,7 +171,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
self.loadAuthors()
|
self.loadAuthors()
|
||||||
self.loadTopics()
|
self.loadTopics()
|
||||||
self.loadBooks()
|
self.loadBooks()
|
||||||
#it's a new song to preview is not possible
|
# it's a new song to preview is not possible
|
||||||
self.previewButton.setVisible(False)
|
self.previewButton.setVisible(False)
|
||||||
|
|
||||||
def loadSong(self, id, preview):
|
def loadSong(self, id, preview):
|
||||||
|
@ -221,7 +221,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
self.CCLNumberEdit.setText(self.song.ccli_number)
|
self.CCLNumberEdit.setText(self.song.ccli_number)
|
||||||
else:
|
else:
|
||||||
self.CCLNumberEdit.setText(u'')
|
self.CCLNumberEdit.setText(u'')
|
||||||
#lazy xml migration for now
|
# lazy xml migration for now
|
||||||
self.VerseListWidget.clear()
|
self.VerseListWidget.clear()
|
||||||
self.VerseListWidget.setRowCount(0)
|
self.VerseListWidget.setRowCount(0)
|
||||||
self.VerseListWidget.setColumnWidth(0, self.width)
|
self.VerseListWidget.setColumnWidth(0, self.width)
|
||||||
|
@ -263,7 +263,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
||||||
self.TopicsListView.addItem(topic_name)
|
self.TopicsListView.addItem(topic_name)
|
||||||
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
|
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
|
||||||
#if not preview hide the preview button
|
# if not preview hide the preview button
|
||||||
self.previewButton.setVisible(False)
|
self.previewButton.setVisible(False)
|
||||||
if preview:
|
if preview:
|
||||||
self.previewButton.setVisible(True)
|
self.previewButton.setVisible(True)
|
||||||
|
@ -291,6 +291,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
'exist, do you want to add them?'),
|
'exist, do you want to add them?'),
|
||||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
||||||
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
|
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
|
||||||
|
if text.find(' ') == -1:
|
||||||
|
author = Author.populate(first_name=u'', last_name=u'',
|
||||||
|
display_name=text)
|
||||||
|
else:
|
||||||
author = Author.populate(first_name=text.rsplit(u' ', 1)[0],
|
author = Author.populate(first_name=text.rsplit(u' ', 1)[0],
|
||||||
last_name=text.rsplit(u' ', 1)[1], display_name=text)
|
last_name=text.rsplit(u' ', 1)[1], display_name=text)
|
||||||
self.songmanager.save_object(author, False)
|
self.songmanager.save_object(author, False)
|
||||||
|
@ -408,7 +412,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
|
|
||||||
def onThemeComboChanged(self, item):
|
def onThemeComboChanged(self, item):
|
||||||
if item == 0:
|
if item == 0:
|
||||||
#None means no Theme
|
# None means no Theme
|
||||||
self.song.theme_name = None
|
self.song.theme_name = None
|
||||||
else:
|
else:
|
||||||
them_name = unicode(self.ThemeSelectionComboItem.itemText(item))
|
them_name = unicode(self.ThemeSelectionComboItem.itemText(item))
|
||||||
|
@ -445,7 +449,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
data = u'%s:%s' % (verse, subVerse)
|
data = u'%s:%s' % (verse, subVerse)
|
||||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
|
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
|
||||||
item.setText(afterText)
|
item.setText(afterText)
|
||||||
#number of lines has change so repaint the list moving the data
|
# number of lines has change so repaint the list moving the data
|
||||||
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
|
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
|
||||||
tempList = {}
|
tempList = {}
|
||||||
tempId = {}
|
tempId = {}
|
||||||
|
@ -484,7 +488,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
for count, parts in enumerate(match.split(u']---\n')):
|
for count, parts in enumerate(match.split(u']---\n')):
|
||||||
if len(parts) > 1:
|
if len(parts) > 1:
|
||||||
if count == 0:
|
if count == 0:
|
||||||
#make sure the tag is correctly cased
|
# make sure the tag is correctly cased
|
||||||
variant = u'%s%s' % \
|
variant = u'%s%s' % \
|
||||||
(parts[0:1].upper(), parts[1:].lower())
|
(parts[0:1].upper(), parts[1:].lower())
|
||||||
else:
|
else:
|
||||||
|
@ -582,8 +586,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
unicode(translate('SongsPlugin.EditSongForm',
|
unicode(translate('SongsPlugin.EditSongForm',
|
||||||
'You have not used %s anywhere in the verse '
|
'You have not used %s anywhere in the verse '
|
||||||
'order. Are you sure you want to save the song '
|
'order. Are you sure you want to save the song '
|
||||||
'like this?')) % \
|
'like this?')) % verse_names[count].replace(u':', u' '),
|
||||||
verse_names[count].replace(u':', u' '),
|
|
||||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
|
||||||
if answer == QtGui.QMessageBox.No:
|
if answer == QtGui.QMessageBox.No:
|
||||||
return False
|
return False
|
||||||
|
@ -627,7 +630,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
'not exist, do you want to add it?'),
|
'not exist, do you want to add it?'),
|
||||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
||||||
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
|
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
|
||||||
book = Book.populate(name=text)
|
book = Book.populate(name=text, publisher=u'')
|
||||||
self.songmanager.save_object(book)
|
self.songmanager.save_object(book)
|
||||||
self.song.book = book
|
self.song.book = book
|
||||||
self.loadBooks()
|
self.loadBooks()
|
||||||
|
|
Loading…
Reference in New Issue