openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #03083
[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/34008
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py 2010-08-27 23:19:50 +0000
+++ openlp/core/lib/htmlbuilder.py 2010-08-28 23:55:56 +0000
@@ -343,10 +343,10 @@
shadow = u'display: none;'
if theme:
lyricscommon = u'width: %spx; height: %spx; word-wrap: break-word; ' \
- u'font-family: %s; font-size: %spx; color: %s; line-height: %d%%;' % \
- (item.main.width(), item.main.height(),
- theme.font_main_name, theme.font_main_proportion,
- theme.font_main_color, 100 + int(theme.font_main_line_adjustment))
+ u'font-family: %s; font-size: %spx; color: %s; line-height: %d%%;' \
+ % (item.main.width(), item.main.height(), theme.font_main_name,
+ theme.font_main_proportion, theme.font_main_color,
+ 100 + int(theme.font_main_line_adjustment))
lyricstable = u'left: %spx; top: %spx;' % \
(item.main.x(), item.main.y())
outlinetable = u'left: %spx; top: %spx;' % \
@@ -375,7 +375,7 @@
theme.display_outline_color)
if theme.display_shadow:
shadow = u'-webkit-text-stroke: %sem %s; ' \
- u'-webkit-text-fill-color: %s; '% \
+ u'-webkit-text-fill-color: %s; ' % \
(float(theme.display_outline_size) / 16,
theme.display_shadow_color, theme.display_shadow_color)
else:
=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py 2010-08-27 18:28:19 +0000
+++ openlp/core/lib/rendermanager.py 2010-08-28 23:55:56 +0000
@@ -200,7 +200,7 @@
serviceItem.raw_footer = footer
serviceItem.render(True)
self.display.buildHtml(serviceItem)
- frame, raw_html = serviceItem.get_rendered_frame(0)
+ raw_html = serviceItem.get_rendered_frame(0)[1]
preview = self.display.text(raw_html)
# Reset the real screen size for subsequent render requests
self.calculate_default(self.screens.current[u'size'])
=== 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 23:55:56 +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.
@@ -54,18 +53,17 @@
if event.button() == QtCore.Qt.RightButton:
# Rewrite the mouse event to a left button event so the cursor is
# moved to the location of the pointer.
- event = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonPress, event.pos(),
- QtCore.Qt.LeftButton, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier)
+ event = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonPress,
+ event.pos(), QtCore.Qt.LeftButton, QtCore.Qt.LeftButton,
+ QtCore.Qt.NoModifier)
QtGui.QPlainTextEdit.mousePressEvent(self, event)
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 +92,9 @@
popup_menu.exec_(event.globalPos())
def correctWord(self, word):
- '''
+ """
Replaces the selected text with word.
- '''
+ """
cursor = self.textCursor()
cursor.beginEditBlock()
@@ -106,9 +104,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 +151,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/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2010-08-27 16:10:15 +0000
+++ openlp/core/ui/mainwindow.py 2010-08-28 23:55:56 +0000
@@ -94,8 +94,10 @@
self.ControlSplitter.setObjectName(u'ControlSplitter')
self.MainContentLayout.addWidget(self.ControlSplitter)
# Create slide controllers
- self.PreviewController = SlideController(self, self.settingsmanager, self.screens)
- self.LiveController = SlideController(self, self.settingsmanager, self.screens, True)
+ self.PreviewController = SlideController(self, self.settingsmanager,
+ self.screens)
+ self.LiveController = SlideController(self, self.settingsmanager,
+ self.screens, True)
# Create menu
self.MenuBar = QtGui.QMenuBar(MainWindow)
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2010-08-28 15:49:51 +0000
+++ openlp/core/ui/slidecontroller.py 2010-08-28 23:55:56 +0000
@@ -117,7 +117,8 @@
self.split = 1
self.typePrefix = u'live'
else:
- self.TypeLabel.setText(translate('OpenLP.SlideController', 'Preview'))
+ self.TypeLabel.setText(translate('OpenLP.SlideController',
+ 'Preview'))
self.split = 0
self.typePrefix = u'preview'
self.TypeLabel.setStyleSheet(u'font-weight: bold; font-size: 12pt;')
@@ -199,7 +200,8 @@
QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
if self.screens.display_count > 1:
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
- u':/slides/slide_desktop.png'), u'Show Desktop', self.HideMenu)
+ u':/slides/slide_desktop.png'), u'Show Desktop',
+ self.HideMenu)
self.DesktopScreen.setCheckable(True)
QtCore.QObject.connect(self.DesktopScreen,
QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)
@@ -212,7 +214,8 @@
self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton(
u'Go Live', u':/general/general_live.png',
- translate('OpenLP.SlideController', 'Move to live'), self.onGoLive)
+ translate('OpenLP.SlideController', 'Move to live'),
+ self.onGoLive)
self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton(
u'Edit Song', u':/general/general_edit.png',
@@ -233,7 +236,8 @@
self.DelaySpinBox.setMaximum(180)
self.Toolbar.addToolbarWidget(
u'Image SpinBox', self.DelaySpinBox)
- self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController', 's'))
+ self.DelaySpinBox.setSuffix(translate('OpenLP.SlideController',
+ 's'))
self.DelaySpinBox.setToolTip(translate('OpenLP.SlideController',
'Delay between slides in seconds'))
self.ControllerLayout.addWidget(self.Toolbar)
@@ -274,11 +278,13 @@
# Build the Song Toolbar
if isLive:
self.SongMenu = QtGui.QToolButton(self.Toolbar)
- self.SongMenu.setText(translate('OpenLP.SlideController', 'Go to Verse'))
+ self.SongMenu.setText(translate('OpenLP.SlideController',
+ 'Go to Verse'))
self.SongMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
self.Toolbar.addToolbarWidget(u'Song Menu', self.SongMenu)
self.SongMenu.setMenu(QtGui.QMenu(
- translate('OpenLP.SlideController', 'Go to Verse'), self.Toolbar))
+ translate('OpenLP.SlideController', 'Go to Verse'),
+ self.Toolbar))
self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
# Screen preview area
self.PreviewFrame = QtGui.QFrame(self.Splitter)
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2010-08-26 15:50:11 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2010-08-28 23:55:56 +0000
@@ -465,9 +465,9 @@
self.displayResults(bible, dual_bible)
def generateSlideData(self, service_item, item=None):
- '''
+ """
Generates and formats the slides for the service item.
- '''
+ """
log.debug(u'generating slide data')
items = self.listView.selectedIndexes()
if len(items) == 0:
@@ -551,7 +551,8 @@
if isinstance(reference, QtCore.QVariant):
reference = reference.toPyObject()
bible_new = self._decodeQtObject(reference, 'bible')
- dual_bible_new = self._decodeQtObject(reference, 'dual_bible')
+ dual_bible_new = self._decodeQtObject(reference,
+ 'dual_bible')
if dual_bible_new:
raw_slides.append(bible_text)
bible_text = u''
@@ -639,10 +640,10 @@
combo.addItem(unicode(i))
def displayResults(self, bible, dual_bible=None):
- '''
- Displays the search results in the media manager. All data needed for further
- action is saved for/in each row.
- '''
+ """
+ Displays the search results in the media manager. All data needed for
+ further action is saved for/in each row.
+ """
version = self.parent.manager.get_meta_data(bible, u'Version')
copyright = self.parent.manager.get_meta_data(bible, u'Copyright')
#permission = self.parent.manager.get_meta_data(bible, u'Permissions')
=== 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 23:55:56 +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 23:55:56 +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 23:55:56 +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 23:55:56 +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 23:55:56 +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 23:55:56 +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 23:55:56 +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