openlp/openlp/core/ui/serviceitemeditdialog.py

71 lines
3.7 KiB
Python
Raw Normal View History

2010-03-17 21:08:18 +00:00
# -*- coding: utf-8 -*-
2019-04-13 13:00:22 +00:00
##########################################################################
# OpenLP - Open Source Lyrics Projection #
# ---------------------------------------------------------------------- #
# Copyright (c) 2008-2019 OpenLP Developers #
# ---------------------------------------------------------------------- #
# 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, either version 3 of the License, or #
# (at your option) any later version. #
# #
# 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, see <https://www.gnu.org/licenses/>. #
##########################################################################
2013-02-01 21:34:23 +00:00
"""
The UI widgets for the service item edit dialog
"""
2015-11-07 00:49:40 +00:00
from PyQt5 import QtWidgets
2017-10-07 07:05:07 +00:00
from openlp.core.common.i18n import translate
2018-10-02 04:39:42 +00:00
from openlp.core.lib.ui import create_button, create_button_box
2018-04-21 19:57:51 +00:00
from openlp.core.ui.icons import UiIcons
2010-03-17 21:08:18 +00:00
2013-02-01 21:34:23 +00:00
2010-03-17 21:08:18 +00:00
class Ui_ServiceItemEditDialog(object):
2013-02-01 21:34:23 +00:00
"""
The UI widgets for the service item edit dialog
"""
def setup_ui(self, serviceItemEditDialog):
2013-02-01 21:34:23 +00:00
"""
Set up the UI
"""
2013-08-31 18:17:38 +00:00
serviceItemEditDialog.setObjectName('serviceItemEditDialog')
2018-04-21 19:57:51 +00:00
serviceItemEditDialog.setWindowIcon(UiIcons().main_icon)
2015-11-07 00:49:40 +00:00
self.dialog_layout = QtWidgets.QGridLayout(serviceItemEditDialog)
2013-01-27 20:36:18 +00:00
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setSpacing(8)
2013-08-31 18:17:38 +00:00
self.dialog_layout.setObjectName('dialog_layout')
2015-11-07 00:49:40 +00:00
self.list_widget = QtWidgets.QListWidget(serviceItemEditDialog)
2013-01-27 20:36:18 +00:00
self.list_widget.setAlternatingRowColors(True)
2013-08-31 18:17:38 +00:00
self.list_widget.setObjectName('list_widget')
2013-01-27 20:36:18 +00:00
self.dialog_layout.addWidget(self.list_widget, 0, 0)
2015-11-07 00:49:40 +00:00
self.button_layout = QtWidgets.QVBoxLayout()
2013-08-31 18:17:38 +00:00
self.button_layout.setObjectName('button_layout')
self.delete_button = create_button(serviceItemEditDialog, 'deleteButton', role='delete',
2013-12-24 15:55:01 +00:00
click=serviceItemEditDialog.on_delete_button_clicked)
2013-01-27 20:36:18 +00:00
self.button_layout.addWidget(self.delete_button)
self.button_layout.addStretch()
2013-08-31 18:17:38 +00:00
self.up_button = create_button(serviceItemEditDialog, 'up_button', role='up',
2013-12-24 15:55:01 +00:00
click=serviceItemEditDialog.on_up_button_clicked)
2013-08-31 18:17:38 +00:00
self.down_button = create_button(serviceItemEditDialog, 'down_button', role='down',
2013-12-24 15:55:01 +00:00
click=serviceItemEditDialog.on_down_button_clicked)
2013-01-27 20:36:18 +00:00
self.button_layout.addWidget(self.up_button)
self.button_layout.addWidget(self.down_button)
self.dialog_layout.addLayout(self.button_layout, 0, 1)
2013-08-31 18:17:38 +00:00
self.button_box = create_button_box(serviceItemEditDialog, 'button_box', ['cancel', 'save'])
2013-01-27 20:36:18 +00:00
self.dialog_layout.addWidget(self.button_box, 1, 0, 1, 2)
self.retranslate_ui(serviceItemEditDialog)
2010-03-17 21:08:18 +00:00
def retranslate_ui(self, serviceItemEditDialog):
2013-02-01 21:34:23 +00:00
"""
Translate the UI on the fly
"""
2012-12-29 13:35:16 +00:00
serviceItemEditDialog.setWindowTitle(translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))