Start of Song work

Clean up code to standards
This commit is contained in:
Tim Bentley 2009-06-10 18:12:03 +01:00
parent 356c788537
commit a576962181
6 changed files with 140 additions and 144 deletions

View File

@ -17,7 +17,7 @@ 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.forms.authorsdialog import Ui_AuthorsDialog
from openlp.plugins.songs.lib import TextListData
@ -36,13 +36,13 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
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 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
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()

View File

@ -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 @@ class Ui_EditSongDialog(object):
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,18 @@ class Ui_EditSongDialog(object):
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 +112,23 @@ class Ui_EditSongDialog(object):
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 +139,48 @@ class Ui_EditSongDialog(object):
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.setAlternatingRowColors(True)
self.AuthorsListView.setObjectName("AuthorsListView")
self.AuthorsListView.setObjectName(u'AuthorsListView')
self.AuthorsListView.setColumnCount(0)
self.AuthorsListView.setRowCount(0)
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 +188,7 @@ class Ui_EditSongDialog(object):
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 +197,24 @@ class Ui_EditSongDialog(object):
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 +222,62 @@ class Ui_EditSongDialog(object):
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.setAlternatingRowColors(True)
self.TopicsListView.setObjectName("TopicsListView")
self.TopicsListView.setObjectName(u'TopicsListView')
self.TopicsListView.setColumnCount(0)
self.TopicsListView.setRowCount(0)
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.pushButton.setObjectName(u'pushButton')
self.TopicRemoveLayout.addWidget(self.pushButton)
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 +285,12 @@ class Ui_EditSongDialog(object):
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)
@ -320,26 +310,26 @@ class Ui_EditSongDialog(object):
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.pushButton.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:'))

View File

@ -36,19 +36,19 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
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.AddTopicButton,
QtCore.SIGNAL('clicked()'), self.onAddTopicButtonClicked)
QtCore.SIGNAL(u'clicked()'), self.onAddTopicButtonClicked)
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)
# Create other objects and forms
self.songmanager = songmanager
self.authors_form = AuthorsForm(self.songmanager)
@ -95,7 +95,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.TitleEditItem.setText(self.song.title)
self.CopyrightEditItem.setText(self.song.copyright)
#self.LyricsTextEdit.setText(self.song.lyrics)
verses = self.song.lyrics.split('\n\n')
verses = self.song.lyrics.split(u'\n\n')
for verse in verses:
self.VerseListWidget.addItem(verse)
@ -136,7 +136,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadBooks()
def onAddVerseButtonClicked(self):
self.verse_form.setVerse('')
self.verse_form.setVerse(u'')
self.verse_form.exec_()
self.VerseListWidget.addItem(self.verse_form.getVerse())
@ -174,9 +174,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
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)
@ -191,3 +191,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.CopyrightEditItem.setText(text)
self.CopyrightEditItem.setFocus()
self.CopyrightEditItem.setCursorPosition(pos + 1)
def onAccept(self):
a = c

View File

@ -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'))

View File

@ -18,6 +18,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
"""
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 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
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 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
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)

View File

@ -16,10 +16,9 @@ You should have received a copy of the GNU General Public License along with
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 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
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 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
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)