← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/bug-1387309 into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-1387309 into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
  Tomas Groth (tomasgroth)
Related bugs:
  Bug #1387309 in OpenLP: "Spurrious & in first time wizard initial page"
  https://bugs.launchpad.net/openlp/+bug/1387309

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-1387309/+merge/240354

Fix bug #1387309: Filter out ampersands and angle brackets

Add this to your merge proposal:
--------------------------------
lp:~raoul-snyman/openlp/bug-1387309 (revision 2440)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/734/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/677/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/621/
[SUCCESS] http://ci.openlp.org/job/Branch-04a-Windows_Functional_Tests/560/
[SUCCESS] http://ci.openlp.org/job/Branch-04b-Windows_Interface_Tests/169/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/374/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/248/
-- 
https://code.launchpad.net/~raoul-snyman/openlp/bug-1387309/+merge/240354
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/common/__init__.py'
--- openlp/core/common/__init__.py	2014-10-09 20:30:07 +0000
+++ openlp/core/common/__init__.py	2014-11-01 10:44:39 +0000
@@ -233,6 +233,15 @@
     return decode(hash_value.data(), 'ascii')
 
 
+def clean_button_text(button_text):
+    """
+    Clean the & and other characters out of button text
+
+    :param button_text: The text to clean
+    """
+    return button_text.replace('&', '').replace('< ', '').replace(' >', '')
+
+
 from .openlpmixin import OpenLPMixin
 from .registry import Registry
 from .registrymixin import RegistryMixin

=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py	2014-10-22 21:01:40 +0000
+++ openlp/core/ui/firsttimeform.py	2014-11-01 10:44:39 +0000
@@ -41,7 +41,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, translate
+from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, \
+    translate, clean_button_text
 from openlp.core.lib import PluginStatus, build_icon
 from openlp.core.utils import get_web_page
 from .firsttimewizard import UiFirstTimeWizard, FirstTimePage
@@ -395,20 +396,20 @@
             if self.has_run_wizard:
                 self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
                                             'Download complete. Click the %s button to return to OpenLP.') %
-                                            self.buttonText(QtGui.QWizard.FinishButton))
+                                            clean_button_text(self.buttonText(QtGui.QWizard.FinishButton)))
             else:
                 self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
                                             'Download complete. Click the %s button to start OpenLP.') %
-                                            self.buttonText(QtGui.QWizard.FinishButton))
+                                            clean_button_text(self.buttonText(QtGui.QWizard.FinishButton)))
         else:
             if self.has_run_wizard:
                 self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
                                             'Click the %s button to return to OpenLP.') %
-                                            self.buttonText(QtGui.QWizard.FinishButton))
+                                            clean_button_text(self.buttonText(QtGui.QWizard.FinishButton)))
             else:
                 self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
                                             'Click the %s button to start OpenLP.') %
-                                            self.buttonText(QtGui.QWizard.FinishButton))
+                                            clean_button_text(self.buttonText(QtGui.QWizard.FinishButton)))
         self.finish_button.setVisible(True)
         self.finish_button.setEnabled(True)
         self.cancel_button.setVisible(False)

=== modified file 'openlp/core/ui/firsttimewizard.py'
--- openlp/core/ui/firsttimewizard.py	2014-10-22 20:43:05 +0000
+++ openlp/core/ui/firsttimewizard.py	2014-11-01 10:44:39 +0000
@@ -31,7 +31,7 @@
 """
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import translate, is_macosx
+from openlp.core.common import translate, is_macosx, clean_button_text
 from openlp.core.lib import build_icon
 from openlp.core.lib.ui import add_welcome_page
 
@@ -220,7 +220,7 @@
         first_time_wizard.information_label.setText(
             translate('OpenLP.FirstTimeWizard', 'This wizard will help you to configure OpenLP for initial use. '
                                                 'Click the %s button below to start.') %
-            first_time_wizard.buttonText(QtGui.QWizard.NextButton))
+            clean_button_text(first_time_wizard.buttonText(QtGui.QWizard.NextButton)))
         self.plugin_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Activate required Plugins'))
         self.plugin_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select the Plugins you wish to use. '))
         self.songs_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Songs'))
@@ -245,7 +245,7 @@
         self.cancel_wizard_text = translate('OpenLP.FirstTimeWizard',
                                             '\n\nTo cancel the First Time Wizard completely (and not start OpenLP), '
                                             'click the %s button now.') % \
-            first_time_wizard.buttonText(QtGui.QWizard.CancelButton)
+            clean_button_text(first_time_wizard.buttonText(QtGui.QWizard.CancelButton))
         self.songs_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Songs'))
         self.songs_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download public domain songs.'))
         self.bibles_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Bibles'))

=== added file 'openlp/core/ui/projector/__init__.py'
--- openlp/core/ui/projector/__init__.py	1970-01-01 00:00:00 +0000
+++ openlp/core/ui/projector/__init__.py	2014-11-01 10:44:39 +0000
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 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                          #
+###############################################################################
+"""
+The Projector driver module.
+"""
\ No newline at end of file

=== modified file 'tests/functional/openlp_core_common/test_common.py'
--- tests/functional/openlp_core_common/test_common.py	2014-08-27 23:18:06 +0000
+++ tests/functional/openlp_core_common/test_common.py	2014-11-01 10:44:39 +0000
@@ -33,7 +33,7 @@
 from unittest import TestCase
 
 from openlp.core.common import check_directory_exists, de_hump, trace_error_handler, translate, is_win, is_macosx, \
-    is_linux
+    is_linux, clean_button_text
 from tests.functional import MagicMock, patch
 
 
@@ -188,3 +188,17 @@
             self.assertTrue(is_linux(), 'is_linux() should return True')
             self.assertFalse(is_win(), 'is_win() should return False')
             self.assertFalse(is_macosx(), 'is_macosx() should return False')
+
+    def clean_button_text_test(self):
+        """
+        Test the clean_button_text() function.
+        """
+        # GIVEN: Button text
+        input_text = '&Next >'
+        expected_text = 'Next'
+
+        # WHEN: The button caption is sent through the clean_button_text function
+        actual_text = clean_button_text(input_text)
+
+        # THEN: The text should have been cleaned
+        self.assertEqual(expected_text, actual_text, 'The text should be clean')


Follow ups