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

Proposed by Raoul Snyman
Status: Merged
Merged at revision: 2663
Proposed branch: lp:~raoul-snyman/openlp/mac-niggles-2.4
Merge into: lp:openlp/2.4
Diff against target: 341 lines (+123/-74)
8 files modified
openlp/core/__init__.py (+16/-5)
openlp/core/ui/mainwindow.py (+9/-13)
openlp/core/ui/mediadockmanager.py (+1/-1)
openlp/core/ui/themewizard.py (+1/-1)
tests/functional/openlp_core_ui/test_aboutform.py (+30/-20)
tests/functional/openlp_core_ui/test_shortcutlistdialog.py (+60/-0)
tests/functional/test_init.py (+6/-2)
tests/interfaces/openlp_core_ui/test_shortcutlistform.py (+0/-32)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/mac-niggles-2.4
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+313471@code.launchpad.net

Description of the change

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/

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
129 application_stylesheet += WIN_REPAIR_STYLESHEET129 application_stylesheet += WIN_REPAIR_STYLESHEET
130 if application_stylesheet:130 if application_stylesheet:
131 self.setStyleSheet(application_stylesheet)131 self.setStyleSheet(application_stylesheet)
132 show_splash = Settings().value('core/show splash')132 can_show_splash = Settings().value('core/show splash')
133 if show_splash:133 if can_show_splash:
134 self.splash = SplashScreen()134 self.splash = SplashScreen()
135 self.splash.show()135 self.splash.show()
136 # make sure Qt really display the splash screen136 # make sure Qt really display the splash screen
137 self.processEvents()137 self.processEvents()
138 # Check if OpenLP has been upgrade and if a backup of data should be created138 # Check if OpenLP has been upgrade and if a backup of data should be created
139 self.backup_on_upgrade(has_run_wizard)139 self.backup_on_upgrade(has_run_wizard, can_show_splash)
140 # start the main app window140 # start the main app window
141 self.main_window = MainWindow()141 self.main_window = MainWindow()
142 Registry().execute('bootstrap_initialise')142 Registry().execute('bootstrap_initialise')
143 Registry().execute('bootstrap_post_set_up')143 Registry().execute('bootstrap_post_set_up')
144 Registry().initialise = False144 Registry().initialise = False
145 self.main_window.show()145 self.main_window.show()
146 if show_splash:146 if can_show_splash:
147 # now kill the splashscreen147 # now kill the splashscreen
148 self.splash.finish(self.main_window)148 self.splash.finish(self.main_window)
149 log.debug('Splashscreen closed')149 log.debug('Splashscreen closed')
@@ -192,9 +192,15 @@
192 self.exception_form = ExceptionForm()192 self.exception_form = ExceptionForm()
193 self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))193 self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))
194 self.set_normal_cursor()194 self.set_normal_cursor()
195 is_splash_visible = False
196 if hasattr(self, 'splash') and self.splash.isVisible():
197 is_splash_visible = True
198 self.splash.hide()
195 self.exception_form.exec()199 self.exception_form.exec()
200 if is_splash_visible:
201 self.splash.show()
196202
197 def backup_on_upgrade(self, has_run_wizard):203 def backup_on_upgrade(self, has_run_wizard, can_show_splash):
198 """204 """
199 Check if OpenLP has been upgraded, and ask if a backup of data should be made205 Check if OpenLP has been upgraded, and ask if a backup of data should be made
200206
@@ -207,6 +213,8 @@
207 Settings().setValue('core/application version', openlp_version)213 Settings().setValue('core/application version', openlp_version)
208 # If data_version is different from the current version ask if we should backup the data folder214 # If data_version is different from the current version ask if we should backup the data folder
209 elif data_version != openlp_version:215 elif data_version != openlp_version:
216 if self.splash.isVisible():
217 self.splash.hide()
210 if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),218 if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),
211 translate('OpenLP', 'OpenLP has been upgraded, do you want to create '219 translate('OpenLP', 'OpenLP has been upgraded, do you want to create '
212 'a backup of OpenLPs data folder?'),220 'a backup of OpenLPs data folder?'),
@@ -228,6 +236,8 @@
228 % data_folder_backup_path)236 % data_folder_backup_path)
229 # Update the version in the settings237 # Update the version in the settings
230 Settings().setValue('core/application version', openlp_version)238 Settings().setValue('core/application version', openlp_version)
239 if can_show_splash:
240 self.splash.show()
231241
232 def process_events(self):242 def process_events(self):
233 """243 """
@@ -342,6 +352,7 @@
342 application.setOrganizationName('OpenLP')352 application.setOrganizationName('OpenLP')
343 application.setOrganizationDomain('openlp.org')353 application.setOrganizationDomain('openlp.org')
344 application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)354 application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
355 application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True)
345 if args and args.portable:356 if args and args.portable:
346 application.setApplicationName('OpenLPPortable')357 application.setApplicationName('OpenLPPortable')
347 Settings.setDefaultFormat(Settings.IniFormat)358 Settings.setDefaultFormat(Settings.IniFormat)
348359
=== 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 @@
52log = logging.getLogger(__name__)52log = logging.getLogger(__name__)
5353
54MEDIA_MANAGER_STYLE = """54MEDIA_MANAGER_STYLE = """
55QToolBox {55::tab#media_tool_box {
56 padding-bottom: 2px;
57}
58QToolBox::tab {
59 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,56 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
60 stop: 0 palette(button), stop: 1.0 palette(mid));57 stop: 0 palette(button), stop: 1.0 palette(mid));
61 border: 1px solid palette(mid);58 border: 0;
62 border-radius: 3px;59 border-radius: 2px;
63}60 margin-bottom: 0;
64QToolBox::tab:selected {61 margin-top: 0;
65 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,62 text-align: left;
66 stop: 0 palette(light), stop: 1.0 palette(button));63}
67 border: 1px solid palette(mid);64/* This is here to make the tabs on KDE with the Breeze theme work */
68 font-weight: bold;65::tab:selected {}
69}
70"""66"""
7167
72PROGRESSBAR_STYLE = """68PROGRESSBAR_STYLE = """
7369
=== 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 @@
54 match = True54 match = True
55 break55 break
56 if not match:56 if not match:
57 self.media_dock.addItem(media_item, visible_title['title'])57 self.media_dock.addItem(media_item, media_item.plugin.icon, visible_title['title'])
5858
59 def remove_dock(self, media_item):59 def remove_dock(self, media_item):
60 """60 """
6161
=== 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 @@
43 theme_wizard.setModal(True)43 theme_wizard.setModal(True)
44 theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages |44 theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages |
45 QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1)45 QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1)
46 theme_wizard.setFixedWidth(640)
46 if is_macosx():47 if is_macosx():
47 theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))48 theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
48 theme_wizard.resize(646, 400)
49 else:49 else:
50 theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)50 theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)
51 self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)51 self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
5252
=== 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 @@
22"""22"""
23Package to test the openlp.core.ui.firsttimeform package.23Package to test the openlp.core.ui.firsttimeform package.
24"""24"""
25from unittest import TestCase25from unittest.mock import patch
2626
27from openlp.core.ui.aboutform import AboutForm27from openlp.core.ui.aboutform import AboutForm
2828
29from tests.functional import patch29
30from tests.helpers.testmixin import TestMixin30@patch('openlp.core.ui.aboutform.get_application_version')
3131def test_create_about_form(mocked_get_application_version):
3232 """
33class TestFirstTimeForm(TestCase, TestMixin):33 Test creating an about form
3434 """
35 def test_on_volunteer_button_clicked(self):35 # GIVEN: An application version with a build number
36 """36 mocked_get_application_version.return_value = {'version': '3.1.1', 'build': '3000'}
37 Test that clicking on the "Volunteer" button opens a web page.37
38 """38 # WHEN: The about form is created
39 # GIVEN: A new About dialog and a mocked out webbrowser module39 about_form = AboutForm(None)
40 with patch('openlp.core.ui.aboutform.webbrowser') as mocked_webbrowser:40
41 about_form = AboutForm(None)41 # THEN: The correct version information should be in the dialog
4242 assert 'OpenLP 3.1.1 build 3000' in about_form.about_text_edit.toPlainText()
43 # WHEN: The "Volunteer" button is "clicked"43
44 about_form.on_volunteer_button_clicked()44
4545@patch('openlp.core.ui.aboutform.webbrowser')
46 # THEN: A web browser is opened46def test_on_volunteer_button_clicked(mocked_webbrowser):
47 mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')47 """
48 Test that clicking on the "Volunteer" button opens a web page.
49 """
50 # GIVEN: A new About dialog and a mocked out webbrowser module
51 about_form = AboutForm(None)
52
53 # WHEN: The "Volunteer" button is "clicked"
54 about_form.on_volunteer_button_clicked()
55
56 # THEN: A web browser is opened
57 mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')
4858
=== 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 @@
1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
3
4###############################################################################
5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #
7# Copyright (c) 2008-2016 OpenLP Developers #
8# --------------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #
10# under the terms of the GNU General Public License as published by the Free #
11# Software Foundation; version 2 of the License. #
12# #
13# This program is distributed in the hope that it will be useful, but WITHOUT #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
16# more details. #
17# #
18# You should have received a copy of the GNU General Public License along #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
21###############################################################################
22"""
23Package to test the openlp.core.ui.shortcutdialog package.
24"""
25from unittest.mock import MagicMock
26
27from PyQt5 import QtCore
28
29from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
30
31
32def test_key_press_event():
33 """
34 Test the keyPressEvent method
35 """
36 # GIVEN: A checked button and a mocked event
37 button = CaptureShortcutButton()
38 button.setChecked(True)
39 mocked_event = MagicMock()
40 mocked_event.key.return_value = QtCore.Qt.Key_Space
41
42 # WHEN: keyPressEvent is called with an event that should be ignored
43 button.keyPressEvent(mocked_event)
44
45 # THEN: The ignore() method on the event should have been called
46 mocked_event.ignore.assert_called_once_with()
47
48
49def test_keyboard_search():
50 """
51 Test the keyboardSearch method of the ShortcutTreeWidget
52 """
53 # GIVEN: A ShortcutTreeWidget
54 widget = ShortcutTreeWidget()
55
56 # WHEN: keyboardSearch() is called
57 widget.keyboardSearch('')
58
59 # THEN: Nothing happens
60 assert True
061
=== 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 @@
102 mocked_question.return_value = QtWidgets.QMessageBox.No102 mocked_question.return_value = QtWidgets.QMessageBox.No
103103
104 # WHEN: We check if a backup should be created104 # WHEN: We check if a backup should be created
105 self.openlp.backup_on_upgrade(old_install)105 self.openlp.backup_on_upgrade(old_install, False)
106106
107 # THEN: It should not ask if we want to create a backup107 # THEN: It should not ask if we want to create a backup
108 self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be the same!')108 self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be the same!')
@@ -120,14 +120,18 @@
120 'build': 'bzr000'120 'build': 'bzr000'
121 }121 }
122 Settings().setValue('core/application version', '2.0.5')122 Settings().setValue('core/application version', '2.0.5')
123 self.openlp.splash = MagicMock()
124 self.openlp.splash.isVisible.return_value = True
123 with patch('openlp.core.get_application_version') as mocked_get_application_version,\125 with patch('openlp.core.get_application_version') as mocked_get_application_version,\
124 patch('openlp.core.QtWidgets.QMessageBox.question') as mocked_question:126 patch('openlp.core.QtWidgets.QMessageBox.question') as mocked_question:
125 mocked_get_application_version.return_value = MOCKED_VERSION127 mocked_get_application_version.return_value = MOCKED_VERSION
126 mocked_question.return_value = QtWidgets.QMessageBox.No128 mocked_question.return_value = QtWidgets.QMessageBox.No
127129
128 # WHEN: We check if a backup should be created130 # WHEN: We check if a backup should be created
129 self.openlp.backup_on_upgrade(old_install)131 self.openlp.backup_on_upgrade(old_install, True)
130132
131 # THEN: It should ask if we want to create a backup133 # THEN: It should ask if we want to create a backup
132 self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be upgraded!')134 self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be upgraded!')
133 self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!')135 self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!')
136 self.openlp.splash.hide.assert_called_once_with()
137 self.openlp.splash.show.assert_called_once_with()
134138
=== 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 @@
2828
29from openlp.core.common import Registry29from openlp.core.common import Registry
30from openlp.core.ui.shortcutlistform import ShortcutListForm30from openlp.core.ui.shortcutlistform import ShortcutListForm
31from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
3231
33from tests.interfaces import MagicMock, patch32from tests.interfaces import MagicMock, patch
34from tests.helpers.testmixin import TestMixin33from tests.helpers.testmixin import TestMixin
@@ -228,34 +227,3 @@
228 mocked_action_shortcuts.assert_called_with(mocked_action)227 mocked_action_shortcuts.assert_called_with(mocked_action)
229 mocked_refresh_shortcut_list.assert_called_with()228 mocked_refresh_shortcut_list.assert_called_with()
230 mocked_set_text.assert_called_with('Esc')229 mocked_set_text.assert_called_with('Esc')
231
232
233def test_key_press_event():
234 """
235 Test the keyPressEvent method
236 """
237 # GIVEN: A checked button and a mocked event
238 button = CaptureShortcutButton()
239 button.setChecked(True)
240 mocked_event = MagicMock()
241 mocked_event.key.return_value = QtCore.Qt.Key_Space
242
243 # WHEN: keyPressEvent is called with an event that should be ignored
244 button.keyPressEvent(mocked_event)
245
246 # THEN: The ignore() method on the event should have been called
247 mocked_event.ignore.assert_called_once_with()
248
249
250def test_keyboard_search():
251 """
252 Test the keyboardSearch method of the ShortcutTreeWidget
253 """
254 # GIVEN: A ShortcutTreeWidget
255 widget = ShortcutTreeWidget()
256
257 # WHEN: keyboardSearch() is called
258 widget.keyboardSearch('')
259
260 # THEN: Nothing happens
261 assert True

Subscribers

People subscribed via source and target branches

to all changes: