openlp/openlp/plugins/alerts/forms/alertdialog.py

96 lines
6.0 KiB
Python
Raw Normal View History

2010-02-14 13:27:32 +00:00
# -*- coding: utf-8 -*-
2013-01-01 16:33:41 +00:00
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
2010-02-14 13:27:32 +00:00
2010-04-21 17:21:56 +00:00
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
2013-12-24 08:56:50 +00:00
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
2012-11-11 21:16:14 +00:00
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
2012-10-21 13:16:22 +00:00
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
2010-04-21 17:21:56 +00:00
# --------------------------------------------------------------------------- #
# 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 #
###############################################################################
2010-02-14 13:27:32 +00:00
2012-05-21 12:41:33 +00:00
from PyQt4 import QtGui
2010-06-01 17:13:54 +00:00
2013-10-13 21:07:28 +00:00
from openlp.core.common import translate
from openlp.core.lib import build_icon
from openlp.core.lib.ui import create_button, create_button_box
2010-02-14 13:27:32 +00:00
2013-02-14 21:31:17 +00:00
2010-02-14 13:27:32 +00:00
class Ui_AlertDialog(object):
2013-02-14 21:31:17 +00:00
def setupUi(self, alert_dialog):
2013-08-31 18:17:38 +00:00
alert_dialog.setObjectName('alert_dialog')
2013-02-14 21:31:17 +00:00
alert_dialog.resize(400, 300)
2013-08-31 18:17:38 +00:00
alert_dialog.setWindowIcon(build_icon(':/icon/openlp-logo-16x16.png'))
2013-02-14 21:31:17 +00:00
self.alert_dialog_layout = QtGui.QGridLayout(alert_dialog)
2013-08-31 18:17:38 +00:00
self.alert_dialog_layout.setObjectName('alert_dialog_layout')
2013-02-14 21:31:17 +00:00
self.alert_text_layout = QtGui.QFormLayout()
2013-08-31 18:17:38 +00:00
self.alert_text_layout.setObjectName('alert_text_layout')
2013-02-14 21:31:17 +00:00
self.alert_entry_label = QtGui.QLabel(alert_dialog)
2013-08-31 18:17:38 +00:00
self.alert_entry_label.setObjectName('alert_entry_label')
2013-02-14 21:31:17 +00:00
self.alert_text_edit = QtGui.QLineEdit(alert_dialog)
2013-08-31 18:17:38 +00:00
self.alert_text_edit.setObjectName('alert_text_edit')
2013-02-14 21:31:17 +00:00
self.alert_entry_label.setBuddy(self.alert_text_edit)
self.alert_text_layout.addRow(self.alert_entry_label, self.alert_text_edit)
self.alert_parameter = QtGui.QLabel(alert_dialog)
2013-08-31 18:17:38 +00:00
self.alert_parameter.setObjectName('alert_parameter')
2013-02-14 21:31:17 +00:00
self.parameter_edit = QtGui.QLineEdit(alert_dialog)
2013-08-31 18:17:38 +00:00
self.parameter_edit.setObjectName('parameter_edit')
2013-02-14 21:31:17 +00:00
self.alert_parameter.setBuddy(self.parameter_edit)
self.alert_text_layout.addRow(self.alert_parameter, self.parameter_edit)
self.alert_dialog_layout.addLayout(self.alert_text_layout, 0, 0, 1, 2)
self.alert_list_widget = QtGui.QListWidget(alert_dialog)
self.alert_list_widget.setAlternatingRowColors(True)
2013-08-31 18:17:38 +00:00
self.alert_list_widget.setObjectName('alert_list_widget')
2013-02-14 21:31:17 +00:00
self.alert_dialog_layout.addWidget(self.alert_list_widget, 1, 0)
self.manage_button_layout = QtGui.QVBoxLayout()
2013-08-31 18:17:38 +00:00
self.manage_button_layout.setObjectName('manage_button_layout')
2013-02-14 21:31:17 +00:00
self.new_button = QtGui.QPushButton(alert_dialog)
2013-08-31 18:17:38 +00:00
self.new_button.setIcon(build_icon(':/general/general_new.png'))
self.new_button.setObjectName('new_button')
2013-02-14 21:31:17 +00:00
self.manage_button_layout.addWidget(self.new_button)
self.save_button = QtGui.QPushButton(alert_dialog)
self.save_button.setEnabled(False)
2013-08-31 18:17:38 +00:00
self.save_button.setIcon(build_icon(':/general/general_save.png'))
self.save_button.setObjectName('save_button')
2013-02-14 21:31:17 +00:00
self.manage_button_layout.addWidget(self.save_button)
2013-08-31 18:17:38 +00:00
self.delete_button = create_button(alert_dialog, 'delete_button', role='delete', enabled=False,
2013-04-18 17:17:00 +00:00
click=alert_dialog.on_delete_button_clicked)
2013-02-14 21:31:17 +00:00
self.manage_button_layout.addWidget(self.delete_button)
self.manage_button_layout.addStretch()
self.alert_dialog_layout.addLayout(self.manage_button_layout, 1, 1)
2013-08-31 18:17:38 +00:00
display_icon = build_icon(':/general/general_live.png')
self.display_button = create_button(alert_dialog, 'display_button', icon=display_icon, enabled=False)
self.display_close_button = create_button(alert_dialog, 'display_close_button', icon=display_icon,
2013-02-14 21:31:17 +00:00
enabled=False)
2013-08-31 18:17:38 +00:00
self.button_box = create_button_box(alert_dialog, 'button_box', ['close'],
2013-02-14 21:31:17 +00:00
[self.display_button, self.display_close_button])
self.alert_dialog_layout.addWidget(self.button_box, 2, 0, 1, 2)
self.retranslateUi(alert_dialog)
2010-02-14 13:27:32 +00:00
2013-02-14 21:31:17 +00:00
def retranslateUi(self, alert_dialog):
alert_dialog.setWindowTitle(translate('AlertsPlugin.AlertForm', 'Alert Message'))
self.alert_entry_label.setText(translate('AlertsPlugin.AlertForm', 'Alert &text:'))
self.alert_parameter.setText(translate('AlertsPlugin.AlertForm', '&Parameter:'))
self.new_button.setText(translate('AlertsPlugin.AlertForm', '&New'))
self.save_button.setText(translate('AlertsPlugin.AlertForm', '&Save'))
self.display_button.setText(translate('AlertsPlugin.AlertForm', 'Displ&ay'))
self.display_close_button.setText(translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))