openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #03073
[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 as subform (Bug #612282)
Cleanup long lines, docstring chars and some more variable naming
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/34005
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py 2010-08-24 17:53:41 +0000
+++ openlp/core/ui/__init__.py 2010-08-28 20:02:40 +0000
@@ -41,7 +41,6 @@
from openlp.core.lib import html_expands, translate, context_menu_action
class SpellTextEdit(QtGui.QPlainTextEdit):
-
def __init__(self, *args):
QtGui.QPlainTextEdit.__init__(self, *args)
# Default dictionary based on the current locale.
@@ -60,12 +59,10 @@
def contextMenuEvent(self, event):
popup_menu = self.createStandardContextMenu()
-
# Select the word under the cursor.
cursor = self.textCursor()
cursor.select(QtGui.QTextCursor.WordUnderCursor)
self.setTextCursor(cursor)
-
# Check if the selected word is misspelled and offer spelling
# suggestions if it is.
if enchant_available and self.textCursor().hasSelection():
@@ -94,9 +91,9 @@
popup_menu.exec_(event.globalPos())
def correctWord(self, word):
- '''
+ """
Replaces the selected text with word.
- '''
+ """
cursor = self.textCursor()
cursor.beginEditBlock()
@@ -106,9 +103,9 @@
cursor.endEditBlock()
def htmlTag(self, tag):
- '''
+ """
Replaces the selected text with word.
- '''
+ """
for html in html_expands:
if tag == html[u'desc']:
cursor = self.textCursor()
@@ -153,9 +150,9 @@
word_object.end() - word_object.start(), format)
class SpellAction(QtGui.QAction):
- '''
+ """
A special QAction that returns the text in a signal.
- '''
+ """
correct = QtCore.pyqtSignal(unicode)
def __init__(self, *args):
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2010-07-27 09:32:52 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2010-08-28 20:02:40 +0000
@@ -263,8 +263,8 @@
self.SongbookLayout.setSpacing(8)
self.SongbookLayout.setObjectName(u'SongbookLayout')
self.SongbookCombo = QtGui.QComboBox(self.SongBookGroup)
- sizePolicy = QtGui.QSizePolicy(
- QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
+ QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
@@ -273,6 +273,12 @@
self.SongbookCombo.setSizePolicy(sizePolicy)
self.SongbookCombo.setObjectName(u'SongbookCombo')
self.SongbookLayout.addWidget(self.SongbookCombo, 0, 0, 1, 1)
+ self.songBookNumberLabel = QtGui.QLabel(self.SongBookGroup)
+ self.SongbookLayout.addWidget(self.songBookNumberLabel, 0, 1, 1, 1)
+ self.songBookNumberEdit = QtGui.QLineEdit(self.SongBookGroup)
+ self.songBookNumberLabel.setBuddy(self.songBookNumberEdit)
+ self.songBookNumberEdit.setMaximumWidth(35)
+ self.SongbookLayout.addWidget(self.songBookNumberEdit, 0, 2, 1, 1)
self.TopicBookLayout.addWidget(self.SongBookGroup)
self.AuthorsTabLayout.addWidget(self.TopicBookWidget)
self.SongTabWidget.addTab(self.AuthorsTab, u'')
@@ -440,6 +446,8 @@
translate('SongsPlugin.EditSongForm', 'R&emove'))
self.SongBookGroup.setTitle(
translate('SongsPlugin.EditSongForm', 'Song Book'))
+ self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm',
+ 'Song No.:'))
self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.AuthorsTab),
translate('SongsPlugin.EditSongForm',
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2010-08-21 19:35:32 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2010-08-28 20:02:40 +0000
@@ -49,6 +49,7 @@
"""
QtGui.QDialog.__init__(self, parent)
self.parent = parent
+ self.song = None
# can this be automated?
self.width = 400
self.setupUi(self)
@@ -83,10 +84,6 @@
QtCore.QObject.connect(self.VerseListWidget,
QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'),
self.onVerseListViewPressed)
- QtCore.QObject.connect(self.SongbookCombo,
- QtCore.SIGNAL(u'activated(int)'), self.onSongBookComboChanged)
- QtCore.QObject.connect(self.ThemeSelectionComboItem,
- QtCore.SIGNAL(u'activated(int)'), self.onThemeComboChanged)
QtCore.QObject.connect(self.ThemeAddButton,
QtCore.SIGNAL(u'clicked()'),
self.parent.parent.renderManager.theme_manager.onAddTheme)
@@ -157,7 +154,6 @@
def newSong(self):
log.debug(u'New Song')
self.SongTabWidget.setCurrentIndex(0)
- self.song = Song()
self.TitleEditItem.setText(u'')
self.AlternativeEdit.setText(u'')
self.CopyrightEditItem.setText(u'')
@@ -298,8 +294,7 @@
else:
author = Author.populate(first_name=text.rsplit(u' ', 1)[0],
last_name=text.rsplit(u' ', 1)[1], display_name=text)
- self.songmanager.save_object(author, False)
- self.song.authors.append(author)
+ self.songmanager.save_object(author)
author_item = QtGui.QListWidgetItem(
unicode(author.display_name))
author_item.setData(QtCore.Qt.UserRole,
@@ -312,13 +307,13 @@
elif item > 0:
item_id = (self.AuthorsSelectionComboItem.itemData(item)).toInt()[0]
author = self.songmanager.get_object(Author, item_id)
- if author in self.song.authors:
+ if self.AuthorsListView.findItems(unicode(author.display_name),
+ QtCore.Qt.MatchExactly):
QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm', 'This author is '
'already in the list.'))
else:
- self.song.authors.append(author)
author_item = QtGui.QListWidgetItem(unicode(
author.display_name))
author_item.setData(QtCore.Qt.UserRole,
@@ -340,9 +335,6 @@
def onAuthorRemoveButtonClicked(self):
self.AuthorRemoveButton.setEnabled(False)
item = self.AuthorsListView.currentItem()
- author_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
- author = self.songmanager.get_object(Author, author_id)
- self.song.authors.remove(author)
row = self.AuthorsListView.row(item)
self.AuthorsListView.takeItem(row)
@@ -357,8 +349,7 @@
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
topic = Topic.populate(name=text)
- self.songmanager.save_object(topic, False)
- self.song.topics.append(topic)
+ self.songmanager.save_object(topic)
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(topic.id))
@@ -370,13 +361,13 @@
elif item > 0:
item_id = (self.SongTopicCombo.itemData(item)).toInt()[0]
topic = self.songmanager.get_object(Topic, item_id)
- if topic in self.song.topics:
+ if self.TopicsListView.findItems(unicode(topic.name),
+ QtCore.Qt.MatchExactly):
QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm', 'This topic is '
'already in the list.'))
else:
- self.song.topics.append(topic)
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(topic.id))
@@ -396,27 +387,9 @@
def onTopicRemoveButtonClicked(self):
self.TopicRemoveButton.setEnabled(False)
item = self.TopicsListView.currentItem()
- topic_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
- topic = self.songmanager.get_object(Topic, topic_id)
- self.song.topics.remove(topic)
row = self.TopicsListView.row(item)
self.TopicsListView.takeItem(row)
- def onSongBookComboChanged(self, item):
- if item >= 1:
- self.song.song_book_id = \
- (self.SongbookCombo.itemData(item)).toInt()[0]
- else:
- self.song.song_book_id = 0
-
- def onThemeComboChanged(self, item):
- if item == 0:
- # None means no Theme
- self.song.theme_name = None
- else:
- them_name = unicode(self.ThemeSelectionComboItem.itemText(item))
- self.song.theme_name = them_name
-
def onVerseListViewPressed(self):
self.VerseEditButton.setEnabled(True)
self.VerseDeleteButton.setEnabled(True)
@@ -602,10 +575,17 @@
self.CopyrightEditItem.setCursorPosition(pos + 1)
def onMaintenanceButtonClicked(self):
+ temp_song_book = None
+ item = int(self.SongbookCombo.currentIndex())
+ text = unicode(self.SongbookCombo.currentText())
+ if item == 0 and text:
+ temp_song_book = text
self.parent.song_maintenance_form.exec_()
self.loadAuthors()
self.loadBooks()
self.loadTopics()
+ if temp_song_book:
+ self.SongbookCombo.setEditText(temp_song_book)
def onPreview(self, button):
"""
@@ -622,6 +602,8 @@
def accept(self):
log.debug(u'accept')
+ if not self.song:
+ self.song = Song()
item = int(self.SongbookCombo.currentIndex())
text = unicode(self.SongbookCombo.currentText())
if item == 0 and text:
@@ -634,7 +616,6 @@
book = Book.populate(name=text, publisher=u'')
self.songmanager.save_object(book)
self.song.book = book
- self.loadBooks()
else:
return
if self.saveSong():
@@ -650,9 +631,22 @@
self.song.comments = unicode(self.CommentsEdit.toPlainText())
self.song.verse_order = unicode(self.VerseOrderEdit.text())
self.song.ccli_number = unicode(self.CCLNumberEdit.text())
+ self.song.song_number = unicode(self.songBookNumberEdit.text())
if self._validate_song():
self.processLyrics()
self.processTitle()
+ self.song.authors = []
+ for row in range(self.AuthorsListView.count()):
+ item = self.AuthorsListView.item(row)
+ authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.song.authors.append(self.songmanager.get_object(Author,
+ authorId))
+ self.song.topics = []
+ for row in range(self.TopicsListView.count()):
+ item = self.TopicsListView.item(row)
+ topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ self.song.topics.append(self.songmanager.get_object(Topic,
+ topicId))
self.songmanager.save_object(self.song)
return True
return False
@@ -684,5 +678,5 @@
def processTitle(self):
log.debug(u'processTitle')
- self.song.search_title = \
- re.sub(r'[\'"`,;:(){}?]+', u'', unicode(self.song.search_title))
+ self.song.search_title = re.sub(r'[\'"`,;:(){}?]+', u'',
+ unicode(self.song.search_title))
=== modified file 'openlp/plugins/songs/forms/editversedialog.py'
--- openlp/plugins/songs/forms/editversedialog.py 2010-08-22 07:05:05 +0000
+++ openlp/plugins/songs/forms/editversedialog.py 2010-08-28 20:02:40 +0000
@@ -31,77 +31,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 = SpellTextEdit(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 = SpellTextEdit(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-08-22 07:05:05 +0000
+++ openlp/plugins/songs/forms/editverseform.py 2010-08-28 20:02:40 +0000
@@ -45,19 +45,14 @@
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
- QtCore.QObject.connect(self.VerseTextEdit,
+ QtCore.QObject.connect(self.verseTextEdit,
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
self.contextMenu)
- 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 contextMenu(self, point):
@@ -65,21 +60,21 @@
print item
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:
@@ -92,12 +87,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:
@@ -113,8 +108,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)):
@@ -122,26 +117,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 20:02:40 +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 20:02:40 +0000
@@ -404,12 +404,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,
@@ -426,12 +426,12 @@
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,
@@ -446,12 +446,12 @@
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))
=== modified file 'openlp/plugins/songs/lib/db.py'
--- openlp/plugins/songs/lib/db.py 2010-07-27 09:32:52 +0000
+++ openlp/plugins/songs/lib/db.py 2010-08-28 20:02:40 +0000
@@ -72,7 +72,7 @@
``url``
The database to setup
"""
- session, metadata = init_db(url, auto_flush=False)
+ session, metadata = init_db(url)
# Definition of the "authors" table
authors_table = Table(u'authors', metadata,
Follow ups