fixing string encoding in songmaintenanceform

making verses w/o index a alias for the first one
This commit is contained in:
M2j 2010-06-02 17:33:55 +02:00
parent 1bf14e1605
commit ffcdddf928
3 changed files with 20 additions and 26 deletions

View File

@ -469,7 +469,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.SongTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus()
#split the verse list by space and mark lower case for testing
taglist = unicode(self.trUtf8(' bitped'))
taglist = unicode(self.trUtf8(' bitpeovc'))
for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '):
if len(verse) > 1:
if (verse[0:1] == u'%s' % self.trUtf8('v') or

View File

@ -129,12 +129,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.setAutoDisplayName(True)
if self.authorform.exec_():
author = Author.populate(
first_name=unicode(
self.authorform.FirstNameEdit.text(), u'utf-8'),
last_name=unicode(
self.authorform.LastNameEdit.text(), u'utf-8'),
display_name=unicode(
self.authorform.DisplayEdit.text(), u'utf-8'))
first_name=unicode(self.authorform.FirstNameEdit.text()),
last_name=unicode(self.authorform.LastNameEdit.text()),
display_name=unicode(self.authorform.DisplayEdit.text()))
if self.songmanager.save_author(author):
self.resetAuthors()
else:
@ -144,8 +141,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onTopicAddButtonClick(self):
if self.topicform.exec_():
topic = Topic.populate(
name=unicode(self.topicform.NameEdit.text(), u'utf-8'))
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text()))
if self.songmanager.save_topic(topic):
self.resetTopics()
else:
@ -156,8 +152,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onBookAddButtonClick(self):
if self.bookform.exec_():
book = Book.populate(
name=unicode(self.bookform.NameEdit.text(), u'utf-8'),
publisher=unicode(self.bookform.PublisherEdit.text(), u'utf-8'))
name=unicode(self.bookform.NameEdit.text()),
publisher=unicode(self.bookform.PublisherEdit.text()))
if self.songmanager.save_book(book):
self.resetBooks()
else:
@ -175,11 +171,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.DisplayEdit.setText(author.display_name)
if self.authorform.exec_(False):
author.first_name = unicode(
self.authorform.FirstNameEdit.text(), u'utf-8')
author.last_name = unicode(
self.authorform.LastNameEdit.text(), u'utf-8')
self.authorform.FirstNameEdit.text())
author.last_name = unicode(self.authorform.LastNameEdit.text())
author.display_name = unicode(
self.authorform.DisplayEdit.text(), u'utf-8')
self.authorform.DisplayEdit.text())
if self.songmanager.save_author(author):
self.resetAuthors()
else:
@ -193,7 +188,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
topic = self.songmanager.get_topic(topic_id)
self.topicform.NameEdit.setText(topic.name)
if self.topicform.exec_(False):
topic.name = unicode(self.topicform.NameEdit.text(), u'utf-8')
topic.name = unicode(self.topicform.NameEdit.text())
if self.songmanager.save_topic(topic):
self.resetTopics()
else:
@ -208,9 +203,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.bookform.NameEdit.setText(book.name)
self.bookform.PublisherEdit.setText(book.publisher)
if self.bookform.exec_(False):
book.name = unicode(self.bookform.NameEdit.text(), u'utf-8')
book.publisher = unicode(
self.bookform.PublisherEdit.text(), u'utf-8')
book.name = unicode(self.bookform.NameEdit.text())
book.publisher = unicode(self.bookform.PublisherEdit.text())
if self.songmanager.save_book(book):
self.resetBooks()
else:

View File

@ -335,16 +335,16 @@ class SongMediaItem(MediaManagerItem):
break
for verse in verseList:
if verse[1]:
if verse[0][u'type'] == "Verse" \
or verse[0][u'type'] == "Chorus":
if verse[0][u'label'] == order[1:] and \
verse[0][u'type'][0] == order[0]:
if order[1:]:
if verse[0][u'type'][0] == order[0] and \
verse[0][u'label'] == order[1:]:
verseTag = u'%s:%s' % \
(verse[0][u'type'], verse[0][u'label'])
service_item.add_from_text\
(verse[1][:30], verse[1], verseTag)
else:
if verse[0][u'type'][0] == order[0]:
if verse[0][u'type'][0] == order[0] and \
verse[0][u'label'] == u'1':
verseTag = u'%s:%s' % \
(verse[0][u'type'], verse[0][u'label'])
service_item.add_from_text\