Added the verse editing form and modified the song editing form to accommodate verses.

bzr-revno: 396
This commit is contained in:
Raoul Snyman 2009-03-07 21:38:59 +00:00
parent bd7577a0f1
commit 036dfef2eb
12 changed files with 349 additions and 78 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd"> <!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd">
<!-- eric4 user project file for project openlp.org 2.0 --> <!-- eric4 user project file for project openlp.org 2.0 -->
<!-- Saved: 2009-03-07, 01:40:29 --> <!-- Saved: 2009-03-07, 19:39:48 -->
<!-- Copyright (C) 2009 Raoul Snyman, raoulsnyman@openlp.org --> <!-- Copyright (C) 2009 Raoul Snyman, raoulsnyman@openlp.org -->
<UserProject version="4.0"> <UserProject version="4.0">
</UserProject> </UserProject>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Tasks SYSTEM "Tasks-4.2.dtd"> <!DOCTYPE Tasks SYSTEM "Tasks-4.2.dtd">
<!-- eric4 tasks file for project openlp.org 2.0 --> <!-- eric4 tasks file for project openlp.org 2.0 -->
<!-- Saved: 2009-03-07, 01:40:29 --> <!-- Saved: 2009-03-07, 19:39:59 -->
<Tasks version="4.2"> <Tasks version="4.2">
<Task priority="1" completed="False" bugfix="False"> <Task priority="1" completed="False" bugfix="False">
<Summary>TODO: what is the tags for bridge, pre-chorus?</Summary> <Summary>TODO: what is the tags for bridge, pre-chorus?</Summary>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Project SYSTEM "Project-4.6.dtd"> <!DOCTYPE Project SYSTEM "Project-4.6.dtd">
<!-- eric4 project file for project openlp.org 2.0 --> <!-- eric4 project file for project openlp.org 2.0 -->
<!-- Saved: 2009-03-07, 01:40:29 --> <!-- Saved: 2009-03-07, 19:39:48 -->
<!-- Copyright (C) 2009 Raoul Snyman, raoulsnyman@openlp.org --> <!-- Copyright (C) 2009 Raoul Snyman, raoulsnyman@openlp.org -->
<Project version="4.6"> <Project version="4.6">
<Language>en</Language> <Language>en</Language>
@ -133,11 +133,26 @@
<Source>openlp/plugins/videos/lib/__init__.py</Source> <Source>openlp/plugins/videos/lib/__init__.py</Source>
<Source>openlp/plugins/videos/lib/videotab.py</Source> <Source>openlp/plugins/videos/lib/videotab.py</Source>
<Source>openlp/plugins/bibles/lib/biblemediaitem.py</Source> <Source>openlp/plugins/bibles/lib/biblemediaitem.py</Source>
<Source>openlp/plugins/images/imageserviceitem.py</Source>
<Source>openlp/core/ui/test/test_service_manager.py</Source> <Source>openlp/core/ui/test/test_service_manager.py</Source>
<Source>openlp/plugins/images/lib/__init__.py</Source> <Source>openlp/plugins/images/lib/__init__.py</Source>
<Source>openlp/plugins/images/lib/imageserviceitem.py</Source> <Source>openlp/plugins/images/lib/imageserviceitem.py</Source>
<Source>openlp/plugins/images/lib/listwithpreviews.py</Source> <Source>openlp/plugins/images/lib/listwithpreviews.py</Source>
<Source>resources/forms/Ui_editversedialog.py</Source>
<Source>openlp/plugins/songs/forms/editverseform.py</Source>
<Source>openlp/plugins/songs/forms/editversedialog.py</Source>
<Source>openlp/plugins/custom/__init__.py</Source>
<Source>openlp/plugins/custom/customplugin.py</Source>
<Source>openlp/plugins/custom/forms/__init__.py</Source>
<Source>openlp/plugins/custom/forms/editcustomform.py</Source>
<Source>openlp/plugins/custom/forms/editcustomdialog.py</Source>
<Source>openlp/plugins/custom/lib/__init__.py</Source>
<Source>openlp/plugins/custom/lib/customtab.py</Source>
<Source>openlp/plugins/custom/lib/classes.py</Source>
<Source>openlp/plugins/custom/lib/tables.py</Source>
<Source>openlp/plugins/custom/lib/custommediaitem.py</Source>
<Source>openlp/plugins/custom/lib/meta.py</Source>
<Source>openlp/plugins/custom/lib/models.py</Source>
<Source>openlp/plugins/custom/lib/manager.py</Source>
</Sources> </Sources>
<Forms> <Forms>
<Form>resources/forms/openlpexportform.ui</Form> <Form>resources/forms/openlpexportform.ui</Form>
@ -156,6 +171,8 @@
<Form>resources/forms/songbookdialog.ui</Form> <Form>resources/forms/songbookdialog.ui</Form>
<Form>resources/forms/topicsdialog.ui</Form> <Form>resources/forms/topicsdialog.ui</Form>
<Form>resources/forms/editsongdialog.ui</Form> <Form>resources/forms/editsongdialog.ui</Form>
<Form>resources/forms/editversedialog.ui</Form>
<Form>resources/forms/editcustomdialog.ui</Form>
</Forms> </Forms>
<Translations> <Translations>
</Translations> </Translations>

View File

@ -39,7 +39,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
QtCore.QObject.connect(self.SaveButton, QtCore.SIGNAL("pressed()"), self.onSaveButtonPressed) QtCore.QObject.connect(self.SaveButton, QtCore.SIGNAL("pressed()"), self.onSaveButtonPressed)
QtCore.QObject.connect(self.DeleteButton, QtCore.SIGNAL("pressed()"), self.onDeleteButtonPressed) QtCore.QObject.connect(self.DeleteButton, QtCore.SIGNAL("pressed()"), self.onDeleteButtonPressed)
QtCore.QObject.connect(self.ClearButton, QtCore.SIGNAL("pressed()"), self.onClearButtonPressed) QtCore.QObject.connect(self.ClearButton, QtCore.SIGNAL("pressed()"), self.onClearButtonPressed)
QtCore.QObject.connect(self.TitleEdit, QtCore.SIGNAL("lostFocus()"), self.validate) QtCore.QObject.connect(self.TitleEdit, QtCore.SIGNAL("lostFocus()"), self.validate)
QtCore.QObject.connect(self.VerseListView, QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.onVerseListViewSelected) QtCore.QObject.connect(self.VerseListView, QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.onVerseListViewSelected)
QtCore.QObject.connect(self.VerseListView, QtCore.SIGNAL("itemClicked(QListWidgetItem*)"), self.onVerseListViewPressed) QtCore.QObject.connect(self.VerseListView, QtCore.SIGNAL("itemClicked(QListWidgetItem*)"), self.onVerseListViewPressed)
# Create other objects and forms # Create other objects and forms
@ -53,45 +53,45 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
for i in range (0, self.VerseListView.count()): for i in range (0, self.VerseListView.count()):
print self.VerseListView.item(i).text() print self.VerseListView.item(i).text()
if self.valid: if self.valid:
self.close() self.close()
def rejected(self): def rejected(self):
self.close() self.close()
def onClearButtonPressed(self): def onClearButtonPressed(self):
self.VerseTextEdit.clear() self.VerseTextEdit.clear()
def onVerseListViewPressed(self, item): def onVerseListViewPressed(self, item):
self.DeleteButton.setEnabled(True) self.DeleteButton.setEnabled(True)
self.EditButton.setEnabled(True) self.EditButton.setEnabled(True)
self.selectedRow = self.VerseListView.currentRow() self.selectedRow = self.VerseListView.currentRow()
def onVerseListViewSelected(self, item): def onVerseListViewSelected(self, item):
self.VerseTextEdit.setPlainText(item.text()) self.VerseTextEdit.setPlainText(item.text())
self.DeleteButton.setEnabled(False) self.DeleteButton.setEnabled(False)
self.EditButton.setEnabled(False) self.EditButton.setEnabled(False)
self.SaveButton.setEnabled(True) self.SaveButton.setEnabled(True)
def onAddButtonPressed(self): def onAddButtonPressed(self):
self.VerseListView.addItem(self.VerseTextEdit.toPlainText()) self.VerseListView.addItem(self.VerseTextEdit.toPlainText())
self.DeleteButton.setEnabled(False) self.DeleteButton.setEnabled(False)
self.VerseTextEdit.clear() self.VerseTextEdit.clear()
def onEditButtonPressed(self): def onEditButtonPressed(self):
self.VerseTextEdit.setPlainText(self.VerseListView.currentItem().text()) self.VerseTextEdit.setPlainText(self.VerseListView.currentItem().text())
self.DeleteButton.setEnabled(False) self.DeleteButton.setEnabled(False)
self.EditButton.setEnabled(False) self.EditButton.setEnabled(False)
self.SaveButton.setEnabled(True) self.SaveButton.setEnabled(True)
def onSaveButtonPressed(self): def onSaveButtonPressed(self):
self.VerseListView.currentItem().setText(self.VerseTextEdit.toPlainText()) self.VerseListView.currentItem().setText(self.VerseTextEdit.toPlainText())
self.SaveButton.setEnabled(False) self.SaveButton.setEnabled(False)
self.EditButton.setEnabled(False) self.EditButton.setEnabled(False)
def onDeleteButtonPressed(self): def onDeleteButtonPressed(self):
self.VerseListView.takeItem(self.VerseListView.currentRow()) self.VerseListView.takeItem(self.VerseListView.currentRow())
self.EditButton.setEnabled(False) self.EditButton.setEnabled(False)
def validate(self): def validate(self):
invalid = 0 invalid = 0
self.valid = True self.valid = True
@ -102,13 +102,12 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
self.TitleLabel.setStyleSheet('color: black') self.TitleLabel.setStyleSheet('color: black')
if invalid == 1: if invalid == 1:
self.valid = False self.valid = False
def initialise(self): def initialise(self):
self.valid = True self.valid = True
self.DeleteButton.setEnabled(False) self.DeleteButton.setEnabled(False)
self.EditButton.setEnabled(False) self.EditButton.setEnabled(False)
self.SaveButton.setEnabled(False) self.SaveButton.setEnabled(False)
pass
# list = self.songmanager.get_authors() # list = self.songmanager.get_authors()
# self.AuthorsSelectionComboItem.clear() # self.AuthorsSelectionComboItem.clear()
# for i in list: # for i in list:
@ -191,11 +190,3 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
def on_TitleEditItem_lostFocus(self): def on_TitleEditItem_lostFocus(self):
#self._validate_song() #self._validate_song()
pass pass
def onCopyrightInsertItemTriggered(self):
text = self.CopyrightEditItem.displayText()
pos = self.CopyrightEditItem.cursorPosition()
text = text[:pos] + u'©' + text[pos:]
self.CopyrightEditItem.setText(text)
self.CopyrightEditItem.setFocus()
self.CopyrightEditItem.setCursorPosition(pos + 1)

View File

@ -44,20 +44,21 @@ class CustomManager():
""" """
self.config = config self.config = config
log.debug('Custom Initialising') log.debug('Custom Initialising')
self.db_url = u'' """self.db_url = u''
db_type = self.config.get_config(u'db type') db_type = self.config.get_config(u'db type')
if db_type == u'sqlite': if db_type == u'sqlite':
self.db_url = u'sqlite:///' + self.config.get_data_path() + \ self.db_url = u'sqlite:///' + self.config.get_data_path() + \
u'/custom.sqlite' u'/custom.sqlite'
else: else:
self.db_url = db_type + 'u://' + \ self.db_url = u'%s://%s:%s@%s/%s' % \
self.config.get_config(u'db username') + u':' + \ (db_type, self.config.get_config(u'db username'),
self.config.get_config(u'db password') + u'@' + \ self.config.get_config(u'db password'),
self.config.get_config(u'db hostname') + u'/' + \ self.config.get_config(u'db hostname'),
self.config.get_config(u'db database') self.config.get_config(u'db database'))
self.session = init_models(self.db_url) self.session = init_models(self.db_url)
if not custom_slide_table.exists(): if not custom_slide_table.exists():
metadata.create_all() metadata.create_all()
"""
log.debug('Custom Initialised') log.debug('Custom Initialised')
# #
# def process_dialog(self, dialogobject): # def process_dialog(self, dialogobject):

View File

@ -22,6 +22,7 @@ from editsongform import EditSongForm
from authorsform import AuthorsForm from authorsform import AuthorsForm
from topicsform import TopicsForm from topicsform import TopicsForm
from songbookform import SongBookForm from songbookform import SongBookForm
from editverseform import EditVerseForm
from openlpexportform import OpenLPExportForm from openlpexportform import OpenLPExportForm
from openlpimportform import OpenLPImportForm from openlpimportform import OpenLPImportForm

View File

@ -12,10 +12,11 @@ from PyQt4 import QtCore, QtGui
class Ui_EditSongDialog(object): class Ui_EditSongDialog(object):
def setupUi(self, EditSongDialog): def setupUi(self, EditSongDialog):
EditSongDialog.setObjectName("EditSongDialog") EditSongDialog.setObjectName("EditSongDialog")
EditSongDialog.resize(786, 669) EditSongDialog.resize(786, 704)
icon = QtGui.QIcon() icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
EditSongDialog.setWindowIcon(icon) EditSongDialog.setWindowIcon(icon)
EditSongDialog.setModal(True)
self.EditSongLayout = QtGui.QVBoxLayout(EditSongDialog) self.EditSongLayout = QtGui.QVBoxLayout(EditSongDialog)
self.EditSongLayout.setSpacing(8) self.EditSongLayout.setSpacing(8)
self.EditSongLayout.setMargin(8) self.EditSongLayout.setMargin(8)
@ -52,16 +53,34 @@ class Ui_EditSongDialog(object):
self.LyricsLabel = QtGui.QLabel(self.TextWidget) self.LyricsLabel = QtGui.QLabel(self.TextWidget)
self.LyricsLabel.setObjectName("LyricsLabel") self.LyricsLabel.setObjectName("LyricsLabel")
self.DetailsLayout.addWidget(self.LyricsLabel) self.DetailsLayout.addWidget(self.LyricsLabel)
self.LyricsTextEdit = QtGui.QTextEdit(self.TextWidget) self.VerseEditWidget = QtGui.QWidget(self.TextWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.MinimumExpanding) self.VerseEditWidget.setObjectName("VerseEditWidget")
sizePolicy.setHorizontalStretch(0) self.VerseEditLayout = QtGui.QVBoxLayout(self.VerseEditWidget)
sizePolicy.setVerticalStretch(0) self.VerseEditLayout.setSpacing(8)
sizePolicy.setHeightForWidth(self.LyricsTextEdit.sizePolicy().hasHeightForWidth()) self.VerseEditLayout.setMargin(0)
self.LyricsTextEdit.setSizePolicy(sizePolicy) self.VerseEditLayout.setObjectName("VerseEditLayout")
self.LyricsTextEdit.setLineWrapMode(QtGui.QTextEdit.NoWrap) self.VerseListWidget = QtGui.QListWidget(self.VerseEditWidget)
self.LyricsTextEdit.setAcceptRichText(False) self.VerseListWidget.setObjectName("VerseListWidget")
self.LyricsTextEdit.setObjectName("LyricsTextEdit") self.VerseEditLayout.addWidget(self.VerseListWidget)
self.DetailsLayout.addWidget(self.LyricsTextEdit) self.VerseButtonWidget = QtGui.QWidget(self.VerseEditWidget)
self.VerseButtonWidget.setObjectName("VerseButtonWidget")
self.VerseButtonLayout = QtGui.QHBoxLayout(self.VerseButtonWidget)
self.VerseButtonLayout.setSpacing(8)
self.VerseButtonLayout.setMargin(0)
self.VerseButtonLayout.setObjectName("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.VerseButtonLayout.addWidget(self.AddButton)
self.EditButton = QtGui.QPushButton(self.VerseButtonWidget)
self.EditButton.setObjectName("EditButton")
self.VerseButtonLayout.addWidget(self.EditButton)
self.DeleteButton = QtGui.QPushButton(self.VerseButtonWidget)
self.DeleteButton.setObjectName("DeleteButton")
self.VerseButtonLayout.addWidget(self.DeleteButton)
self.VerseEditLayout.addWidget(self.VerseButtonWidget)
self.DetailsLayout.addWidget(self.VerseEditWidget)
self.VerseOrderLabel = QtGui.QLabel(self.TextWidget) self.VerseOrderLabel = QtGui.QLabel(self.TextWidget)
self.VerseOrderLabel.setObjectName("VerseOrderLabel") self.VerseOrderLabel.setObjectName("VerseOrderLabel")
self.DetailsLayout.addWidget(self.VerseOrderLabel) self.DetailsLayout.addWidget(self.VerseOrderLabel)
@ -72,11 +91,12 @@ class Ui_EditSongDialog(object):
self.CommentsLabel.setObjectName("CommentsLabel") self.CommentsLabel.setObjectName("CommentsLabel")
self.DetailsLayout.addWidget(self.CommentsLabel) self.DetailsLayout.addWidget(self.CommentsLabel)
self.CommentsEdit = QtGui.QTextEdit(self.TextWidget) self.CommentsEdit = QtGui.QTextEdit(self.TextWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.CommentsEdit.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.CommentsEdit.sizePolicy().hasHeightForWidth())
self.CommentsEdit.setSizePolicy(sizePolicy) self.CommentsEdit.setSizePolicy(sizePolicy)
self.CommentsEdit.setMaximumSize(QtCore.QSize(16777215, 84))
self.CommentsEdit.setObjectName("CommentsEdit") self.CommentsEdit.setObjectName("CommentsEdit")
self.DetailsLayout.addWidget(self.CommentsEdit) self.DetailsLayout.addWidget(self.CommentsEdit)
self.ThemeGroupBox = QtGui.QGroupBox(self.TextWidget) self.ThemeGroupBox = QtGui.QGroupBox(self.TextWidget)
@ -147,8 +167,8 @@ class Ui_EditSongDialog(object):
self.AuthorRemoveLayout.setSpacing(8) self.AuthorRemoveLayout.setSpacing(8)
self.AuthorRemoveLayout.setMargin(0) self.AuthorRemoveLayout.setMargin(0)
self.AuthorRemoveLayout.setObjectName("AuthorRemoveLayout") self.AuthorRemoveLayout.setObjectName("AuthorRemoveLayout")
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.AuthorRemoveLayout.addItem(spacerItem) self.AuthorRemoveLayout.addItem(spacerItem1)
self.AuthorRemoveItem = QtGui.QPushButton(self.AuthorRemoveWidget) self.AuthorRemoveItem = QtGui.QPushButton(self.AuthorRemoveWidget)
self.AuthorRemoveItem.setObjectName("AuthorRemoveItem") self.AuthorRemoveItem.setObjectName("AuthorRemoveItem")
self.AuthorRemoveLayout.addWidget(self.AuthorRemoveItem) self.AuthorRemoveLayout.addWidget(self.AuthorRemoveItem)
@ -226,8 +246,8 @@ class Ui_EditSongDialog(object):
self.TopicRemoveLayout.setSpacing(8) self.TopicRemoveLayout.setSpacing(8)
self.TopicRemoveLayout.setMargin(0) self.TopicRemoveLayout.setMargin(0)
self.TopicRemoveLayout.setObjectName("TopicRemoveLayout") self.TopicRemoveLayout.setObjectName("TopicRemoveLayout")
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.TopicRemoveLayout.addItem(spacerItem1) self.TopicRemoveLayout.addItem(spacerItem2)
self.pushButton = QtGui.QPushButton(self.TopicRemoveWidget) self.pushButton = QtGui.QPushButton(self.TopicRemoveWidget)
self.pushButton.setObjectName("pushButton") self.pushButton.setObjectName("pushButton")
self.TopicRemoveLayout.addWidget(self.pushButton) self.TopicRemoveLayout.addWidget(self.pushButton)
@ -282,8 +302,7 @@ class Ui_EditSongDialog(object):
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), EditSongDialog.close) QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), EditSongDialog.close)
QtCore.QMetaObject.connectSlotsByName(EditSongDialog) QtCore.QMetaObject.connectSlotsByName(EditSongDialog)
EditSongDialog.setTabOrder(self.TitleEditItem, self.AlternativeEdit) EditSongDialog.setTabOrder(self.TitleEditItem, self.AlternativeEdit)
EditSongDialog.setTabOrder(self.AlternativeEdit, self.LyricsTextEdit) EditSongDialog.setTabOrder(self.AlternativeEdit, self.VerseOrderEdit)
EditSongDialog.setTabOrder(self.LyricsTextEdit, self.VerseOrderEdit)
EditSongDialog.setTabOrder(self.VerseOrderEdit, self.CommentsEdit) EditSongDialog.setTabOrder(self.VerseOrderEdit, self.CommentsEdit)
EditSongDialog.setTabOrder(self.CommentsEdit, self.ThemeSelectionComboItem) EditSongDialog.setTabOrder(self.CommentsEdit, self.ThemeSelectionComboItem)
EditSongDialog.setTabOrder(self.ThemeSelectionComboItem, self.ThemeAddItem) EditSongDialog.setTabOrder(self.ThemeSelectionComboItem, self.ThemeAddItem)
@ -305,6 +324,9 @@ class Ui_EditSongDialog(object):
self.TitleLabel.setText(QtGui.QApplication.translate("EditSongDialog", "Title:", 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.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.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.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.CommentsLabel.setText(QtGui.QApplication.translate("EditSongDialog", "Comments:", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeGroupBox.setTitle(QtGui.QApplication.translate("EditSongDialog", "Theme", None, QtGui.QApplication.UnicodeUTF8)) self.ThemeGroupBox.setTitle(QtGui.QApplication.translate("EditSongDialog", "Theme", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -22,6 +22,7 @@ from PyQt4 import Qt, QtCore, QtGui
from authorsform import AuthorsForm from authorsform import AuthorsForm
from topicsform import TopicsForm from topicsform import TopicsForm
from songbookform import SongBookForm from songbookform import SongBookForm
from editverseform import EditVerseForm
from editsongdialog import Ui_EditSongDialog from editsongdialog import Ui_EditSongDialog
@ -29,22 +30,33 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
""" """
Class documentation goes here. Class documentation goes here.
""" """
def __init__(self, songmanager, parent = None): def __init__(self, songmanager, parent=None):
""" """
Constructor Constructor
""" """
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
# Connecting signals and slots # Connecting signals and slots
QtCore.QObject.connect(self.AddAuthorsButton, QtCore.SIGNAL('clicked()'), self.onAddAuthorsButtonClicked) QtCore.QObject.connect(self.AddAuthorsButton,
QtCore.QObject.connect(self.AddTopicButton, QtCore.SIGNAL('clicked()'), self.onAddTopicButtonClicked) QtCore.SIGNAL('clicked()'), self.onAddAuthorsButtonClicked)
QtCore.QObject.connect(self.AddSongBookButton, QtCore.SIGNAL('clicked()'), self.onAddSongBookButtonClicked) QtCore.QObject.connect(self.AddTopicButton,
QtCore.QObject.connect(self.CopyrightInsertItem, QtCore.SIGNAL('clicked()'), self.onCopyrightInsertItemTriggered) QtCore.SIGNAL('clicked()'), self.onAddTopicButtonClicked)
QtCore.QObject.connect(self.AddSongBookButton,
QtCore.SIGNAL('clicked()'), self.onAddSongBookButtonClicked)
QtCore.QObject.connect(self.CopyrightInsertItem,
QtCore.SIGNAL('clicked()'), self.onCopyrightInsertItemTriggered)
QtCore.QObject.connect(self.AddButton,
QtCore.SIGNAL('clicked()'), self.onAddVerseButtonClicked)
QtCore.QObject.connect(self.EditButton,
QtCore.SIGNAL('clicked()'), self.onEditVerseButtonClicked)
QtCore.QObject.connect(self.DeleteButton,
QtCore.SIGNAL('clicked()'), self.onDeleteVerseButtonClicked)
# Create other objects and forms # Create other objects and forms
self.songmanager = songmanager self.songmanager = songmanager
self.authors_form = AuthorsForm(self.songmanager) self.authors_form = AuthorsForm(self.songmanager)
self.topics_form = TopicsForm(self.songmanager) self.topics_form = TopicsForm(self.songmanager)
self.song_book_form = SongBookForm(self.songmanager) self.song_book_form = SongBookForm(self.songmanager)
self.verse_form = EditVerseForm()
self.initialise() self.initialise()
self.AuthorsListView.setColumnCount(2) self.AuthorsListView.setColumnCount(2)
@ -64,8 +76,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def loadSong(self, id): def loadSong(self, id):
self.song = self.songmanager.get_song(id) self.song = self.songmanager.get_song(id)
self.TitleEditItem.setText(self.song.title) self.TitleEditItem.setText(self.song.title)
self.LyricsTextEdit.setText(self.song.lyrics)
self.CopyrightEditItem.setText(self.song.copyright) 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.clear() # clear the results
self.AuthorsListView.setHorizontalHeaderLabels(QtCore.QStringList(['', u'Author'])) self.AuthorsListView.setHorizontalHeaderLabels(QtCore.QStringList(['', u'Author']))
@ -104,6 +119,21 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.song_book_form.load_form() self.song_book_form.load_form()
self.song_book_form.exec_() self.song_book_form.exec_()
def onAddVerseButtonClicked(self):
self.verse_form.setVerse('')
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())
def onDeleteVerseButtonClicked(self):
item = self.VerseListWidget.takeItem(self.VerseListWidget.currentRow())
item = None
def _validate_song(self): def _validate_song(self):
""" """
Check the validity of the form. Only display the 'save' if the data can be saved. Check the validity of the form. Only display the 'save' if the data can be saved.

View File

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/raoul/Projects/openlp-2/resources/forms/editversedialog.ui'
#
# Created: Sat Mar 7 11:11:49 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_EditVerseDialog(object):
def setupUi(self, EditVerseDialog):
EditVerseDialog.setObjectName("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.VerseTextEdit = QtGui.QTextEdit(EditVerseDialog)
self.VerseTextEdit.setAcceptRichText(False)
self.VerseTextEdit.setObjectName("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.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.QMetaObject.connectSlotsByName(EditVerseDialog)
def retranslateUi(self, EditVerseDialog):
EditVerseDialog.setWindowTitle(QtGui.QApplication.translate("EditVerseDialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
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 Qt, QtCore, QtGui
from editversedialog import Ui_EditVerseDialog
class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
"""
This is the form that is used to edit the verses of the song.
"""
def __init__(self, parent=None):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
def setVerse(self, verse):
self.VerseTextEdit.setPlainText(verse)
def getVerse(self):
return self.VerseTextEdit.toPlainText()

View File

@ -1,12 +1,12 @@
<ui version="4.0" > <ui version="4.0" >
<class>EditSongDialog</class> <class>EditSongDialog</class>
<widget class="QWidget" name="EditSongDialog" > <widget class="QDialog" name="EditSongDialog" >
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>786</width> <width>786</width>
<height>669</height> <height>704</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
@ -16,6 +16,9 @@
<iconset resource="../images/openlp-2.qrc" > <iconset resource="../images/openlp-2.qrc" >
<normaloff>:/icon/openlp.org-icon-32.bmp</normaloff>:/icon/openlp.org-icon-32.bmp</iconset> <normaloff>:/icon/openlp.org-icon-32.bmp</normaloff>:/icon/openlp.org-icon-32.bmp</iconset>
</property> </property>
<property name="modal" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="EditSongLayout" > <layout class="QVBoxLayout" name="EditSongLayout" >
<property name="spacing" > <property name="spacing" >
<number>8</number> <number>8</number>
@ -76,19 +79,64 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTextEdit" name="LyricsTextEdit" > <widget class="QWidget" native="1" name="VerseEditWidget" >
<property name="sizePolicy" > <layout class="QVBoxLayout" name="VerseEditLayout" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" > <property name="spacing" >
<horstretch>0</horstretch> <number>8</number>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="margin" >
</property> <number>0</number>
<property name="lineWrapMode" > </property>
<enum>QTextEdit::NoWrap</enum> <item>
</property> <widget class="QListWidget" name="VerseListWidget" />
<property name="acceptRichText" > </item>
<bool>false</bool> <item>
</property> <widget class="QWidget" native="1" name="VerseButtonWidget" >
<layout class="QHBoxLayout" name="VerseButtonLayout" >
<property name="spacing" >
<number>8</number>
</property>
<property name="margin" >
<number>0</number>
</property>
<item>
<spacer name="ButtonSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="AddButton" >
<property name="text" >
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="EditButton" >
<property name="text" >
<string>Edit</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="DeleteButton" >
<property name="text" >
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
@ -111,11 +159,17 @@
<item> <item>
<widget class="QTextEdit" name="CommentsEdit" > <widget class="QTextEdit" name="CommentsEdit" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" > <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>84</height>
</size>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -504,7 +558,6 @@
<tabstops> <tabstops>
<tabstop>TitleEditItem</tabstop> <tabstop>TitleEditItem</tabstop>
<tabstop>AlternativeEdit</tabstop> <tabstop>AlternativeEdit</tabstop>
<tabstop>LyricsTextEdit</tabstop>
<tabstop>VerseOrderEdit</tabstop> <tabstop>VerseOrderEdit</tabstop>
<tabstop>CommentsEdit</tabstop> <tabstop>CommentsEdit</tabstop>
<tabstop>ThemeSelectionComboItem</tabstop> <tabstop>ThemeSelectionComboItem</tabstop>

View File

@ -0,0 +1,79 @@
<ui version="4.0" >
<class>EditVerseDialog</class>
<widget class="QDialog" name="EditVerseDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>492</width>
<height>373</height>
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
</property>
<property name="modal" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="DialogLayout" >
<property name="spacing" >
<number>8</number>
</property>
<property name="margin" >
<number>8</number>
</property>
<item>
<widget class="QTextEdit" name="VerseTextEdit" >
<property name="acceptRichText" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="ButtonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>ButtonBox</sender>
<signal>accepted()</signal>
<receiver>EditVerseDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>ButtonBox</sender>
<signal>rejected()</signal>
<receiver>EditVerseDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>