openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00105
[Merge] lp:~trb143/openlp/songs into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/songs into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Phase 1 of Operation Song plugin complete
Cleaned up pluging and removed str and replaced with unicode
New songs can be created
Songs can be changed and saved
Songs can now have themes, authors, songbooks and Topics
Songs now render correctly.
Replace the song database due to conversion error leaving old fields behind.
Nb
ServiceManager fixed for doubleclick to live.
(More to do...)
--
https://code.launchpad.net/~trb143/openlp/songs/+merge/7418
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/event.py'
--- openlp/core/lib/event.py 2009-05-20 20:17:20 +0000
+++ openlp/core/lib/event.py 2009-06-14 07:25:39 +0000
@@ -24,28 +24,17 @@
Types of events are stored in this class.
"""
# "Default" event - a non-event
- Default = 0
+ Default = 0
# General application events
- InitApplication = -1
- ShowApplication = -2
- BeforeAppClose = -3
- ApplicationClose = -4
# Service events
- BeforeLoadService = 1
- AfterLoadService = 2
- BeforeSaveService = 3
- AfterSaveService = 4
- LoadServiceItem = 5
+ LoadServiceItem = 20
# Preview events
- PreviewShow = 10
- LiveShow = 11
- #PreviewBeforeLoad = 11
- #PreviewAfterLoad = 12
- #PreviewBeforeShow = 13
- #PreviewAfterShow = 14
-
-#Theme Related Events
- ThemeListChanged = 15
+ PreviewShow = 30
+ LiveShow = 31
+ #Theme Related Events
+ ThemeListChanged = 40
+ #Plugin Related Events
+ LoadSongList = 50
class Event(object):
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2009-05-20 20:17:20 +0000
+++ openlp/core/lib/plugin.py 2009-06-11 05:13:10 +0000
@@ -94,6 +94,7 @@
self.event_manager = plugin_helpers[u'event']
self.render_manager = plugin_helpers[u'render']
self.service_manager = plugin_helpers[u'service']
+ self.settings= plugin_helpers[u'settings']
def check_pre_conditions(self):
"""
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2009-06-05 18:53:50 +0000
+++ openlp/core/ui/generaltab.py 2009-06-11 21:14:12 +0000
@@ -165,7 +165,7 @@
def load(self):
for screen in self.screen_list:
screen_name = translate(u'GeneralTab', u'Screen') + u' ' + \
- str(screen[u'number'] + 1)
+ unicode(screen[u'number'] + 1)
if screen[u'primary']:
screen_name = screen_name + u' (' + \
translate(u'GeneralTab', u'primary') + u')'
@@ -174,9 +174,9 @@
self.MonitorNumber = int(self.config.get_config(u'Monitor', u'0'))
self.Warning = str_to_bool(self.config.get_config(u'Warning', u'False'))
self.AutoOpen = str_to_bool(self.config.get_config(u'Auto Open', u'False'))
- self.CCLNumber = str(self.config.get_config(u'CCL Number', u'XXX'))
- self.Username = str(self.config.get_config(u'User Name', u''))
- self.Password = str(self.config.get_config(u'Password', u''))
+ self.CCLNumber = unicode(self.config.get_config(u'CCL Number', u'XXX'))
+ self.Username = unicode(self.config.get_config(u'User Name', u''))
+ self.Password = unicode(self.config.get_config(u'Password', u''))
# Set a few things up
self.MonitorComboBox.setCurrentIndex(self.MonitorNumber)
self.WarningCheckBox.setChecked(self.Warning)
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2009-06-08 19:11:55 +0000
+++ openlp/core/ui/mainwindow.py 2009-06-11 05:13:10 +0000
@@ -70,6 +70,7 @@
self.plugin_helpers[u'theme'] = self.ThemeManagerContents
self.plugin_helpers[u'render'] = self.RenderManager
self.plugin_helpers[u'service'] = self.ServiceManagerContents
+ self.plugin_helpers[u'settings'] = self.settingsForm
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers,
self.EventManager)
# hook methods have to happen after find_plugins. Find plugins needs the
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-06-10 15:54:46 +0000
+++ openlp/core/ui/servicemanager.py 2009-06-13 06:46:13 +0000
@@ -103,6 +103,8 @@
# Connect up our signals and slots
QtCore.QObject.connect(self.ThemeComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onThemeComboBoxSelected)
+ QtCore.QObject.connect(self.ServiceManagerList,
+ QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.makeLive)
# Last little bits of setting up
self.config = PluginConfig(u'Main')
self.service_theme = self.config.get_config(u'theme service theme', u'')
=== modified file 'openlp/plugins/songs/forms/authorsform.py'
--- openlp/plugins/songs/forms/authorsform.py 2009-06-05 05:00:26 +0000
+++ openlp/plugins/songs/forms/authorsform.py 2009-06-10 17:12:03 +0000
@@ -17,7 +17,7 @@
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from PyQt4 import QtGui, QtCore
-
+from openlp.core.lib import translate
from openlp.plugins.songs.forms.authorsdialog import Ui_AuthorsDialog
from openlp.plugins.songs.lib import TextListData
@@ -36,13 +36,13 @@
self.author = None
QtCore.QObject.connect(self.DeleteButton,
- QtCore.SIGNAL('pressed()'), self.onDeleteButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonClick)
QtCore.QObject.connect(self.ClearButton,
- QtCore.SIGNAL('pressed()'), self.onClearButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onClearButtonClick)
QtCore.QObject.connect(self.AddUpdateButton,
- QtCore.SIGNAL('pressed()'), self.onAddUpdateButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onAddUpdateButtonClick)
QtCore.QObject.connect(self.DisplayEdit,
- QtCore.SIGNAL('lostFocus()'), self.onDisplayEditLostFocus)
+ QtCore.SIGNAL(u'lostFocus()'), self.onDisplayEditLostFocus)
QtCore.QObject.connect(self.AuthorListView,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onAuthorListViewItemClicked)
@@ -114,10 +114,10 @@
self.FirstNameEdit.setText(self.author.first_name)
self.LastNameEdit.setText(self.author.last_name)
if len(self.author.songs) > 0:
- self.MessageLabel.setText("Author in use 'Delete' is disabled")
+ self.MessageLabel.setText(translate(u'AuthorForm', u'Author in use "Delete" is disabled'))
self.DeleteButton.setEnabled(False)
else:
- self.MessageLabel.setText("Author is not used")
+ self.MessageLabel.setText(translate(u'AuthorForm', u'Author in not used'))
self.DeleteButton.setEnabled(True)
self._validate_form()
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2009-06-04 19:00:41 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2009-06-14 06:30:09 +0000
@@ -1,40 +1,33 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file '/home/raoul/Projects/openlp-2/resources/forms/editsongdialog.ui'
-#
-# Created: Thu Feb 19 23:35:35 2009
-# by: PyQt4 UI code generator 4.4.4
-#
-# WARNING! All changes made in this file will be lost!
-
+
+from openlp.core.lib import translate
from PyQt4 import QtCore, QtGui
class Ui_EditSongDialog(object):
def setupUi(self, EditSongDialog):
- EditSongDialog.setObjectName("EditSongDialog")
+ EditSongDialog.setObjectName(u'EditSongDialog')
EditSongDialog.resize(786, 704)
icon = QtGui.QIcon()
- icon.addPixmap(QtGui.QPixmap(":/icon/openlp-logo-16x16.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
+ icon.addPixmap(QtGui.QPixmap(u':/icon/openlp-logo-16x16.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
EditSongDialog.setWindowIcon(icon)
EditSongDialog.setModal(True)
self.EditSongLayout = QtGui.QVBoxLayout(EditSongDialog)
self.EditSongLayout.setSpacing(8)
self.EditSongLayout.setMargin(8)
- self.EditSongLayout.setObjectName("EditSongLayout")
+ self.EditSongLayout.setObjectName(u'EditSongLayout')
self.TopWidget = QtGui.QWidget(EditSongDialog)
- self.TopWidget.setObjectName("TopWidget")
+ self.TopWidget.setObjectName(u'TopWidget')
self.TopLayout = QtGui.QHBoxLayout(self.TopWidget)
self.TopLayout.setSpacing(8)
self.TopLayout.setMargin(0)
- self.TopLayout.setObjectName("TopLayout")
+ self.TopLayout.setObjectName(u'TopLayout')
self.TextWidget = QtGui.QWidget(self.TopWidget)
- self.TextWidget.setObjectName("TextWidget")
+ self.TextWidget.setObjectName(u'TextWidget')
self.DetailsLayout = QtGui.QVBoxLayout(self.TextWidget)
self.DetailsLayout.setSpacing(8)
self.DetailsLayout.setMargin(0)
- self.DetailsLayout.setObjectName("DetailsLayout")
+ self.DetailsLayout.setObjectName(u'DetailsLayout')
self.TitleLabel = QtGui.QLabel(self.TextWidget)
- self.TitleLabel.setObjectName("TitleLabel")
+ self.TitleLabel.setObjectName(u'TitleLabel')
self.DetailsLayout.addWidget(self.TitleLabel)
self.TitleEditItem = QtGui.QLineEdit(self.TextWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
@@ -42,54 +35,54 @@
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.TitleEditItem.sizePolicy().hasHeightForWidth())
self.TitleEditItem.setSizePolicy(sizePolicy)
- self.TitleEditItem.setObjectName("TitleEditItem")
+ self.TitleEditItem.setObjectName(u'TitleEditItem')
self.DetailsLayout.addWidget(self.TitleEditItem)
self.AlternativeTitleLabel = QtGui.QLabel(self.TextWidget)
- self.AlternativeTitleLabel.setObjectName("AlternativeTitleLabel")
+ self.AlternativeTitleLabel.setObjectName(u'AlternativeTitleLabel')
self.DetailsLayout.addWidget(self.AlternativeTitleLabel)
self.AlternativeEdit = QtGui.QLineEdit(self.TextWidget)
- self.AlternativeEdit.setObjectName("AlternativeEdit")
+ self.AlternativeEdit.setObjectName(u'AlternativeEdit')
self.DetailsLayout.addWidget(self.AlternativeEdit)
self.LyricsLabel = QtGui.QLabel(self.TextWidget)
- self.LyricsLabel.setObjectName("LyricsLabel")
+ self.LyricsLabel.setObjectName(u'LyricsLabel')
self.DetailsLayout.addWidget(self.LyricsLabel)
self.VerseEditWidget = QtGui.QWidget(self.TextWidget)
- self.VerseEditWidget.setObjectName("VerseEditWidget")
+ self.VerseEditWidget.setObjectName(u'VerseEditWidget')
self.VerseEditLayout = QtGui.QVBoxLayout(self.VerseEditWidget)
self.VerseEditLayout.setSpacing(8)
self.VerseEditLayout.setMargin(0)
- self.VerseEditLayout.setObjectName("VerseEditLayout")
+ self.VerseEditLayout.setObjectName(u'VerseEditLayout')
self.VerseListWidget = QtGui.QListWidget(self.VerseEditWidget)
- self.VerseListWidget.setObjectName("VerseListWidget")
+ self.VerseListWidget.setObjectName(u'VerseListWidget')
self.VerseListWidget.setAlternatingRowColors(True)
self.VerseEditLayout.addWidget(self.VerseListWidget)
self.VerseButtonWidget = QtGui.QWidget(self.VerseEditWidget)
- self.VerseButtonWidget.setObjectName("VerseButtonWidget")
+ self.VerseButtonWidget.setObjectName(u'VerseButtonWidget')
self.VerseButtonLayout = QtGui.QHBoxLayout(self.VerseButtonWidget)
self.VerseButtonLayout.setSpacing(8)
self.VerseButtonLayout.setMargin(0)
- self.VerseButtonLayout.setObjectName("VerseButtonLayout")
+ self.VerseButtonLayout.setObjectName(u'VerseButtonLayout')
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.VerseButtonLayout.addItem(spacerItem)
self.AddButton = QtGui.QPushButton(self.VerseButtonWidget)
- self.AddButton.setObjectName("AddButton")
+ self.AddButton.setObjectName(u'AddButton')
self.VerseButtonLayout.addWidget(self.AddButton)
self.EditButton = QtGui.QPushButton(self.VerseButtonWidget)
- self.EditButton.setObjectName("EditButton")
+ self.EditButton.setObjectName(u'EditButton')
self.VerseButtonLayout.addWidget(self.EditButton)
self.DeleteButton = QtGui.QPushButton(self.VerseButtonWidget)
- self.DeleteButton.setObjectName("DeleteButton")
+ self.DeleteButton.setObjectName(u'DeleteButton')
self.VerseButtonLayout.addWidget(self.DeleteButton)
self.VerseEditLayout.addWidget(self.VerseButtonWidget)
self.DetailsLayout.addWidget(self.VerseEditWidget)
self.VerseOrderLabel = QtGui.QLabel(self.TextWidget)
- self.VerseOrderLabel.setObjectName("VerseOrderLabel")
+ self.VerseOrderLabel.setObjectName(u'VerseOrderLabel')
self.DetailsLayout.addWidget(self.VerseOrderLabel)
self.VerseOrderEdit = QtGui.QLineEdit(self.TextWidget)
- self.VerseOrderEdit.setObjectName("VerseOrderEdit")
+ self.VerseOrderEdit.setObjectName(u'VerseOrderEdit')
self.DetailsLayout.addWidget(self.VerseOrderEdit)
self.CommentsLabel = QtGui.QLabel(self.TextWidget)
- self.CommentsLabel.setObjectName("CommentsLabel")
+ self.CommentsLabel.setObjectName(u'CommentsLabel')
self.DetailsLayout.addWidget(self.CommentsLabel)
self.CommentsEdit = QtGui.QTextEdit(self.TextWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
@@ -98,21 +91,17 @@
sizePolicy.setHeightForWidth(self.CommentsEdit.sizePolicy().hasHeightForWidth())
self.CommentsEdit.setSizePolicy(sizePolicy)
self.CommentsEdit.setMaximumSize(QtCore.QSize(16777215, 84))
- self.CommentsEdit.setObjectName("CommentsEdit")
+ self.CommentsEdit.setObjectName(u'CommentsEdit')
self.DetailsLayout.addWidget(self.CommentsEdit)
self.ThemeGroupBox = QtGui.QGroupBox(self.TextWidget)
- self.ThemeGroupBox.setObjectName("ThemeGroupBox")
+ self.ThemeGroupBox.setObjectName(u'ThemeGroupBox')
self.ThemeLayout = QtGui.QHBoxLayout(self.ThemeGroupBox)
self.ThemeLayout.setSpacing(8)
self.ThemeLayout.setMargin(8)
- self.ThemeLayout.setObjectName("ThemeLayout")
+ self.ThemeLayout.setObjectName(u'ThemeLayout')
self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeGroupBox)
- self.ThemeSelectionComboItem.setObjectName("ThemeSelectionComboItem")
+ self.ThemeSelectionComboItem.setObjectName(u'ThemeSelectionComboItem')
self.ThemeLayout.addWidget(self.ThemeSelectionComboItem)
-# self.ThemeAddItem = QtGui.QPushButton(self.ThemeGroupBox)
-# self.ThemeAddItem.setMaximumSize(QtCore.QSize(110, 16777215))
-# self.ThemeAddItem.setObjectName("ThemeAddItem")
-# self.ThemeLayout.addWidget(self.ThemeAddItem)
self.DetailsLayout.addWidget(self.ThemeGroupBox)
self.TopLayout.addWidget(self.TextWidget)
self.AdditionalWidget = QtGui.QWidget(self.TopWidget)
@@ -122,23 +111,23 @@
sizePolicy.setHeightForWidth(self.AdditionalWidget.sizePolicy().hasHeightForWidth())
self.AdditionalWidget.setSizePolicy(sizePolicy)
self.AdditionalWidget.setMinimumSize(QtCore.QSize(100, 0))
- self.AdditionalWidget.setObjectName("AdditionalWidget")
+ self.AdditionalWidget.setObjectName(u'AdditionalWidget')
self.AdditionalLayout = QtGui.QVBoxLayout(self.AdditionalWidget)
self.AdditionalLayout.setSpacing(8)
self.AdditionalLayout.setMargin(0)
- self.AdditionalLayout.setObjectName("AdditionalLayout")
+ self.AdditionalLayout.setObjectName(u'AdditionalLayout')
self.AuthorsGroupBox = QtGui.QGroupBox(self.AdditionalWidget)
- self.AuthorsGroupBox.setObjectName("AuthorsGroupBox")
+ self.AuthorsGroupBox.setObjectName(u'AuthorsGroupBox')
self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsGroupBox)
self.AuthorsLayout.setSpacing(8)
self.AuthorsLayout.setMargin(8)
- self.AuthorsLayout.setObjectName("AuthorsLayout")
+ self.AuthorsLayout.setObjectName(u'AuthorsLayout')
self.AuthorAddWidget = QtGui.QWidget(self.AuthorsGroupBox)
- self.AuthorAddWidget.setObjectName("AuthorAddWidget")
+ self.AuthorAddWidget.setObjectName(u'AuthorAddWidget')
self.AddAuthorLayout = QtGui.QHBoxLayout(self.AuthorAddWidget)
self.AddAuthorLayout.setSpacing(8)
self.AddAuthorLayout.setMargin(0)
- self.AddAuthorLayout.setObjectName("AddAuthorLayout")
+ self.AddAuthorLayout.setObjectName(u'AddAuthorLayout')
self.AuthorsSelectionComboItem = QtGui.QComboBox(self.AuthorAddWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -149,48 +138,46 @@
self.AuthorsSelectionComboItem.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically)
self.AuthorsSelectionComboItem.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AuthorsSelectionComboItem.setMinimumContentsLength(8)
- self.AuthorsSelectionComboItem.setObjectName("AuthorsSelectionComboItem")
+ self.AuthorsSelectionComboItem.setObjectName(u'AuthorsSelectionComboItem')
self.AddAuthorLayout.addWidget(self.AuthorsSelectionComboItem)
self.AuthorAddtoSongItem = QtGui.QPushButton(self.AuthorAddWidget)
self.AuthorAddtoSongItem.setMaximumSize(QtCore.QSize(110, 16777215))
- self.AuthorAddtoSongItem.setObjectName("AuthorAddtoSongItem")
+ self.AuthorAddtoSongItem.setObjectName(u'AuthorAddtoSongItem')
self.AddAuthorLayout.addWidget(self.AuthorAddtoSongItem)
self.AuthorsLayout.addWidget(self.AuthorAddWidget)
- self.AuthorsListView = QtGui.QTableWidget(self.AuthorsGroupBox)
+ self.AuthorsListView = QtGui.QListWidget(self.AuthorsGroupBox)
self.AuthorsListView.setAlternatingRowColors(True)
- self.AuthorsListView.setObjectName("AuthorsListView")
- self.AuthorsListView.setColumnCount(0)
- self.AuthorsListView.setRowCount(0)
+ self.AuthorsListView.setObjectName(u'AuthorsListView')
self.AuthorsLayout.addWidget(self.AuthorsListView)
self.AuthorRemoveWidget = QtGui.QWidget(self.AuthorsGroupBox)
- self.AuthorRemoveWidget.setObjectName("AuthorRemoveWidget")
+ self.AuthorRemoveWidget.setObjectName(u'AuthorRemoveWidget')
self.AuthorRemoveLayout = QtGui.QHBoxLayout(self.AuthorRemoveWidget)
self.AuthorRemoveLayout.setSpacing(8)
self.AuthorRemoveLayout.setMargin(0)
- self.AuthorRemoveLayout.setObjectName("AuthorRemoveLayout")
+ self.AuthorRemoveLayout.setObjectName(u'AuthorRemoveLayout')
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.AuthorRemoveLayout.addItem(spacerItem1)
self.AuthorRemoveItem = QtGui.QPushButton(self.AuthorRemoveWidget)
- self.AuthorRemoveItem.setObjectName("AuthorRemoveItem")
+ self.AuthorRemoveItem.setObjectName(u'AuthorRemoveItem')
self.AuthorRemoveLayout.addWidget(self.AuthorRemoveItem)
self.AddAuthorsButton = QtGui.QPushButton(self.AuthorRemoveWidget)
- self.AddAuthorsButton.setObjectName("AddAuthorsButton")
+ self.AddAuthorsButton.setObjectName(u'AddAuthorsButton')
self.AuthorRemoveLayout.addWidget(self.AddAuthorsButton)
self.AuthorsLayout.addWidget(self.AuthorRemoveWidget)
self.AdditionalLayout.addWidget(self.AuthorsGroupBox)
self.SongBookGroup = QtGui.QGroupBox(self.AdditionalWidget)
- self.SongBookGroup.setObjectName("SongBookGroup")
+ self.SongBookGroup.setObjectName(u'SongBookGroup')
self.SongbookLayout = QtGui.QGridLayout(self.SongBookGroup)
self.SongbookLayout.setMargin(8)
self.SongbookLayout.setSpacing(8)
- self.SongbookLayout.setObjectName("SongbookLayout")
+ self.SongbookLayout.setObjectName(u'SongbookLayout')
self.SongbookCombo = QtGui.QComboBox(self.SongBookGroup)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.SongbookCombo.sizePolicy().hasHeightForWidth())
self.SongbookCombo.setSizePolicy(sizePolicy)
- self.SongbookCombo.setObjectName("SongbookCombo")
+ self.SongbookCombo.setObjectName(u'SongbookCombo')
self.SongbookLayout.addWidget(self.SongbookCombo, 0, 0, 1, 1)
self.AddSongBookButton = QtGui.QPushButton(self.SongBookGroup)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
@@ -198,7 +185,7 @@
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.AddSongBookButton.sizePolicy().hasHeightForWidth())
self.AddSongBookButton.setSizePolicy(sizePolicy)
- self.AddSongBookButton.setObjectName("AddSongBookButton")
+ self.AddSongBookButton.setObjectName(u'AddSongBookButton')
self.SongbookLayout.addWidget(self.AddSongBookButton, 0, 1, 1, 1)
self.AdditionalLayout.addWidget(self.SongBookGroup)
self.TopicGroupBox = QtGui.QGroupBox(self.AdditionalWidget)
@@ -207,24 +194,24 @@
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.TopicGroupBox.sizePolicy().hasHeightForWidth())
self.TopicGroupBox.setSizePolicy(sizePolicy)
- self.TopicGroupBox.setObjectName("TopicGroupBox")
+ self.TopicGroupBox.setObjectName(u'TopicGroupBox')
self.TopicLayout = QtGui.QVBoxLayout(self.TopicGroupBox)
self.TopicLayout.setSpacing(8)
self.TopicLayout.setMargin(8)
- self.TopicLayout.setObjectName("TopicLayout")
+ self.TopicLayout.setObjectName(u'TopicLayout')
self.TopicAddWidget = QtGui.QWidget(self.TopicGroupBox)
- self.TopicAddWidget.setObjectName("TopicAddWidget")
+ self.TopicAddWidget.setObjectName(u'TopicAddWidget')
self.TopicAddLayout = QtGui.QHBoxLayout(self.TopicAddWidget)
self.TopicAddLayout.setSpacing(8)
self.TopicAddLayout.setMargin(0)
- self.TopicAddLayout.setObjectName("TopicAddLayout")
+ self.TopicAddLayout.setObjectName(u'TopicAddLayout')
self.SongTopicCombo = QtGui.QComboBox(self.TopicAddWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.SongTopicCombo.sizePolicy().hasHeightForWidth())
self.SongTopicCombo.setSizePolicy(sizePolicy)
- self.SongTopicCombo.setObjectName("SongTopicCombo")
+ self.SongTopicCombo.setObjectName(u'SongTopicCombo')
self.TopicAddLayout.addWidget(self.SongTopicCombo)
self.AddTopicsToSongButton = QtGui.QPushButton(self.TopicAddWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
@@ -232,62 +219,60 @@
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.AddTopicsToSongButton.sizePolicy().hasHeightForWidth())
self.AddTopicsToSongButton.setSizePolicy(sizePolicy)
- self.AddTopicsToSongButton.setObjectName("AddTopicsToSongButton")
+ self.AddTopicsToSongButton.setObjectName(u'AddTopicsToSongButton')
self.TopicAddLayout.addWidget(self.AddTopicsToSongButton)
self.TopicLayout.addWidget(self.TopicAddWidget)
- self.TopicsListView = QtGui.QTableWidget(self.TopicGroupBox)
+ self.TopicsListView = QtGui.QListWidget(self.TopicGroupBox)
self.TopicsListView.setAlternatingRowColors(True)
- self.TopicsListView.setObjectName("TopicsListView")
- self.TopicsListView.setColumnCount(0)
- self.TopicsListView.setRowCount(0)
+ self.TopicsListView.setObjectName(u'TopicsListView')
self.TopicLayout.addWidget(self.TopicsListView)
self.TopicRemoveWidget = QtGui.QWidget(self.TopicGroupBox)
- self.TopicRemoveWidget.setObjectName("TopicRemoveWidget")
+ self.TopicRemoveWidget.setObjectName(u'TopicRemoveWidget')
self.TopicRemoveLayout = QtGui.QHBoxLayout(self.TopicRemoveWidget)
self.TopicRemoveLayout.setSpacing(8)
self.TopicRemoveLayout.setMargin(0)
- self.TopicRemoveLayout.setObjectName("TopicRemoveLayout")
+ self.TopicRemoveLayout.setObjectName(u'TopicRemoveLayout')
spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.TopicRemoveLayout.addItem(spacerItem2)
- self.pushButton = QtGui.QPushButton(self.TopicRemoveWidget)
- self.pushButton.setObjectName("pushButton")
- self.TopicRemoveLayout.addWidget(self.pushButton)
+ self.TopicRemoveItem = QtGui.QPushButton(self.TopicRemoveWidget)
+ self.TopicRemoveItem.setObjectName(u'TopicRemoveItem')
+ self.TopicRemoveLayout.addWidget(self.TopicRemoveItem)
self.AddTopicButton = QtGui.QPushButton(self.TopicRemoveWidget)
- self.AddTopicButton.setObjectName("AddTopicButton")
+ self.AddTopicButton.setObjectName(u'AddTopicButton')
self.TopicRemoveLayout.addWidget(self.AddTopicButton)
self.TopicLayout.addWidget(self.TopicRemoveWidget)
self.AdditionalLayout.addWidget(self.TopicGroupBox)
self.CopyrightgroupBox = QtGui.QGroupBox(self.AdditionalWidget)
- self.CopyrightgroupBox.setObjectName("CopyrightgroupBox")
+ self.CopyrightgroupBox.setObjectName(u'CopyrightgroupBox')
self.CopyrightLayout = QtGui.QVBoxLayout(self.CopyrightgroupBox)
self.CopyrightLayout.setSpacing(8)
self.CopyrightLayout.setMargin(8)
- self.CopyrightLayout.setObjectName("CopyrightLayout")
+ self.CopyrightLayout.setObjectName(u'CopyrightLayout')
self.CopyrightWidget = QtGui.QWidget(self.CopyrightgroupBox)
- self.CopyrightWidget.setObjectName("CopyrightWidget")
+ self.CopyrightWidget.setObjectName(u'CopyrightWidget')
self.CopyLayout = QtGui.QHBoxLayout(self.CopyrightWidget)
self.CopyLayout.setSpacing(8)
self.CopyLayout.setMargin(0)
- self.CopyLayout.setObjectName("CopyLayout")
+ self.CopyLayout.setObjectName(u'CopyLayout')
self.CopyrightEditItem = QtGui.QLineEdit(self.CopyrightWidget)
- self.CopyrightEditItem.setObjectName("CopyrightEditItem")
+ self.CopyrightEditItem.setObjectName(u'CopyrightEditItem')
self.CopyLayout.addWidget(self.CopyrightEditItem)
self.CopyrightInsertItem = QtGui.QPushButton(self.CopyrightWidget)
self.CopyrightInsertItem.setMaximumSize(QtCore.QSize(29, 16777215))
- self.CopyrightInsertItem.setObjectName("CopyrightInsertItem")
+ self.CopyrightInsertItem.setObjectName(u'CopyrightInsertItem')
self.CopyLayout.addWidget(self.CopyrightInsertItem)
self.CopyrightLayout.addWidget(self.CopyrightWidget)
self.CcliWidget = QtGui.QWidget(self.CopyrightgroupBox)
- self.CcliWidget.setObjectName("CcliWidget")
+ self.CcliWidget.setObjectName(u'CcliWidget')
self.CCLILayout = QtGui.QHBoxLayout(self.CcliWidget)
self.CCLILayout.setSpacing(8)
self.CCLILayout.setMargin(0)
- self.CCLILayout.setObjectName("CCLILayout")
+ self.CCLILayout.setObjectName(u'CCLILayout')
self.CCLILabel = QtGui.QLabel(self.CcliWidget)
- self.CCLILabel.setObjectName("CCLILabel")
+ self.CCLILabel.setObjectName(u'CCLILabel')
self.CCLILayout.addWidget(self.CCLILabel)
self.CCLNumberEdit = QtGui.QLineEdit(self.CcliWidget)
- self.CCLNumberEdit.setObjectName("CCLNumberEdit")
+ self.CCLNumberEdit.setObjectName(u'CCLNumberEdit')
self.CCLILayout.addWidget(self.CCLNumberEdit)
self.CopyrightLayout.addWidget(self.CcliWidget)
self.AdditionalLayout.addWidget(self.CopyrightgroupBox)
@@ -295,12 +280,12 @@
self.EditSongLayout.addWidget(self.TopWidget)
self.ButtonBox = QtGui.QDialogButtonBox(EditSongDialog)
self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
- self.ButtonBox.setObjectName("ButtonBox")
+ self.ButtonBox.setObjectName(u'ButtonBox')
self.EditSongLayout.addWidget(self.ButtonBox)
self.retranslateUi(EditSongDialog)
- QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("rejected()"), EditSongDialog.close)
- QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), EditSongDialog.close)
+ QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'rejected()'), EditSongDialog.close)
+ QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), self.onAccept)
QtCore.QMetaObject.connectSlotsByName(EditSongDialog)
EditSongDialog.setTabOrder(self.TitleEditItem, self.AlternativeEdit)
EditSongDialog.setTabOrder(self.AlternativeEdit, self.VerseOrderEdit)
@@ -313,33 +298,33 @@
EditSongDialog.setTabOrder(self.SongbookCombo, self.AddSongBookButton)
EditSongDialog.setTabOrder(self.AddSongBookButton, self.SongTopicCombo)
EditSongDialog.setTabOrder(self.SongTopicCombo, self.TopicsListView)
- EditSongDialog.setTabOrder(self.TopicsListView, self.pushButton)
- EditSongDialog.setTabOrder(self.pushButton, self.CopyrightEditItem)
+ EditSongDialog.setTabOrder(self.TopicsListView, self.TopicRemoveItem)
+ EditSongDialog.setTabOrder(self.TopicRemoveItem, self.CopyrightEditItem)
EditSongDialog.setTabOrder(self.CopyrightEditItem, self.CopyrightInsertItem)
EditSongDialog.setTabOrder(self.CopyrightInsertItem, self.CCLNumberEdit)
EditSongDialog.setTabOrder(self.CCLNumberEdit, self.ButtonBox)
def retranslateUi(self, EditSongDialog):
- EditSongDialog.setWindowTitle(QtGui.QApplication.translate("EditSongDialog", "Song Editor", None, QtGui.QApplication.UnicodeUTF8))
- self.TitleLabel.setText(QtGui.QApplication.translate("EditSongDialog", "Title:", None, QtGui.QApplication.UnicodeUTF8))
- self.AlternativeTitleLabel.setText(QtGui.QApplication.translate("EditSongDialog", "Alternative Title:", None, QtGui.QApplication.UnicodeUTF8))
- self.LyricsLabel.setText(QtGui.QApplication.translate("EditSongDialog", "Lyrics:", None, QtGui.QApplication.UnicodeUTF8))
- self.AddButton.setText(QtGui.QApplication.translate("EditSongDialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
- self.EditButton.setText(QtGui.QApplication.translate("EditSongDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8))
- self.DeleteButton.setText(QtGui.QApplication.translate("EditSongDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8))
- self.VerseOrderLabel.setText(QtGui.QApplication.translate("EditSongDialog", "Verse Order:", None, QtGui.QApplication.UnicodeUTF8))
- self.CommentsLabel.setText(QtGui.QApplication.translate("EditSongDialog", "Comments:", None, QtGui.QApplication.UnicodeUTF8))
- self.ThemeGroupBox.setTitle(QtGui.QApplication.translate("EditSongDialog", "Theme", None, QtGui.QApplication.UnicodeUTF8))
- self.AuthorsGroupBox.setTitle(QtGui.QApplication.translate("EditSongDialog", "Authors", None, QtGui.QApplication.UnicodeUTF8))
- self.AuthorAddtoSongItem.setText(QtGui.QApplication.translate("EditSongDialog", "Add to Song", None, QtGui.QApplication.UnicodeUTF8))
- self.AuthorRemoveItem.setText(QtGui.QApplication.translate("EditSongDialog", "Remove", None, QtGui.QApplication.UnicodeUTF8))
- self.AddAuthorsButton.setText(QtGui.QApplication.translate("EditSongDialog", "Manage Authors", None, QtGui.QApplication.UnicodeUTF8))
- self.SongBookGroup.setTitle(QtGui.QApplication.translate("EditSongDialog", "Song Book", None, QtGui.QApplication.UnicodeUTF8))
- self.AddSongBookButton.setText(QtGui.QApplication.translate("EditSongDialog", "Manage Song Books", None, QtGui.QApplication.UnicodeUTF8))
- self.TopicGroupBox.setTitle(QtGui.QApplication.translate("EditSongDialog", "Topic", None, QtGui.QApplication.UnicodeUTF8))
- self.AddTopicsToSongButton.setText(QtGui.QApplication.translate("EditSongDialog", "Add to Song", None, QtGui.QApplication.UnicodeUTF8))
- self.pushButton.setText(QtGui.QApplication.translate("EditSongDialog", "Remove", None, QtGui.QApplication.UnicodeUTF8))
- self.AddTopicButton.setText(QtGui.QApplication.translate("EditSongDialog", "Manage Topics", None, QtGui.QApplication.UnicodeUTF8))
- self.CopyrightgroupBox.setTitle(QtGui.QApplication.translate("EditSongDialog", "Copyright Infomaton", None, QtGui.QApplication.UnicodeUTF8))
- self.CopyrightInsertItem.setText(QtGui.QApplication.translate("EditSongDialog", "©", None, QtGui.QApplication.UnicodeUTF8))
- self.CCLILabel.setText(QtGui.QApplication.translate("EditSongDialog", "CCLI Number:", None, QtGui.QApplication.UnicodeUTF8))
+ EditSongDialog.setWindowTitle(translate(u'EditSongDialog', u'Song Editor'))
+ self.TitleLabel.setText(translate(u'EditSongDialog', u'Title:'))
+ self.AlternativeTitleLabel.setText(translate(u'EditSongDialog', u'Alternative Title:'))
+ self.LyricsLabel.setText(translate(u'EditSongDialog', u'Lyrics:'))
+ self.AddButton.setText(translate(u'EditSongDialog', u'Add'))
+ self.EditButton.setText(translate(u'EditSongDialog', u'Edit'))
+ self.DeleteButton.setText(translate(u'EditSongDialog', u'Delete'))
+ self.VerseOrderLabel.setText(translate(u'EditSongDialog', u'Verse Order:'))
+ self.CommentsLabel.setText(translate(u'EditSongDialog', u'Comments:'))
+ self.ThemeGroupBox.setTitle(translate(u'EditSongDialog', u'Theme'))
+ self.AuthorsGroupBox.setTitle(translate(u'EditSongDialog', u'Authors'))
+ self.AuthorAddtoSongItem.setText(translate(u'EditSongDialog', u'Add to Song'))
+ self.AuthorRemoveItem.setText(translate(u'EditSongDialog', u'Remove'))
+ self.AddAuthorsButton.setText(translate(u'EditSongDialog', u'Manage Authors'))
+ self.SongBookGroup.setTitle(translate(u'EditSongDialog', u'Song Book'))
+ self.AddSongBookButton.setText(translate(u'EditSongDialog', u'Manage Song Books'))
+ self.TopicGroupBox.setTitle(translate(u'EditSongDialog', u'Topic'))
+ self.AddTopicsToSongButton.setText(translate(u'EditSongDialog', u'Add to Song'))
+ self.TopicRemoveItem.setText(translate(u'EditSongDialog', u'Remove'))
+ self.AddTopicButton.setText(translate(u'EditSongDialog', u'Manage Topics'))
+ self.CopyrightgroupBox.setTitle(translate(u'EditSongDialog', u'Copyright Infomaton'))
+ self.CopyrightInsertItem.setText(translate(u'EditSongDialog', u'(c)'))
+ self.CCLILabel.setText(translate(u'EditSongDialog', u'CCLI Number:'))
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2009-06-04 20:06:32 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2009-06-14 07:25:39 +0000
@@ -17,18 +17,23 @@
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
+import logging
from PyQt4 import Qt, QtCore, QtGui
-
+from openlp.core.lib import SongXMLBuilder, SongXMLParser, Event, EventType, EventManager
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm, \
EditVerseForm
+from openlp.plugins.songs.lib.models import Song
from editsongdialog import Ui_EditSongDialog
class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
- Class documentation goes here.
+ Class to manage the editing of a song
"""
- def __init__(self, songmanager, parent=None):
+ global log
+ log = logging.getLogger(u'EditSongForm')
+ log.info(u'Song Editor loaded')
+ def __init__(self, songmanager, eventmanager, parent=None):
"""
Constructor
"""
@@ -36,41 +41,59 @@
self.setupUi(self)
# Connecting signals and slots
QtCore.QObject.connect(self.AddAuthorsButton,
- QtCore.SIGNAL('clicked()'), self.onAddAuthorsButtonClicked)
+ QtCore.SIGNAL(u'clicked()'), self.onAddAuthorsButtonClicked)
+ QtCore.QObject.connect(self.AuthorAddtoSongItem,
+ QtCore.SIGNAL(u'clicked()'), self.onAuthorAddtoSongItemClicked)
+ QtCore.QObject.connect(self.AuthorRemoveItem,
+ QtCore.SIGNAL(u'clicked()'), self.onAuthorRemovefromSongItemClicked)
+ QtCore.QObject.connect(self.AuthorsListView,
+ QtCore.SIGNAL("itemClicked(QListWidgetItem*)"), self.onAuthorsListViewPressed)
QtCore.QObject.connect(self.AddTopicButton,
- QtCore.SIGNAL('clicked()'), self.onAddTopicButtonClicked)
+ QtCore.SIGNAL(u'clicked()'), self.onAddTopicButtonClicked)
+ QtCore.QObject.connect(self.AddTopicsToSongButton,
+ QtCore.SIGNAL(u'clicked()'), self.onTopicAddtoSongItemClicked)
+ QtCore.QObject.connect(self.TopicRemoveItem,
+ QtCore.SIGNAL(u'clicked()'), self.onTopicRemovefromSongItemClicked)
+ QtCore.QObject.connect(self.TopicsListView,
+ QtCore.SIGNAL("itemClicked(QListWidgetItem*)"), self.onTopicListViewPressed)
QtCore.QObject.connect(self.AddSongBookButton,
- QtCore.SIGNAL('clicked()'), self.onAddSongBookButtonClicked)
+ QtCore.SIGNAL(u'clicked()'), self.onAddSongBookButtonClicked)
QtCore.QObject.connect(self.CopyrightInsertItem,
- QtCore.SIGNAL('clicked()'), self.onCopyrightInsertItemTriggered)
+ QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertItemTriggered)
QtCore.QObject.connect(self.AddButton,
- QtCore.SIGNAL('clicked()'), self.onAddVerseButtonClicked)
+ QtCore.SIGNAL(u'clicked()'), self.onAddVerseButtonClicked)
QtCore.QObject.connect(self.EditButton,
- QtCore.SIGNAL('clicked()'), self.onEditVerseButtonClicked)
+ QtCore.SIGNAL(u'clicked()'), self.onEditVerseButtonClicked)
QtCore.QObject.connect(self.DeleteButton,
- QtCore.SIGNAL('clicked()'), self.onDeleteVerseButtonClicked)
+ QtCore.SIGNAL(u'clicked()'), self.onDeleteVerseButtonClicked)
+ QtCore.QObject.connect(self.VerseListWidget,
+ QtCore.SIGNAL("itemClicked(QListWidgetItem*)"), 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)
# Create other objects and forms
self.songmanager = songmanager
+ self.eventmanager = eventmanager
self.authors_form = AuthorsForm(self.songmanager)
self.topics_form = TopicsForm(self.songmanager)
self.song_book_form = SongBookForm(self.songmanager)
self.verse_form = EditVerseForm()
self.initialise()
-
- self.AuthorsListView.setColumnCount(2)
- self.AuthorsListView.setColumnHidden(0, True)
- self.AuthorsListView.setColumnWidth(1, 200)
- self.AuthorsListView.setShowGrid(False)
self.AuthorsListView.setSortingEnabled(False)
self.AuthorsListView.setAlternatingRowColors(True)
- self.AuthorsListView.horizontalHeader().setVisible(False)
- self.AuthorsListView.verticalHeader().setVisible(False)
- self.savebutton = self.ButtonBox.button(QtGui.QDialogButtonBox.Save)
+ self.TopicsListView.setSortingEnabled(False)
+ self.TopicsListView.setAlternatingRowColors(True)
def initialise(self):
self.loadAuthors()
self.loadTopics()
self.loadBooks()
+ self.EditButton.setEnabled(False)
+ self.DeleteButton.setEnabled(False)
+ self.AuthorRemoveItem.setEnabled(False)
+ self.TopicRemoveItem.setEnabled(False)
+ self.title_change = False
def loadAuthors(self):
authors = self.songmanager.get_authors()
@@ -87,29 +110,115 @@
def loadBooks(self):
books = self.songmanager.get_books()
self.SongbookCombo.clear()
+ self.SongbookCombo.addItem(u' ')
for book in books:
self.SongbookCombo.addItem(book.name)
+ def loadThemes(self, theme_list):
+ self.ThemeSelectionComboItem.clear()
+ self.ThemeSelectionComboItem.addItem(u' ')
+ for theme in theme_list:
+ self.ThemeSelectionComboItem.addItem(theme)
+
+ def newSong(self):
+ log.debug(u'New Song')
+ self.song = Song()
+ self.TitleEditItem.setText(u'')
+ self.AlternativeEdit.setText(u'')
+ self.CopyrightEditItem.setText(u'')
+ self.VerseListWidget.clear()
+ self.AuthorsListView.clear()
+ self.TopicsListView.clear()
+ self.title_change = False
+
def loadSong(self, id):
+ log.debug(u'Load Song')
self.song = self.songmanager.get_song(id)
self.TitleEditItem.setText(self.song.title)
+ title = self.song.search_title.split(u'@')
+ if self.song.song_book_id != 0:
+ book_name = self.songmanager.get_book(self.song.song_book_id)
+ id = self.SongbookCombo.findText(unicode(book_name), QtCore.Qt.MatchExactly)
+ if id == -1:
+ # Not Found
+ id = 0
+ book_name.setCurrentIndex(id)
+ if self.song.theme_name is not None and len(self.song.theme_name) > 0:
+ id = self.SongbookCombo.findText(unicode(self.song.theme_name), QtCore.Qt.MatchExactly)
+ if id == -1:
+ # Not Found
+ id = 0
+ self.song.theme_name = None
+ self.SongbookCombo.setCurrentIndex(id)
+ if len(title) > 1:
+ self.AlternativeEdit.setText(title[1])
self.CopyrightEditItem.setText(self.song.copyright)
- #self.LyricsTextEdit.setText(self.song.lyrics)
- verses = self.song.lyrics.split('\n\n')
- for verse in verses:
- self.VerseListWidget.addItem(verse)
-
- self.AuthorsListView.clear() # clear the results
- self.AuthorsListView.setRowCount(0)
+ self.VerseListWidget.clear()
+ #lazy xml migration for now
+ if self.song.lyrics.startswith(u'<?xml version='):
+ songXML=SongXMLParser(self.song.lyrics)
+ verseList = songXML.get_verses()
+ for verse in verseList:
+ self.VerseListWidget.addItem(verse[1])
+ else:
+ verses = self.song.lyrics.split(u'\n\n')
+ for verse in verses:
+ self.VerseListWidget.addItem(verse)
+ # clear the results
+ self.AuthorsListView.clear()
for author in self.song.authors:
- row_count = self.AuthorsListView.rowCount()
- self.AuthorsListView.setRowCount(row_count + 1)
- author_id = QtGui.QTableWidgetItem(str(author.id))
- self.AuthorsListView.setItem(row_count, 0, author_id)
- author_name = QtGui.QTableWidgetItem(str(author.display_name))
- self.AuthorsListView.setItem(row_count, 1, author_name)
- self.AuthorsListView.setRowHeight(row_count, 20)
+ author_name = QtGui.QListWidgetItem(unicode(author.display_name))
+ author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
+ self.AuthorsListView.addItem(author_name)
+ # clear the results
+ self.TopicsListView.clear()
+ for topic in self.song.topics:
+ topic_name = QtGui.QListWidgetItem(unicode(topic.name))
+ topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
+ self.TopicsListView.addItem(topic_name)
self._validate_song()
+ self.title_change = False
+
+ def onAuthorAddtoSongItemClicked(self):
+ author_name = unicode(self.AuthorsSelectionComboItem.currentText())
+ author = self.songmanager.get_author_by_name(author_name)
+ self.song.authors.append(author)
+ author_item = QtGui.QListWidgetItem(unicode(author.display_name))
+ author_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
+ self.AuthorsListView.addItem(author_item)
+
+ def onAuthorsListViewPressed(self):
+ if self.AuthorsListView.count() >1:
+ self.AuthorRemoveItem.setEnabled(True)
+
+ def onAuthorRemovefromSongItemClicked(self):
+ self.AuthorRemoveItem.setEnabled(False)
+ item = self.AuthorsListView.currentItem()
+ author_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ author = self.songmanager.get_author(author_id)
+ self.song.authors.remove(author)
+ row = self.AuthorsListView.row(item)
+ self.AuthorsListView.takeItem(row)
+
+ def onTopicAddtoSongItemClicked(self):
+ topic_name = unicode(self.SongTopicCombo.currentText())
+ topic = self.songmanager.get_topic_by_name(topic_name)
+ self.song.topics.append(topic)
+ topic_item = QtGui.QListWidgetItem(unicode(topic.name))
+ topic_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
+ self.TopicsListView.addItem(topic_item)
+
+ def onTopicListViewPressed(self):
+ self.TopicRemoveItem.setEnabled(True)
+
+ def onTopicRemovefromSongItemClicked(self):
+ self.TopicRemoveItem.setEnabled(False)
+ item = self.TopicsListView.currentItem()
+ topic_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ topic = self.songmanager.get_topic(topic_id)
+ self.song.topics.remove(topic)
+ row = self.TopicsListView.row(item)
+ self.TopicsListView.takeItem(row)
def onAddAuthorsButtonClicked(self):
"""
@@ -135,54 +244,75 @@
self.song_book_form.exec_()
self.loadBooks()
+ def onSongBookComboChanged(self, item):
+ if item == 0:
+ self.song.song_book_id = 0
+ else:
+ book_name = unicode(self.SongbookCombo.itemText(item))
+ book = self.songmanager.get_book_by_name(book_name)
+ self.song.song_book_id = book.id
+
+ def onThemeComboChanged(self, item):
+ if item == 0:
+ #None means no Theme
+ self.song.song_theme = None
+ else:
+ them_name = unicode(self.ThemeSelectionComboItem.itemText(item))
+ self.song.theme_name = them_name
+
+ def onVerseListViewPressed(self):
+ self.EditButton.setEnabled(True)
+ self.DeleteButton.setEnabled(True)
+
def onAddVerseButtonClicked(self):
- self.verse_form.setVerse('')
+ self.verse_form.setVerse(u'')
self.verse_form.exec_()
self.VerseListWidget.addItem(self.verse_form.getVerse())
def onEditVerseButtonClicked(self):
item = self.VerseListWidget.currentItem()
- self.verse_form.setVerse(item.text())
- self.verse_form.exec_()
- item.setText(self.verse_form.getVerse())
+ if item is not None:
+ self.verse_form.setVerse(item.text())
+ self.verse_form.exec_()
+ item.setText(self.verse_form.getVerse())
+ self.EditButton.setEnabled(False)
+ self.DeleteButton.setEnabled(False)
def onDeleteVerseButtonClicked(self):
item = self.VerseListWidget.takeItem(self.VerseListWidget.currentRow())
item = None
+ self.EditButton.setEnabled(False)
+ self.DeleteButton.setEnabled(False)
def _validate_song(self):
"""
Check the validity of the form. Only display the 'save' if the data can be saved.
"""
- valid = True # Lets be nice and assume the data is correct.
- if len(self.TitleEditItem.displayText()) == 0: #Song title missing
- valid = False
- #self._color_widget(self.TitleEditItem, True)
- #else:
- #self._color_widget(self.TitleEditItem, False)
- if len(self.CopyrightEditItem.displayText()) == 0: #Song title missing
- valid = False
- #self._color_widget(self.CopyrightEditItem, True)
- #else:
- #self._color_widget(self.CopyrightEditItem, False)
-
- if valid:
- self.ButtonBox.addButton(self.savebutton, QtGui.QDialogButtonBox.AcceptRole) # hide the save button tile screen is valid
- else:
- self.ButtonBox.removeButton(self.savebutton) # hide the save button tile screen is valid
+ log.debug(u'Validate Song')
+ # Lets be nice and assume the data is correct.
+ valid = True
+ if len(self.TitleEditItem.displayText()) == 0:
+ valid = False
+ if len(self.CopyrightEditItem.displayText()) == 0:
+ valid = False
+ if self.VerseListWidget.count() == 0:
+ valid = False
+ if self.AuthorsListView.count() == 0:
+ valid = False
+ return valid
def _color_widget(self, slot, invalid):
r = Qt.QPalette(slot.palette())
if invalid == True:
- r.setColor(Qt.QPalette.Base, Qt.QColor('darkRed'))
+ r.setColor(Qt.QPalette.Base, Qt.QColor(u'darkRed'))
else:
- r.setColor(Qt.QPalette.Base, Qt.QColor('white'))
+ r.setColor(Qt.QPalette.Base, Qt.QColor(u'white'))
slot.setPalette(r)
slot.setAutoFillBackground(True)
def on_TitleEditItem_lostFocus(self):
- #self._validate_song()
- pass
+ self.song.title = self.TitleEditItem.text()
+ self.title_change = True
def onCopyrightInsertItemTriggered(self):
text = self.CopyrightEditItem.displayText()
@@ -191,3 +321,55 @@
self.CopyrightEditItem.setText(text)
self.CopyrightEditItem.setFocus()
self.CopyrightEditItem.setCursorPosition(pos + 1)
+
+ def onAccept(self):
+ log.debug(u'OnAccept')
+ #self.song.topics.append(9) << need opject here
+ if not self._validate_song():
+ return
+ self.song.title = unicode(self.TitleEditItem.displayText())
+ self.song.copyright = unicode(self.CopyrightEditItem.displayText())
+ self.song.search_title = self.TitleEditItem.displayText() + u'@'+ self.AlternativeEdit.displayText()
+ self.processLyrics()
+ self.processTitle()
+ self.song.song_book_id = 0
+ self.songmanager.save_song(self.song)
+ if self.title_change:
+ self.eventmanager.post_event(Event(EventType.LoadSongList))
+ self.close()
+
+ def processLyrics(self):
+ log.debug(u'processLyrics')
+ sxml=SongXMLBuilder()
+ sxml.new_document()
+ sxml.add_lyrics_to_song()
+ count = 1
+ text = u' '
+ for i in range (0, self.VerseListWidget.count()):
+ sxml.add_verse_to_lyrics(u'Verse', unicode(count), unicode(self.VerseListWidget.item(i).text()))
+ text = text + unicode(self.VerseListWidget.item(i).text()) + u' '
+ count += 1
+ text = text.replace("'", u'')
+ text = text.replace(u',', u'')
+ text = text.replace(u';', u'')
+ text = text.replace(u':', u'')
+ text = text.replace(u'(', u'')
+ text = text.replace(u')', u'')
+ text = text.replace(u'{', u'')
+ text = text.replace(u'}', u'')
+ text = text.replace(u'?', u'')
+ self.song.search_lyrics = unicode(text)
+ self.song.lyrics = unicode(sxml.extract_xml())
+
+ def processTitle(self):
+ log.debug(u'processTitle')
+ self.song.search_title = self.song.search_title.replace("'", u'')
+ self.song.search_title = self.song.search_title.replace(u',', u'')
+ self.song.search_title = self.song.search_title.replace(u';', u'')
+ self.song.search_title = self.song.search_title.replace(u':', u'')
+ self.song.search_title = self.song.search_title.replace(u'(', u'')
+ self.song.search_title = self.song.search_title.replace(u')', u'')
+ self.song.search_title = self.song.search_title.replace(u'{', u'')
+ self.song.search_title = self.song.search_title.replace(u'}', u'')
+ self.song.search_title = self.song.search_title.replace(u'?', u'')
+ self.song.search_title = unicode(self.song.search_title)
=== modified file 'openlp/plugins/songs/forms/editversedialog.py'
--- openlp/plugins/songs/forms/editversedialog.py 2009-03-07 21:38:59 +0000
+++ openlp/plugins/songs/forms/editversedialog.py 2009-06-10 17:12:03 +0000
@@ -8,30 +8,31 @@
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
+from openlp.core.lib import translate
class Ui_EditVerseDialog(object):
def setupUi(self, EditVerseDialog):
- EditVerseDialog.setObjectName("EditVerseDialog")
+ EditVerseDialog.setObjectName(u'EditVerseDialog')
EditVerseDialog.resize(492, 373)
EditVerseDialog.setModal(True)
self.DialogLayout = QtGui.QVBoxLayout(EditVerseDialog)
self.DialogLayout.setSpacing(8)
self.DialogLayout.setMargin(8)
- self.DialogLayout.setObjectName("DialogLayout")
+ self.DialogLayout.setObjectName(u'DialogLayout')
self.VerseTextEdit = QtGui.QTextEdit(EditVerseDialog)
self.VerseTextEdit.setAcceptRichText(False)
- self.VerseTextEdit.setObjectName("VerseTextEdit")
+ self.VerseTextEdit.setObjectName(u'VerseTextEdit')
self.DialogLayout.addWidget(self.VerseTextEdit)
self.ButtonBox = QtGui.QDialogButtonBox(EditVerseDialog)
self.ButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
- self.ButtonBox.setObjectName("ButtonBox")
+ self.ButtonBox.setObjectName(u'ButtonBox')
self.DialogLayout.addWidget(self.ButtonBox)
self.retranslateUi(EditVerseDialog)
- QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), EditVerseDialog.accept)
- QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("rejected()"), EditVerseDialog.reject)
+ QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), EditVerseDialog.accept)
+ QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'rejected()'), EditVerseDialog.reject)
QtCore.QMetaObject.connectSlotsByName(EditVerseDialog)
def retranslateUi(self, EditVerseDialog):
- EditVerseDialog.setWindowTitle(QtGui.QApplication.translate("EditVerseDialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
+ EditVerseDialog.setWindowTitle(translate(u'EditVerseDialog', u'Dialog'))
=== modified file 'openlp/plugins/songs/forms/songbookform.py'
--- openlp/plugins/songs/forms/songbookform.py 2009-06-05 05:00:26 +0000
+++ openlp/plugins/songs/forms/songbookform.py 2009-06-10 17:12:03 +0000
@@ -18,6 +18,7 @@
"""
from PyQt4 import QtGui, QtCore
+from openlp.core.lib import translate
from songbookdialog import Ui_SongBookDialog
from openlp.plugins.songs.lib.classes import Book
@@ -36,13 +37,13 @@
self.songbook = None
QtCore.QObject.connect(self.DeleteButton,
- QtCore.SIGNAL('pressed()'), self.onDeleteButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonClick)
QtCore.QObject.connect(self.ClearButton,
- QtCore.SIGNAL('pressed()'), self.onClearButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onClearButtonClick)
QtCore.QObject.connect(self.AddUpdateButton,
- QtCore.SIGNAL('pressed()'), self.onAddUpdateButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onAddUpdateButtonClick)
QtCore.QObject.connect(self.NameEdit,
- QtCore.SIGNAL('lostFocus()'), self.onBookNameEditLostFocus)
+ QtCore.SIGNAL(u'lostFocus()'), self.onBookNameEditLostFocus)
QtCore.QObject.connect(self.BookSongListView,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onBooksListViewItemClicked)
@@ -112,15 +113,16 @@
self.NameEdit.setText(self.Book.name)
self.PublisherEdit.setText(self.Book.publisher)
if len(self.Book.songs) > 0:
- self.MessageLabel.setText("Book in use 'Delete' is disabled")
+ self.MessageLabel.setText(translate(u'BookForm', u'Book in use "Delete" is disabled'))
self.DeleteButton.setEnabled(False)
else:
- self.MessageLabel.setText("Book is not used")
+ self.MessageLabel.setText(translate(u'BookForm', u'Book in not used'))
self.DeleteButton.setEnabled(True)
self._validate_form()
def _validate_form(self):
- if len(self.NameEdit.displayText()) == 0: # We need at lease a display name
+ # We need at lease a display name
+ if len(self.NameEdit.displayText()) == 0:
self.AddUpdateButton.setEnabled(False)
else:
self.AddUpdateButton.setEnabled(True)
=== modified file 'openlp/plugins/songs/forms/topicsform.py'
--- openlp/plugins/songs/forms/topicsform.py 2009-06-05 05:00:26 +0000
+++ openlp/plugins/songs/forms/topicsform.py 2009-06-10 17:12:03 +0000
@@ -16,10 +16,9 @@
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
-
from PyQt4 import QtGui, QtCore
+from openlp.core.lib import translate
from openlp.plugins.songs.lib import TextListData
-
from openlp.plugins.songs.forms.topicsdialog import Ui_TopicsDialog
from openlp.plugins.songs.lib.classes import Topic
@@ -38,13 +37,13 @@
self.topic = None
QtCore.QObject.connect(self.DeleteButton,
- QtCore.SIGNAL('pressed()'), self.onDeleteButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonClick)
QtCore.QObject.connect(self.ClearButton,
- QtCore.SIGNAL('pressed()'), self.onClearButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onClearButtonClick)
QtCore.QObject.connect(self.AddUpdateButton,
- QtCore.SIGNAL('pressed()'), self.onAddUpdateButtonClick)
+ QtCore.SIGNAL(u'pressed()'), self.onAddUpdateButtonClick)
QtCore.QObject.connect(self.TopicNameEdit,
- QtCore.SIGNAL('lostFocus()'), self.onTopicNameEditLostFocus)
+ QtCore.SIGNAL(u'lostFocus()'), self.onTopicNameEditLostFocus)
QtCore.QObject.connect(self.TopicsListView,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onTopicsListViewItemClicked)
@@ -111,15 +110,16 @@
self.TopicNameEdit.setText(self.topic.name)
if len(self.topic.songs) > 0:
- self.MessageLabel.setText("Topic in use 'Delete' is disabled")
+ self.MessageLabel.setText(translate(u'TopicForm', u'Topic in use "Delete" is disabled'))
self.DeleteButton.setEnabled(False)
else:
- self.MessageLabel.setText("Topic is not used")
+ self.MessageLabel.setText(translate(u'TopicForm', u'Topic in not used'))
self.DeleteButton.setEnabled(True)
self._validate_form()
def _validate_form(self):
- if len(self.TopicNameEdit.displayText()) == 0: # We need at lease a display name
+ # We need at lease a display name
+ if len(self.TopicNameEdit.displayText()) == 0:
self.AddUpdateButton.setEnabled(False)
else:
self.AddUpdateButton.setEnabled(True)
=== modified file 'openlp/plugins/songs/lib/manager.py'
--- openlp/plugins/songs/lib/manager.py 2009-06-10 15:37:33 +0000
+++ openlp/plugins/songs/lib/manager.py 2009-06-14 06:48:38 +0000
@@ -34,8 +34,8 @@
"""
global log
- log = logging.getLogger('SongManager')
- log.info('Song manager loaded')
+ log = logging.getLogger(u'SongManager')
+ log.info(u'Song manager loaded')
def __init__(self, config):
"""
@@ -43,7 +43,7 @@
don't exist.
"""
self.config = config
- log.debug('Song Initialising')
+ log.debug(u'Song Initialising')
self.db_url = u''
db_type = self.config.get_config(u'db type', u'sqlite')
if db_type == u'sqlite':
@@ -58,7 +58,7 @@
self.session = init_models(self.db_url)
if not songs_table.exists():
metadata.create_all()
- log.debug('Song Initialised')
+ log.debug(u'Song Initialised')
def process_dialog(self, dialogobject):
self.dialogobject = dialogobject
@@ -99,14 +99,20 @@
self.session.commit()
return True
except:
+ self.session.rollback()
+ log.error(u'Errow thrown %s', sys.exc_info()[1])
return False
- def delete_song(self, song):
+ def delete_song(self, songid):
+ song = self.get_song(songid)
try:
self.session.delete(song)
self.session.commit()
return True
except:
+ self.session.rollback()
+ log.error(u'Errow thrown %s', sys.exc_info()[1])
+ print u'Errow thrown ', sys.exc_info()[1]
return False
def get_authors(self):
@@ -121,6 +127,12 @@
"""
return self.session.query(Author).get(id)
+ def get_author_by_name(self, name):
+ """
+ Details of the Author
+ """
+ return self.session.query(Author).filter_by(display_name = name).first()
+
def save_author(self, author):
"""
Save the Author and refresh the cache
@@ -130,6 +142,8 @@
self.session.commit()
return True
except:
+ self.session.rollback()
+ log.error(u'Errow thrown %s', sys.exc_info()[1])
return False
def delete_author(self, authorid):
@@ -142,7 +156,8 @@
self.session.commit()
return True
except:
- log.error("Errow thrown %s", sys.exc_info()[1])
+ self.session.rollback()
+ log.error(u'Errow thrown %s', sys.exc_info()[1])
return False
def get_topics(self):
@@ -157,6 +172,12 @@
"""
return self.session.query(Topic).get(id)
+ def get_topic_by_name(self, name):
+ """
+ Details of the Topic
+ """
+ return self.session.query(Topic).filter_by(name = name).first()
+
def save_topic(self, topic):
"""
Save the Topic
@@ -166,6 +187,8 @@
self.session.commit()
return True
except:
+ self.session.rollback()
+ log.error(u'Errow thrown %s', sys.exc_info()[1])
return False
def delete_topic(self, topicid):
@@ -178,7 +201,8 @@
self.session.commit()
return True
except:
- log.error("Errow thrown %s", sys.exc_info()[1])
+ self.session.rollback()
+ log.error(u'Errow thrown %s', sys.exc_info()[1])
return False
def get_books(self):
@@ -193,6 +217,12 @@
"""
return self.session.query(Book).get(id)
+ def get_book_by_name(self, name):
+ """
+ Details of the Books
+ """
+ return self.session.query(Book).filter_by(name = name).first()
+
def save_book(self, book):
"""
Save the Book
@@ -202,6 +232,8 @@
self.session.commit()
return True
except:
+ self.session.rollback()
+ log.error(u'Errow thrown %s', sys.exc_info()[1])
return False
def delete_book(self, bookid):
@@ -214,5 +246,6 @@
self.session.commit()
return True
except:
- log.error("Errow thrown %s", sys.exc_info()[1])
+ self.session.rollback()
+ log.error(u'Errow thrown %s', sys.exc_info()[1])
return False
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2009-06-08 05:04:06 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2009-06-14 07:25:39 +0000
@@ -20,8 +20,7 @@
import logging
from PyQt4 import QtCore, QtGui
-
-from openlp.core.lib import MediaManagerItem, translate, ServiceItem
+from openlp.core.lib import MediaManagerItem, translate, ServiceItem, SongXMLParser
from openlp.plugins.songs.forms import EditSongForm
from openlp.plugins.songs.lib import TextListData
@@ -57,7 +56,7 @@
def __init__(self, parent, icon, title):
MediaManagerItem.__init__(self, parent, icon, title)
- self.edit_song_form = EditSongForm(self.parent.songmanager)
+ self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager)
def setupUi(self):
# Add a toolbar
@@ -174,7 +173,7 @@
if author_list != u'':
author_list = author_list + u', '
author_list = author_list + author.display_name
- song_detail = str(u'%s (%s)' % (str(song.title), str(author_list)))
+ song_detail = unicode(u'%s (%s)' % (unicode(song.title), unicode(author_list)))
self.SongListData.addRow(song.id,song_detail)
def onClearTextButtonClick(self):
@@ -184,14 +183,14 @@
self.SearchTextEdit.clear()
def onSearchTextEditChanged(self, text):
- search_length = 3
+ search_length = 1
if self.SearchTypeComboBox.currentIndex() == 1:
search_length = 7
if len(text) > search_length:
self.onSearchTextButtonClick()
def onSearchTextButtonClick(self):
- search_keywords = str(self.SearchTextEdit.displayText())
+ search_keywords = unicode(self.SearchTextEdit.displayText())
search_results = []
search_type = self.SearchTypeComboBox.currentIndex()
if search_type == 0:
@@ -206,6 +205,7 @@
self.displayResults(search_results)
def onSongNewClick(self):
+ self.edit_song_form.newSong()
self.edit_song_form.exec_()
def onSongEditClick(self):
@@ -231,20 +231,35 @@
def generateSlideData(self, service_item):
raw_slides =[]
raw_footer = []
+ author_list = u''
+ ccl = u''
indexes = self.SongListView.selectedIndexes()
for index in indexes:
id = self.SongListData.getId(index)
song = self.parent.songmanager.get_song(id)
- if song.theme_name == None or len(song.theme_name) == 0:
- service_item.theme = None
+ service_item.theme = song.theme_name
+ if song.lyrics.startswith(u'<?xml version='):
+ songXML=SongXMLParser(song.lyrics)
+ verseList = songXML.get_verses()
+ for verse in verseList:
+ service_item.add_from_text(verse[1][:30], verse[1])
else:
- service_item.theme = song.theme_name
- verses = song.lyrics.split(u'\n\n')
- for slide in verses:
- service_item.add_from_text(slide[:30], slide)
+ verses = song.lyrics.split(u'\n\n')
+ for slide in verses:
+ service_item.add_from_text(slide[:30], slide)
service_item.title = song.title
- raw_footer.append(str(u'%s \n%s \n' % (song.title, song.copyright )))
- raw_footer.append(song.copyright)
+ for author in song.authors:
+ if len(author_list) > 1:
+ author_list = author_list + u', '
+ author_list = author_list + unicode(author.display_name)
+ if song.ccli_number == None or len(song.ccli_number) == 0:
+ ccl = self.parent.settings.GeneralTab.CCLNumber
+ else:
+ ccl = unicode(song.ccli_number)
+ raw_footer.append(song.title)
+ raw_footer.append(author_list)
+ raw_footer.append(song.copyright )
+ raw_footer.append(unicode(translate(u'SongMediaItem', u'CCL Licence: ') + ccl ))
service_item.raw_footer = raw_footer
def onSongLiveClick(self):
=== modified file 'openlp/plugins/songs/lib/tables.py'
--- openlp/plugins/songs/lib/tables.py 2009-01-21 08:52:03 +0000
+++ openlp/plugins/songs/lib/tables.py 2009-06-13 16:15:55 +0000
@@ -38,7 +38,7 @@
# Definition of the "songs" table
songs_table = Table('songs', metadata,
- Column('id', types.Integer(), primary_key=True),
+ Column('id', types.Integer, primary_key=True),
Column('song_book_id', types.Integer, ForeignKey('song_books.id'), default=0),
Column('title', types.Unicode(255), nullable=False),
Column('lyrics', types.UnicodeText, nullable=False),
=== modified file 'openlp/plugins/songs/lib/textlistdata.py'
--- openlp/plugins/songs/lib/textlistdata.py 2009-06-05 16:24:42 +0000
+++ openlp/plugins/songs/lib/textlistdata.py 2009-06-13 16:15:55 +0000
@@ -42,7 +42,6 @@
def insertRow(self, row, id, title):
self.beginInsertRows(QtCore.QModelIndex(),row,row)
- log.debug("insert row %d:%s for id %d" % (row,title, id))
self.items.insert(row, (id, title))
self.endInsertRows()
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2009-06-10 15:37:33 +0000
+++ openlp/plugins/songs/songsplugin.py 2009-06-14 07:25:39 +0000
@@ -21,8 +21,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Plugin, Event
-from openlp.core.lib import EventType
+from openlp.core.lib import Plugin, Event, EventType, translate
from openlp.plugins.songs.lib import SongManager, SongsTab, SongMediaItem
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
OpenSongImportForm, OpenLPExportForm
@@ -54,55 +53,54 @@
def add_import_menu_item(self, import_menu):
self.ImportSongMenu = QtGui.QMenu(import_menu)
- self.ImportSongMenu.setObjectName("ImportSongMenu")
+ self.ImportSongMenu.setObjectName(u'ImportSongMenu')
self.ImportOpenSongItem = QtGui.QAction(import_menu)
- self.ImportOpenSongItem.setObjectName("ImportOpenSongItem")
+ self.ImportOpenSongItem.setObjectName(u'ImportOpenSongItem')
self.ImportOpenlp1Item = QtGui.QAction(import_menu)
- self.ImportOpenlp1Item.setObjectName("ImportOpenlp1Item")
+ self.ImportOpenlp1Item.setObjectName(u'ImportOpenlp1Item')
self.ImportOpenlp2Item = QtGui.QAction(import_menu)
- self.ImportOpenlp2Item.setObjectName("ImportOpenlp2Item")
+ self.ImportOpenlp2Item.setObjectName(u'ImportOpenlp2Item')
# Add to menus
self.ImportSongMenu.addAction(self.ImportOpenlp1Item)
self.ImportSongMenu.addAction(self.ImportOpenlp2Item)
self.ImportSongMenu.addAction(self.ImportOpenSongItem)
import_menu.addAction(self.ImportSongMenu.menuAction())
# Translations...
- self.ImportSongMenu.setTitle(QtGui.QApplication.translate("main_window", "&Song", None, QtGui.QApplication.UnicodeUTF8))
- self.ImportOpenSongItem.setText(QtGui.QApplication.translate("main_window", "OpenSong", None, QtGui.QApplication.UnicodeUTF8))
- self.ImportOpenlp1Item.setText(QtGui.QApplication.translate("main_window", "openlp.org 1.0", None, QtGui.QApplication.UnicodeUTF8))
- self.ImportOpenlp1Item.setToolTip(QtGui.QApplication.translate("main_window", "Export songs in openlp.org 1.0 format", None, QtGui.QApplication.UnicodeUTF8))
- self.ImportOpenlp1Item.setStatusTip(QtGui.QApplication.translate("main_window", "Export songs in openlp.org 1.0 format", None, QtGui.QApplication.UnicodeUTF8))
- self.ImportOpenlp2Item.setText(QtGui.QApplication.translate("main_window", "OpenLP 2.0", None, QtGui.QApplication.UnicodeUTF8))
- self.ImportOpenlp2Item.setToolTip(QtGui.QApplication.translate("main_window", "Export songs in OpenLP 2.0 format", None, QtGui.QApplication.UnicodeUTF8))
- self.ImportOpenlp2Item.setStatusTip(QtGui.QApplication.translate("main_window", "Export songs in OpenLP 2.0 format", None, QtGui.QApplication.UnicodeUTF8))
+ self.ImportSongMenu.setTitle(translate(u'main_window', u'&Song'))
+ self.ImportOpenSongItem.setText(translate(u'main_window', u'OpenSong'))
+ self.ImportOpenlp1Item.setText(translate(u'main_window', u'openlp.org 1.0'))
+ self.ImportOpenlp1Item.setToolTip(translate(u'main_window', u'Export songs in openlp.org 1.0 format'))
+ self.ImportOpenlp1Item.setStatusTip(translate(u'main_window', u'Export songs in openlp.org 1.0 format'))
+ self.ImportOpenlp2Item.setText(translate(u'main_window', u'OpenLP 2.0'))
+ self.ImportOpenlp2Item.setToolTip(translate(u'main_window', u'Export songs in OpenLP 2.0 format'))
+ self.ImportOpenlp2Item.setStatusTip(translate(u'main_window', u'Export songs in OpenLP 2.0 format'))
# Signals and slots
- QtCore.QObject.connect(self.ImportOpenlp1Item, QtCore.SIGNAL("triggered()"), self.onImportOpenlp1ItemClick)
- QtCore.QObject.connect(self.ImportOpenlp2Item, QtCore.SIGNAL("triggered()"), self.onImportOpenlp1ItemClick)
- QtCore.QObject.connect(self.ImportOpenSongItem, QtCore.SIGNAL("triggered()"), self.onImportOpenSongItemClick)
-
+ QtCore.QObject.connect(self.ImportOpenlp1Item, QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
+ QtCore.QObject.connect(self.ImportOpenlp2Item, QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
+ QtCore.QObject.connect(self.ImportOpenSongItem, QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
def add_export_menu_item(self, export_menu):
self.ExportSongMenu = QtGui.QMenu(export_menu)
- self.ExportSongMenu.setObjectName("ExportSongMenu")
+ self.ExportSongMenu.setObjectName(u'ExportSongMenu')
self.ExportOpenSongItem = QtGui.QAction(export_menu)
- self.ExportOpenSongItem.setObjectName("ExportOpenSongItem")
+ self.ExportOpenSongItem.setObjectName(u'ExportOpenSongItem')
self.ExportOpenlp1Item = QtGui.QAction(export_menu)
- self.ExportOpenlp1Item.setObjectName("ExportOpenlp1Item")
+ self.ExportOpenlp1Item.setObjectName(u'ExportOpenlp1Item')
self.ExportOpenlp2Item = QtGui.QAction(export_menu)
- self.ExportOpenlp2Item.setObjectName("ExportOpenlp2Item")
+ self.ExportOpenlp2Item.setObjectName(u'ExportOpenlp2Item')
# Add to menus
self.ExportSongMenu.addAction(self.ExportOpenlp1Item)
self.ExportSongMenu.addAction(self.ExportOpenlp2Item)
self.ExportSongMenu.addAction(self.ExportOpenSongItem)
export_menu.addAction(self.ExportSongMenu.menuAction())
# Translations...
- self.ExportSongMenu.setTitle(QtGui.QApplication.translate("main_window", "&Song", None, QtGui.QApplication.UnicodeUTF8))
- self.ExportOpenSongItem.setText(QtGui.QApplication.translate("main_window", "OpenSong", None, QtGui.QApplication.UnicodeUTF8))
- self.ExportOpenlp1Item.setText(QtGui.QApplication.translate("main_window", "openlp.org 1.0", None, QtGui.QApplication.UnicodeUTF8))
- self.ExportOpenlp2Item.setText(QtGui.QApplication.translate("main_window", "OpenLP 2.0", None, QtGui.QApplication.UnicodeUTF8))
+ self.ExportSongMenu.setTitle(translate(u'main_window', u'&Song'))
+ self.ExportOpenSongItem.setText(translate(u'main_window', u'OpenSong'))
+ self.ExportOpenlp1Item.setText(translate(u'main_window', u'openlp.org 1.0'))
+ self.ExportOpenlp2Item.setText(translate(u'main_window', u'OpenLP 2.0'))
# Signals and slots
- QtCore.QObject.connect(self.ExportOpenlp1Item, QtCore.SIGNAL("triggered()"), self.onExportOpenlp1ItemClicked)
- QtCore.QObject.connect(self.ExportOpenSongItem, QtCore.SIGNAL("triggered()"), self.onExportOpenSongItemClicked)
+ QtCore.QObject.connect(self.ExportOpenlp1Item, QtCore.SIGNAL(u'triggered()'), self.onExportOpenlp1ItemClicked)
+ QtCore.QObject.connect(self.ExportOpenSongItem, QtCore.SIGNAL(u'triggered()'), self.onExportOpenSongItemClicked)
def initialise(self):
self.media_item.displayResults(self.songmanager.get_songs())
@@ -126,7 +124,7 @@
log.debug(u'Handle event called with event %s' % event.event_type)
if event.event_type == EventType.ThemeListChanged:
log.debug(u'New Theme request received')
- #self.edit_custom_form.loadThemes(self.theme_manager.getThemes())
+ self.media_item.edit_song_form.loadThemes(self.theme_manager.getThemes())
if event.event_type == EventType.LoadServiceItem and event.payload == 'Song':
log.debug(u'Load Service Item received')
self.media_item.onSongAddClick()
@@ -136,3 +134,6 @@
if event.event_type == EventType.LiveShow and event.payload == 'Song':
log.debug(u'Load Live Show Item received')
self.media_item.onSongLiveClick()
+ if event.event_type == EventType.LoadSongList :
+ log.debug(u'Load Load Song List Item received')
+ self.media_item.displayResults(self.songmanager.get_songs())
=== modified file 'resources/songs/songs.sqlite'
Binary files resources/songs/songs.sqlite 2009-01-10 08:34:49 +0000 and resources/songs/songs.sqlite 2009-06-14 07:27:58 +0000 differ
Follow ups