forked from openlp/openlp
More Song tagging fixes
This commit is contained in:
parent
fe2d35a937
commit
1d359c7503
@ -433,9 +433,9 @@ class ServiceManager(QtGui.QWidget):
|
||||
{u'serviceitem':item[u'service_item'].get_service_repr()})
|
||||
if item[u'service_item'].service_item_type == ServiceItemType.Image or \
|
||||
item[u'service_item'].service_item_type == ServiceItemType.Command:
|
||||
for frame in item[u'service_item'].frames:
|
||||
for frame in item[u'service_item'].get_frames:
|
||||
path_from = unicode(os.path.join(
|
||||
item[u'service_item'].service_item_path, frame[u'title']))
|
||||
item[u'service_item'].service_item_path, frame.get_frame_title()))
|
||||
zip.write(path_from)
|
||||
file = open(servicefile, u'wb')
|
||||
cPickle.dump(service, file)
|
||||
|
@ -23,6 +23,7 @@
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
@ -110,6 +111,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.AuthorsListView.setAlternatingRowColors(True)
|
||||
self.TopicsListView.setSortingEnabled(False)
|
||||
self.TopicsListView.setAlternatingRowColors(True)
|
||||
self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE)
|
||||
|
||||
def initialise(self):
|
||||
self.VerseEditButton.setEnabled(False)
|
||||
@ -346,23 +348,36 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
if self.VerseListWidget.count() > 0:
|
||||
for row in range(0, self.VerseListWidget.count()):
|
||||
item = self.VerseListWidget.item(row)
|
||||
verse_list += u'<%s>\n' % \
|
||||
unicode((item.data(QtCore.Qt.UserRole)).toString())
|
||||
field = unicode((item.data(QtCore.Qt.UserRole)).toString())
|
||||
if len(field) <= 2:
|
||||
verse_list += u'---[v%s]---\n' % field
|
||||
else:
|
||||
verse_list += u'---[%s]---\n' % field
|
||||
verse_list += item.text()
|
||||
verse_list += u'\n---\n'
|
||||
verse_list += u'\n'
|
||||
self.verse_form.setVerse(verse_list)
|
||||
else:
|
||||
self.verse_form.setVerse(u'')
|
||||
if self.verse_form.exec_():
|
||||
verse_list = self.verse_form.getVerse()
|
||||
verse_list = verse_list.replace(u'\r\n', u'\n')
|
||||
verse_list = self.verse_form.getVerseAll()
|
||||
verse_list = unicode(verse_list.replace(u'\r\n', u'\n'))
|
||||
self.VerseListWidget.clear()
|
||||
for row in verse_list.split(u'\n---\n'):
|
||||
bits = row.split(u'>\n')
|
||||
item = QtGui.QListWidgetItem(bits[1])
|
||||
verse = bits[0][1:]
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse))
|
||||
self.VerseListWidget.addItem(item)
|
||||
print self.findVerseSplit.split(verse_list)
|
||||
for row in self.findVerseSplit.split(verse_list):
|
||||
print row
|
||||
# parts = unicode(row).split(u']---\n')
|
||||
# print len(parts) , parts
|
||||
# verse = u''
|
||||
# if len(parts) > 1:
|
||||
# item = QtGui.QListWidgetItem(parts[1])
|
||||
# if parts[0][0].lower() == u'v':
|
||||
# verse = parts[0][1:]
|
||||
# else:
|
||||
# verse = parts[0]
|
||||
# else:
|
||||
# item = QtGui.QListWidgetItem(parts[0])
|
||||
# item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse))
|
||||
# self.VerseListWidget.addItem(item)
|
||||
self.VerseListWidget.repaint()
|
||||
|
||||
def onVerseDeleteButtonClicked(self):
|
||||
|
@ -51,7 +51,9 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
posSub = 0
|
||||
if single:
|
||||
if len(id) <= 2:
|
||||
if len(id) == 1:
|
||||
if len(id) == 0:
|
||||
pass
|
||||
elif len(id) == 1:
|
||||
posVerse = self.VerseListComboBox.findText(id, QtCore.Qt.MatchExactly)
|
||||
else:
|
||||
posVerse = self.VerseListComboBox.findText(id[0], QtCore.Qt.MatchExactly)
|
||||
@ -76,3 +78,6 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
return self.VerseTextEdit.toPlainText(), \
|
||||
unicode(self.VerseListComboBox.currentText()), \
|
||||
unicode(self.SubVerseListComboBox.currentText())
|
||||
|
||||
def getVerseAll(self):
|
||||
return self.VerseTextEdit.toPlainText()
|
||||
|
Loading…
Reference in New Issue
Block a user