openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01678
[Merge] lp:~m2j/openlp/work into lp:openlp
mmj has proposed merging lp:~m2j/openlp/work into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Tim Bentley (trb143)
This are a fraction of my utf8fit changes for the songmaintenance form. Furthermore this will enable multiple items for all verse types, while entries w/o index are handled as the first one. Still the GUI accepts only multible verses and choruses.
--
https://code.launchpad.net/~m2j/openlp/work/+merge/26881
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-05-29 19:50:50 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2010-06-06 10:32:24 +0000
@@ -101,6 +101,7 @@
QtCore.QObject.connect(self.VerseOrderEdit,
QtCore.SIGNAL(u'lostFocus()'), self.onVerseOrderEditLostFocus)
self.previewButton = QtGui.QPushButton()
+ self.previewButton.setObjectName(u'previewButton')
self.previewButton.setText(self.trUtf8('Save && Preview'))
self.ButtonBox.addButton(
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
@@ -370,7 +371,8 @@
item.setText(afterText)
self.VerseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1)
- self.VerseListWidget.setItem(int(self.VerseListWidget.rowCount() - 1), 0, item)
+ self.VerseListWidget.setItem(
+ int(self.VerseListWidget.rowCount() - 1), 0, item)
self.VerseListWidget.setColumnWidth(0, self.width)
self.VerseListWidget.resizeRowsToContents()
self.tagRows()
@@ -469,7 +471,7 @@
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(' bitpeo'))
for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '):
if len(verse) > 1:
if (verse[0:1] == u'%s' % self.trUtf8('v') or
@@ -493,19 +495,19 @@
return True, u''
def onTitleEditItemLostFocus(self):
- self.song.title = self.TitleEditItem.text()
+ self.song.title = unicode(self.TitleEditItem.text())
def onVerseOrderEditLostFocus(self):
- self.song.verse_order = self.VerseOrderEdit.text()
+ self.song.verse_order = unicode(self.VerseOrderEdit.text())
def onCommentsEditLostFocus(self):
- self.song.comments = self.CommentsEdit.text()
+ self.song.comments = unicode(self.CommentsEdit.text())
def onCCLNumberEditLostFocus(self):
self.song.ccli_number = self.CCLNumberEdit.text()
def onCopyrightInsertButtonTriggered(self):
- text = self.CopyrightEditItem.displayText()
+ text = self.CopyrightEditItem.text()
pos = self.CopyrightEditItem.cursorPosition()
text = text[:pos] + u'©' + text[pos:]
self.CopyrightEditItem.setText(text)
@@ -524,8 +526,7 @@
The Song is valid so as the plugin to add it to preview to see.
"""
log.debug(u'onPreview')
- if button.text() == unicode(self.trUtf8('Save && Preview')) \
- and self.saveSong():
+ if unicode(button.objectName()) == u'previewButton' and self.saveSong():
Receiver.send_message(u'songs_preview')
def closePressed(self):
@@ -545,13 +546,13 @@
self, self.trUtf8('Error'), message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return False
- self.song.title = unicode(self.TitleEditItem.displayText())
- self.song.copyright = unicode(self.CopyrightEditItem.displayText())
- self.song.search_title = unicode(self.TitleEditItem.displayText()) + \
- u'@'+ unicode(self.AlternativeEdit.displayText())
+ self.song.title = unicode(self.TitleEditItem.text())
+ self.song.copyright = unicode(self.CopyrightEditItem.text())
+ self.song.search_title = unicode(self.TitleEditItem.text()) + \
+ u'@'+ unicode(self.AlternativeEdit.text())
self.song.comments = unicode(self.CommentsEdit.toPlainText())
self.song.verse_order = unicode(self.VerseOrderEdit.text())
- self.song.ccli_number = unicode(self.CCLNumberEdit.displayText())
+ self.song.ccli_number = unicode(self.CCLNumberEdit.text())
self.processLyrics()
self.processTitle()
self.songmanager.save_song(self.song)
@@ -588,6 +589,7 @@
def processTitle(self):
log.debug(u'processTitle')
+ self.song.search_title = unicode(self.song.search_title)
self.song.search_title = self.song.search_title.replace(u'\'', u'')
self.song.search_title = self.song.search_title.replace(u'\"', u'')
self.song.search_title = self.song.search_title.replace(u'`', u'')
@@ -599,6 +601,5 @@
self.song.search_title = self.song.search_title.replace(u'{', u'')
self.song.search_title = self.song.search_title.replace(u'}', u'')
self.song.search_title = self.song.search_title.replace(u'?', u'')
- self.song.search_title = unicode(self.song.search_title)
=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py 2010-05-25 23:47:26 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py 2010-06-06 10:32:24 +0000
@@ -129,12 +129,9 @@
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 @@
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 @@
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:
@@ -174,12 +170,11 @@
self.authorform.LastNameEdit.setText(author.last_name)
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')
- author.display_name = unicode(
- self.authorform.DisplayEdit.text(), u'utf-8')
+ author.first_name = unicode(
+ self.authorform.FirstNameEdit.text())
+ author.last_name = unicode(self.authorform.LastNameEdit.text())
+ author.display_name = unicode(
+ self.authorform.DisplayEdit.text())
if self.songmanager.save_author(author):
self.resetAuthors()
else:
@@ -193,7 +188,7 @@
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 @@
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:
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2010-05-25 23:47:26 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2010-06-06 10:32:24 +0000
@@ -187,12 +187,7 @@
if author_list != u'':
author_list = author_list + u', '
author_list = author_list + author.display_name
- if not isinstance(author_list, unicode):
- author_list = unicode(author_list, u'utf8')
- if isinstance(song.title, unicode):
- song_title = song.title
- else:
- song_title = unicode(song.title, u'utf8')
+ song_title = unicode(song.title)
song_detail = u'%s (%s)' % (song_title, author_list)
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
@@ -203,8 +198,8 @@
self.ListView.clear()
for author in searchresults:
for song in author.songs:
- song_detail = unicode(self.trUtf8('%s (%s)' % \
- (unicode(author.display_name), unicode(song.title))))
+ song_detail = unicode(self.trUtf8('%s (%s)') % \
+ (author.display_name, song.title)
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.ListView.addItem(song_name)
Follow ups