From 3774cf3704e0230b78c577fc26fd24636dcf402a Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 11 Jan 2015 21:46:41 +0200 Subject: [PATCH] Update the credits in the About dialog --- openlp/core/ui/aboutdialog.py | 57 ++++++++++--------- openlp/core/ui/aboutform.py | 14 +++-- .../openlp_core_lib/test_renderer.py | 2 +- .../openlp_core_ui/test_aboutform.py | 54 ++++++++++++++++++ .../openlp_core_ui/test_firsttimeform.py | 1 - .../openlp_core_ui/test_maindisplay.py | 2 +- .../openlp_core_ui/test_slidecontroller.py | 2 +- .../openlp_core_ui/test_thememanager.py | 4 +- 8 files changed, 100 insertions(+), 36 deletions(-) create mode 100644 tests/functional/openlp_core_ui/test_aboutform.py diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py index d633bf4e7..9e07b4a4e 100644 --- a/openlp/core/ui/aboutdialog.py +++ b/openlp/core/ui/aboutdialog.py @@ -34,14 +34,16 @@ from openlp.core.lib import build_icon from openlp.core.lib.ui import create_button, create_button_box -class Ui_AboutDialog(object): +class UiAboutDialog(object): """ The actual GUI widgets for the About form. """ - def setupUi(self, about_dialog): + def setup_ui(self, about_dialog): """ Set up the UI for the dialog. + + :param about_dialog: The QDialog object to set up. """ about_dialog.setObjectName('about_dialog') about_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg')) @@ -84,12 +86,14 @@ class Ui_AboutDialog(object): self.volunteer_button = create_button(None, 'volunteer_button', icon=':/system/system_volunteer.png') self.button_box = create_button_box(about_dialog, 'button_box', ['close'], [self.volunteer_button]) self.about_dialog_layout.addWidget(self.button_box) - self.retranslateUi(about_dialog) + self.retranslate_ui(about_dialog) self.about_notebook.setCurrentIndex(0) - def retranslateUi(self, about_dialog): + def retranslate_ui(self, about_dialog): """ Dynamically translate the UI. + + :param about_dialog: The QDialog object to translate """ about_dialog.setWindowTitle('%s OpenLP' % UiStrings().About) self.about_text_edit.setPlainText( @@ -109,30 +113,27 @@ class Ui_AboutDialog(object): 'consider volunteering by using the button below.')) self.about_notebook.setTabText(self.about_notebook.indexOf(self.about_tab), UiStrings().About) lead = 'Raoul "superfly" Snyman' - developers = ['Tim "TRB143" Bentley', 'Jonathan "gushie" Corwin', - 'Michael "cocooncrash" Gorven', - 'Andreas "googol" Preikschat', 'Raoul "superfly" Snyman', - 'Martin "mijiti" Thompson', 'Jon "Meths" Tibble'] - contributors = ['Gerald "jerryb" Britton', - 'Samuel "MrGamgee" Findlay', 'Scott "sguerrieri" Guerrieri', - 'Matthias "matthub" Hub', 'Meinert "m2j" Jordan', - 'Armin "orangeshirt" K\xf6hler', 'Erik "luen" Lundin', - 'Edwin "edwinlunando" Lunando', 'Brian "brianmeyer" Meyer', - 'Joshua "milleja46" Miller', 'Stevan "ElderP" Pettit', - 'Mattias "mahfiaz" P\xf5ldaru', 'Christian "crichter" Richter', - 'Philip "Phill" Ridout', 'Simon "samscudder" Scudder', - 'Jeffrey "whydoubt" Smith', 'Maikel Stuivenberg', - 'Dave "Dave42W" Warnock', 'Frode "frodus" Woldsund', - 'Martin "matysek" Zibricky', 'Patrick "mohij" Zimmermann'] + developers = ['Tim "TRB143" Bentley', 'Tomas "tgc" Groth', 'Samuel "samuel_m" Mehrbrodt', + 'Andreas "googol" Preikschat', 'Ken "alisonken1" Roberts', 'Raoul "superfly" Snyman', + 'Jonathan "springermac" Springer', 'Philip "Phill" Ridout'] + contributors = ['Stuart "sibecker" Becker', 'Gerald "jerryb" Britton', 'Jonathan "gushie" Corwin', + 'Samuel "MrGamgee" Findlay', 'Michael "cocooncrash" Gorven', 'Scott "sguerrieri" Guerrieri', + 'Matthias "matthub" Hub', 'Meinert "m2j" Jordan', 'Armin "orangeshirt" K\xf6hler', + 'Rafael "rafaellerm" Lerm', 'Erik "luen" Lundin', 'Edwin "edwinlunando" Lunando', + 'Dmitriy Marmyshev', 'Brian "brianmeyer" Meyer', 'Joshua "milleja46" Miller', + 'Stevan "ElderP" Pettit', 'Mattias "mahfiaz" P\xf5ldaru', 'Felipe Polo-Wood', + 'Christian "crichter" Richter', 'Arjan "arjans" Schrijver', 'Simon "samscudder" Scudder', + 'Jeffrey "whydoubt" Smith', 'Stefan Strasser', 'Maikel Stuivenberg', 'Martin "mijiti" Thompson', + 'Jon "Meths" Tibble', 'Dave "Dave42W" Warnock', 'Oliver "OliWie" Wieland', + 'Frode "frodus" Woldsund', 'Martin "matysek" Zibricky', 'Patrick "mohij" Zimmermann'] testers = ['Philip "Phill" Ridout', 'Wesley "wrst" Stout', 'John "jseagull1" Cegalis (lead)'] packagers = ['Thomas "tabthorpe" Abthorpe (FreeBSD)', 'Tim "TRB143" Bentley (Fedora and Android)', - 'Matthias "matthub" Hub (Mac OS X)', 'Joseph "jdmulloy" Mulloy (openSUSE)', 'Stevan "ElderP" Pettit (Windows)', - 'Raoul "superfly" Snyman (Debian, Ubuntu)', - 'Garrett "floft" Wilson (Arch Linux)'] + 'Raoul "superfly" Snyman (Mac OS X, Debian, Ubuntu)', + 'Wesley "wrst" Stout (Arch Linux)'] translators = { 'af': ['Johan "nuvolari" Mynhardt'], 'cs': ['Martin "matysek" Zibricky'], @@ -140,7 +141,7 @@ class Ui_AboutDialog(object): 'de': ['Patrick "madmuffin" Br\xfcckner', 'Meinert "m2j" Jordan', 'Andreas "googol" Preikschat', 'Christian "crichter" Richter'], 'en_GB': ['Tim "TRB143" Bentley', 'Jonathan "gushie" Corwin'], - 'en_ZA': ['Raoul "superfly" Snyman', 'Johan "nuvolari" Mynhardt'], + 'en_ZA': ['Raoul "superfly" Snyman'], 'el': ['Alexander Siozos'], 'es': ['Josu\xe9 Z\xfa\xf1iga', 'Christian Gonzalez'], 'et': ['Mattias "mahfiaz" P\xf5ldaru'], @@ -151,8 +152,9 @@ class Ui_AboutDialog(object): 'ja': ['Kunio "Kunio" Nakamaru', 'Chris Haris'], 'nb': ['Atle "pendlaren" Weibell', 'Frode "frodus" Woldsund'], 'nl': ['Arjen "typovar" van Voorst'], + 'pl': ['Agata \u017B\u0105d\u0142o', 'Piotr Karze\u0142ek'], 'pt_BR': ['David Mederiros', 'Rafael "rafaellerm" Lerm', 'Eduardo Levi Chaves', - 'Gustavo Bim', 'Rog\xeanio Bel\xe9m', 'Samuel Simon "samscudder" Scudder', 'Van Der Fran'], + 'Gustavo Bim', 'Rog\xeanio Bel\xe9m', 'Simon "samscudder" Scudder', 'Van Der Fran'], 'ru': ['Sergey "ratz" Ratz'], 'sv': ['Erik "luen" Lundin'], 'ta_LK': ['"Prasad"'], @@ -209,6 +211,8 @@ class Ui_AboutDialog(object): ' %s\n' ' Dutch (nl)\n' ' %s\n' + ' Polish (pl)\n' + ' %s\n' ' Portuguese, Brazil (pt_BR)\n' ' %s\n' ' Russian (ru)\n' @@ -258,6 +262,7 @@ class Ui_AboutDialog(object): '\n '.join(translators['ja']), '\n '.join(translators['nb']), '\n '.join(translators['nl']), + '\n '.join(translators['pl']), '\n '.join(translators['pt_BR']), '\n '.join(translators['ru']), '\n '.join(translators['sv']), @@ -267,8 +272,8 @@ class Ui_AboutDialog(object): self.about_notebook.setTabText(self.about_notebook.indexOf(self.credits_tab), translate('OpenLP.AboutForm', 'Credits')) copyright_note = translate('OpenLP.AboutForm', - 'Copyright \xa9 2004-2014 %s\n' - 'Portions copyright \xa9 2004-2014 %s') % \ + 'Copyright \xa9 2004-2015 %s\n' + 'Portions copyright \xa9 2004-2015 %s') % \ ('Raoul Snyman', 'Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, ' 'Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, ' diff --git a/openlp/core/ui/aboutform.py b/openlp/core/ui/aboutform.py index 614873d64..5004f13bf 100644 --- a/openlp/core/ui/aboutform.py +++ b/openlp/core/ui/aboutform.py @@ -29,15 +29,16 @@ """ The About dialog. """ +import webbrowser from PyQt4 import QtGui -from .aboutdialog import Ui_AboutDialog from openlp.core.lib import translate from openlp.core.utils import get_application_version +from .aboutdialog import UiAboutDialog -class AboutForm(QtGui.QDialog, Ui_AboutDialog): +class AboutForm(QtGui.QDialog, UiAboutDialog): """ The About dialog """ @@ -47,8 +48,14 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog): Do some initialisation stuff """ super(AboutForm, self).__init__(parent) + self._setup() + + def _setup(self): + """ + Set up the dialog. This method is mocked out in tests. + """ + self.setup_ui(self) application_version = get_application_version() - self.setupUi(self) about_text = self.about_text_edit.toPlainText() about_text = about_text.replace('', application_version['version']) if application_version['build']: @@ -63,5 +70,4 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog): """ Launch a web browser and go to the contribute page on the site. """ - import webbrowser webbrowser.open_new('http://openlp.org/en/contribute') diff --git a/tests/functional/openlp_core_lib/test_renderer.py b/tests/functional/openlp_core_lib/test_renderer.py index c3a8bfc3f..32623c8fa 100644 --- a/tests/functional/openlp_core_lib/test_renderer.py +++ b/tests/functional/openlp_core_lib/test_renderer.py @@ -36,7 +36,7 @@ from PyQt4 import QtCore from openlp.core.common import Registry from openlp.core.lib import Renderer, ScreenList, ServiceItem -from tests.interfaces import MagicMock +from tests.functional import MagicMock SCREEN = { 'primary': False, diff --git a/tests/functional/openlp_core_ui/test_aboutform.py b/tests/functional/openlp_core_ui/test_aboutform.py new file mode 100644 index 000000000..d5fd639fa --- /dev/null +++ b/tests/functional/openlp_core_ui/test_aboutform.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2015 Raoul Snyman # +# Portions copyright (c) 2008-2015 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, # +# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. # +# 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 # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### +""" +Package to test the openlp.core.ui.firsttimeform package. +""" +from unittest import TestCase + +from openlp.core.ui.aboutform import AboutForm + +from tests.functional import patch +from tests.helpers.testmixin import TestMixin + + +class TestFirstTimeForm(TestCase, TestMixin): + + def test_on_volunteer_button_clicked(self): + """ + Test that clicking on the "Volunteer" button opens a web page. + """ + # GIVEN: A new About dialog and a mocked out webbrowser module + with patch('openlp.core.ui.aboutform.webbrowser') as mocked_webbrowser: + about_form = AboutForm(None) + + # WHEN: The "Volunteer" button is "clicked" + about_form.on_volunteer_button_clicked() + + # THEN: A web browser is opened + mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute') diff --git a/tests/functional/openlp_core_ui/test_firsttimeform.py b/tests/functional/openlp_core_ui/test_firsttimeform.py index e5b91f442..7b2a8f450 100644 --- a/tests/functional/openlp_core_ui/test_firsttimeform.py +++ b/tests/functional/openlp_core_ui/test_firsttimeform.py @@ -29,7 +29,6 @@ """ Package to test the openlp.core.ui.firsttimeform package. """ -from configparser import ConfigParser import os from unittest import TestCase diff --git a/tests/functional/openlp_core_ui/test_maindisplay.py b/tests/functional/openlp_core_ui/test_maindisplay.py index ac64f817b..507b89f67 100644 --- a/tests/functional/openlp_core_ui/test_maindisplay.py +++ b/tests/functional/openlp_core_ui/test_maindisplay.py @@ -39,7 +39,7 @@ from openlp.core.ui import MainDisplay from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET from tests.helpers.testmixin import TestMixin -from tests.interfaces import MagicMock +from tests.functional import MagicMock SCREEN = { 'primary': False, diff --git a/tests/functional/openlp_core_ui/test_slidecontroller.py b/tests/functional/openlp_core_ui/test_slidecontroller.py index ae4b52a90..9a6edd567 100644 --- a/tests/functional/openlp_core_ui/test_slidecontroller.py +++ b/tests/functional/openlp_core_ui/test_slidecontroller.py @@ -37,7 +37,7 @@ from openlp.core.lib import ServiceItemAction from openlp.core.ui import SlideController from openlp.core.ui.slidecontroller import InfoLabel, WIDE_MENU, NON_TEXT_MENU -from tests.interfaces import MagicMock, patch +from tests.functional import MagicMock, patch class TestSlideController(TestCase): diff --git a/tests/functional/openlp_core_ui/test_thememanager.py b/tests/functional/openlp_core_ui/test_thememanager.py index 7164e94c2..7e651f64f 100644 --- a/tests/functional/openlp_core_ui/test_thememanager.py +++ b/tests/functional/openlp_core_ui/test_thememanager.py @@ -34,14 +34,14 @@ import os import shutil from unittest import TestCase -from tests.interfaces import MagicMock +from tests.functional import MagicMock from tempfile import mkdtemp from openlp.core.ui import ThemeManager from openlp.core.common import Registry from tests.utils.constants import TEST_RESOURCES_PATH -from tests.interfaces import MagicMock, patch +from tests.functional import MagicMock, patch class TestThemeManager(TestCase):