From 036dfef2eb2ff4240659aa0178f43b7c9c8cecc6 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 7 Mar 2009 21:38:59 +0000 Subject: [PATCH] Added the verse editing form and modified the song editing form to accommodate verses. bzr-revno: 396 --- .eric4project/openlp.org 2.0.e4q | 2 +- .eric4project/openlp.org 2.0.e4t | 2 +- openlp.org 2.0.e4p | 21 ++++- openlp/plugins/custom/forms/editcustomform.py | 45 ++++------ openlp/plugins/custom/lib/manager.py | 13 +-- openlp/plugins/songs/forms/__init__.py | 1 + openlp/plugins/songs/forms/editsongdialog.py | 58 +++++++++---- openlp/plugins/songs/forms/editsongform.py | 42 +++++++-- openlp/plugins/songs/forms/editversedialog.py | 37 ++++++++ openlp/plugins/songs/forms/editverseform.py | 40 +++++++++ resources/forms/editsongdialog.ui | 87 +++++++++++++++---- resources/forms/editversedialog.ui | 79 +++++++++++++++++ 12 files changed, 349 insertions(+), 78 deletions(-) create mode 100644 openlp/plugins/songs/forms/editversedialog.py create mode 100644 openlp/plugins/songs/forms/editverseform.py create mode 100644 resources/forms/editversedialog.ui diff --git a/.eric4project/openlp.org 2.0.e4q b/.eric4project/openlp.org 2.0.e4q index c8614a2b0..df4bfb535 100644 --- a/.eric4project/openlp.org 2.0.e4q +++ b/.eric4project/openlp.org 2.0.e4q @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/.eric4project/openlp.org 2.0.e4t b/.eric4project/openlp.org 2.0.e4t index d304e2f5d..9a0cb2bdc 100644 --- a/.eric4project/openlp.org 2.0.e4t +++ b/.eric4project/openlp.org 2.0.e4t @@ -1,7 +1,7 @@ - + TODO: what is the tags for bridge, pre-chorus? diff --git a/openlp.org 2.0.e4p b/openlp.org 2.0.e4p index 077a5e2ea..54ab8cd13 100644 --- a/openlp.org 2.0.e4p +++ b/openlp.org 2.0.e4p @@ -1,7 +1,7 @@ - + en @@ -133,11 +133,26 @@ openlp/plugins/videos/lib/__init__.py openlp/plugins/videos/lib/videotab.py openlp/plugins/bibles/lib/biblemediaitem.py - openlp/plugins/images/imageserviceitem.py openlp/core/ui/test/test_service_manager.py openlp/plugins/images/lib/__init__.py openlp/plugins/images/lib/imageserviceitem.py openlp/plugins/images/lib/listwithpreviews.py + resources/forms/Ui_editversedialog.py + openlp/plugins/songs/forms/editverseform.py + openlp/plugins/songs/forms/editversedialog.py + openlp/plugins/custom/__init__.py + openlp/plugins/custom/customplugin.py + openlp/plugins/custom/forms/__init__.py + openlp/plugins/custom/forms/editcustomform.py + openlp/plugins/custom/forms/editcustomdialog.py + openlp/plugins/custom/lib/__init__.py + openlp/plugins/custom/lib/customtab.py + openlp/plugins/custom/lib/classes.py + openlp/plugins/custom/lib/tables.py + openlp/plugins/custom/lib/custommediaitem.py + openlp/plugins/custom/lib/meta.py + openlp/plugins/custom/lib/models.py + openlp/plugins/custom/lib/manager.py
resources/forms/openlpexportform.ui
@@ -156,6 +171,8 @@
resources/forms/songbookdialog.ui
resources/forms/topicsdialog.ui
resources/forms/editsongdialog.ui
+
resources/forms/editversedialog.ui
+
resources/forms/editcustomdialog.ui
diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 01e511038..f218bb295 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -39,7 +39,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): QtCore.QObject.connect(self.SaveButton, QtCore.SIGNAL("pressed()"), self.onSaveButtonPressed) QtCore.QObject.connect(self.DeleteButton, QtCore.SIGNAL("pressed()"), self.onDeleteButtonPressed) 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("itemClicked(QListWidgetItem*)"), self.onVerseListViewPressed) # Create other objects and forms @@ -53,45 +53,45 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): for i in range (0, self.VerseListView.count()): print self.VerseListView.item(i).text() if self.valid: - self.close() - + self.close() + def rejected(self): self.close() - + def onClearButtonPressed(self): self.VerseTextEdit.clear() def onVerseListViewPressed(self, item): self.DeleteButton.setEnabled(True) self.EditButton.setEnabled(True) - self.selectedRow = self.VerseListView.currentRow() - + self.selectedRow = self.VerseListView.currentRow() + def onVerseListViewSelected(self, item): self.VerseTextEdit.setPlainText(item.text()) self.DeleteButton.setEnabled(False) - self.EditButton.setEnabled(False) + self.EditButton.setEnabled(False) self.SaveButton.setEnabled(True) - + def onAddButtonPressed(self): self.VerseListView.addItem(self.VerseTextEdit.toPlainText()) self.DeleteButton.setEnabled(False) - self.VerseTextEdit.clear() - + self.VerseTextEdit.clear() + def onEditButtonPressed(self): self.VerseTextEdit.setPlainText(self.VerseListView.currentItem().text()) self.DeleteButton.setEnabled(False) - self.EditButton.setEnabled(False) + self.EditButton.setEnabled(False) self.SaveButton.setEnabled(True) - + def onSaveButtonPressed(self): self.VerseListView.currentItem().setText(self.VerseTextEdit.toPlainText()) self.SaveButton.setEnabled(False) - self.EditButton.setEnabled(False) - + self.EditButton.setEnabled(False) + def onDeleteButtonPressed(self): self.VerseListView.takeItem(self.VerseListView.currentRow()) - self.EditButton.setEnabled(False) - + self.EditButton.setEnabled(False) + def validate(self): invalid = 0 self.valid = True @@ -102,13 +102,12 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): self.TitleLabel.setStyleSheet('color: black') if invalid == 1: self.valid = False - + def initialise(self): self.valid = True self.DeleteButton.setEnabled(False) self.EditButton.setEnabled(False) - self.SaveButton.setEnabled(False) - pass + self.SaveButton.setEnabled(False) # list = self.songmanager.get_authors() # self.AuthorsSelectionComboItem.clear() # for i in list: @@ -191,11 +190,3 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog): def on_TitleEditItem_lostFocus(self): #self._validate_song() 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) diff --git a/openlp/plugins/custom/lib/manager.py b/openlp/plugins/custom/lib/manager.py index 0c318740c..d0f821009 100644 --- a/openlp/plugins/custom/lib/manager.py +++ b/openlp/plugins/custom/lib/manager.py @@ -44,20 +44,21 @@ class CustomManager(): """ self.config = config log.debug('Custom Initialising') - self.db_url = u'' + """self.db_url = u'' db_type = self.config.get_config(u'db type') if db_type == u'sqlite': self.db_url = u'sqlite:///' + self.config.get_data_path() + \ u'/custom.sqlite' else: - self.db_url = db_type + 'u://' + \ - self.config.get_config(u'db username') + u':' + \ - self.config.get_config(u'db password') + u'@' + \ - self.config.get_config(u'db hostname') + u'/' + \ - self.config.get_config(u'db database') + self.db_url = u'%s://%s:%s@%s/%s' % \ + (db_type, self.config.get_config(u'db username'), + self.config.get_config(u'db password'), + self.config.get_config(u'db hostname'), + self.config.get_config(u'db database')) self.session = init_models(self.db_url) if not custom_slide_table.exists(): metadata.create_all() + """ log.debug('Custom Initialised') # # def process_dialog(self, dialogobject): diff --git a/openlp/plugins/songs/forms/__init__.py b/openlp/plugins/songs/forms/__init__.py index a646d95fc..a6ddc1f72 100644 --- a/openlp/plugins/songs/forms/__init__.py +++ b/openlp/plugins/songs/forms/__init__.py @@ -22,6 +22,7 @@ from editsongform import EditSongForm from authorsform import AuthorsForm from topicsform import TopicsForm from songbookform import SongBookForm +from editverseform import EditVerseForm from openlpexportform import OpenLPExportForm from openlpimportform import OpenLPImportForm diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 70c501e15..437bf8ea2 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -12,10 +12,11 @@ from PyQt4 import QtCore, QtGui class Ui_EditSongDialog(object): def setupUi(self, EditSongDialog): EditSongDialog.setObjectName("EditSongDialog") - EditSongDialog.resize(786, 669) + EditSongDialog.resize(786, 704) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), 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) @@ -52,16 +53,34 @@ class Ui_EditSongDialog(object): self.LyricsLabel = QtGui.QLabel(self.TextWidget) self.LyricsLabel.setObjectName("LyricsLabel") self.DetailsLayout.addWidget(self.LyricsLabel) - self.LyricsTextEdit = QtGui.QTextEdit(self.TextWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.MinimumExpanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.LyricsTextEdit.sizePolicy().hasHeightForWidth()) - self.LyricsTextEdit.setSizePolicy(sizePolicy) - self.LyricsTextEdit.setLineWrapMode(QtGui.QTextEdit.NoWrap) - self.LyricsTextEdit.setAcceptRichText(False) - self.LyricsTextEdit.setObjectName("LyricsTextEdit") - self.DetailsLayout.addWidget(self.LyricsTextEdit) + self.VerseEditWidget = QtGui.QWidget(self.TextWidget) + self.VerseEditWidget.setObjectName("VerseEditWidget") + self.VerseEditLayout = QtGui.QVBoxLayout(self.VerseEditWidget) + self.VerseEditLayout.setSpacing(8) + self.VerseEditLayout.setMargin(0) + self.VerseEditLayout.setObjectName("VerseEditLayout") + self.VerseListWidget = QtGui.QListWidget(self.VerseEditWidget) + self.VerseListWidget.setObjectName("VerseListWidget") + self.VerseEditLayout.addWidget(self.VerseListWidget) + 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.setObjectName("VerseOrderLabel") self.DetailsLayout.addWidget(self.VerseOrderLabel) @@ -72,11 +91,12 @@ class Ui_EditSongDialog(object): self.CommentsLabel.setObjectName("CommentsLabel") self.DetailsLayout.addWidget(self.CommentsLabel) 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.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.CommentsEdit.sizePolicy().hasHeightForWidth()) self.CommentsEdit.setSizePolicy(sizePolicy) + self.CommentsEdit.setMaximumSize(QtCore.QSize(16777215, 84)) self.CommentsEdit.setObjectName("CommentsEdit") self.DetailsLayout.addWidget(self.CommentsEdit) self.ThemeGroupBox = QtGui.QGroupBox(self.TextWidget) @@ -147,8 +167,8 @@ class Ui_EditSongDialog(object): self.AuthorRemoveLayout.setSpacing(8) self.AuthorRemoveLayout.setMargin(0) self.AuthorRemoveLayout.setObjectName("AuthorRemoveLayout") - spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.AuthorRemoveLayout.addItem(spacerItem) + 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.AuthorRemoveLayout.addWidget(self.AuthorRemoveItem) @@ -226,8 +246,8 @@ class Ui_EditSongDialog(object): self.TopicRemoveLayout.setSpacing(8) self.TopicRemoveLayout.setMargin(0) self.TopicRemoveLayout.setObjectName("TopicRemoveLayout") - spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.TopicRemoveLayout.addItem(spacerItem1) + 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) @@ -282,8 +302,7 @@ class Ui_EditSongDialog(object): QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL("accepted()"), EditSongDialog.close) QtCore.QMetaObject.connectSlotsByName(EditSongDialog) EditSongDialog.setTabOrder(self.TitleEditItem, self.AlternativeEdit) - EditSongDialog.setTabOrder(self.AlternativeEdit, self.LyricsTextEdit) - EditSongDialog.setTabOrder(self.LyricsTextEdit, self.VerseOrderEdit) + EditSongDialog.setTabOrder(self.AlternativeEdit, self.VerseOrderEdit) EditSongDialog.setTabOrder(self.VerseOrderEdit, self.CommentsEdit) EditSongDialog.setTabOrder(self.CommentsEdit, self.ThemeSelectionComboItem) 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.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)) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index e249c23fd..b1f79bf38 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -22,6 +22,7 @@ from PyQt4 import Qt, QtCore, QtGui from authorsform import AuthorsForm from topicsform import TopicsForm from songbookform import SongBookForm +from editverseform import EditVerseForm from editsongdialog import Ui_EditSongDialog @@ -29,22 +30,33 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): """ Class documentation goes here. """ - def __init__(self, songmanager, parent = None): + def __init__(self, songmanager, parent=None): """ Constructor """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) # Connecting signals and slots - QtCore.QObject.connect(self.AddAuthorsButton, QtCore.SIGNAL('clicked()'), self.onAddAuthorsButtonClicked) - QtCore.QObject.connect(self.AddTopicButton, 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.AddAuthorsButton, + QtCore.SIGNAL('clicked()'), self.onAddAuthorsButtonClicked) + QtCore.QObject.connect(self.AddTopicButton, + 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 self.songmanager = songmanager 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) @@ -64,8 +76,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def loadSong(self, id): self.song = self.songmanager.get_song(id) self.TitleEditItem.setText(self.song.title) - self.LyricsTextEdit.setText(self.song.lyrics) 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.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.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): """ Check the validity of the form. Only display the 'save' if the data can be saved. diff --git a/openlp/plugins/songs/forms/editversedialog.py b/openlp/plugins/songs/forms/editversedialog.py new file mode 100644 index 000000000..5b69297a0 --- /dev/null +++ b/openlp/plugins/songs/forms/editversedialog.py @@ -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)) diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py new file mode 100644 index 000000000..35f8c110e --- /dev/null +++ b/openlp/plugins/songs/forms/editverseform.py @@ -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() diff --git a/resources/forms/editsongdialog.ui b/resources/forms/editsongdialog.ui index dd1d247d0..da470786f 100644 --- a/resources/forms/editsongdialog.ui +++ b/resources/forms/editsongdialog.ui @@ -1,12 +1,12 @@ EditSongDialog - + 0 0 786 - 669 + 704 @@ -16,6 +16,9 @@ :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp + + true + 8 @@ -76,19 +79,64 @@ - - - - 0 - 0 - - - - QTextEdit::NoWrap - - - false - + + + + 8 + + + 0 + + + + + + + + + 8 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Add + + + + + + + Edit + + + + + + + Delete + + + + + + + @@ -111,11 +159,17 @@ - + 0 0 + + + 16777215 + 84 + + @@ -504,7 +558,6 @@ TitleEditItem AlternativeEdit - LyricsTextEdit VerseOrderEdit CommentsEdit ThemeSelectionComboItem diff --git a/resources/forms/editversedialog.ui b/resources/forms/editversedialog.ui new file mode 100644 index 000000000..68417ed41 --- /dev/null +++ b/resources/forms/editversedialog.ui @@ -0,0 +1,79 @@ + + EditVerseDialog + + + + 0 + 0 + 492 + 373 + + + + Dialog + + + true + + + + 8 + + + 8 + + + + + false + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Save + + + + + + + + + ButtonBox + accepted() + EditVerseDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + ButtonBox + rejected() + EditVerseDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +