forked from openlp/openlp
Clean up custom plugin dialog
This commit is contained in:
parent
b9630907a8
commit
141a9b4358
@ -24,13 +24,14 @@
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import build_icon
|
||||
|
||||
class Ui_customEditDialog(object):
|
||||
def setupUi(self, customEditDialog):
|
||||
customEditDialog.setObjectName(u'customEditDialog')
|
||||
customEditDialog.resize(590, 541)
|
||||
icon = build_icon(u':/icon/openlp.org-icon-32.bmp')
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
customEditDialog.setWindowIcon(icon)
|
||||
self.gridLayout = QtGui.QGridLayout(customEditDialog)
|
||||
self.gridLayout.setObjectName(u'gridLayout')
|
||||
@ -52,15 +53,19 @@ class Ui_customEditDialog(object):
|
||||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName(u'verticalLayout')
|
||||
self.UpButton = QtGui.QPushButton(customEditDialog)
|
||||
icon1 = build_icon(u':/services/service_up.png')
|
||||
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)
|
||||
spacerItem = QtGui.QSpacerItem(20, 128,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
self.verticalLayout.addItem(spacerItem)
|
||||
self.DownButton = QtGui.QPushButton(customEditDialog)
|
||||
icon2 = build_icon(u':/services/service_down.png')
|
||||
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)
|
||||
@ -97,6 +102,9 @@ class Ui_customEditDialog(object):
|
||||
self.ClearButton = QtGui.QPushButton(self.ButtonWidge)
|
||||
self.ClearButton.setObjectName(u'ClearButton')
|
||||
self.verticalLayout_2.addWidget(self.ClearButton)
|
||||
self.SplitButton = QtGui.QPushButton(self.ButtonWidge)
|
||||
self.SplitButton.setObjectName(u'SplitButton')
|
||||
self.verticalLayout_2.addWidget(self.SplitButton)
|
||||
spacerItem1 = QtGui.QSpacerItem(20, 40,
|
||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.verticalLayout_2.addItem(spacerItem1)
|
||||
@ -121,16 +129,15 @@ class Ui_customEditDialog(object):
|
||||
self.horizontalLayout_2.addWidget(self.CreditEdit)
|
||||
self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
|
||||
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'rejected()'), customEditDialog.closePressed)
|
||||
QtCore.QObject.connect(self.buttonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), customEditDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
|
||||
customEditDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
|
||||
customEditDialog.closePressed)
|
||||
QtCore.QMetaObject.connectSlotsByName(customEditDialog)
|
||||
customEditDialog.setTabOrder(self.TitleEdit, self.VerseTextEdit)
|
||||
customEditDialog.setTabOrder(self.VerseTextEdit, self.AddButton)
|
||||
@ -143,12 +150,11 @@ class Ui_customEditDialog(object):
|
||||
customEditDialog.setTabOrder(self.CreditEdit, self.UpButton)
|
||||
customEditDialog.setTabOrder(self.UpButton, self.DownButton)
|
||||
customEditDialog.setTabOrder(self.DownButton, self.ThemeComboBox)
|
||||
customEditDialog.setTabOrder(self.ThemeComboBox, self.buttonBox)
|
||||
|
||||
def retranslateUi(self, customEditDialog):
|
||||
customEditDialog.setWindowTitle(self.trUtf8('Edit Custom Slides'))
|
||||
self.UpButton.setToolTip(self.trUtf8('Move slide Up 1'))
|
||||
self.DownButton.setToolTip(self.trUtf8('Move slide down 1'))
|
||||
customEditDialog.setWindowTitle(self.trUtf8('Edit Custom Slides'))
|
||||
self.TitleLabel.setText(self.trUtf8('Title:'))
|
||||
self.AddButton.setText(self.trUtf8('Add New'))
|
||||
self.AddButton.setToolTip(self.trUtf8('Add new slide at bottom'))
|
||||
@ -162,6 +168,7 @@ class Ui_customEditDialog(object):
|
||||
self.DeleteButton.setToolTip(self.trUtf8('Delete selected slide'))
|
||||
self.ClearButton.setText(self.trUtf8('Clear'))
|
||||
self.ClearButton.setToolTip(self.trUtf8('Clear edit area'))
|
||||
self.SplitButton.setText(self.trUtf8('Split Slide'))
|
||||
self.SplitButton.setToolTip(self.trUtf8('Add slide split'))
|
||||
self.ThemeLabel.setText(self.trUtf8('Theme:'))
|
||||
self.ThemeComboBox.setToolTip(self.trUtf8('Set Theme for Slides'))
|
||||
self.CreditLabel.setText(self.trUtf8('Credits:'))
|
||||
|
@ -68,6 +68,8 @@ 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.SplitButton,
|
||||
QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed)
|
||||
QtCore.QObject.connect(self.VerseListView,
|
||||
QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'),
|
||||
self.onVerseListViewSelected)
|
||||
@ -94,6 +96,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
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()
|
||||
@ -202,12 +205,14 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
def onEditAllButtonPressed(self):
|
||||
self.editAll = True
|
||||
self.AddButton.setEnabled(False)
|
||||
self.SplitButton.setEnabled(True)
|
||||
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()
|
||||
verse_list += u'\n---\n'
|
||||
if row != self.VerseListView.count() - 1:
|
||||
verse_list += u'\n[---]\n'
|
||||
self.editText(verse_list)
|
||||
|
||||
def editText(self, text):
|
||||
@ -222,7 +227,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
def onSaveButtonPressed(self):
|
||||
if self.editAll:
|
||||
self.VerseListView.clear()
|
||||
for row in unicode(self.VerseTextEdit.toPlainText()).split(u'\n---\n'):
|
||||
for row in unicode(self.VerseTextEdit.toPlainText()).split(u'\n[---]\n'):
|
||||
self.VerseListView.addItem(row)
|
||||
else:
|
||||
self.VerseListView.currentItem().setText(
|
||||
@ -241,8 +246,15 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
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):
|
||||
self.VerseListView.takeItem(self.VerseListView.currentRow())
|
||||
self.EditButton.setEnabled(False)
|
||||
@ -258,5 +270,5 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
return False, self.trUtf8('You need to enter a slide')
|
||||
if self.VerseTextEdit.toPlainText():
|
||||
self.VerseTextEdit.setFocus()
|
||||
return False, self.trUtf8('You have unsaved data')
|
||||
return False, self.trUtf8('You have unsaved data, please save or clear')
|
||||
return True, u''
|
||||
|
@ -46,7 +46,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="UpButton">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Move selected slide up one"/>
|
||||
<string extracomment="Move slide up 1"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -73,7 +73,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="DownButton">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Move selected slide down one"/>
|
||||
<string extracomment="Move slide down 1"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -106,7 +106,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="AddButton">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Adds a new slide at bottom of list"/>
|
||||
<string extracomment="Adds a new slide at bottom"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add New</string>
|
||||
@ -136,7 +136,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="SaveButton">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Save changed slide"/>
|
||||
<string extracomment="Replace edited slide"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
@ -163,6 +163,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="SplitButton">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Add new slide split"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Split Slide</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="ButtonSpacer">
|
||||
<property name="orientation">
|
||||
@ -216,8 +226,11 @@
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Edit dialog"/>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -236,12 +249,44 @@
|
||||
<tabstop>UpButton</tabstop>
|
||||
<tabstop>DownButton</tabstop>
|
||||
<tabstop>ThemeComboBox</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../images/openlp-2.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>customEditDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>294</x>
|
||||
<y>524</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>294</x>
|
||||
<y>270</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>customEditDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>294</x>
|
||||
<y>524</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>294</x>
|
||||
<y>270</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>accept()</slot>
|
||||
<slot>rejected()</slot>
|
||||
|
Loading…
Reference in New Issue
Block a user