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