Fix field names and more state changes

bzr-revno: 395
This commit is contained in:
Tim Bentley 2009-03-07 20:36:12 +00:00
parent 710b60bc19
commit bd7577a0f1
2 changed files with 69 additions and 66 deletions

View File

@ -8,6 +8,7 @@
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
from openlp.core import translate
class Ui_customEditDialog(object):
def setupUi(self, customEditDialog):
@ -32,56 +33,56 @@ class Ui_customEditDialog(object):
self.verticalLayout.addWidget(self.VerseListView)
self.EditWidget = QtGui.QWidget(customEditDialog)
self.EditWidget.setObjectName("EditWidget")
self.EditLayout_3 = QtGui.QHBoxLayout(self.EditWidget)
self.EditLayout_3.setSpacing(8)
self.EditLayout_3.setMargin(0)
self.EditLayout_3.setObjectName("EditLayout_3")
self.VerseTextEdit_3 = QtGui.QTextEdit(self.EditWidget)
self.VerseTextEdit_3.setObjectName("VerseTextEdit_3")
self.EditLayout_3.addWidget(self.VerseTextEdit_3)
self.EditLayout = QtGui.QHBoxLayout(self.EditWidget)
self.EditLayout.setSpacing(8)
self.EditLayout.setMargin(0)
self.EditLayout.setObjectName("EditLayout")
self.VerseTextEdit = QtGui.QTextEdit(self.EditWidget)
self.VerseTextEdit.setObjectName("VerseTextEdit")
self.EditLayout.addWidget(self.VerseTextEdit)
self.ButtonWidge = QtGui.QWidget(self.EditWidget)
self.ButtonWidge.setObjectName("ButtonWidge")
self.ButtonLayout_3 = QtGui.QVBoxLayout(self.ButtonWidge)
self.ButtonLayout_3.setSpacing(8)
self.ButtonLayout_3.setMargin(0)
self.ButtonLayout_3.setObjectName("ButtonLayout_3")
self.AddButton_3 = QtGui.QPushButton(self.ButtonWidge)
self.AddButton_3.setObjectName("AddButton_3")
self.ButtonLayout_3.addWidget(self.AddButton_3)
self.EditButton_3 = QtGui.QPushButton(self.ButtonWidge)
self.EditButton_3.setObjectName("EditButton_3")
self.ButtonLayout_3.addWidget(self.EditButton_3)
self.SaveButton_3 = QtGui.QPushButton(self.ButtonWidge)
self.SaveButton_3.setObjectName("SaveButton_3")
self.ButtonLayout_3.addWidget(self.SaveButton_3)
self.ButtonLayout = QtGui.QVBoxLayout(self.ButtonWidge)
self.ButtonLayout.setSpacing(8)
self.ButtonLayout.setMargin(0)
self.ButtonLayout.setObjectName("ButtonLayout")
self.AddButton = QtGui.QPushButton(self.ButtonWidge)
self.AddButton.setObjectName("AddButton")
self.ButtonLayout.addWidget(self.AddButton)
self.EditButton = QtGui.QPushButton(self.ButtonWidge)
self.EditButton.setObjectName("EditButton")
self.ButtonLayout.addWidget(self.EditButton)
self.SaveButton = QtGui.QPushButton(self.ButtonWidge)
self.SaveButton.setObjectName("SaveButton")
self.ButtonLayout.addWidget(self.SaveButton)
self.DeleteButton = QtGui.QPushButton(self.ButtonWidge)
self.DeleteButton.setObjectName("DeleteButton")
self.ButtonLayout_3.addWidget(self.DeleteButton)
self.ButtonLayout.addWidget(self.DeleteButton)
self.ClearButton = QtGui.QPushButton(self.ButtonWidge)
self.ClearButton.setObjectName("ClearButton")
self.ButtonLayout_3.addWidget(self.ClearButton)
self.ButtonLayout.addWidget(self.ClearButton)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.ButtonLayout_3.addItem(spacerItem)
self.EditLayout_3.addWidget(self.ButtonWidge)
self.ButtonLayout.addItem(spacerItem)
self.EditLayout.addWidget(self.ButtonWidge)
self.verticalLayout.addWidget(self.EditWidget)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.ThemeLabel = QtGui.QLabel(customEditDialog)
self.ThemeLabel.setObjectName("ThemeLabel")
self.horizontalLayout_3.addWidget(self.ThemeLabel)
self.horizontalLayout.addWidget(self.ThemeLabel)
self.ThemecomboBox = QtGui.QComboBox(customEditDialog)
self.ThemecomboBox.setObjectName("ThemecomboBox")
self.horizontalLayout_3.addWidget(self.ThemecomboBox)
self.verticalLayout.addLayout(self.horizontalLayout_3)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.horizontalLayout.addWidget(self.ThemecomboBox)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.CreditLabel = QtGui.QLabel(customEditDialog)
self.CreditLabel.setObjectName("CreditLabel")
self.horizontalLayout_2.addWidget(self.CreditLabel)
self.horizontalLayout.addWidget(self.CreditLabel)
self.CreditEdit = QtGui.QLineEdit(customEditDialog)
self.CreditEdit.setObjectName("CreditEdit")
self.horizontalLayout_2.addWidget(self.CreditEdit)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.horizontalLayout.addWidget(self.CreditEdit)
self.verticalLayout.addLayout(self.horizontalLayout)
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
@ -89,22 +90,22 @@ class Ui_customEditDialog(object):
self.retranslateUi(customEditDialog)
QtCore.QMetaObject.connectSlotsByName(customEditDialog)
customEditDialog.setTabOrder(self.TitleEdit, self.VerseTextEdit_3)
customEditDialog.setTabOrder(self.VerseTextEdit_3, self.EditButton_3)
customEditDialog.setTabOrder(self.EditButton_3, self.SaveButton_3)
customEditDialog.setTabOrder(self.SaveButton_3, self.CreditEdit)
customEditDialog.setTabOrder(self.TitleEdit, self.VerseTextEdit)
customEditDialog.setTabOrder(self.VerseTextEdit, self.EditButton)
customEditDialog.setTabOrder(self.EditButton, self.SaveButton)
customEditDialog.setTabOrder(self.SaveButton, self.CreditEdit)
customEditDialog.setTabOrder(self.CreditEdit, self.VerseListView)
customEditDialog.setTabOrder(self.VerseListView, self.AddButton_3)
customEditDialog.setTabOrder(self.AddButton_3, self.DeleteButton)
customEditDialog.setTabOrder(self.VerseListView, self.AddButton)
customEditDialog.setTabOrder(self.AddButton, self.DeleteButton)
customEditDialog.setTabOrder(self.DeleteButton, self.buttonBox)
def retranslateUi(self, customEditDialog):
customEditDialog.setWindowTitle(QtGui.QApplication.translate("customEditDialog", "Edit Custom Slides", None, QtGui.QApplication.UnicodeUTF8))
self.TitleLabel.setText(QtGui.QApplication.translate("customEditDialog", "Title:", None, QtGui.QApplication.UnicodeUTF8))
self.AddButton_3.setText(QtGui.QApplication.translate("customEditDialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
self.EditButton_3.setText(QtGui.QApplication.translate("customEditDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8))
self.SaveButton_3.setText(QtGui.QApplication.translate("customEditDialog", "Save", None, QtGui.QApplication.UnicodeUTF8))
self.DeleteButton.setText(QtGui.QApplication.translate("customEditDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8))
self.ClearButton.setText(QtGui.QApplication.translate("customEditDialog", "Clear", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeLabel.setText(QtGui.QApplication.translate("customEditDialog", "Theme:", None, QtGui.QApplication.UnicodeUTF8))
self.CreditLabel.setText(QtGui.QApplication.translate("customEditDialog", "Credits:", None, QtGui.QApplication.UnicodeUTF8))
customEditDialog.setWindowTitle(translate("customEditDialog", "Edit Custom Slides"))
self.TitleLabel.setText(translate("customEditDialog", "Title:"))
self.AddButton.setText(translate("customEditDialog", "Add"))
self.EditButton.setText(translate("customEditDialog", "Edit"))
self.SaveButton.setText(translate("customEditDialog", "Save"))
self.DeleteButton.setText(translate("customEditDialog", "Delete"))
self.ClearButton.setText(translate("customEditDialog", "Clear"))
self.ThemeLabel.setText(translate("customEditDialog", "Theme:"))
self.CreditLabel.setText(translate("customEditDialog", "Credits:"))

View File

@ -34,9 +34,9 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
# Connecting signals and slots
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.rejected)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.accept)
QtCore.QObject.connect(self.AddButton_3, QtCore.SIGNAL("pressed()"), self.onAddButtonPressed)
QtCore.QObject.connect(self.EditButton_3, QtCore.SIGNAL("pressed()"), self.onEditButtonPressed)
QtCore.QObject.connect(self.SaveButton_3, QtCore.SIGNAL("pressed()"), self.onSaveButtonPressed)
QtCore.QObject.connect(self.AddButton, QtCore.SIGNAL("pressed()"), self.onAddButtonPressed)
QtCore.QObject.connect(self.EditButton, QtCore.SIGNAL("pressed()"), self.onEditButtonPressed)
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)
@ -59,36 +59,38 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
self.close()
def onClearButtonPressed(self):
self.VerseTextEdit_3.clear()
self.VerseTextEdit.clear()
def onVerseListViewPressed(self, item):
self.DeleteButton.setEnabled(True)
self.EditButton_3.setEnabled(True)
self.EditButton.setEnabled(True)
self.selectedRow = self.VerseListView.currentRow()
def onVerseListViewSelected(self, item):
self.VerseTextEdit_3.setPlainText(item.text())
self.VerseTextEdit.setPlainText(item.text())
self.DeleteButton.setEnabled(False)
self.EditButton_3.setEnabled(False)
self.SaveButton_3.setEnabled(True)
self.EditButton.setEnabled(False)
self.SaveButton.setEnabled(True)
def onAddButtonPressed(self):
self.VerseListView.addItem(self.VerseTextEdit_3.toPlainText())
self.VerseListView.addItem(self.VerseTextEdit.toPlainText())
self.DeleteButton.setEnabled(False)
self.VerseTextEdit_3.clear()
self.VerseTextEdit.clear()
def onEditButtonPressed(self):
self.VerseTextEdit_3.setPlainText(self.VerseListView.currentItem().text())
self.VerseTextEdit.setPlainText(self.VerseListView.currentItem().text())
self.DeleteButton.setEnabled(False)
self.EditButton_3.setEnabled(False)
self.SaveButton_3.setEnabled(True)
self.EditButton.setEnabled(False)
self.SaveButton.setEnabled(True)
def onSaveButtonPressed(self):
self.VerseListView.currentItem().setText(self.VerseTextEdit_3.toPlainText())
self.SaveButton_3.setEnabled(False)
self.VerseListView.currentItem().setText(self.VerseTextEdit.toPlainText())
self.SaveButton.setEnabled(False)
self.EditButton.setEnabled(False)
def onDeleteButtonPressed(self):
self.VerseListView.takeItem(self.VerseListView.currentRow())
self.EditButton.setEnabled(False)
def validate(self):
invalid = 0
@ -104,8 +106,8 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
def initialise(self):
self.valid = True
self.DeleteButton.setEnabled(False)
self.EditButton_3.setEnabled(False)
self.SaveButton_3.setEnabled(False)
self.EditButton.setEnabled(False)
self.SaveButton.setEnabled(False)
pass
# list = self.songmanager.get_authors()
# self.AuthorsSelectionComboItem.clear()