openlp/openlp/core/ui/servicenoteform.py

88 lines
3.9 KiB
Python
Raw Normal View History

2010-03-03 17:48:37 +00:00
# -*- coding: utf-8 -*-
2012-12-29 13:35:16 +00:00
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
2010-03-03 17:48:37 +00:00
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
2012-12-29 20:56:56 +00:00
# Copyright (c) 2008-2013 Raoul Snyman #
# Portions copyright (c) 2008-2013 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-03-03 17:48:37 +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 #
###############################################################################
2013-02-01 21:34:23 +00:00
"""
The :mod:`~openlp.core.ui.servicenoteform` module contains the `ServiceNoteForm` class.
"""
2012-05-21 12:41:33 +00:00
from PyQt4 import QtGui
2010-06-08 15:56:47 +00:00
2013-10-13 21:07:28 +00:00
from openlp.core.common import translate
from openlp.core.lib import SpellTextEdit, Registry
from openlp.core.lib.ui import create_button_box
2010-03-03 17:48:37 +00:00
2013-02-01 21:34:23 +00:00
2011-02-01 18:05:59 +00:00
class ServiceNoteForm(QtGui.QDialog):
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
"""
2013-08-31 18:17:38 +00:00
super(ServiceNoteForm, self).__init__(Registry().get('main_window'))
2011-02-01 00:33:50 +00:00
self.setupUi()
self.retranslateUi()
2011-06-13 20:49:14 +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()
2011-06-13 20:49:14 +00:00
return QtGui.QDialog.exec_(self)
2011-02-01 00:33:50 +00:00
def setupUi(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')
2013-01-27 20:36:18 +00:00
self.dialog_layout = QtGui.QVBoxLayout(self)
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('verticalLayout')
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 retranslateUi(self):
2013-02-01 21:34:23 +00:00
"""
Translate the UI on the fly
"""
2012-12-29 13:35:16 +00:00
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
2013-01-27 07:36:04 +00:00
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
2013-08-31 18:17:38 +00:00
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
2013-01-27 07:36:04 +00:00
return self._main_window
2013-02-05 08:05:28 +00:00
main_window = property(_get_main_window)