forked from openlp/openlp
UI library - delete_push_button
This commit is contained in:
parent
9c4e47009d
commit
eb9364b45e
|
@ -30,7 +30,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import build_icon, translate
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -108,3 +108,18 @@ def media_item_combo_box(parent, name):
|
||||||
combo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
|
combo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
|
||||||
combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||||
return combo
|
return combo
|
||||||
|
|
||||||
|
def delete_push_button(parent, icon=None):
|
||||||
|
"""
|
||||||
|
Return a standard push button with delete label.
|
||||||
|
"""
|
||||||
|
delete_button = QtGui.QPushButton(parent)
|
||||||
|
delete_button.setObjectName(u'deleteButton')
|
||||||
|
delete_icon = icon if icon else u':/general/general_delete.png'
|
||||||
|
delete_button.setIcon(build_icon(delete_icon))
|
||||||
|
delete_button.setText(translate('OpenLP.Ui', '&Delete'))
|
||||||
|
delete_button.setToolTip(
|
||||||
|
translate('OpenLP.Ui', 'Delete the selected item.'))
|
||||||
|
QtCore.QObject.connect(delete_button,
|
||||||
|
QtCore.SIGNAL(u'clicked()'), parent.onDeleteButtonClicked)
|
||||||
|
return delete_button
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, build_icon
|
from openlp.core.lib import translate, build_icon
|
||||||
from openlp.core.lib.ui import save_cancel_button_box
|
from openlp.core.lib.ui import save_cancel_button_box, delete_push_button
|
||||||
|
|
||||||
class Ui_ServiceItemEditDialog(object):
|
class Ui_ServiceItemEditDialog(object):
|
||||||
def setupUi(self, serviceItemEditDialog):
|
def setupUi(self, serviceItemEditDialog):
|
||||||
|
@ -40,8 +40,7 @@ class Ui_ServiceItemEditDialog(object):
|
||||||
self.dialogLayout.addWidget(self.listWidget, 0, 0)
|
self.dialogLayout.addWidget(self.listWidget, 0, 0)
|
||||||
self.buttonLayout = QtGui.QVBoxLayout()
|
self.buttonLayout = QtGui.QVBoxLayout()
|
||||||
self.buttonLayout.setObjectName(u'buttonLayout')
|
self.buttonLayout.setObjectName(u'buttonLayout')
|
||||||
self.deleteButton = QtGui.QPushButton(serviceItemEditDialog)
|
self.deleteButton = delete_push_button(serviceItemEditDialog)
|
||||||
self.deleteButton.setObjectName(u'deleteButton')
|
|
||||||
self.buttonLayout.addWidget(self.deleteButton)
|
self.buttonLayout.addWidget(self.deleteButton)
|
||||||
self.buttonLayout.addStretch()
|
self.buttonLayout.addStretch()
|
||||||
self.upButton = QtGui.QPushButton(serviceItemEditDialog)
|
self.upButton = QtGui.QPushButton(serviceItemEditDialog)
|
||||||
|
@ -61,5 +60,3 @@ class Ui_ServiceItemEditDialog(object):
|
||||||
def retranslateUi(self, serviceItemEditDialog):
|
def retranslateUi(self, serviceItemEditDialog):
|
||||||
serviceItemEditDialog.setWindowTitle(
|
serviceItemEditDialog.setWindowTitle(
|
||||||
translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))
|
translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))
|
||||||
self.deleteButton.setText(translate('OpenLP.ServiceItemEditForm',
|
|
||||||
'Delete'))
|
|
||||||
|
|
|
@ -44,8 +44,6 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onItemUp)
|
QtCore.SIGNAL(u'clicked()'), self.onItemUp)
|
||||||
QtCore.QObject.connect(self.downButton,
|
QtCore.QObject.connect(self.downButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onItemDown)
|
QtCore.SIGNAL(u'clicked()'), self.onItemDown)
|
||||||
QtCore.QObject.connect(self.deleteButton,
|
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onItemDelete)
|
|
||||||
QtCore.QObject.connect(self.listWidget,
|
QtCore.QObject.connect(self.listWidget,
|
||||||
QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
|
QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
|
||||||
|
|
||||||
|
@ -77,7 +75,7 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
|
||||||
item_name = QtGui.QListWidgetItem(frame[u'title'])
|
item_name = QtGui.QListWidgetItem(frame[u'title'])
|
||||||
self.listWidget.addItem(item_name)
|
self.listWidget.addItem(item_name)
|
||||||
|
|
||||||
def onItemDelete(self):
|
def onDeleteButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Delete the current row.
|
Delete the current row.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate
|
from openlp.core.lib import build_icon, translate
|
||||||
|
from openlp.core.lib.ui import delete_push_button
|
||||||
|
|
||||||
class Ui_AlertDialog(object):
|
class Ui_AlertDialog(object):
|
||||||
def setupUi(self, alertDialog):
|
def setupUi(self, alertDialog):
|
||||||
|
@ -65,9 +66,7 @@ class Ui_AlertDialog(object):
|
||||||
self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
|
self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
|
||||||
self.saveButton.setObjectName(u'saveButton')
|
self.saveButton.setObjectName(u'saveButton')
|
||||||
self.manageButtonLayout.addWidget(self.saveButton)
|
self.manageButtonLayout.addWidget(self.saveButton)
|
||||||
self.deleteButton = QtGui.QPushButton(alertDialog)
|
self.deleteButton = delete_push_button(alertDialog)
|
||||||
self.deleteButton.setIcon(build_icon(u':/general/general_delete.png'))
|
|
||||||
self.deleteButton.setObjectName(u'deleteButton')
|
|
||||||
self.manageButtonLayout.addWidget(self.deleteButton)
|
self.manageButtonLayout.addWidget(self.deleteButton)
|
||||||
self.manageButtonLayout.addStretch()
|
self.manageButtonLayout.addStretch()
|
||||||
self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1)
|
self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1)
|
||||||
|
@ -101,8 +100,6 @@ class Ui_AlertDialog(object):
|
||||||
translate('AlertsPlugin.AlertForm', '&New'))
|
translate('AlertsPlugin.AlertForm', '&New'))
|
||||||
self.saveButton.setText(
|
self.saveButton.setText(
|
||||||
translate('AlertsPlugin.AlertForm', '&Save'))
|
translate('AlertsPlugin.AlertForm', '&Save'))
|
||||||
self.deleteButton.setText(
|
|
||||||
translate('AlertsPlugin.AlertForm', '&Delete'))
|
|
||||||
self.displayButton.setText(
|
self.displayButton.setText(
|
||||||
translate('AlertsPlugin.AlertForm', 'Displ&ay'))
|
translate('AlertsPlugin.AlertForm', 'Displ&ay'))
|
||||||
self.displayCloseButton.setText(
|
self.displayCloseButton.setText(
|
||||||
|
|
|
@ -52,8 +52,6 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
||||||
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged)
|
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged)
|
||||||
QtCore.QObject.connect(self.newButton, QtCore.SIGNAL(u'clicked()'),
|
QtCore.QObject.connect(self.newButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onNewClick)
|
self.onNewClick)
|
||||||
QtCore.QObject.connect(self.deleteButton, QtCore.SIGNAL(u'clicked()'),
|
|
||||||
self.onDeleteClick)
|
|
||||||
QtCore.QObject.connect(self.saveButton, QtCore.SIGNAL(u'clicked()'),
|
QtCore.QObject.connect(self.saveButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onSaveClick)
|
self.onSaveClick)
|
||||||
QtCore.QObject.connect(self.alertListWidget,
|
QtCore.QObject.connect(self.alertListWidget,
|
||||||
|
@ -83,7 +81,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
||||||
if self.triggerAlert(unicode(self.alertTextEdit.text())):
|
if self.triggerAlert(unicode(self.alertTextEdit.text())):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Deletes the selected item.
|
Deletes the selected item.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate
|
from openlp.core.lib import build_icon, translate
|
||||||
from openlp.core.lib.ui import save_cancel_button_box
|
from openlp.core.lib.ui import save_cancel_button_box, delete_push_button
|
||||||
|
|
||||||
class Ui_CustomEditDialog(object):
|
class Ui_CustomEditDialog(object):
|
||||||
def setupUi(self, customEditDialog):
|
def setupUi(self, customEditDialog):
|
||||||
|
@ -64,8 +64,7 @@ class Ui_CustomEditDialog(object):
|
||||||
self.editAllButton = QtGui.QPushButton(customEditDialog)
|
self.editAllButton = QtGui.QPushButton(customEditDialog)
|
||||||
self.editAllButton.setObjectName(u'editAllButton')
|
self.editAllButton.setObjectName(u'editAllButton')
|
||||||
self.buttonLayout.addWidget(self.editAllButton)
|
self.buttonLayout.addWidget(self.editAllButton)
|
||||||
self.deleteButton = QtGui.QPushButton(customEditDialog)
|
self.deleteButton = delete_push_button(customEditDialog)
|
||||||
self.deleteButton.setObjectName(u'deleteButton')
|
|
||||||
self.buttonLayout.addWidget(self.deleteButton)
|
self.buttonLayout.addWidget(self.deleteButton)
|
||||||
self.buttonLayout.addStretch()
|
self.buttonLayout.addStretch()
|
||||||
self.upButton = QtGui.QPushButton(customEditDialog)
|
self.upButton = QtGui.QPushButton(customEditDialog)
|
||||||
|
@ -125,11 +124,6 @@ class Ui_CustomEditDialog(object):
|
||||||
self.editAllButton.setToolTip(
|
self.editAllButton.setToolTip(
|
||||||
translate('CustomPlugin.EditCustomForm', 'Edit all the slides at '
|
translate('CustomPlugin.EditCustomForm', 'Edit all the slides at '
|
||||||
'once.'))
|
'once.'))
|
||||||
self.deleteButton.setText(
|
|
||||||
translate('CustomPlugin.EditCustomForm', '&Delete'))
|
|
||||||
self.deleteButton.setToolTip(
|
|
||||||
translate('CustomPlugin.EditCustomForm', 'Delete the selected '
|
|
||||||
'slide.'))
|
|
||||||
self.themeLabel.setText(
|
self.themeLabel.setText(
|
||||||
translate('CustomPlugin.EditCustomForm', 'The&me:'))
|
translate('CustomPlugin.EditCustomForm', 'The&me:'))
|
||||||
self.creditLabel.setText(
|
self.creditLabel.setText(
|
||||||
|
|
|
@ -62,8 +62,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed)
|
QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed)
|
||||||
QtCore.QObject.connect(self.editAllButton,
|
QtCore.QObject.connect(self.editAllButton,
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed)
|
QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed)
|
||||||
QtCore.QObject.connect(self.deleteButton,
|
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonPressed)
|
|
||||||
QtCore.QObject.connect(self.upButton,
|
QtCore.QObject.connect(self.upButton,
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed)
|
QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed)
|
||||||
QtCore.QObject.connect(self.downButton,
|
QtCore.QObject.connect(self.downButton,
|
||||||
|
@ -243,7 +241,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
||||||
self.slideListView.addItem(slide)
|
self.slideListView.addItem(slide)
|
||||||
self.slideListView.repaint()
|
self.slideListView.repaint()
|
||||||
|
|
||||||
def onDeleteButtonPressed(self):
|
def onDeleteButtonClicked(self):
|
||||||
self.slideListView.takeItem(self.slideListView.currentRow())
|
self.slideListView.takeItem(self.slideListView.currentRow())
|
||||||
self.editButton.setEnabled(True)
|
self.editButton.setEnabled(True)
|
||||||
self.editAllButton.setEnabled(True)
|
self.editAllButton.setEnabled(True)
|
||||||
|
|
Loading…
Reference in New Issue