openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #03037
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Fix song maintenance form when called as a sub form of editsongform (Bug #612282)
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/33978
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2010-07-31 02:06:44 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2010-08-28 01:35:59 +0000
@@ -600,6 +600,7 @@
self.CopyrightEditItem.setCursorPosition(pos + 1)
def onMaintenanceButtonClicked(self):
+ self.parent.song_maintenance_form.songFormLaunch = True
self.parent.song_maintenance_form.exec_()
self.loadAuthors()
self.loadBooks()
=== modified file 'openlp/plugins/songs/forms/editversedialog.py'
--- openlp/plugins/songs/forms/editversedialog.py 2010-07-27 09:32:52 +0000
+++ openlp/plugins/songs/forms/editversedialog.py 2010-08-28 01:35:59 +0000
@@ -30,77 +30,78 @@
from openlp.plugins.songs.lib import VerseType
class Ui_EditVerseDialog(object):
- def setupUi(self, EditVerseDialog):
- EditVerseDialog.setObjectName(u'EditVerseDialog')
- EditVerseDialog.resize(474, 442)
- EditVerseDialog.setModal(True)
- self.EditVerseLayout = QtGui.QVBoxLayout(EditVerseDialog)
- self.EditVerseLayout.setSpacing(8)
- self.EditVerseLayout.setMargin(8)
- self.EditVerseLayout.setObjectName(u'EditVerseLayout')
- self.VerseTextEdit = QtGui.QPlainTextEdit(EditVerseDialog)
- self.VerseTextEdit.setObjectName(u'VerseTextEdit')
- self.EditVerseLayout.addWidget(self.VerseTextEdit)
- self.VerseTypeLayout = QtGui.QHBoxLayout()
- self.VerseTypeLayout.setSpacing(8)
- self.VerseTypeLayout.setObjectName(u'VerseTypeLayout')
- self.VerseTypeLabel = QtGui.QLabel(EditVerseDialog)
- self.VerseTypeLabel.setObjectName(u'VerseTypeLabel')
- self.VerseTypeLayout.addWidget(self.VerseTypeLabel)
- self.VerseTypeComboBox = QtGui.QComboBox(EditVerseDialog)
- self.VerseTypeComboBox.setObjectName(u'VerseTypeComboBox')
- self.VerseTypeComboBox.addItem(u'')
- self.VerseTypeComboBox.addItem(u'')
- self.VerseTypeComboBox.addItem(u'')
- self.VerseTypeComboBox.addItem(u'')
- self.VerseTypeComboBox.addItem(u'')
- self.VerseTypeComboBox.addItem(u'')
- self.VerseTypeComboBox.addItem(u'')
- self.VerseTypeLayout.addWidget(self.VerseTypeComboBox)
- self.VerseNumberBox = QtGui.QSpinBox(EditVerseDialog)
- self.VerseNumberBox.setMinimum(1)
- self.VerseNumberBox.setObjectName(u'VerseNumberBox')
- self.VerseTypeLayout.addWidget(self.VerseNumberBox)
- self.InsertButton = QtGui.QPushButton(EditVerseDialog)
- self.InsertButton.setIcon(build_icon(u':/general/general_add.png'))
- self.InsertButton.setObjectName(u'InsertButton')
- self.VerseTypeLayout.addWidget(self.InsertButton)
- self.VerseTypeSpacer = QtGui.QSpacerItem(40, 20,
+ def setupUi(self, editVerseDialog):
+ editVerseDialog.setObjectName(u'editVerseDialog')
+ editVerseDialog.resize(474, 442)
+ editVerseDialog.setModal(True)
+ self.editVerseLayout = QtGui.QVBoxLayout(editVerseDialog)
+ self.editVerseLayout.setSpacing(8)
+ self.editVerseLayout.setMargin(8)
+ self.editVerseLayout.setObjectName(u'editVerseLayout')
+ self.verseTextEdit = QtGui.QPlainTextEdit(editVerseDialog)
+ self.verseTextEdit.setObjectName(u'verseTextEdit')
+ self.editVerseLayout.addWidget(self.verseTextEdit)
+ self.verseTypeLayout = QtGui.QHBoxLayout()
+ self.verseTypeLayout.setSpacing(8)
+ self.verseTypeLayout.setObjectName(u'verseTypeLayout')
+ self.verseTypeLabel = QtGui.QLabel(editVerseDialog)
+ self.verseTypeLabel.setObjectName(u'verseTypeLabel')
+ self.verseTypeLayout.addWidget(self.verseTypeLabel)
+ self.verseTypeComboBox = QtGui.QComboBox(editVerseDialog)
+ self.verseTypeComboBox.setObjectName(u'verseTypeComboBox')
+ self.verseTypeLabel.setBuddy(self.verseTypeComboBox)
+ self.verseTypeComboBox.addItem(u'')
+ self.verseTypeComboBox.addItem(u'')
+ self.verseTypeComboBox.addItem(u'')
+ self.verseTypeComboBox.addItem(u'')
+ self.verseTypeComboBox.addItem(u'')
+ self.verseTypeComboBox.addItem(u'')
+ self.verseTypeComboBox.addItem(u'')
+ self.verseTypeLayout.addWidget(self.verseTypeComboBox)
+ self.verseNumberBox = QtGui.QSpinBox(editVerseDialog)
+ self.verseNumberBox.setMinimum(1)
+ self.verseNumberBox.setObjectName(u'verseNumberBox')
+ self.verseTypeLayout.addWidget(self.verseNumberBox)
+ self.insertButton = QtGui.QPushButton(editVerseDialog)
+ self.insertButton.setIcon(build_icon(u':/general/general_add.png'))
+ self.insertButton.setObjectName(u'insertButton')
+ self.verseTypeLayout.addWidget(self.insertButton)
+ self.verseTypeSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.VerseTypeLayout.addItem(self.VerseTypeSpacer)
- self.EditVerseLayout.addLayout(self.VerseTypeLayout)
- self.EditButtonBox = QtGui.QDialogButtonBox(EditVerseDialog)
- self.EditButtonBox.setOrientation(QtCore.Qt.Horizontal)
- self.EditButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
+ self.verseTypeLayout.addItem(self.verseTypeSpacer)
+ self.editVerseLayout.addLayout(self.verseTypeLayout)
+ self.editButtonBox = QtGui.QDialogButtonBox(editVerseDialog)
+ self.editButtonBox.setOrientation(QtCore.Qt.Horizontal)
+ self.editButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save)
- self.EditButtonBox.setObjectName(u'EditButtonBox')
- self.EditVerseLayout.addWidget(self.EditButtonBox)
-
- self.retranslateUi(EditVerseDialog)
- QtCore.QObject.connect(self.EditButtonBox, QtCore.SIGNAL(u'accepted()'),
- EditVerseDialog.accept)
- QtCore.QObject.connect(self.EditButtonBox, QtCore.SIGNAL(u'rejected()'),
- EditVerseDialog.reject)
- QtCore.QMetaObject.connectSlotsByName(EditVerseDialog)
-
- def retranslateUi(self, EditVerseDialog):
- EditVerseDialog.setWindowTitle(
+ self.editButtonBox.setObjectName(u'editButtonBox')
+ self.editVerseLayout.addWidget(self.editButtonBox)
+
+ self.retranslateUi(editVerseDialog)
+ QtCore.QObject.connect(self.editButtonBox, QtCore.SIGNAL(u'accepted()'),
+ editVerseDialog.accept)
+ QtCore.QObject.connect(self.editButtonBox, QtCore.SIGNAL(u'rejected()'),
+ editVerseDialog.reject)
+ QtCore.QMetaObject.connectSlotsByName(editVerseDialog)
+
+ def retranslateUi(self, editVerseDialog):
+ editVerseDialog.setWindowTitle(
translate('SongsPlugin.EditVerseForm', 'Edit Verse'))
- self.VerseTypeLabel.setText(
+ self.verseTypeLabel.setText(
translate('SongsPlugin.EditVerseForm', '&Verse type:'))
- self.VerseTypeComboBox.setItemText(0,
+ self.verseTypeComboBox.setItemText(0,
VerseType.to_string(VerseType.Verse))
- self.VerseTypeComboBox.setItemText(1,
+ self.verseTypeComboBox.setItemText(1,
VerseType.to_string(VerseType.Chorus))
- self.VerseTypeComboBox.setItemText(2,
+ self.verseTypeComboBox.setItemText(2,
VerseType.to_string(VerseType.Bridge))
- self.VerseTypeComboBox.setItemText(3,
+ self.verseTypeComboBox.setItemText(3,
VerseType.to_string(VerseType.PreChorus))
- self.VerseTypeComboBox.setItemText(4,
+ self.verseTypeComboBox.setItemText(4,
VerseType.to_string(VerseType.Intro))
- self.VerseTypeComboBox.setItemText(5,
+ self.verseTypeComboBox.setItemText(5,
VerseType.to_string(VerseType.Ending))
- self.VerseTypeComboBox.setItemText(6,
+ self.verseTypeComboBox.setItemText(6,
VerseType.to_string(VerseType.Other))
- self.InsertButton.setText(
+ self.insertButton.setText(
translate('SongsPlugin.EditVerseForm', '&Insert'))
=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py 2010-07-27 09:32:52 +0000
+++ openlp/plugins/songs/forms/editverseform.py 2010-08-28 01:35:59 +0000
@@ -45,34 +45,29 @@
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
- QtCore.QObject.connect(
- self.InsertButton,
- QtCore.SIGNAL(u'clicked()'),
- self.onInsertButtonClicked
- )
- QtCore.QObject.connect(
- self.VerseTextEdit,
+ QtCore.QObject.connect(self.insertButton, QtCore.SIGNAL(u'clicked()'),
+ self.onInsertButtonClicked)
+ QtCore.QObject.connect(self.verseTextEdit,
QtCore.SIGNAL(u'cursorPositionChanged()'),
- self.onCursorPositionChanged
- )
+ self.onCursorPositionChanged)
self.verse_regex = re.compile(r'---\[([-\w]+):([\d]+)\]---')
def insertVerse(self, title, num=1):
- if self.VerseTextEdit.textCursor().columnNumber() != 0:
- self.VerseTextEdit.insertPlainText(u'\n')
- self.VerseTextEdit.insertPlainText(u'---[%s:%s]---\n' % (title, num))
- self.VerseTextEdit.setFocus()
+ if self.verseTextEdit.textCursor().columnNumber() != 0:
+ self.verseTextEdit.insertPlainText(u'\n')
+ self.verseTextEdit.insertPlainText(u'---[%s:%s]---\n' % (title, num))
+ self.verseTextEdit.setFocus()
def onInsertButtonClicked(self):
- if self.VerseTextEdit.textCursor().columnNumber() != 0:
- self.VerseTextEdit.insertPlainText(u'\n')
- verse_type = self.VerseTypeComboBox.currentIndex()
+ if self.verseTextEdit.textCursor().columnNumber() != 0:
+ self.verseTextEdit.insertPlainText(u'\n')
+ verse_type = self.verseTypeComboBox.currentIndex()
if verse_type == VerseType.Verse:
self.insertVerse(VerseType.to_string(VerseType.Verse),
- self.VerseNumberBox.value())
+ self.verseNumberBox.value())
elif verse_type == VerseType.Chorus:
self.insertVerse(VerseType.to_string(VerseType.Chorus),
- self.VerseNumberBox.value())
+ self.verseNumberBox.value())
elif verse_type == VerseType.Bridge:
self.insertVerse(VerseType.to_string(VerseType.Bridge))
elif verse_type == VerseType.PreChorus:
@@ -85,12 +80,12 @@
self.insertVerse(VerseType.to_string(VerseType.Other))
def onCursorPositionChanged(self):
- position = self.VerseTextEdit.textCursor().position()
- text = unicode(self.VerseTextEdit.toPlainText())
+ position = self.verseTextEdit.textCursor().position()
+ text = unicode(self.verseTextEdit.toPlainText())
if not text:
return
if text.rfind(u'[', 0, position) > text.rfind(u']', 0, position) and \
- text.find(u']', position) < text.find(u'[', position):
+ text.find(u']', position) < text.find(u'[', position):
return
position = text.rfind(u'---[', 0, position)
if position == -1:
@@ -106,8 +101,8 @@
verse_number = int(match.group(2))
verse_type_index = VerseType.from_string(verse_type)
if verse_type_index is not None:
- self.VerseTypeComboBox.setCurrentIndex(verse_type_index)
- self.VerseNumberBox.setValue(verse_number)
+ self.verseTypeComboBox.setCurrentIndex(verse_type_index)
+ self.verseNumberBox.setValue(verse_number)
def setVerse(self, text, single=False,
tag=u'%s:1' % VerseType.to_string(VerseType.Verse)):
@@ -115,26 +110,26 @@
verse_type, verse_number = tag.split(u':')
verse_type_index = VerseType.from_string(verse_type)
if verse_type_index is not None:
- self.VerseTypeComboBox.setCurrentIndex(verse_type_index)
- self.VerseNumberBox.setValue(int(verse_number))
- self.InsertButton.setVisible(False)
+ self.verseTypeComboBox.setCurrentIndex(verse_type_index)
+ self.verseNumberBox.setValue(int(verse_number))
+ self.insertButton.setVisible(False)
else:
if not text:
text = u'---[%s:1]---\n' % VerseType.to_string(VerseType.Verse)
- self.VerseTypeComboBox.setCurrentIndex(0)
- self.VerseNumberBox.setValue(1)
- self.InsertButton.setVisible(True)
- self.VerseTextEdit.setPlainText(text)
- self.VerseTextEdit.setFocus(QtCore.Qt.OtherFocusReason)
- self.VerseTextEdit.moveCursor(QtGui.QTextCursor.End)
+ self.verseTypeComboBox.setCurrentIndex(0)
+ self.verseNumberBox.setValue(1)
+ self.insertButton.setVisible(True)
+ self.verseTextEdit.setPlainText(text)
+ self.verseTextEdit.setFocus(QtCore.Qt.OtherFocusReason)
+ self.verseTextEdit.moveCursor(QtGui.QTextCursor.End)
def getVerse(self):
- return self.VerseTextEdit.toPlainText(), \
- VerseType.to_string(self.VerseTypeComboBox.currentIndex()), \
- unicode(self.VerseNumberBox.value())
+ return self.verseTextEdit.toPlainText(), \
+ VerseType.to_string(self.verseTypeComboBox.currentIndex()), \
+ unicode(self.verseNumberBox.value())
def getVerseAll(self):
- text = self.VerseTextEdit.toPlainText()
+ text = self.verseTextEdit.toPlainText()
if not text.startsWith(u'---['):
text = u'---[%s:1]---\n%s' % (VerseType.to_string(VerseType.Verse),
text)
=== modified file 'openlp/plugins/songs/forms/songimportwizard.py'
--- openlp/plugins/songs/forms/songimportwizard.py 2010-08-23 19:29:39 +0000
+++ openlp/plugins/songs/forms/songimportwizard.py 2010-08-28 01:35:59 +0000
@@ -215,25 +215,32 @@
self.wordsOfWorshipLayout.setSpacing(8)
self.wordsOfWorshipLayout.setMargin(0)
self.wordsOfWorshipLayout.setObjectName(u'wordsOfWorshipLayout')
- self.wordsOfWorshipFileListWidget = QtGui.QListWidget(self.wordsOfWorshipPage)
+ self.wordsOfWorshipFileListWidget = QtGui.QListWidget(
+ self.wordsOfWorshipPage)
self.wordsOfWorshipFileListWidget.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection)
- self.wordsOfWorshipFileListWidget.setObjectName(u'wordsOfWorshipFileListWidget')
+ self.wordsOfWorshipFileListWidget.setObjectName(
+ u'wordsOfWorshipFileListWidget')
self.wordsOfWorshipLayout.addWidget(self.wordsOfWorshipFileListWidget)
self.wordsOfWorshipButtonLayout = QtGui.QHBoxLayout()
self.wordsOfWorshipButtonLayout.setSpacing(8)
- self.wordsOfWorshipButtonLayout.setObjectName(u'wordsOfWorshipButtonLayout')
- self.wordsOfWorshipAddButton = QtGui.QPushButton(self.wordsOfWorshipPage)
+ self.wordsOfWorshipButtonLayout.setObjectName(
+ u'wordsOfWorshipButtonLayout')
+ self.wordsOfWorshipAddButton = QtGui.QPushButton(
+ self.wordsOfWorshipPage)
self.wordsOfWorshipAddButton.setIcon(openIcon)
self.wordsOfWorshipAddButton.setObjectName(u'wordsOfWorshipAddButton')
self.wordsOfWorshipButtonLayout.addWidget(self.wordsOfWorshipAddButton)
self.wordsOfWorshipButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.wordsOfWorshipButtonLayout.addItem(self.wordsOfWorshipButtonSpacer)
- self.wordsOfWorshipRemoveButton = QtGui.QPushButton(self.wordsOfWorshipPage)
+ self.wordsOfWorshipRemoveButton = QtGui.QPushButton(
+ self.wordsOfWorshipPage)
self.wordsOfWorshipRemoveButton.setIcon(deleteIcon)
- self.wordsOfWorshipRemoveButton.setObjectName(u'wordsOfWorshipRemoveButton')
- self.wordsOfWorshipButtonLayout.addWidget(self.wordsOfWorshipRemoveButton)
+ self.wordsOfWorshipRemoveButton.setObjectName(
+ u'wordsOfWorshipRemoveButton')
+ self.wordsOfWorshipButtonLayout.addWidget(
+ self.wordsOfWorshipRemoveButton)
self.wordsOfWorshipLayout.addLayout(self.wordsOfWorshipButtonLayout)
self.formatStackedWidget.addWidget(self.wordsOfWorshipPage)
# CCLI File import
@@ -267,30 +274,43 @@
# Songs of Fellowship
self.songsOfFellowshipPage = QtGui.QWidget()
self.songsOfFellowshipPage.setObjectName(u'songsOfFellowshipPage')
- self.songsOfFellowshipLayout = QtGui.QVBoxLayout(self.songsOfFellowshipPage)
+ self.songsOfFellowshipLayout = QtGui.QVBoxLayout(
+ self.songsOfFellowshipPage)
self.songsOfFellowshipLayout.setMargin(0)
self.songsOfFellowshipLayout.setSpacing(8)
self.songsOfFellowshipLayout.setObjectName(u'songsOfFellowshipLayout')
- self.songsOfFellowshipFileListWidget = QtGui.QListWidget(self.songsOfFellowshipPage)
+ self.songsOfFellowshipFileListWidget = QtGui.QListWidget(
+ self.songsOfFellowshipPage)
self.songsOfFellowshipFileListWidget.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection)
- self.songsOfFellowshipFileListWidget.setObjectName(u'songsOfFellowshipFileListWidget')
- self.songsOfFellowshipLayout.addWidget(self.songsOfFellowshipFileListWidget)
+ self.songsOfFellowshipFileListWidget.setObjectName(
+ u'songsOfFellowshipFileListWidget')
+ self.songsOfFellowshipLayout.addWidget(
+ self.songsOfFellowshipFileListWidget)
self.songsOfFellowshipButtonLayout = QtGui.QHBoxLayout()
self.songsOfFellowshipButtonLayout.setSpacing(8)
- self.songsOfFellowshipButtonLayout.setObjectName(u'songsOfFellowshipButtonLayout')
- self.songsOfFellowshipAddButton = QtGui.QPushButton(self.songsOfFellowshipPage)
+ self.songsOfFellowshipButtonLayout.setObjectName(
+ u'songsOfFellowshipButtonLayout')
+ self.songsOfFellowshipAddButton = QtGui.QPushButton(
+ self.songsOfFellowshipPage)
self.songsOfFellowshipAddButton.setIcon(openIcon)
- self.songsOfFellowshipAddButton.setObjectName(u'songsOfFellowshipAddButton')
- self.songsOfFellowshipButtonLayout.addWidget(self.songsOfFellowshipAddButton)
+ self.songsOfFellowshipAddButton.setObjectName(
+ u'songsOfFellowshipAddButton')
+ self.songsOfFellowshipButtonLayout.addWidget(
+ self.songsOfFellowshipAddButton)
self.songsOfFellowshipButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.songsOfFellowshipButtonLayout.addItem(self.songsOfFellowshipButtonSpacer)
- self.songsOfFellowshipRemoveButton = QtGui.QPushButton(self.songsOfFellowshipPage)
+ self.songsOfFellowshipButtonLayout.addItem(
+ self.songsOfFellowshipButtonSpacer)
+ self.songsOfFellowshipRemoveButton = QtGui.QPushButton(
+ self.songsOfFellowshipPage)
self.songsOfFellowshipRemoveButton.setIcon(deleteIcon)
- self.songsOfFellowshipRemoveButton.setObjectName(u'songsOfFellowshipRemoveButton')
- self.songsOfFellowshipButtonLayout.addWidget(self.songsOfFellowshipRemoveButton)
- self.songsOfFellowshipLayout.addLayout(self.songsOfFellowshipButtonLayout)
+ self.songsOfFellowshipRemoveButton.setObjectName(
+ u'songsOfFellowshipRemoveButton')
+ self.songsOfFellowshipButtonLayout.addWidget(
+ self.songsOfFellowshipRemoveButton)
+ self.songsOfFellowshipLayout.addLayout(
+ self.songsOfFellowshipButtonLayout)
self.formatStackedWidget.addWidget(self.songsOfFellowshipPage)
# Generic Document/Presentation import
self.genericPage = QtGui.QWidget()
=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py 2010-08-26 00:37:25 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py 2010-08-28 01:35:59 +0000
@@ -42,6 +42,8 @@
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
+ self.songFormLaunch = False
+ self.commitOnSave = True
self.songmanager = songmanager
self.authorform = AuthorsForm(self)
self.topicform = TopicsForm(self)
@@ -70,6 +72,11 @@
self.resetAuthors()
self.resetTopics()
self.resetBooks()
+ if self.songFormLaunch:
+ self.commitOnSave = False
+ self.songFormLaunch = False
+ else:
+ self.commitOnSave = True
self.TypeListWidget.setFocus()
return QtGui.QDialog.exec_(self)
@@ -227,7 +234,7 @@
last_name=unicode(self.authorform.LastNameEdit.text()),
display_name=unicode(self.authorform.DisplayEdit.text()))
if self.checkAuthor(author):
- if self.songmanager.save_object(author):
+ if self.songmanager.save_object(author, self.commitOnSave):
self.resetAuthors()
else:
QtGui.QMessageBox.critical(self,
@@ -244,7 +251,7 @@
if self.topicform.exec_():
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text()))
if self.checkTopic(topic):
- if self.songmanager.save_object(topic):
+ if self.songmanager.save_object(topic, self.commitOnSave):
self.resetTopics()
else:
QtGui.QMessageBox.critical(self,
@@ -262,7 +269,7 @@
book = Book.populate(name=unicode(self.bookform.NameEdit.text()),
publisher=unicode(self.bookform.PublisherEdit.text()))
if self.checkBook(book):
- if self.songmanager.save_object(book):
+ if self.songmanager.save_object(book, self.commitOnSave):
self.resetBooks()
else:
QtGui.QMessageBox.critical(self,
@@ -295,7 +302,7 @@
author.display_name = unicode(
self.authorform.DisplayEdit.text())
if self.checkAuthor(author, True):
- if self.songmanager.save_object(author):
+ if self.songmanager.save_object(author, self.commitOnSave):
self.resetAuthors()
Receiver.send_message(u'songs_load_list')
else:
@@ -337,7 +344,7 @@
if self.topicform.exec_(False):
topic.name = unicode(self.topicform.NameEdit.text())
if self.checkTopic(topic, True):
- if self.songmanager.save_object(topic):
+ if self.songmanager.save_object(topic, self.commitOnSave):
self.resetTopics()
else:
QtGui.QMessageBox.critical(self,
@@ -380,7 +387,7 @@
book.name = unicode(self.bookform.NameEdit.text())
book.publisher = unicode(self.bookform.PublisherEdit.text())
if self.checkBook(book, True):
- if self.songmanager.save_object(book):
+ if self.songmanager.save_object(book, self.commitOnSave):
self.resetBooks()
else:
QtGui.QMessageBox.critical(self,
@@ -404,12 +411,12 @@
book.publisher = temp_publisher
def mergeAuthors(self, old_author):
- '''
+ """
Merges two authors into one author.
``old_author``
The author which will be deleted afterwards.
- '''
+ """
existing_author = self.songmanager.get_object_filtered(Author,
and_(Author.first_name == old_author.first_name,
Author.last_name == old_author.last_name,
@@ -422,16 +429,16 @@
if existing_author not in song.authors:
song.authors.append(existing_author)
song.authors.remove(old_author)
- self.songmanager.save_object(song)
+ self.songmanager.save_object(song, self.commitOnSave)
self.songmanager.delete_object(Author, old_author.id)
def mergeTopics(self, old_topic):
- '''
+ """
Merges two topics into one topic.
``old_topic``
The topic which will be deleted afterwards.
- '''
+ """
existing_topic = self.songmanager.get_object_filtered(Topic,
Topic.name == old_topic.name)
songs = self.songmanager.get_all_objects(Song,
@@ -442,16 +449,16 @@
if existing_topic not in song.topics:
song.topics.append(existing_topic)
song.topics.remove(old_topic)
- self.songmanager.save_object(song)
+ self.songmanager.save_object(song, self.commitOnSave)
self.songmanager.delete_object(Topic, old_topic.id)
def mergeBooks(self, old_book):
- '''
+ """
Merges two books into one book.
``old_book``
The book which will be deleted afterwards.
- '''
+ """
existing_book = self.songmanager.get_object_filtered(Book,
and_(Book.name == old_book.name,
Book.publisher == old_book.publisher))
@@ -459,7 +466,7 @@
Song.song_book_id == old_book.id)
for song in songs:
song.song_book_id = existing_book.id
- self.songmanager.save_object(song)
+ self.songmanager.save_object(song, self.commitOnSave)
self.songmanager.delete_object(Book, old_book.id)
def onAuthorDeleteButtonClick(self):
Follow ups