openlp/openlp/core/ui/aboutform.py

67 lines
2.9 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2012-12-29 09:35:24 +00:00
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
2016-12-31 11:05:48 +00:00
# Copyright (c) 2008-2017 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; 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 19:58:18 +00:00
"""
The About dialog.
"""
2015-01-11 19:46:41 +00:00
import webbrowser
from PyQt5 import QtCore, QtWidgets
from openlp.core.lib import translate
2011-03-25 16:29:39 +00:00
from openlp.core.utils import get_application_version
2015-01-11 19:46:41 +00:00
from .aboutdialog import UiAboutDialog
2013-02-01 19:58:18 +00:00
2015-11-07 00:49:40 +00:00
class AboutForm(QtWidgets.QDialog, UiAboutDialog):
"""
The About dialog
"""
2011-03-25 16:29:39 +00:00
def __init__(self, parent):
"""
Do some initialisation stuff
"""
2016-01-09 16:26:14 +00:00
super(AboutForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
2015-01-11 19:46:41 +00:00
self._setup()
def _setup(self):
"""
Set up the dialog. This method is mocked out in tests.
"""
self.setup_ui(self)
2013-03-01 11:02:18 +00:00
application_version = get_application_version()
2013-03-01 11:01:14 +00:00
about_text = self.about_text_edit.toPlainText()
2013-08-31 18:17:38 +00:00
about_text = about_text.replace('<version>', application_version['version'])
if application_version['build']:
build_text = translate('OpenLP.AboutForm', ' build %s') % application_version['build']
else:
2013-08-31 18:17:38 +00:00
build_text = ''
about_text = about_text.replace('<revision>', build_text)
2013-03-01 11:01:14 +00:00
self.about_text_edit.setPlainText(about_text)
2013-03-05 13:55:50 +00:00
self.volunteer_button.clicked.connect(self.on_volunteer_button_clicked)
2013-03-01 11:02:18 +00:00
def on_volunteer_button_clicked(self):
"""
Launch a web browser and go to the contribute page on the site.
"""
2013-08-31 18:17:38 +00:00
webbrowser.open_new('http://openlp.org/en/contribute')