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
1=== modified file 'openlp/core/__init__.py'
2--- openlp/core/__init__.py 2016-05-12 20:30:52 +0000
3+++ openlp/core/__init__.py 2016-12-16 21:06:02 +0000
4@@ -129,21 +129,21 @@
5 application_stylesheet += WIN_REPAIR_STYLESHEET
6 if application_stylesheet:
7 self.setStyleSheet(application_stylesheet)
8- show_splash = Settings().value('core/show splash')
9- if show_splash:
10+ can_show_splash = Settings().value('core/show splash')
11+ if can_show_splash:
12 self.splash = SplashScreen()
13 self.splash.show()
14 # make sure Qt really display the splash screen
15 self.processEvents()
16 # Check if OpenLP has been upgrade and if a backup of data should be created
17- self.backup_on_upgrade(has_run_wizard)
18+ self.backup_on_upgrade(has_run_wizard, can_show_splash)
19 # start the main app window
20 self.main_window = MainWindow()
21 Registry().execute('bootstrap_initialise')
22 Registry().execute('bootstrap_post_set_up')
23 Registry().initialise = False
24 self.main_window.show()
25- if show_splash:
26+ if can_show_splash:
27 # now kill the splashscreen
28 self.splash.finish(self.main_window)
29 log.debug('Splashscreen closed')
30@@ -192,9 +192,15 @@
31 self.exception_form = ExceptionForm()
32 self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))
33 self.set_normal_cursor()
34+ is_splash_visible = False
35+ if hasattr(self, 'splash') and self.splash.isVisible():
36+ is_splash_visible = True
37+ self.splash.hide()
38 self.exception_form.exec()
39+ if is_splash_visible:
40+ self.splash.show()
41
42- def backup_on_upgrade(self, has_run_wizard):
43+ def backup_on_upgrade(self, has_run_wizard, can_show_splash):
44 """
45 Check if OpenLP has been upgraded, and ask if a backup of data should be made
46
47@@ -207,6 +213,8 @@
48 Settings().setValue('core/application version', openlp_version)
49 # If data_version is different from the current version ask if we should backup the data folder
50 elif data_version != openlp_version:
51+ if self.splash.isVisible():
52+ self.splash.hide()
53 if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),
54 translate('OpenLP', 'OpenLP has been upgraded, do you want to create '
55 'a backup of OpenLPs data folder?'),
56@@ -228,6 +236,8 @@
57 % data_folder_backup_path)
58 # Update the version in the settings
59 Settings().setValue('core/application version', openlp_version)
60+ if can_show_splash:
61+ self.splash.show()
62
63 def process_events(self):
64 """
65@@ -342,6 +352,7 @@
66 application.setOrganizationName('OpenLP')
67 application.setOrganizationDomain('openlp.org')
68 application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
69+ application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True)
70 if args and args.portable:
71 application.setApplicationName('OpenLPPortable')
72 Settings.setDefaultFormat(Settings.IniFormat)
73
74=== modified file 'openlp/core/ui/mainwindow.py'
75--- openlp/core/ui/mainwindow.py 2016-01-11 21:57:20 +0000
76+++ openlp/core/ui/mainwindow.py 2016-12-16 21:06:02 +0000
77@@ -52,21 +52,17 @@
78 log = logging.getLogger(__name__)
79
80 MEDIA_MANAGER_STYLE = """
81-QToolBox {
82- padding-bottom: 2px;
83-}
84-QToolBox::tab {
85+::tab#media_tool_box {
86 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
87 stop: 0 palette(button), stop: 1.0 palette(mid));
88- border: 1px solid palette(mid);
89- border-radius: 3px;
90-}
91-QToolBox::tab:selected {
92- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
93- stop: 0 palette(light), stop: 1.0 palette(button));
94- border: 1px solid palette(mid);
95- font-weight: bold;
96-}
97+ border: 0;
98+ border-radius: 2px;
99+ margin-bottom: 0;
100+ margin-top: 0;
101+ text-align: left;
102+}
103+/* This is here to make the tabs on KDE with the Breeze theme work */
104+::tab:selected {}
105 """
106
107 PROGRESSBAR_STYLE = """
108
109=== modified file 'openlp/core/ui/mediadockmanager.py'
110--- openlp/core/ui/mediadockmanager.py 2016-01-10 18:01:36 +0000
111+++ openlp/core/ui/mediadockmanager.py 2016-12-16 21:06:02 +0000
112@@ -54,7 +54,7 @@
113 match = True
114 break
115 if not match:
116- self.media_dock.addItem(media_item, visible_title['title'])
117+ self.media_dock.addItem(media_item, media_item.plugin.icon, visible_title['title'])
118
119 def remove_dock(self, media_item):
120 """
121
122=== modified file 'openlp/core/ui/themewizard.py'
123--- openlp/core/ui/themewizard.py 2015-12-31 22:46:06 +0000
124+++ openlp/core/ui/themewizard.py 2016-12-16 21:06:02 +0000
125@@ -43,9 +43,9 @@
126 theme_wizard.setModal(True)
127 theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages |
128 QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1)
129+ theme_wizard.setFixedWidth(640)
130 if is_macosx():
131 theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
132- theme_wizard.resize(646, 400)
133 else:
134 theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle)
135 self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
136
137=== modified file 'tests/functional/openlp_core_ui/test_aboutform.py'
138--- tests/functional/openlp_core_ui/test_aboutform.py 2015-12-31 22:46:06 +0000
139+++ tests/functional/openlp_core_ui/test_aboutform.py 2016-12-16 21:06:02 +0000
140@@ -22,26 +22,36 @@
141 """
142 Package to test the openlp.core.ui.firsttimeform package.
143 """
144-from unittest import TestCase
145+from unittest.mock import patch
146
147 from openlp.core.ui.aboutform import AboutForm
148
149-from tests.functional import patch
150-from tests.helpers.testmixin import TestMixin
151-
152-
153-class TestFirstTimeForm(TestCase, TestMixin):
154-
155- def test_on_volunteer_button_clicked(self):
156- """
157- Test that clicking on the "Volunteer" button opens a web page.
158- """
159- # GIVEN: A new About dialog and a mocked out webbrowser module
160- with patch('openlp.core.ui.aboutform.webbrowser') as mocked_webbrowser:
161- about_form = AboutForm(None)
162-
163- # WHEN: The "Volunteer" button is "clicked"
164- about_form.on_volunteer_button_clicked()
165-
166- # THEN: A web browser is opened
167- mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')
168+
169+@patch('openlp.core.ui.aboutform.get_application_version')
170+def test_create_about_form(mocked_get_application_version):
171+ """
172+ Test creating an about form
173+ """
174+ # GIVEN: An application version with a build number
175+ mocked_get_application_version.return_value = {'version': '3.1.1', 'build': '3000'}
176+
177+ # WHEN: The about form is created
178+ about_form = AboutForm(None)
179+
180+ # THEN: The correct version information should be in the dialog
181+ assert 'OpenLP 3.1.1 build 3000' in about_form.about_text_edit.toPlainText()
182+
183+
184+@patch('openlp.core.ui.aboutform.webbrowser')
185+def test_on_volunteer_button_clicked(mocked_webbrowser):
186+ """
187+ Test that clicking on the "Volunteer" button opens a web page.
188+ """
189+ # GIVEN: A new About dialog and a mocked out webbrowser module
190+ about_form = AboutForm(None)
191+
192+ # WHEN: The "Volunteer" button is "clicked"
193+ about_form.on_volunteer_button_clicked()
194+
195+ # THEN: A web browser is opened
196+ mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')
197
198=== added file 'tests/functional/openlp_core_ui/test_shortcutlistdialog.py'
199--- tests/functional/openlp_core_ui/test_shortcutlistdialog.py 1970-01-01 00:00:00 +0000
200+++ tests/functional/openlp_core_ui/test_shortcutlistdialog.py 2016-12-16 21:06:02 +0000
201@@ -0,0 +1,60 @@
202+# -*- coding: utf-8 -*-
203+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
204+
205+###############################################################################
206+# OpenLP - Open Source Lyrics Projection #
207+# --------------------------------------------------------------------------- #
208+# Copyright (c) 2008-2016 OpenLP Developers #
209+# --------------------------------------------------------------------------- #
210+# This program is free software; you can redistribute it and/or modify it #
211+# under the terms of the GNU General Public License as published by the Free #
212+# Software Foundation; version 2 of the License. #
213+# #
214+# This program is distributed in the hope that it will be useful, but WITHOUT #
215+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
216+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
217+# more details. #
218+# #
219+# You should have received a copy of the GNU General Public License along #
220+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
221+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
222+###############################################################################
223+"""
224+Package to test the openlp.core.ui.shortcutdialog package.
225+"""
226+from unittest.mock import MagicMock
227+
228+from PyQt5 import QtCore
229+
230+from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
231+
232+
233+def 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+
250+def 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
262
263=== modified file 'tests/functional/test_init.py'
264--- tests/functional/test_init.py 2015-12-31 22:46:06 +0000
265+++ tests/functional/test_init.py 2016-12-16 21:06:02 +0000
266@@ -102,7 +102,7 @@
267 mocked_question.return_value = QtWidgets.QMessageBox.No
268
269 # WHEN: We check if a backup should be created
270- self.openlp.backup_on_upgrade(old_install)
271+ self.openlp.backup_on_upgrade(old_install, False)
272
273 # THEN: It should not ask if we want to create a backup
274 self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be the same!')
275@@ -120,14 +120,18 @@
276 'build': 'bzr000'
277 }
278 Settings().setValue('core/application version', '2.0.5')
279+ self.openlp.splash = MagicMock()
280+ self.openlp.splash.isVisible.return_value = True
281 with patch('openlp.core.get_application_version') as mocked_get_application_version,\
282 patch('openlp.core.QtWidgets.QMessageBox.question') as mocked_question:
283 mocked_get_application_version.return_value = MOCKED_VERSION
284 mocked_question.return_value = QtWidgets.QMessageBox.No
285
286 # WHEN: We check if a backup should be created
287- self.openlp.backup_on_upgrade(old_install)
288+ self.openlp.backup_on_upgrade(old_install, True)
289
290 # THEN: It should ask if we want to create a backup
291 self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be upgraded!')
292 self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!')
293+ self.openlp.splash.hide.assert_called_once_with()
294+ self.openlp.splash.show.assert_called_once_with()
295
296=== modified file 'tests/interfaces/openlp_core_ui/test_shortcutlistform.py'
297--- tests/interfaces/openlp_core_ui/test_shortcutlistform.py 2016-12-14 21:41:01 +0000
298+++ tests/interfaces/openlp_core_ui/test_shortcutlistform.py 2016-12-16 21:06:02 +0000
299@@ -28,7 +28,6 @@
300
301 from openlp.core.common import Registry
302 from openlp.core.ui.shortcutlistform import ShortcutListForm
303-from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
304
305 from tests.interfaces import MagicMock, patch
306 from tests.helpers.testmixin import TestMixin
307@@ -228,34 +227,3 @@
308 mocked_action_shortcuts.assert_called_with(mocked_action)
309 mocked_refresh_shortcut_list.assert_called_with()
310 mocked_set_text.assert_called_with('Esc')
311-
312-
313-def test_key_press_event():
314- """
315- Test the keyPressEvent method
316- """
317- # GIVEN: A checked button and a mocked event
318- button = CaptureShortcutButton()
319- button.setChecked(True)
320- mocked_event = MagicMock()
321- mocked_event.key.return_value = QtCore.Qt.Key_Space
322-
323- # WHEN: keyPressEvent is called with an event that should be ignored
324- button.keyPressEvent(mocked_event)
325-
326- # THEN: The ignore() method on the event should have been called
327- mocked_event.ignore.assert_called_once_with()
328-
329-
330-def test_keyboard_search():
331- """
332- Test the keyboardSearch method of the ShortcutTreeWidget
333- """
334- # GIVEN: A ShortcutTreeWidget
335- widget = ShortcutTreeWidget()
336-
337- # WHEN: keyboardSearch() is called
338- widget.keyboardSearch('')
339-
340- # THEN: Nothing happens
341- assert True

Subscribers

People subscribed via source and target branches

to all changes: