← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/mac-niggles-2.4 into lp:openlp/2.4

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/mac-niggles-2.4 into lp:openlp/2.4.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1645867 in OpenLP: "Spinners in Theme Wizard segfault on OS X"
  https://bugs.launchpad.net/openlp/+bug/1645867

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/mac-niggles-2.4/+merge/313471

Fix bug #1645867 by setting an application attribute related to OpenGL
Set the width of the Theme wizard so that it doesn't resize by itself
Hide the splash screen when the backup dialog shows and when the exception form shows
Add icons back into the media library tabs

Add this to your merge proposal:
--------------------------------
lp:~raoul-snyman/openlp/mac-niggles-2.4 (revision 2666)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1875/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1786/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1725/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1464/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/1054/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/1122/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/990/
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/mac-niggles-2.4 into lp:openlp/2.4.
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py	2016-05-12 20:30:52 +0000
+++ openlp/core/__init__.py	2016-12-16 21:06:02 +0000
@@ -129,21 +129,21 @@
             application_stylesheet += WIN_REPAIR_STYLESHEET
         if application_stylesheet:
             self.setStyleSheet(application_stylesheet)
-        show_splash = Settings().value('core/show splash')
-        if show_splash:
+        can_show_splash = Settings().value('core/show splash')
+        if can_show_splash:
             self.splash = SplashScreen()
             self.splash.show()
         # make sure Qt really display the splash screen
         self.processEvents()
         # Check if OpenLP has been upgrade and if a backup of data should be created
-        self.backup_on_upgrade(has_run_wizard)
+        self.backup_on_upgrade(has_run_wizard, can_show_splash)
         # start the main app window
         self.main_window = MainWindow()
         Registry().execute('bootstrap_initialise')
         Registry().execute('bootstrap_post_set_up')
         Registry().initialise = False
         self.main_window.show()
-        if show_splash:
+        if can_show_splash:
             # now kill the splashscreen
             self.splash.finish(self.main_window)
             log.debug('Splashscreen closed')
@@ -192,9 +192,15 @@
             self.exception_form = ExceptionForm()
         self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))
         self.set_normal_cursor()
+        is_splash_visible = False
+        if hasattr(self, 'splash') and self.splash.isVisible():
+            is_splash_visible = True
+            self.splash.hide()
         self.exception_form.exec()
+        if is_splash_visible:
+            self.splash.show()
 
-    def backup_on_upgrade(self, has_run_wizard):
+    def backup_on_upgrade(self, has_run_wizard, can_show_splash):
         """
         Check if OpenLP has been upgraded, and ask if a backup of data should be made
 
@@ -207,6 +213,8 @@
             Settings().setValue('core/application version', openlp_version)
         # If data_version is different from the current version ask if we should backup the data folder
         elif data_version != openlp_version:
+            if self.splash.isVisible():
+                self.splash.hide()
             if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),
                                               translate('OpenLP', 'OpenLP has been upgraded, do you want to create '
                                                                   'a backup of OpenLPs data folder?'),
@@ -228,6 +236,8 @@
                                                   % data_folder_backup_path)
             # Update the version in the settings
             Settings().setValue('core/application version', openlp_version)
+            if can_show_splash:
+                self.splash.show()
 
     def process_events(self):
         """
@@ -342,6 +352,7 @@
     application.setOrganizationName('OpenLP')
     application.setOrganizationDomain('openlp.org')
     application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
+    application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True)
     if args and args.portable:
         application.setApplicationName('OpenLPPortable')
         Settings.setDefaultFormat(Settings.IniFormat)

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2016-01-11 21:57:20 +0000
+++ openlp/core/ui/mainwindow.py	2016-12-16 21:06:02 +0000
@@ -52,21 +52,17 @@
 log = logging.getLogger(__name__)
 
 MEDIA_MANAGER_STYLE = """
-QToolBox {
-    padding-bottom: 2px;
-}
-QToolBox::tab {
+::tab#media_tool_box {
     background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
         stop: 0 palette(button), stop: 1.0 palette(mid));
-    border: 1px solid palette(mid);
-    border-radius: 3px;
-}
-QToolBox::tab:selected {
-    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
-        stop: 0 palette(light), stop: 1.0 palette(button));
-    border: 1px solid palette(mid);
-    font-weight: bold;
-}
+    border: 0;
+    border-radius: 2px;
+    margin-bottom: 0;
+    margin-top: 0;
+    text-align: left;
+}
+/* This is here to make the tabs on KDE with the Breeze theme work */
+::tab:selected {}
 """
 
 PROGRESSBAR_STYLE = """

=== modified file 'openlp/core/ui/mediadockmanager.py'
--- openlp/core/ui/mediadockmanager.py	2016-01-10 18:01:36 +0000
+++ openlp/core/ui/mediadockmanager.py	2016-12-16 21:06:02 +0000
@@ -54,7 +54,7 @@
                 match = True
                 break
         if not match:
-            self.media_dock.addItem(media_item, visible_title['title'])
+            self.media_dock.addItem(media_item, media_item.plugin.icon, visible_title['title'])
 
     def remove_dock(self, media_item):
         """

=== modified file 'openlp/core/ui/themewizard.py'
--- openlp/core/ui/themewizard.py	2015-12-31 22:46:06 +0000
+++ openlp/core/ui/themewizard.py	2016-12-16 21:06:02 +0000
@@ -43,9 +43,9 @@
         theme_wizard.setModal(True)
         theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages |
                                 QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1)
+        theme_wizard.setFixedWidth(640)
         if is_macosx():
             theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
-            theme_wizard.resize(646, 400)
         else:
             theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)
         self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)

=== modified file 'tests/functional/openlp_core_ui/test_aboutform.py'
--- tests/functional/openlp_core_ui/test_aboutform.py	2015-12-31 22:46:06 +0000
+++ tests/functional/openlp_core_ui/test_aboutform.py	2016-12-16 21:06:02 +0000
@@ -22,26 +22,36 @@
 """
 Package to test the openlp.core.ui.firsttimeform package.
 """
-from unittest import TestCase
+from unittest.mock import patch
 
 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')
+
+@patch('openlp.core.ui.aboutform.get_application_version')
+def test_create_about_form(mocked_get_application_version):
+    """
+    Test creating an about form
+    """
+    # GIVEN: An application version with a build number
+    mocked_get_application_version.return_value = {'version': '3.1.1', 'build': '3000'}
+
+    # WHEN: The about form is created
+    about_form = AboutForm(None)
+
+    # THEN: The correct version information should be in the dialog
+    assert 'OpenLP 3.1.1 build 3000' in about_form.about_text_edit.toPlainText()
+
+
+@patch('openlp.core.ui.aboutform.webbrowser')
+def test_on_volunteer_button_clicked(mocked_webbrowser):
+    """
+    Test that clicking on the "Volunteer" button opens a web page.
+    """
+    # GIVEN: A new About dialog and a mocked out webbrowser module
+    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')

=== added file 'tests/functional/openlp_core_ui/test_shortcutlistdialog.py'
--- tests/functional/openlp_core_ui/test_shortcutlistdialog.py	1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_core_ui/test_shortcutlistdialog.py	2016-12-16 21:06:02 +0000
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2016 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                          #
+###############################################################################
+"""
+Package to test the openlp.core.ui.shortcutdialog package.
+"""
+from unittest.mock import MagicMock
+
+from PyQt5 import QtCore
+
+from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
+
+
+def test_key_press_event():
+    """
+    Test the keyPressEvent method
+    """
+    # GIVEN: A checked button and a mocked event
+    button = CaptureShortcutButton()
+    button.setChecked(True)
+    mocked_event = MagicMock()
+    mocked_event.key.return_value = QtCore.Qt.Key_Space
+
+    # WHEN: keyPressEvent is called with an event that should be ignored
+    button.keyPressEvent(mocked_event)
+
+    # THEN: The ignore() method on the event should have been called
+    mocked_event.ignore.assert_called_once_with()
+
+
+def test_keyboard_search():
+    """
+    Test the keyboardSearch method of the ShortcutTreeWidget
+    """
+    # GIVEN: A ShortcutTreeWidget
+    widget = ShortcutTreeWidget()
+
+    # WHEN: keyboardSearch() is called
+    widget.keyboardSearch('')
+
+    # THEN: Nothing happens
+    assert True

=== modified file 'tests/functional/test_init.py'
--- tests/functional/test_init.py	2015-12-31 22:46:06 +0000
+++ tests/functional/test_init.py	2016-12-16 21:06:02 +0000
@@ -102,7 +102,7 @@
             mocked_question.return_value = QtWidgets.QMessageBox.No
 
             # WHEN: We check if a backup should be created
-            self.openlp.backup_on_upgrade(old_install)
+            self.openlp.backup_on_upgrade(old_install, False)
 
             # THEN: It should not ask if we want to create a backup
             self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be the same!')
@@ -120,14 +120,18 @@
             'build': 'bzr000'
         }
         Settings().setValue('core/application version', '2.0.5')
+        self.openlp.splash = MagicMock()
+        self.openlp.splash.isVisible.return_value = True
         with patch('openlp.core.get_application_version') as mocked_get_application_version,\
                 patch('openlp.core.QtWidgets.QMessageBox.question') as mocked_question:
             mocked_get_application_version.return_value = MOCKED_VERSION
             mocked_question.return_value = QtWidgets.QMessageBox.No
 
             # WHEN: We check if a backup should be created
-            self.openlp.backup_on_upgrade(old_install)
+            self.openlp.backup_on_upgrade(old_install, True)
 
             # THEN: It should ask if we want to create a backup
             self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be upgraded!')
             self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!')
+            self.openlp.splash.hide.assert_called_once_with()
+            self.openlp.splash.show.assert_called_once_with()

=== modified file 'tests/interfaces/openlp_core_ui/test_shortcutlistform.py'
--- tests/interfaces/openlp_core_ui/test_shortcutlistform.py	2016-12-14 21:41:01 +0000
+++ tests/interfaces/openlp_core_ui/test_shortcutlistform.py	2016-12-16 21:06:02 +0000
@@ -28,7 +28,6 @@
 
 from openlp.core.common import Registry
 from openlp.core.ui.shortcutlistform import ShortcutListForm
-from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
 
 from tests.interfaces import MagicMock, patch
 from tests.helpers.testmixin import TestMixin
@@ -228,34 +227,3 @@
             mocked_action_shortcuts.assert_called_with(mocked_action)
             mocked_refresh_shortcut_list.assert_called_with()
             mocked_set_text.assert_called_with('Esc')
-
-
-def test_key_press_event():
-    """
-    Test the keyPressEvent method
-    """
-    # GIVEN: A checked button and a mocked event
-    button = CaptureShortcutButton()
-    button.setChecked(True)
-    mocked_event = MagicMock()
-    mocked_event.key.return_value = QtCore.Qt.Key_Space
-
-    # WHEN: keyPressEvent is called with an event that should be ignored
-    button.keyPressEvent(mocked_event)
-
-    # THEN: The ignore() method on the event should have been called
-    mocked_event.ignore.assert_called_once_with()
-
-
-def test_keyboard_search():
-    """
-    Test the keyboardSearch method of the ShortcutTreeWidget
-    """
-    # GIVEN: A ShortcutTreeWidget
-    widget = ShortcutTreeWidget()
-
-    # WHEN: keyboardSearch() is called
-    widget.keyboardSearch('')
-
-    # THEN: Nothing happens
-    assert True


Follow ups