From 607a0d11550673a2c52cdc568d691878c3e51f31 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 9 Oct 2010 13:00:28 +0200 Subject: [PATCH 01/13] - make sure the 'edit all' button is disabled when creating a new custom - ask if unsaved data should be saved when clicking on the save button --- openlp/plugins/custom/forms/editcustomform.py | 64 +++++++++++++------ 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 910fe65e7..d802cb58c 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -81,7 +81,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.onVerseListViewPressed) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.loadThemes) - # Create other objects and forms + # Create other objects and forms. self.custommanager = custommanager self.initialise() @@ -104,7 +104,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.creditEdit.setText(u'') self.verseTextEdit.clear() self.verseListView.clear() - #make sure we have a new item + # Make sure we have a new item. self.customSlide = CustomSlide() self.themeComboBox.addItem(u'') @@ -115,6 +115,16 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.themeComboBox.addItem(themename) def loadCustom(self, id, preview=False): + """ + Called when editing or creating a new custom. + + ``id`` + The cutom's id. If zero, then a new custom is created. + + ``preview`` + States whether the custom is edited while being previewed in the + preview panel. + """ self.customSlide = CustomSlide() self.initialise() if id != 0: @@ -132,7 +142,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.themeComboBox.setCurrentIndex(id) else: self.themeComboBox.setCurrentIndex(0) - #if not preview hide the preview button + self.editAllButton.setEnabled(False) + # If not preview hide the preview button. self.previewButton.setVisible(False) if preview: self.previewButton.setVisible(True) @@ -148,10 +159,10 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.close() def saveCustom(self): - valid, message = self._validate() - if not valid: - QtGui.QMessageBox.critical(self, - translate('CustomPlugin.EditCustomForm', 'Error'), message) + """ + Saves the custom. + """ + if not self._validate(): return False sxml = CustomXMLBuilder() sxml.new_document() @@ -237,7 +248,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): else: self.verseListView.currentItem().setText( self.verseTextEdit.toPlainText()) - #number of lines has change + # The number of lines has changed. if len(self.beforeText.split(u'\n')) != \ len(self.verseTextEdit.toPlainText().split(u'\n')): tempList = {} @@ -266,18 +277,35 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.editAllButton.setEnabled(True) def _validate(self): + """ + Checks whether a custom is valid or not. + """ + # We must have a title. if len(self.titleEdit.displayText()) == 0: self.titleEdit.setFocus() - return False, translate('CustomPlugin.EditCustomForm', - 'You need to type in a title.') - # must have 1 slide + QtGui.QMessageBox.critical(self, + translate('CustomPlugin.EditCustomForm', 'Error'), + translate('CustomPlugin.EditCustomForm', + 'You need to type in a title.')) + return False + # We must have one slide. if self.verseListView.count() == 0: self.verseTextEdit.setFocus() - return False, translate('CustomPlugin.EditCustomForm', - 'You need to add at least one slide') + QtGui.QMessageBox.critical(self, + translate('CustomPlugin.EditCustomForm', 'Error'), + translate('CustomPlugin.EditCustomForm', + 'You need to add at least one slide.')) + return False + # We must not have unsaved data. if self.verseTextEdit.toPlainText(): - self.verseTextEdit.setFocus() - return False, translate('CustomPlugin.EditCustomForm', - 'You have one or more unsaved slides, please either save your ' - 'slide(s) or clear your changes.') - return True, u'' + if QtGui.QMessageBox.critical(self, + translate('CustomPlugin.EditCustomForm', 'Error'), + translate('CustomPlugin.EditCustomForm', 'You have one or more ' + 'unsaved slides. Do you want to save them and continue?'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | + QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes: + self.onSaveButtonPressed() + else: + self.verseTextEdit.setFocus() + return False + return True From 384a3e46830d684f409a1cb3c017b1ab05bea6bb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 9 Oct 2010 13:00:51 +0200 Subject: [PATCH 02/13] - make sure the 'edit all' button is disabled when creating a new custom - ask if unsaved data should be saved when clicking on the save button From 2f99a85c4efcc21e6becc00588ee07096c499cf2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 9 Oct 2010 14:15:31 +0200 Subject: [PATCH 03/13] continued save button problem --- openlp/plugins/custom/forms/editcustomform.py | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index d802cb58c..d412287aa 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -162,7 +162,10 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): """ Saves the custom. """ - if not self._validate(): + valid, message = self._validate() + if not valid: + QtGui.QMessageBox.critical(self, + translate('CustomPlugin.EditCustomForm', 'Error'), message) return False sxml = CustomXMLBuilder() sxml.new_document() @@ -196,6 +199,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.verseListView.setCurrentRow(selectedRow + 1) def onClearButtonPressed(self): + #TODO: enable the "big" save button. self.verseTextEdit.clear() self.editAll = False self.addButton.setEnabled(True) @@ -210,14 +214,18 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.editText(item.text()) def onAddButtonPressed(self): + #TODO: enable the "big" save button. self.verseListView.addItem(self.verseTextEdit.toPlainText()) + self.editAllButton.setEnabled(True) self.deleteButton.setEnabled(False) self.verseTextEdit.clear() def onEditButtonPressed(self): + #TODO: disable the "big" save button. self.editText(self.verseListView.currentItem().text()) def onEditAllButtonPressed(self): + #TODO: disable the "big" save button. self.editAll = True self.addButton.setEnabled(False) self.splitButton.setEnabled(True) @@ -240,6 +248,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.clearButton.setEnabled(True) def onSaveButtonPressed(self): + #TODO: enable the "big" save button. if self.editAll: self.verseListView.clear() for row in unicode(self.verseTextEdit.toPlainText()).split( @@ -272,9 +281,13 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.verseTextEdit.setFocus() def onDeleteButtonPressed(self): + #TODO: make sure the "big" save button is disabled if no slides. self.verseListView.takeItem(self.verseListView.currentRow()) self.editButton.setEnabled(False) self.editAllButton.setEnabled(True) + if self.verseListView.count() == 0: + self.deleteButton.setEnabled(False) + self.editAllButton.setEnabled(False) def _validate(self): """ @@ -283,29 +296,11 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): # We must have a title. if len(self.titleEdit.displayText()) == 0: self.titleEdit.setFocus() - QtGui.QMessageBox.critical(self, - translate('CustomPlugin.EditCustomForm', 'Error'), - translate('CustomPlugin.EditCustomForm', - 'You need to type in a title.')) - return False + return False, translate('CustomPlugin.EditCustomForm', + 'You need to type in a title.') # We must have one slide. if self.verseListView.count() == 0: self.verseTextEdit.setFocus() - QtGui.QMessageBox.critical(self, - translate('CustomPlugin.EditCustomForm', 'Error'), - translate('CustomPlugin.EditCustomForm', - 'You need to add at least one slide.')) - return False - # We must not have unsaved data. - if self.verseTextEdit.toPlainText(): - if QtGui.QMessageBox.critical(self, - translate('CustomPlugin.EditCustomForm', 'Error'), - translate('CustomPlugin.EditCustomForm', 'You have one or more ' - 'unsaved slides. Do you want to save them and continue?'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | - QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes: - self.onSaveButtonPressed() - else: - self.verseTextEdit.setFocus() - return False - return True + return False, translate('CustomPlugin.EditCustomForm', + 'You need to add at least one slide') + return True, u'' From de940f7ca59f55d412b044836cad6ac749887da3 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 9 Oct 2010 21:20:07 +0200 Subject: [PATCH 04/13] first draft of new custom editor --- openlp/plugins/custom/forms/__init__.py | 1 + .../plugins/custom/forms/editcustomdialog.py | 176 +++++-------- openlp/plugins/custom/forms/editcustomform.py | 149 +++++------ .../custom/forms/editcustomslidedialog.py | 58 +++++ .../custom/forms/editcustomslideform.py | 74 ++++++ resources/forms/editcustomdialog.ui | 240 ++++++------------ 6 files changed, 344 insertions(+), 354 deletions(-) create mode 100644 openlp/plugins/custom/forms/editcustomslidedialog.py create mode 100644 openlp/plugins/custom/forms/editcustomslideform.py diff --git a/openlp/plugins/custom/forms/__init__.py b/openlp/plugins/custom/forms/__init__.py index 008caff8d..f31745e14 100644 --- a/openlp/plugins/custom/forms/__init__.py +++ b/openlp/plugins/custom/forms/__init__.py @@ -25,3 +25,4 @@ ############################################################################### from editcustomform import EditCustomForm +from editcustomslideform import EditCustomSlideForm diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index 84a310cb9..fd5e244f2 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -36,106 +36,82 @@ class Ui_CustomEditDialog(object): build_icon(u':/icon/openlp.org-icon-32.bmp')) self.gridLayout = QtGui.QGridLayout(customEditDialog) self.gridLayout.setObjectName(u'gridLayout') + self.horizontalLayout_3 = QtGui.QHBoxLayout() + self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') + self.themeLabel = QtGui.QLabel(customEditDialog) + self.themeLabel.setObjectName(u'themeLabel') + self.horizontalLayout_3.addWidget(self.themeLabel) + self.themeComboBox = QtGui.QComboBox(customEditDialog) + self.themeComboBox.setObjectName(u'themeComboBox') + self.horizontalLayout_3.addWidget(self.themeComboBox) + self.gridLayout.addLayout(self.horizontalLayout_3, 2, 0, 1, 1) + self.horizontalLayout_2 = QtGui.QHBoxLayout() + self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') + self.creditLabel = QtGui.QLabel(customEditDialog) + self.creditLabel.setObjectName(u'creditLabel') + self.horizontalLayout_2.addWidget(self.creditLabel) + self.creditEdit = QtGui.QLineEdit(customEditDialog) + self.creditEdit.setObjectName(u'creditEdit') + self.horizontalLayout_2.addWidget(self.creditEdit) + self.gridLayout.addLayout(self.horizontalLayout_2, 3, 0, 1, 1) + self.buttonBox = QtGui.QDialogButtonBox(customEditDialog) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | + QtGui.QDialogButtonBox.Save) + self.buttonBox.setObjectName(u'buttonBox') + self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 1) + self.horizontalLayout_4 = QtGui.QHBoxLayout() + self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') + self.verseListView = QtGui.QListWidget(customEditDialog) + self.verseListView.setAlternatingRowColors(True) + self.verseListView.setObjectName(u'verseListView') + self.horizontalLayout_4.addWidget(self.verseListView) + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName(u'verticalLayout') + self.addButton = QtGui.QPushButton(customEditDialog) + self.addButton.setObjectName(u'addButton') + self.verticalLayout.addWidget(self.addButton) + self.editButton = QtGui.QPushButton(customEditDialog) + self.editButton.setObjectName(u'editButton') + self.verticalLayout.addWidget(self.editButton) + self.editAllButton = QtGui.QPushButton(customEditDialog) + self.editAllButton.setObjectName(u'editAllButton') + self.verticalLayout.addWidget(self.editAllButton) + self.deleteButton = QtGui.QPushButton(customEditDialog) + self.deleteButton.setObjectName(u'deleteButton') + self.verticalLayout.addWidget(self.deleteButton) + spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding) + self.verticalLayout.addItem(spacerItem) + self.upButton = QtGui.QPushButton(customEditDialog) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap(u':/services/service_up.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.upButton.setIcon(icon1) + self.upButton.setObjectName(u'upButton') + self.verticalLayout.addWidget(self.upButton) + self.downButton = QtGui.QPushButton(customEditDialog) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap(u':/services/service_down.png'), + QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.downButton.setIcon(icon2) + self.downButton.setObjectName(u'downButton') + self.verticalLayout.addWidget(self.downButton) + self.horizontalLayout_4.addLayout(self.verticalLayout) + self.gridLayout.addLayout(self.horizontalLayout_4, 1, 0, 1, 1) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(u'horizontalLayout') self.titleLabel = QtGui.QLabel(customEditDialog) self.titleLabel.setObjectName(u'titleLabel') self.horizontalLayout.addWidget(self.titleLabel) self.titleEdit = QtGui.QLineEdit(customEditDialog) - self.titleLabel.setBuddy(self.titleEdit) self.titleEdit.setObjectName(u'titleEdit') self.horizontalLayout.addWidget(self.titleEdit) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) - self.horizontalLayout4 = QtGui.QHBoxLayout() - self.horizontalLayout4.setObjectName(u'horizontalLayout4') - self.verseListView = QtGui.QListWidget(customEditDialog) - self.verseListView.setAlternatingRowColors(True) - self.verseListView.setObjectName(u'verseListView') - self.horizontalLayout4.addWidget(self.verseListView) - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName(u'verticalLayout') - self.upButton = QtGui.QPushButton(customEditDialog) - self.upButton.setIcon(build_icon(u':/services/service_up.png')) - self.upButton.setObjectName(u'upButton') - self.verticalLayout.addWidget(self.upButton) - spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem) - self.downButton = QtGui.QPushButton(customEditDialog) - self.downButton.setIcon(build_icon(u':/services/service_down.png')) - self.downButton.setObjectName(u'downButton') - self.verticalLayout.addWidget(self.downButton) - self.horizontalLayout4.addLayout(self.verticalLayout) - self.gridLayout.addLayout(self.horizontalLayout4, 1, 0, 1, 1) - self.editWidget = QtGui.QWidget(customEditDialog) - self.editWidget.setObjectName(u'editWidget') - self.editLayout3 = QtGui.QHBoxLayout(self.editWidget) - self.editLayout3.setSpacing(8) - self.editLayout3.setMargin(0) - self.editLayout3.setObjectName(u'editLayout3') - self.verseTextEdit = SpellTextEdit(self) - self.verseTextEdit.setObjectName(u'verseTextEdit') - self.editLayout3.addWidget(self.verseTextEdit) - self.buttonWidget = QtGui.QWidget(self.editWidget) - self.buttonWidget.setObjectName(u'buttonWidget') - self.verticalLayout2 = QtGui.QVBoxLayout(self.buttonWidget) - self.verticalLayout2.setObjectName(u'verticalLayout2') - self.addButton = QtGui.QPushButton(self.buttonWidget) - self.addButton.setObjectName(u'addButton') - self.verticalLayout2.addWidget(self.addButton) - self.editButton = QtGui.QPushButton(self.buttonWidget) - self.editButton.setObjectName(u'editButton') - self.verticalLayout2.addWidget(self.editButton) - self.editAllButton = QtGui.QPushButton(self.buttonWidget) - self.editAllButton.setObjectName(u'editAllButton') - self.verticalLayout2.addWidget(self.editAllButton) - self.saveButton = QtGui.QPushButton(self.buttonWidget) - self.saveButton.setObjectName(u'saveButton') - self.verticalLayout2.addWidget(self.saveButton) - self.deleteButton = QtGui.QPushButton(self.buttonWidget) - self.deleteButton.setObjectName(u'deleteButton') - self.verticalLayout2.addWidget(self.deleteButton) - self.clearButton = QtGui.QPushButton(self.buttonWidget) - self.clearButton.setObjectName(u'clearButton') - self.verticalLayout2.addWidget(self.clearButton) - self.splitButton = QtGui.QPushButton(self.buttonWidget) - self.splitButton.setObjectName(u'splitButton') - self.verticalLayout2.addWidget(self.splitButton) - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Expanding) - self.verticalLayout2.addItem(spacerItem1) - self.editLayout3.addWidget(self.buttonWidget) - self.gridLayout.addWidget(self.editWidget, 2, 0, 1, 1) - self.horizontalLayout3 = QtGui.QHBoxLayout() - self.horizontalLayout3.setObjectName(u'horizontalLayout3') - self.themeLabel = QtGui.QLabel(customEditDialog) - self.themeLabel.setObjectName(u'themeLabel') - self.horizontalLayout3.addWidget(self.themeLabel) - self.themeComboBox = QtGui.QComboBox(customEditDialog) - self.themeLabel.setBuddy(self.themeComboBox) - self.themeComboBox.setObjectName(u'themeComboBox') - self.horizontalLayout3.addWidget(self.themeComboBox) - self.gridLayout.addLayout(self.horizontalLayout3, 3, 0, 1, 1) - self.horizontalLayout2 = QtGui.QHBoxLayout() - self.horizontalLayout2.setObjectName(u'horizontalLayout2') - self.creditLabel = QtGui.QLabel(customEditDialog) - self.creditLabel.setObjectName(u'creditLabel') - self.horizontalLayout2.addWidget(self.creditLabel) - self.creditEdit = QtGui.QLineEdit(customEditDialog) - self.creditLabel.setBuddy(self.creditEdit) - self.creditEdit.setObjectName(u'creditEdit') - self.horizontalLayout2.addWidget(self.creditEdit) - self.gridLayout.addLayout(self.horizontalLayout2, 4, 0, 1, 1) - self.buttonBox = QtGui.QDialogButtonBox(customEditDialog) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | - QtGui.QDialogButtonBox.Save) - self.buttonBox.setObjectName(u'buttonBox') - self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1) self.retranslateUi(customEditDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), customEditDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), - customEditDialog.closePressed) + customEditDialog.close) QtCore.QMetaObject.connectSlotsByName(customEditDialog) def retranslateUi(self, customEditDialog): @@ -143,46 +119,32 @@ class Ui_CustomEditDialog(object): translate('CustomPlugin.EditCustomForm', 'Edit Custom Slides')) self.upButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Move slide up one ' - 'position.')) + 'position.')) self.downButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Move slide down one ' - 'position.')) + 'position.')) self.titleLabel.setText( translate('CustomPlugin.EditCustomForm', '&Title:')) self.addButton.setText( translate('CustomPlugin.EditCustomForm', 'Add New')) self.addButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Add a new slide at ' - 'bottom.')) + 'bottom.')) self.editButton.setText( translate('CustomPlugin.EditCustomForm', 'Edit')) self.editButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Edit the selected ' - 'slide.')) + 'slide.')) self.editAllButton.setText( translate('CustomPlugin.EditCustomForm', 'Edit All')) self.editAllButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Edit all the slides at ' - 'once.')) - self.saveButton.setText( - translate('CustomPlugin.EditCustomForm', 'Save')) - self.saveButton.setToolTip( - translate('CustomPlugin.EditCustomForm', 'Save the slide currently ' - 'being edited.')) + 'once.')) self.deleteButton.setText( translate('CustomPlugin.EditCustomForm', 'Delete')) self.deleteButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Delete the selected ' - 'slide.')) - self.clearButton.setText( - translate('CustomPlugin.EditCustomForm', 'Clear')) - self.clearButton.setToolTip( - translate('CustomPlugin.EditCustomForm', 'Clear edit area')) - self.splitButton.setText( - translate('CustomPlugin.EditCustomForm', 'Split Slide')) - self.splitButton.setToolTip( - translate('CustomPlugin.EditCustomForm', 'Split a slide into two ' - 'by inserting a slide splitter.')) + 'slide.')) self.themeLabel.setText( translate('CustomPlugin.EditCustomForm', 'The&me:')) self.creditLabel.setText( diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index d412287aa..18ab98d45 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -32,6 +32,7 @@ from openlp.core.lib import Receiver, translate from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser from openlp.plugins.custom.lib.db import CustomSlide from editcustomdialog import Ui_CustomEditDialog +from editcustomslideform import EditCustomSlideForm log = logging.getLogger(__name__) @@ -40,7 +41,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): Class documentation goes here. """ log.info(u'Custom Editor loaded') - def __init__(self, custommanager, parent = None): + def __init__(self, custommanager, parent=None): """ Constructor """ @@ -61,21 +62,12 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed) QtCore.QObject.connect(self.editAllButton, QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed) - QtCore.QObject.connect(self.saveButton, - QtCore.SIGNAL(u'pressed()'), self.onSaveButtonPressed) QtCore.QObject.connect(self.deleteButton, QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonPressed) - QtCore.QObject.connect(self.clearButton, - QtCore.SIGNAL(u'pressed()'), self.onClearButtonPressed) QtCore.QObject.connect(self.upButton, QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed) QtCore.QObject.connect(self.downButton, QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed) - QtCore.QObject.connect(self.splitButton, - QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed) - QtCore.QObject.connect(self.verseListView, - QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'), - self.onVerseListViewSelected) QtCore.QObject.connect(self.verseListView, QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), self.onVerseListViewPressed) @@ -83,30 +75,19 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): QtCore.SIGNAL(u'theme_update_list'), self.loadThemes) # Create other objects and forms. self.custommanager = custommanager + self.slide_form = EditCustomSlideForm(self) self.initialise() - def onPreview(self, button): - log.debug(u'onPreview') - if button.text() == unicode(translate('CustomPlugin.EditCustomForm', - 'Save && Preview')) and self.saveCustom(): - Receiver.send_message(u'custom_preview') - def initialise(self): - self.editAll = False self.addButton.setEnabled(True) self.deleteButton.setEnabled(False) self.editButton.setEnabled(False) self.editAllButton.setEnabled(True) - self.saveButton.setEnabled(False) - self.clearButton.setEnabled(False) - self.splitButton.setEnabled(False) self.titleEdit.setText(u'') self.creditEdit.setText(u'') - self.verseTextEdit.clear() self.verseListView.clear() # Make sure we have a new item. self.customSlide = CustomSlide() - self.themeComboBox.addItem(u'') def loadThemes(self, themelist): self.themeComboBox.clear() @@ -198,37 +179,41 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.verseListView.insertItem(selectedRow + 1, qw) self.verseListView.setCurrentRow(selectedRow + 1) - def onClearButtonPressed(self): - #TODO: enable the "big" save button. - self.verseTextEdit.clear() - self.editAll = False - self.addButton.setEnabled(True) - self.editAllButton.setEnabled(True) - self.saveButton.setEnabled(False) + def onPreview(self, button): + log.debug(u'onPreview') + if button.text() == unicode(translate('CustomPlugin.EditCustomForm', + 'Save && Preview')) and self.saveCustom(): + Receiver.send_message(u'custom_preview') def onVerseListViewPressed(self, item): self.deleteButton.setEnabled(True) self.editButton.setEnabled(True) - def onVerseListViewSelected(self, item): - self.editText(item.text()) + def onDeleteButtonPressed(self): + self.verseListView.takeItem(self.verseListView.currentRow()) + self.editButton.setEnabled(True) + self.editAllButton.setEnabled(True) + if self.verseListView.count() == 0: + self.deleteButton.setEnabled(False) + self.editButton.setEnabled(False) + self.editAllButton.setEnabled(False) def onAddButtonPressed(self): - #TODO: enable the "big" save button. - self.verseListView.addItem(self.verseTextEdit.toPlainText()) - self.editAllButton.setEnabled(True) - self.deleteButton.setEnabled(False) - self.verseTextEdit.clear() + self.slide_form.setText(u'') + if self.slide_form.exec_(): + for slide in self.slide_form.getText(): + self.verseListView.addItem(slide) + self.editAllButton.setEnabled(True) def onEditButtonPressed(self): - #TODO: disable the "big" save button. - self.editText(self.verseListView.currentItem().text()) + self.slide_form.setText(self.verseListView.currentItem().text()) + if self.slide_form.exec_(): + self.updateVerseList(self.slide_form.getText()) def onEditAllButtonPressed(self): - #TODO: disable the "big" save button. - self.editAll = True - self.addButton.setEnabled(False) - self.splitButton.setEnabled(True) + """ + Edits all slides. + """ if self.verseListView.count() > 0: verse_list = u'' for row in range(0, self.verseListView.count()): @@ -236,58 +221,41 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): verse_list += item.text() if row != self.verseListView.count() - 1: verse_list += u'\n[---]\n' - self.editText(verse_list) + self.slide_form.setText(verse_list) + if self.slide_form.exec_(): + self.updateVerseList(self.slide_form.getText(), True) - def editText(self, text): - self.beforeText = text - self.verseTextEdit.setPlainText(text) - self.deleteButton.setEnabled(False) - self.editButton.setEnabled(False) - self.editAllButton.setEnabled(False) - self.saveButton.setEnabled(True) - self.clearButton.setEnabled(True) + def updateVerseList(self, slides, edit_all=False): + """ + Updates the verse list (self.verseListView) after editing slides. - def onSaveButtonPressed(self): - #TODO: enable the "big" save button. - if self.editAll: - self.verseListView.clear() - for row in unicode(self.verseTextEdit.toPlainText()).split( - u'\n[---]\n'): - self.verseListView.addItem(row) + ``slides`` + A list of all slides which have been edited. + + ``edit_all`` + Indicates if all slides or only one slide has been edited. + """ + if len(slides) == 1: + self.verseListView.currentItem().setText(slides[0]) else: - self.verseListView.currentItem().setText( - self.verseTextEdit.toPlainText()) - # The number of lines has changed. - if len(self.beforeText.split(u'\n')) != \ - len(self.verseTextEdit.toPlainText().split(u'\n')): - tempList = {} - for row in range(0, self.verseListView.count()): - tempList[row] = self.verseListView.item(row).text() + if edit_all: self.verseListView.clear() - for row in range (0, len(tempList)): - self.verseListView.addItem(tempList[row]) - self.verseListView.repaint() - self.addButton.setEnabled(True) - self.saveButton.setEnabled(False) - self.editButton.setEnabled(False) - self.editAllButton.setEnabled(True) - self.splitButton.setEnabled(False) - self.verseTextEdit.clear() - - def onSplitButtonPressed(self): - if self.verseTextEdit.textCursor().columnNumber() != 0: - self.verseTextEdit.insertPlainText(u'\n') - self.verseTextEdit.insertPlainText(u'[---]\n' ) - self.verseTextEdit.setFocus() - - def onDeleteButtonPressed(self): - #TODO: make sure the "big" save button is disabled if no slides. - self.verseListView.takeItem(self.verseListView.currentRow()) - self.editButton.setEnabled(False) - self.editAllButton.setEnabled(True) - if self.verseListView.count() == 0: - self.deleteButton.setEnabled(False) - self.editAllButton.setEnabled(False) + for slide in slides: + self.verseListView.addItem(slide) + else: + old_slides = [] + old_row = self.verseListView.currentRow() + # Create a list with all slide (unedited). + old_slides = [self.verseListView.item(row).text() for row in \ + range(0, self.verseListView.count())] + self.verseListView.clear() + old_slides.pop(old_row) + # Insert all slides in the old_slides list, to make the list complete. + for slide in slides: + old_slides.insert(old_row, slide) + for slide in old_slides: + self.verseListView.addItem(slide) + self.verseListView.repaint() def _validate(self): """ @@ -300,7 +268,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): 'You need to type in a title.') # We must have one slide. if self.verseListView.count() == 0: - self.verseTextEdit.setFocus() return False, translate('CustomPlugin.EditCustomForm', 'You need to add at least one slide') return True, u'' diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py new file mode 100644 index 000000000..bc6657d90 --- /dev/null +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # +# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard, Frode Woldsund # +# --------------------------------------------------------------------------- # +# 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 QtCore, QtGui + +from openlp.core.lib import translate + +class Ui_CustomSlideEditDialog(object): + def setupUi(self, customSlideEditDialog): + customSlideEditDialog.setObjectName(u'customSlideEditDialog') + customSlideEditDialog.resize(474, 442) + self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog) + self.buttonBox.setGeometry(QtCore.QRect(8, 407, 458, 32)) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) + self.buttonBox.setObjectName(u'buttonBox') + self.verseTextEdit = QtGui.QTextEdit(customSlideEditDialog) + self.verseTextEdit.setGeometry(QtCore.QRect(8, 8, 451, 341)) + self.verseTextEdit.setObjectName(u'verseTextEdit') + self.splitButton = QtGui.QPushButton(customSlideEditDialog) + self.splitButton.setGeometry(QtCore.QRect(370, 360, 85, 27)) + self.splitButton.setObjectName(u'splitButton') + self.retranslateUi(customSlideEditDialog) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), + customSlideEditDialog.accept) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), + customSlideEditDialog.reject) + QtCore.QMetaObject.connectSlotsByName(customSlideEditDialog) + + def retranslateUi(self, customSlideEditDialog): + self.splitButton.setText( + translate('CustomPlugin.EditCustomForm', 'Split Slide')) + self.splitButton.setToolTip( + translate('CustomPlugin.EditCustomForm', 'Split a slide into two ' + 'by inserting a slide splitter.')) diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py new file mode 100644 index 000000000..b43287b99 --- /dev/null +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # +# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard, Frode Woldsund # +# --------------------------------------------------------------------------- # +# 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 F################################OR 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 # +############################################################################### + +import logging + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import Receiver, translate +from editcustomslidedialog import Ui_CustomSlideEditDialog + +log = logging.getLogger(__name__) + +class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog): + """ + Class documentation goes here. + """ + log.info(u'Custom Verse Editor loaded') + def __init__(self, parent=None): + """ + Constructor + """ + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) + # Connecting signals and slots + QtCore.QObject.connect(self.splitButton, + QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed) + + + def setText(self, text): + """ + Set the text for verseTextEdit. + + ``text`` + The text (unicode). + """ + self.verseTextEdit.clear() + if text: + self.verseTextEdit.setPlainText(text) + self.verseTextEdit.setFocus() + + def getText(self): + """ + Returns a list with all slides. + """ + return self.verseTextEdit.toPlainText().split(u'\n[---]\n') + + def onSplitButtonPressed(self): + if self.verseTextEdit.textCursor().columnNumber() != 0: + self.verseTextEdit.insertPlainText(u'\n') + self.verseTextEdit.insertPlainText(u'[---]\n' ) + self.verseTextEdit.setFocus() diff --git a/resources/forms/editcustomdialog.ui b/resources/forms/editcustomdialog.ui index 44ce46ca7..7c714baab 100644 --- a/resources/forms/editcustomdialog.ui +++ b/resources/forms/editcustomdialog.ui @@ -18,20 +18,48 @@ :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - + + - + - Title: + Theme: - + + + + + + + + + + + Credits: + + + + + + + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Save + + + @@ -44,16 +72,42 @@ - + - + - + Add New - - - :/services/service_up.png:/services/service_up.png + + + + + + + + + Edit + + + + + + + + + + Edit All + + + + + + + + + + Delete @@ -70,6 +124,20 @@ + + + + + + + + + + + :/services/service_up.png:/services/service_up.png + + + @@ -88,166 +156,26 @@ - - - - - 8 - - - 0 - - - - - - - - - - - - - - Add New - - - - - - - - - - Edit - - - - - - - - - - Edit All - - - - - - - - - - Save - - - - - - - - - - Delete - - - - - - - - - - Clear - - - - - - - - - - Split Slide - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - + + - + - Theme: + Title: - - - - - + - - - - - - Credits: - - - - - - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Save - - - TitleEdit - VerseTextEdit - AddButton VerseListView - EditButton - EditAllButton - SaveButton - DeleteButton CreditEdit - UpButton - DownButton ThemeComboBox From f60111e7a95f0afc784b03f207e64628c6ef4d6e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 9 Oct 2010 21:47:15 +0200 Subject: [PATCH 05/13] head From 842c55002af59cd4cc7f10390403aef38f88984c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 9 Oct 2010 22:00:33 +0200 Subject: [PATCH 06/13] fixed broken copyright block --- openlp/plugins/custom/forms/editcustomslideform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py index b43287b99..b20c51010 100644 --- a/openlp/plugins/custom/forms/editcustomslideform.py +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -16,7 +16,7 @@ # # # 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 F################################OR A PARTICULAR PURPOSE. See the GNU General Public License for # +# 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 # From 3c32cb5be589ca74284a06982da0a825b58d5c46 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Oct 2010 15:09:45 +0200 Subject: [PATCH 07/13] clean ups + forgotten file --- .../plugins/custom/forms/editcustomdialog.py | 32 +++---- openlp/plugins/custom/forms/editcustomform.py | 14 +-- .../custom/forms/editcustomslidedialog.py | 3 +- .../custom/forms/editcustomslideform.py | 3 + resources/forms/editcustomslidedialog.ui | 96 +++++++++++++++++++ 5 files changed, 124 insertions(+), 24 deletions(-) create mode 100644 resources/forms/editcustomslidedialog.ui diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index fd5e244f2..82238f005 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -36,35 +36,35 @@ class Ui_CustomEditDialog(object): build_icon(u':/icon/openlp.org-icon-32.bmp')) self.gridLayout = QtGui.QGridLayout(customEditDialog) self.gridLayout.setObjectName(u'gridLayout') - self.horizontalLayout_3 = QtGui.QHBoxLayout() - self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') + self.horizontalLayout3 = QtGui.QHBoxLayout() + self.horizontalLayout3.setObjectName(u'horizontalLayout3') self.themeLabel = QtGui.QLabel(customEditDialog) self.themeLabel.setObjectName(u'themeLabel') - self.horizontalLayout_3.addWidget(self.themeLabel) + self.horizontalLayout3.addWidget(self.themeLabel) self.themeComboBox = QtGui.QComboBox(customEditDialog) self.themeComboBox.setObjectName(u'themeComboBox') - self.horizontalLayout_3.addWidget(self.themeComboBox) - self.gridLayout.addLayout(self.horizontalLayout_3, 2, 0, 1, 1) - self.horizontalLayout_2 = QtGui.QHBoxLayout() - self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') + self.horizontalLayout3.addWidget(self.themeComboBox) + self.gridLayout.addLayout(self.horizontalLayout3, 2, 0, 1, 1) + self.horizontalLayout2 = QtGui.QHBoxLayout() + self.horizontalLayout2.setObjectName(u'horizontalLayout2') self.creditLabel = QtGui.QLabel(customEditDialog) self.creditLabel.setObjectName(u'creditLabel') - self.horizontalLayout_2.addWidget(self.creditLabel) + self.horizontalLayout2.addWidget(self.creditLabel) self.creditEdit = QtGui.QLineEdit(customEditDialog) self.creditEdit.setObjectName(u'creditEdit') - self.horizontalLayout_2.addWidget(self.creditEdit) - self.gridLayout.addLayout(self.horizontalLayout_2, 3, 0, 1, 1) + self.horizontalLayout2.addWidget(self.creditEdit) + self.gridLayout.addLayout(self.horizontalLayout2, 3, 0, 1, 1) self.buttonBox = QtGui.QDialogButtonBox(customEditDialog) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) self.buttonBox.setObjectName(u'buttonBox') self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 1) - self.horizontalLayout_4 = QtGui.QHBoxLayout() - self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') + self.horizontalLayout4 = QtGui.QHBoxLayout() + self.horizontalLayout4.setObjectName(u'horizontalLayout4') self.verseListView = QtGui.QListWidget(customEditDialog) self.verseListView.setAlternatingRowColors(True) self.verseListView.setObjectName(u'verseListView') - self.horizontalLayout_4.addWidget(self.verseListView) + self.horizontalLayout4.addWidget(self.verseListView) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(u'verticalLayout') self.addButton = QtGui.QPushButton(customEditDialog) @@ -96,8 +96,8 @@ class Ui_CustomEditDialog(object): self.downButton.setIcon(icon2) self.downButton.setObjectName(u'downButton') self.verticalLayout.addWidget(self.downButton) - self.horizontalLayout_4.addLayout(self.verticalLayout) - self.gridLayout.addLayout(self.horizontalLayout_4, 1, 0, 1, 1) + self.horizontalLayout4.addLayout(self.verticalLayout) + self.gridLayout.addLayout(self.horizontalLayout4, 1, 0, 1, 1) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(u'horizontalLayout') self.titleLabel = QtGui.QLabel(customEditDialog) @@ -111,7 +111,7 @@ class Ui_CustomEditDialog(object): QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), customEditDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), - customEditDialog.close) + customEditDialog.closePressed) QtCore.QMetaObject.connectSlotsByName(customEditDialog) def retranslateUi(self, customEditDialog): diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 18ab98d45..b1ffbd214 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -78,6 +78,12 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.slide_form = EditCustomSlideForm(self) self.initialise() + def onPreview(self, button): + log.debug(u'onPreview') + if button.text() == unicode(translate('CustomPlugin.EditCustomForm', + 'Save && Preview')) and self.saveCustom(): + Receiver.send_message(u'custom_preview') + def initialise(self): self.addButton.setEnabled(True) self.deleteButton.setEnabled(False) @@ -179,12 +185,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.verseListView.insertItem(selectedRow + 1, qw) self.verseListView.setCurrentRow(selectedRow + 1) - def onPreview(self, button): - log.debug(u'onPreview') - if button.text() == unicode(translate('CustomPlugin.EditCustomForm', - 'Save && Preview')) and self.saveCustom(): - Receiver.send_message(u'custom_preview') - def onVerseListViewPressed(self, item): self.deleteButton.setEnabled(True) self.editButton.setEnabled(True) @@ -245,7 +245,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): else: old_slides = [] old_row = self.verseListView.currentRow() - # Create a list with all slide (unedited). + # Create a list with all (old/unedited) slides. old_slides = [self.verseListView.item(row).text() for row in \ range(0, self.verseListView.count())] self.verseListView.clear() diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index bc6657d90..b0d1970ec 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -35,7 +35,8 @@ class Ui_CustomSlideEditDialog(object): self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog) self.buttonBox.setGeometry(QtCore.QRect(8, 407, 458, 32)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | + QtGui.QDialogButtonBox.Save) self.buttonBox.setObjectName(u'buttonBox') self.verseTextEdit = QtGui.QTextEdit(customSlideEditDialog) self.verseTextEdit.setGeometry(QtCore.QRect(8, 8, 451, 341)) diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py index b20c51010..a3296377b 100644 --- a/openlp/plugins/custom/forms/editcustomslideform.py +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -68,6 +68,9 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog): return self.verseTextEdit.toPlainText().split(u'\n[---]\n') def onSplitButtonPressed(self): + """ + Splits a slide in two slides. + """ if self.verseTextEdit.textCursor().columnNumber() != 0: self.verseTextEdit.insertPlainText(u'\n') self.verseTextEdit.insertPlainText(u'[---]\n' ) diff --git a/resources/forms/editcustomslidedialog.ui b/resources/forms/editcustomslidedialog.ui new file mode 100644 index 000000000..9bc502274 --- /dev/null +++ b/resources/forms/editcustomslidedialog.ui @@ -0,0 +1,96 @@ + + + customSlideEditDialog + + + + 0 + 0 + 474 + 442 + + + + Dialog + + + + + 8 + 407 + 458 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Save + + + + + + 8 + 8 + 451 + 341 + + + + + + + 370 + 360 + 85 + 27 + + + + + + + Split Slide + + + + + + + + + buttonBox + accepted() + customSlideEditDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + customSlideEditDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + From 4dde13136cc82d44d07eb238d20ff6e29f5e5b5a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Oct 2010 15:17:01 +0200 Subject: [PATCH 08/13] layout clean ups --- openlp/plugins/custom/forms/editcustomslidedialog.py | 4 ++-- resources/forms/editcustomslidedialog.ui | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index b0d1970ec..a2513833a 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -39,10 +39,10 @@ class Ui_CustomSlideEditDialog(object): QtGui.QDialogButtonBox.Save) self.buttonBox.setObjectName(u'buttonBox') self.verseTextEdit = QtGui.QTextEdit(customSlideEditDialog) - self.verseTextEdit.setGeometry(QtCore.QRect(8, 8, 451, 341)) + self.verseTextEdit.setGeometry(QtCore.QRect(8, 8, 458, 349)) self.verseTextEdit.setObjectName(u'verseTextEdit') self.splitButton = QtGui.QPushButton(customSlideEditDialog) - self.splitButton.setGeometry(QtCore.QRect(370, 360, 85, 27)) + self.splitButton.setGeometry(QtCore.QRect(380, 370, 85, 27)) self.splitButton.setObjectName(u'splitButton') self.retranslateUi(customSlideEditDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), diff --git a/resources/forms/editcustomslidedialog.ui b/resources/forms/editcustomslidedialog.ui index 9bc502274..f537f854e 100644 --- a/resources/forms/editcustomslidedialog.ui +++ b/resources/forms/editcustomslidedialog.ui @@ -34,16 +34,16 @@ 8 8 - 451 - 341 + 458 + 349 - 370 - 360 + 380 + 370 85 27 From 144060a74b20954cd7544f6d68913b4666b0d48e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Oct 2010 15:29:08 +0200 Subject: [PATCH 09/13] moved method to its old position --- openlp/plugins/custom/forms/editcustomform.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index b1ffbd214..e4cb78752 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -189,15 +189,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.deleteButton.setEnabled(True) self.editButton.setEnabled(True) - def onDeleteButtonPressed(self): - self.verseListView.takeItem(self.verseListView.currentRow()) - self.editButton.setEnabled(True) - self.editAllButton.setEnabled(True) - if self.verseListView.count() == 0: - self.deleteButton.setEnabled(False) - self.editButton.setEnabled(False) - self.editAllButton.setEnabled(False) - def onAddButtonPressed(self): self.slide_form.setText(u'') if self.slide_form.exec_(): @@ -257,6 +248,15 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.verseListView.addItem(slide) self.verseListView.repaint() + def onDeleteButtonPressed(self): + self.verseListView.takeItem(self.verseListView.currentRow()) + self.editButton.setEnabled(True) + self.editAllButton.setEnabled(True) + if self.verseListView.count() == 0: + self.deleteButton.setEnabled(False) + self.editButton.setEnabled(False) + self.editAllButton.setEnabled(False) + def _validate(self): """ Checks whether a custom is valid or not. From bab38de43eee8cb92e3ed1ac78e7b9d0c88b38c8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Oct 2010 16:23:00 +0200 Subject: [PATCH 10/13] -'verse' -> 'slide' -buttons name fixes --- .../plugins/custom/forms/editcustomdialog.py | 19 ++-- openlp/plugins/custom/forms/editcustomform.py | 88 +++++++++---------- .../custom/forms/editcustomslidedialog.py | 6 +- .../custom/forms/editcustomslideform.py | 19 ++-- 4 files changed, 67 insertions(+), 65 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index 82238f005..0883bc779 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -42,6 +42,7 @@ class Ui_CustomEditDialog(object): self.themeLabel.setObjectName(u'themeLabel') self.horizontalLayout3.addWidget(self.themeLabel) self.themeComboBox = QtGui.QComboBox(customEditDialog) + self.themeLabel.setBuddy(self.themeComboBox) self.themeComboBox.setObjectName(u'themeComboBox') self.horizontalLayout3.addWidget(self.themeComboBox) self.gridLayout.addLayout(self.horizontalLayout3, 2, 0, 1, 1) @@ -51,6 +52,7 @@ class Ui_CustomEditDialog(object): self.creditLabel.setObjectName(u'creditLabel') self.horizontalLayout2.addWidget(self.creditLabel) self.creditEdit = QtGui.QLineEdit(customEditDialog) + self.creditLabel.setBuddy(self.creditEdit) self.creditEdit.setObjectName(u'creditEdit') self.horizontalLayout2.addWidget(self.creditEdit) self.gridLayout.addLayout(self.horizontalLayout2, 3, 0, 1, 1) @@ -61,10 +63,10 @@ class Ui_CustomEditDialog(object): self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 1) self.horizontalLayout4 = QtGui.QHBoxLayout() self.horizontalLayout4.setObjectName(u'horizontalLayout4') - self.verseListView = QtGui.QListWidget(customEditDialog) - self.verseListView.setAlternatingRowColors(True) - self.verseListView.setObjectName(u'verseListView') - self.horizontalLayout4.addWidget(self.verseListView) + self.slideListView = QtGui.QListWidget(customEditDialog) + self.slideListView.setAlternatingRowColors(True) + self.slideListView.setObjectName(u'slideListView') + self.horizontalLayout4.addWidget(self.slideListView) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(u'verticalLayout') self.addButton = QtGui.QPushButton(customEditDialog) @@ -104,6 +106,7 @@ class Ui_CustomEditDialog(object): self.titleLabel.setObjectName(u'titleLabel') self.horizontalLayout.addWidget(self.titleLabel) self.titleEdit = QtGui.QLineEdit(customEditDialog) + self.titleLabel.setBuddy(self.titleEdit) self.titleEdit.setObjectName(u'titleEdit') self.horizontalLayout.addWidget(self.titleEdit) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) @@ -126,22 +129,22 @@ class Ui_CustomEditDialog(object): self.titleLabel.setText( translate('CustomPlugin.EditCustomForm', '&Title:')) self.addButton.setText( - translate('CustomPlugin.EditCustomForm', 'Add New')) + translate('CustomPlugin.EditCustomForm', '&Add')) self.addButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Add a new slide at ' 'bottom.')) self.editButton.setText( - translate('CustomPlugin.EditCustomForm', 'Edit')) + translate('CustomPlugin.EditCustomForm', '&Edit')) self.editButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Edit the selected ' 'slide.')) self.editAllButton.setText( - translate('CustomPlugin.EditCustomForm', 'Edit All')) + translate('CustomPlugin.EditCustomForm', 'Ed&it All')) self.editAllButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Edit all the slides at ' 'once.')) self.deleteButton.setText( - translate('CustomPlugin.EditCustomForm', 'Delete')) + translate('CustomPlugin.EditCustomForm', '&Delete')) self.deleteButton.setToolTip( translate('CustomPlugin.EditCustomForm', 'Delete the selected ' 'slide.')) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index e4cb78752..e7dc0d72a 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -68,9 +68,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed) QtCore.QObject.connect(self.downButton, QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed) - QtCore.QObject.connect(self.verseListView, + QtCore.QObject.connect(self.slideListView, QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), - self.onVerseListViewPressed) + self.onSlideListViewPressed) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.loadThemes) # Create other objects and forms. @@ -91,7 +91,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.editAllButton.setEnabled(True) self.titleEdit.setText(u'') self.creditEdit.setText(u'') - self.verseListView.clear() + self.slideListView.clear() # Make sure we have a new item. self.customSlide = CustomSlide() @@ -119,9 +119,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.titleEdit.setText(self.customSlide.title) self.creditEdit.setText(self.customSlide.credits) customXML = CustomXMLParser(self.customSlide.text) - verseList = customXML.get_verses() - for verse in verseList: - self.verseListView.addItem(verse[1]) + slideList = customXML.get_verses() + for slide in slideList: + self.slideListView.addItem(slide[1]) theme = self.customSlide.theme_name id = self.themeComboBox.findText(theme, QtCore.Qt.MatchExactly) if id == -1: @@ -158,9 +158,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): sxml.new_document() sxml.add_lyrics_to_song() count = 1 - for i in range(0, self.verseListView.count()): + for i in range(0, self.slideListView.count()): sxml.add_verse_to_lyrics(u'custom', unicode(count), - unicode(self.verseListView.item(i).text())) + unicode(self.slideListView.item(i).text())) count += 1 self.customSlide.title = unicode(self.titleEdit.displayText(), u'utf-8') self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8') @@ -171,21 +171,21 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): return self.custommanager.save_object(self.customSlide) def onUpButtonPressed(self): - selectedRow = self.verseListView.currentRow() + selectedRow = self.slideListView.currentRow() if selectedRow != 0: - qw = self.verseListView.takeItem(selectedRow) - self.verseListView.insertItem(selectedRow - 1, qw) - self.verseListView.setCurrentRow(selectedRow - 1) + qw = self.slideListView.takeItem(selectedRow) + self.slideListView.insertItem(selectedRow - 1, qw) + self.slideListView.setCurrentRow(selectedRow - 1) def onDownButtonPressed(self): - selectedRow = self.verseListView.currentRow() + selectedRow = self.slideListView.currentRow() # zero base arrays - if selectedRow != self.verseListView.count() - 1: - qw = self.verseListView.takeItem(selectedRow) - self.verseListView.insertItem(selectedRow + 1, qw) - self.verseListView.setCurrentRow(selectedRow + 1) + if selectedRow != self.slideListView.count() - 1: + qw = self.slideListView.takeItem(selectedRow) + self.slideListView.insertItem(selectedRow + 1, qw) + self.slideListView.setCurrentRow(selectedRow + 1) - def onVerseListViewPressed(self, item): + def onSlideListViewPressed(self, item): self.deleteButton.setEnabled(True) self.editButton.setEnabled(True) @@ -193,32 +193,32 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.slide_form.setText(u'') if self.slide_form.exec_(): for slide in self.slide_form.getText(): - self.verseListView.addItem(slide) + self.slideListView.addItem(slide) self.editAllButton.setEnabled(True) def onEditButtonPressed(self): - self.slide_form.setText(self.verseListView.currentItem().text()) + self.slide_form.setText(self.slideListView.currentItem().text()) if self.slide_form.exec_(): - self.updateVerseList(self.slide_form.getText()) + self.updateSlideList(self.slide_form.getText()) def onEditAllButtonPressed(self): """ Edits all slides. """ - if self.verseListView.count() > 0: - verse_list = u'' - for row in range(0, self.verseListView.count()): - item = self.verseListView.item(row) - verse_list += item.text() - if row != self.verseListView.count() - 1: - verse_list += u'\n[---]\n' - self.slide_form.setText(verse_list) + if self.slideListView.count() > 0: + slide_list = u'' + for row in range(0, self.slideListView.count()): + item = self.slideListView.item(row) + slide_list += item.text() + if row != self.slideListView.count() - 1: + slide_list += u'\n[---]\n' + self.slide_form.setText(slide_list) if self.slide_form.exec_(): - self.updateVerseList(self.slide_form.getText(), True) + self.updateSlideList(self.slide_form.getText(), True) - def updateVerseList(self, slides, edit_all=False): + def updateSlideList(self, slides, edit_all=False): """ - Updates the verse list (self.verseListView) after editing slides. + Updates the slide list after editing slides. ``slides`` A list of all slides which have been edited. @@ -227,32 +227,32 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): Indicates if all slides or only one slide has been edited. """ if len(slides) == 1: - self.verseListView.currentItem().setText(slides[0]) + self.slideListView.currentItem().setText(slides[0]) else: if edit_all: - self.verseListView.clear() + self.slideListView.clear() for slide in slides: - self.verseListView.addItem(slide) + self.slideListView.addItem(slide) else: old_slides = [] - old_row = self.verseListView.currentRow() + old_row = self.slideListView.currentRow() # Create a list with all (old/unedited) slides. - old_slides = [self.verseListView.item(row).text() for row in \ - range(0, self.verseListView.count())] - self.verseListView.clear() + old_slides = [self.slideListView.item(row).text() for row in \ + range(0, self.slideListView.count())] + self.slideListView.clear() old_slides.pop(old_row) # Insert all slides in the old_slides list, to make the list complete. for slide in slides: old_slides.insert(old_row, slide) for slide in old_slides: - self.verseListView.addItem(slide) - self.verseListView.repaint() + self.slideListView.addItem(slide) + self.slideListView.repaint() def onDeleteButtonPressed(self): - self.verseListView.takeItem(self.verseListView.currentRow()) + self.slideListView.takeItem(self.slideListView.currentRow()) self.editButton.setEnabled(True) self.editAllButton.setEnabled(True) - if self.verseListView.count() == 0: + if self.slideListView.count() == 0: self.deleteButton.setEnabled(False) self.editButton.setEnabled(False) self.editAllButton.setEnabled(False) @@ -267,7 +267,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): return False, translate('CustomPlugin.EditCustomForm', 'You need to type in a title.') # We must have one slide. - if self.verseListView.count() == 0: + if self.slideListView.count() == 0: return False, translate('CustomPlugin.EditCustomForm', 'You need to add at least one slide') return True, u'' diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index a2513833a..31bbb3d5d 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -38,9 +38,9 @@ class Ui_CustomSlideEditDialog(object): self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) self.buttonBox.setObjectName(u'buttonBox') - self.verseTextEdit = QtGui.QTextEdit(customSlideEditDialog) - self.verseTextEdit.setGeometry(QtCore.QRect(8, 8, 458, 349)) - self.verseTextEdit.setObjectName(u'verseTextEdit') + self.slideTextEdit = QtGui.QTextEdit(customSlideEditDialog) + self.slideTextEdit.setGeometry(QtCore.QRect(8, 8, 458, 349)) + self.slideTextEdit.setObjectName(u'slideTextEdit') self.splitButton = QtGui.QPushButton(customSlideEditDialog) self.splitButton.setGeometry(QtCore.QRect(380, 370, 85, 27)) self.splitButton.setObjectName(u'splitButton') diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py index a3296377b..ab670970b 100644 --- a/openlp/plugins/custom/forms/editcustomslideform.py +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -48,30 +48,29 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog): QtCore.QObject.connect(self.splitButton, QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed) - def setText(self, text): """ - Set the text for verseTextEdit. + Set the text for slideTextEdit. ``text`` The text (unicode). """ - self.verseTextEdit.clear() + self.slideTextEdit.clear() if text: - self.verseTextEdit.setPlainText(text) - self.verseTextEdit.setFocus() + self.slideTextEdit.setPlainText(text) + self.slideTextEdit.setFocus() def getText(self): """ Returns a list with all slides. """ - return self.verseTextEdit.toPlainText().split(u'\n[---]\n') + return self.slideTextEdit.toPlainText().split(u'\n[---]\n') def onSplitButtonPressed(self): """ Splits a slide in two slides. """ - if self.verseTextEdit.textCursor().columnNumber() != 0: - self.verseTextEdit.insertPlainText(u'\n') - self.verseTextEdit.insertPlainText(u'[---]\n' ) - self.verseTextEdit.setFocus() + if self.slideTextEdit.textCursor().columnNumber() != 0: + self.slideTextEdit.insertPlainText(u'\n') + self.slideTextEdit.insertPlainText(u'[---]\n' ) + self.slideTextEdit.setFocus() From 373597120b547b1098e4de72dffdd5b1a9f11ff5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Oct 2010 17:59:11 +0200 Subject: [PATCH 11/13] fixes for merge --- .../plugins/custom/forms/editcustomdialog.py | 2 +- openlp/plugins/custom/forms/editcustomform.py | 22 +++++++++---------- .../custom/forms/editcustomslidedialog.py | 3 ++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index 0883bc779..89cd0b6df 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, translate, SpellTextEdit +from openlp.core.lib import build_icon, translate class Ui_CustomEditDialog(object): def setupUi(self, customEditDialog): diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index e7dc0d72a..8ee4d2673 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -75,7 +75,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): QtCore.SIGNAL(u'theme_update_list'), self.loadThemes) # Create other objects and forms. self.custommanager = custommanager - self.slide_form = EditCustomSlideForm(self) + self.editSlideForm = EditCustomSlideForm(self) self.initialise() def onPreview(self, button): @@ -190,16 +190,16 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.editButton.setEnabled(True) def onAddButtonPressed(self): - self.slide_form.setText(u'') - if self.slide_form.exec_(): - for slide in self.slide_form.getText(): + self.editSlideForm.setText(u'') + if self.editSlideForm.exec_(): + for slide in self.editSlideForm.getText(): self.slideListView.addItem(slide) self.editAllButton.setEnabled(True) def onEditButtonPressed(self): - self.slide_form.setText(self.slideListView.currentItem().text()) - if self.slide_form.exec_(): - self.updateSlideList(self.slide_form.getText()) + self.editSlideForm.setText(self.slideListView.currentItem().text()) + if self.editSlideForm.exec_(): + self.updateSlideList(self.editSlideForm.getText()) def onEditAllButtonPressed(self): """ @@ -212,9 +212,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): slide_list += item.text() if row != self.slideListView.count() - 1: slide_list += u'\n[---]\n' - self.slide_form.setText(slide_list) - if self.slide_form.exec_(): - self.updateSlideList(self.slide_form.getText(), True) + self.editSlideForm.setText(slide_list) + if self.editSlideForm.exec_(): + self.updateSlideList(self.editSlideForm.getText(), True) def updateSlideList(self, slides, edit_all=False): """ @@ -241,7 +241,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): range(0, self.slideListView.count())] self.slideListView.clear() old_slides.pop(old_row) - # Insert all slides in the old_slides list, to make the list complete. + # Insert all slides to make the old_slides list complete. for slide in slides: old_slides.insert(old_row, slide) for slide in old_slides: diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index 31bbb3d5d..ed69b24ba 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate +from openlp.core.lib import translate, SpellTextEdit class Ui_CustomSlideEditDialog(object): def setupUi(self, customSlideEditDialog): @@ -39,6 +39,7 @@ class Ui_CustomSlideEditDialog(object): QtGui.QDialogButtonBox.Save) self.buttonBox.setObjectName(u'buttonBox') self.slideTextEdit = QtGui.QTextEdit(customSlideEditDialog) + self.slideTextEdit = SpellTextEdit(self) self.slideTextEdit.setGeometry(QtCore.QRect(8, 8, 458, 349)) self.slideTextEdit.setObjectName(u'slideTextEdit') self.splitButton = QtGui.QPushButton(customSlideEditDialog) From b9b202e5a83c750c3e0cdf4f7c1d3015f97f483e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Oct 2010 22:19:58 +0200 Subject: [PATCH 12/13] another fix for the merge --- openlp/plugins/custom/forms/editcustomslidedialog.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index ed69b24ba..ce4cf6e29 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -38,7 +38,6 @@ class Ui_CustomSlideEditDialog(object): self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) self.buttonBox.setObjectName(u'buttonBox') - self.slideTextEdit = QtGui.QTextEdit(customSlideEditDialog) self.slideTextEdit = SpellTextEdit(self) self.slideTextEdit.setGeometry(QtCore.QRect(8, 8, 458, 349)) self.slideTextEdit.setObjectName(u'slideTextEdit') From 034bae031a21b0c88883060314cecf9674b3970b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 11 Oct 2010 09:47:55 +0200 Subject: [PATCH 13/13] missing space --- openlp/plugins/custom/forms/editcustomslideform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py index ab670970b..ff396658f 100644 --- a/openlp/plugins/custom/forms/editcustomslideform.py +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -44,7 +44,7 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog): """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - # Connecting signals and slots + # Connecting signals and slots QtCore.QObject.connect(self.splitButton, QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed)