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

Proposed by Raoul Snyman
Status: Merged
Merged at revision: 2711
Proposed branch: lp:~raoul-snyman/openlp/mac-niggles
Merge into: lp:openlp
Diff against target: 272 lines (+95/-22)
6 files modified
openlp/core/__init__.py (+17/-5)
openlp/core/common/settings.py (+3/-3)
openlp/core/ui/mainwindow.py (+8/-11)
openlp/core/ui/themewizard.py (+1/-1)
tests/functional/openlp_core_ui/test_shortcutlistdialog.py (+60/-0)
tests/functional/test_init.py (+6/-2)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/mac-niggles
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+313403@code.launchpad.net

Description of the change

Fix segfault on click on a spinner on macOS
Fix spurious traceback on some platforms or configurations of media players
Make the tab style affect only the media library tabs, not everything else too
Hide the splash screen when the backup dialog shows and when the exception form shows

Add this to your merge proposal:
--------------------------------
lp:~raoul-snyman/openlp/mac-niggles (revision 2713)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1873/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1784/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1723/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1462/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/1052/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/1120/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/988/
[SUCCESS] https://ci.openlp.io/job/Branch-05c-Code_Analysis2/139/

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-11-21 20:21:31 +0000
+++ openlp/core/__init__.py 2016-12-15 22:20:16 +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')
@@ -224,13 +224,20 @@
224 self.exception_form = ExceptionForm()224 self.exception_form = ExceptionForm()
225 self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))225 self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))
226 self.set_normal_cursor()226 self.set_normal_cursor()
227 is_splash_visible = False
228 if hasattr(self, 'splash') and self.splash.isVisible():
229 is_splash_visible = True
230 self.splash.hide()
227 self.exception_form.exec()231 self.exception_form.exec()
232 if is_splash_visible:
233 self.splash.show()
228234
229 def backup_on_upgrade(self, has_run_wizard):235 def backup_on_upgrade(self, has_run_wizard, can_show_splash):
230 """236 """
231 Check if OpenLP has been upgraded, and ask if a backup of data should be made237 Check if OpenLP has been upgraded, and ask if a backup of data should be made
232238
233 :param has_run_wizard: OpenLP has been run before239 :param has_run_wizard: OpenLP has been run before
240 :param can_show_splash: Should OpenLP show the splash screen
234 """241 """
235 data_version = Settings().value('core/application version')242 data_version = Settings().value('core/application version')
236 openlp_version = get_application_version()['version']243 openlp_version = get_application_version()['version']
@@ -239,6 +246,8 @@
239 Settings().setValue('core/application version', openlp_version)246 Settings().setValue('core/application version', openlp_version)
240 # If data_version is different from the current version ask if we should backup the data folder247 # If data_version is different from the current version ask if we should backup the data folder
241 elif data_version != openlp_version:248 elif data_version != openlp_version:
249 if self.splash.isVisible():
250 self.splash.hide()
242 if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),251 if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),
243 translate('OpenLP', 'OpenLP has been upgraded, do you want to create\n'252 translate('OpenLP', 'OpenLP has been upgraded, do you want to create\n'
244 'a backup of the old data folder?'),253 'a backup of the old data folder?'),
@@ -261,6 +270,8 @@
261270
262 # Update the version in the settings271 # Update the version in the settings
263 Settings().setValue('core/application version', openlp_version)272 Settings().setValue('core/application version', openlp_version)
273 if can_show_splash:
274 self.splash.show()
264275
265 def process_events(self):276 def process_events(self):
266 """277 """
@@ -375,6 +386,7 @@
375 application.setOrganizationName('OpenLP')386 application.setOrganizationName('OpenLP')
376 application.setOrganizationDomain('openlp.org')387 application.setOrganizationDomain('openlp.org')
377 application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)388 application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
389 application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True)
378 if args and args.portable:390 if args and args.portable:
379 application.setApplicationName('OpenLPPortable')391 application.setApplicationName('OpenLPPortable')
380 Settings.setDefaultFormat(Settings.IniFormat)392 Settings.setDefaultFormat(Settings.IniFormat)
381393
=== modified file 'openlp/core/common/settings.py'
--- openlp/core/common/settings.py 2016-10-23 19:24:53 +0000
+++ openlp/core/common/settings.py 2016-12-15 22:20:16 +0000
@@ -216,8 +216,8 @@
216 ('advanced/default color', 'core/logo background color', []), # Default image renamed + moved to general > 2.4.216 ('advanced/default color', 'core/logo background color', []), # Default image renamed + moved to general > 2.4.
217 ('advanced/default image', 'core/logo file', []), # Default image renamed + moved to general after 2.4.217 ('advanced/default image', 'core/logo file', []), # Default image renamed + moved to general after 2.4.
218 ('shortcuts/escapeItem', 'shortcuts/desktopScreenEnable', []), # Escape item was removed in 2.6.218 ('shortcuts/escapeItem', 'shortcuts/desktopScreenEnable', []), # Escape item was removed in 2.6.
219 ('shortcuts/offlineHelpItem', 'shortcuts/HelpItem', []), # Online and Offline help were combined in 2.6.219 ('shortcuts/offlineHelpItem', 'shortcuts/userManualItem', []), # Online and Offline help were combined in 2.6.
220 ('shortcuts/onlineHelpItem', 'shortcuts/HelpItem', []) # Online and Offline help were combined in 2.6.220 ('shortcuts/onlineHelpItem', 'shortcuts/userManualItem', []) # Online and Offline help were combined in 2.6.
221 ]221 ]
222222
223 @staticmethod223 @staticmethod
@@ -276,7 +276,7 @@
276 'shortcuts/fileSaveItem': [QtGui.QKeySequence(QtGui.QKeySequence.Save)],276 'shortcuts/fileSaveItem': [QtGui.QKeySequence(QtGui.QKeySequence.Save)],
277 'shortcuts/fileOpenItem': [QtGui.QKeySequence(QtGui.QKeySequence.Open)],277 'shortcuts/fileOpenItem': [QtGui.QKeySequence(QtGui.QKeySequence.Open)],
278 'shortcuts/goLive': [],278 'shortcuts/goLive': [],
279 'shortcuts/HelpItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],279 'shortcuts/userManualItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
280 'shortcuts/importThemeItem': [],280 'shortcuts/importThemeItem': [],
281 'shortcuts/importBibleItem': [],281 'shortcuts/importBibleItem': [],
282 'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],282 'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
283283
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2016-12-13 06:41:59 +0000
+++ openlp/core/ui/mainwindow.py 2016-12-15 22:20:16 +0000
@@ -52,7 +52,7 @@
52log = logging.getLogger(__name__)52log = logging.getLogger(__name__)
5353
54MEDIA_MANAGER_STYLE = """54MEDIA_MANAGER_STYLE = """
55::tab {55::tab#media_tool_box {
56 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,56 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
57 stop: 0 palette(button), stop: 1.0 palette(mid));57 stop: 0 palette(button), stop: 1.0 palette(mid));
58 border: 0;58 border: 0;
@@ -61,10 +61,8 @@
61 margin-bottom: 0;61 margin-bottom: 0;
62 text-align: left;62 text-align: left;
63}63}
64::tab:selected {64/* This is here to make the tabs on KDE with the Breeze theme work */
65 border: 1px solid palette(highlight);65::tab:selected {}
66 font-weight: bold;
67}
68"""66"""
6967
70PROGRESSBAR_STYLE = """68PROGRESSBAR_STYLE = """
@@ -310,10 +308,9 @@
310 elif is_macosx():308 elif is_macosx():
311 self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir),309 self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir),
312 '..', 'Resources', 'OpenLP.help')310 '..', 'Resources', 'OpenLP.help')
313 self.on_help_item = create_action(main_window, 'HelpItem',311 self.user_manual_item = create_action(main_window, 'userManualItem', icon=':/system/system_help_contents.png',
314 icon=':/system/system_help_contents.png',312 can_shortcuts=True, category=UiStrings().Help,
315 can_shortcuts=True,313 triggers=self.on_help_clicked)
316 category=UiStrings().Help, triggers=self.on_help_clicked)
317 self.web_site_item = create_action(main_window, 'webSiteItem', can_shortcuts=True, category=UiStrings().Help)314 self.web_site_item = create_action(main_window, 'webSiteItem', can_shortcuts=True, category=UiStrings().Help)
318 # Shortcuts not connected to buttons or menu entries.315 # Shortcuts not connected to buttons or menu entries.
319 self.search_shortcut_action = create_action(main_window,316 self.search_shortcut_action = create_action(main_window,
@@ -352,7 +349,7 @@
352 add_actions(self.tools_menu, (self.tools_open_data_folder, None))349 add_actions(self.tools_menu, (self.tools_open_data_folder, None))
353 add_actions(self.tools_menu, (self.tools_first_time_wizard, None))350 add_actions(self.tools_menu, (self.tools_first_time_wizard, None))
354 add_actions(self.tools_menu, [self.update_theme_images])351 add_actions(self.tools_menu, [self.update_theme_images])
355 add_actions(self.help_menu, (self.on_help_item, None, self.web_site_item, self.about_item))352 add_actions(self.help_menu, (self.user_manual_item, None, self.web_site_item, self.about_item))
356 add_actions(self.menu_bar, (self.file_menu.menuAction(), self.view_menu.menuAction(),353 add_actions(self.menu_bar, (self.file_menu.menuAction(), self.view_menu.menuAction(),
357 self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction()))354 self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction()))
358 add_actions(self, [self.search_shortcut_action])355 add_actions(self, [self.search_shortcut_action])
@@ -448,7 +445,7 @@
448 'from here.'))445 'from here.'))
449 self.about_item.setText(translate('OpenLP.MainWindow', '&About'))446 self.about_item.setText(translate('OpenLP.MainWindow', '&About'))
450 self.about_item.setStatusTip(translate('OpenLP.MainWindow', 'More information about OpenLP.'))447 self.about_item.setStatusTip(translate('OpenLP.MainWindow', 'More information about OpenLP.'))
451 self.on_help_item.setText(translate('OpenLP.MainWindow', '&User Manual'))448 self.user_manual_item.setText(translate('OpenLP.MainWindow', '&User Manual'))
452 self.search_shortcut_action.setText(UiStrings().Search)449 self.search_shortcut_action.setText(UiStrings().Search)
453 self.search_shortcut_action.setToolTip(450 self.search_shortcut_action.setToolTip(
454 translate('OpenLP.MainWindow', 'Jump to the search box of the current active plugin.'))451 translate('OpenLP.MainWindow', 'Jump to the search box of the current active plugin.'))
455452
=== modified file 'openlp/core/ui/themewizard.py'
--- openlp/core/ui/themewizard.py 2016-10-27 17:45:50 +0000
+++ openlp/core/ui/themewizard.py 2016-12-15 22:20:16 +0000
@@ -44,9 +44,9 @@
44 theme_wizard.setModal(True)44 theme_wizard.setModal(True)
45 theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages |45 theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages |
46 QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1)46 QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1)
47 theme_wizard.setFixedWidth(640)
47 if is_macosx():48 if is_macosx():
48 theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))49 theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
49 theme_wizard.resize(646, 400)
50 else:50 else:
51 theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)51 theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)
52 self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)52 self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
5353
=== 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-15 22:20:16 +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.shortcutlistdialog package.
24"""
25from PyQt5 import QtCore, QtGui, QtWidgets
26
27from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
28
29from tests.interfaces import MagicMock, patch
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 2016-05-31 21:40:13 +0000
+++ tests/functional/test_init.py 2016-12-15 22:20:16 +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()