openlp/openlp/core/ui/servicenoteform.py

73 lines
3.2 KiB
Python
Raw Normal View History

2010-03-03 17:48:37 +00:00
# -*- coding: utf-8 -*-
2019-04-13 13:00:22 +00:00
##########################################################################
# OpenLP - Open Source Lyrics Projection #
# ---------------------------------------------------------------------- #
2022-02-01 10:10:57 +00:00
# Copyright (c) 2008-2022 OpenLP Developers #
2019-04-13 13:00:22 +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, 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 :mod:`~openlp.core.ui.servicenoteform` module contains the `ServiceNoteForm` class.
"""
from PyQt5 import QtCore, QtWidgets
2010-06-08 15:56:47 +00:00
2017-10-07 07:05:07 +00:00
from openlp.core.common.i18n import translate
2017-10-23 22:09:57 +00:00
from openlp.core.common.mixins import RegistryProperties
from openlp.core.common.registry import Registry
from openlp.core.lib.ui import create_button_box
2017-10-23 22:09:57 +00:00
from openlp.core.widgets.edits import SpellTextEdit
2010-03-03 17:48:37 +00:00
2013-02-01 21:34:23 +00:00
2015-11-07 00:49:40 +00:00
class ServiceNoteForm(QtWidgets.QDialog, RegistryProperties):
2010-03-03 17:48:37 +00:00
"""
This is the form that is used to edit the verses of the song.
"""
2013-01-27 07:36:04 +00:00
def __init__(self):
2010-03-03 17:48:37 +00:00
"""
Constructor
"""
super(ServiceNoteForm, self).__init__(Registry().get('main_window'), QtCore.Qt.WindowSystemMenuHint |
QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowCloseButtonHint)
self.setup_ui()
self.retranslate_ui()
2011-02-01 00:33:50 +00:00
2015-11-07 00:49:40 +00:00
def exec(self):
2013-02-01 21:34:23 +00:00
"""
Execute the form and return the result.
"""
2013-01-27 20:36:18 +00:00
self.text_edit.setFocus()
2015-11-07 00:49:40 +00:00
return QtWidgets.QDialog.exec(self)
2011-06-13 20:49:14 +00:00
def setup_ui(self):
2013-02-01 21:34:23 +00:00
"""
Set up the UI of the dialog
"""
2013-08-31 18:17:38 +00:00
self.setObjectName('serviceNoteEdit')
2015-11-07 00:49:40 +00:00
self.dialog_layout = QtWidgets.QVBoxLayout(self)
2013-01-27 20:36:18 +00:00
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setSpacing(8)
2014-03-04 18:49:30 +00:00
self.dialog_layout.setObjectName('vertical_layout')
2013-01-27 20:36:18 +00:00
self.text_edit = SpellTextEdit(self, False)
2013-08-31 18:17:38 +00:00
self.text_edit.setObjectName('textEdit')
2013-01-27 20:36:18 +00:00
self.dialog_layout.addWidget(self.text_edit)
2013-08-31 18:17:38 +00:00
self.button_box = create_button_box(self, 'button_box', ['cancel', 'save'])
2013-01-27 20:36:18 +00:00
self.dialog_layout.addWidget(self.button_box)
2011-02-01 00:33:50 +00:00
def retranslate_ui(self):
2013-02-01 21:34:23 +00:00
"""
Translate the UI on the fly
"""
2014-03-20 19:10:31 +00:00
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))