Merge lp:~suutari-olli/openlp/change-blank-to-desktop-hotkey-to-esc into lp:openlp

Proposed by Azaziah on 2016-10-17
Status: Merged
Merged at revision: 2699
Proposed branch: lp:~suutari-olli/openlp/change-blank-to-desktop-hotkey-to-esc
Merge into: lp:openlp
Diff against target: 438 lines (+89/-102)
12 files modified
openlp/core/common/settings.py (+6/-4)
openlp/core/ui/exceptiondialog.py (+1/-1)
openlp/core/ui/exceptionform.py (+1/-1)
openlp/core/ui/mainwindow.py (+16/-32)
openlp/core/ui/shortcutlistform.py (+3/-3)
openlp/core/ui/slidecontroller.py (+35/-30)
openlp/plugins/custom/lib/mediaitem.py (+1/-1)
openlp/plugins/songs/forms/editsongform.py (+1/-1)
resources/images/openlp-2.qrc (+0/-1)
tests/functional/openlp_core_ui/test_slidecontroller.py (+2/-25)
tests/functional/openlp_plugins/bibles/test_mediaitem.py (+21/-0)
tests/functional/openlp_plugins/bibles/test_swordimport.py (+2/-3)
To merge this branch: bzr merge lp:~suutari-olli/openlp/change-blank-to-desktop-hotkey-to-esc
Reviewer Review Type Date Requested Status
Tomas Groth 2016-10-17 Approve on 2016-10-17
Tim Bentley 2016-10-17 Approve on 2016-10-17
Review via email: mp+308660@code.launchpad.net

This proposal supersedes a proposal from 2016-10-04.

Description of the change

- Replaced Escape item with "Show desktop"
  (Same as blank to desktop, but does not unblank).
- Combined Offline & Online help buttons into "User Manual" button,
  which launches the appropriate help based on OS. (Offline for Win/Mac)
- Improved blank to modes shortcut descriptions.
- Setting migration for old help/escape help keys.

- Fixed bugs:
https://bugs.launchpad.net/openlp/+bug/805082
https://bugs.launchpad.net/openlp/+bug/1612187
https://bugs.launchpad.net/openlp/+bug/1616441
https://bugs.launchpad.net/openlp/+bug/1497637
https://bugs.launchpad.net/openlp/+bug/1294111

--------------------------------
lp:~suutari-olli/openlp/change-blank-to-desktop-hotkey-to-esc (revision 2716)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1799/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1710/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1648/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1404/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/994/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/1062/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/930/
[SUCCESS] https://ci.openlp.io/job/Branch-05c-Code_Analysis2/91/

To post a comment you must log in.
Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

See the comment for the right place.

"This used to be in self.main_window.warning_message, where it was causing traceback.

Does it still work?
I'm not exactly sure of what it's supposed to do to be honest.

Is there a reason why this could not be an a separate line?"

Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

See below and tests would be nice.

review: Needs Fixing
Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal

Looks good to me!
The only thing that nags me is that pressing Esc will also unblank. In my perception of the world Esc should only exit something - not bring it back!
If Tim and Raoul thinks it fine as it is, feel free to ignore me...

review: Needs Information
Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

> Looks good to me!
> The only thing that nags me is that pressing Esc will also unblank. In my
> perception of the world Esc should only exit something - not bring it back!
> If Tim and Raoul thinks it fine as it is, feel free to ignore me...

Good point which I hadn't thought of before.
Perhaps we should create a new shortkey which would
only Blank to desktop but not unblank?

Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal

A new blank-only shortcut sounds great to me :-)

Phill (phill-ridout) wrote : Posted in a previous version of this proposal

Looks good, just one question (see my in line comment).

Also don't forget to regenerate the resource file and submit it in a separate merge request (after this one has gone in)

Phill (phill-ridout) wrote : Posted in a previous version of this proposal

Should note that I've not tested this

Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

> Looks good, just one question (see my in line comment).
>
> Also don't forget to regenerate the resource file and submit it in a separate
> merge request (after this one has gone in)

I've answered the question.

Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

> Should note that I've not tested this

This should probably be tested on Linux just to make sure the Window manager
handles Blank to Desktop in single screen scenarios.

Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

Ended up being unsaved comment, however:

"The automatic wrap puts all of text expect the last word to the same line,
it does not look good at all. I believe manual newline is better in this case.

See the image for reference:

https://drive.google.com/file/d/0B9y8rZiYItltamFQM0hOU0Nhd2s/view?usp=sharing "

Phill (phill-ridout) wrote : Posted in a previous version of this proposal

I've spoke to superfly, and he's happy with you adding the \n so looks good to me!

Tomas Groth (tomasgroth) : Posted in a previous version of this proposal
review: Approve
Tim Bentley (trb143) : Posted in a previous version of this proposal
review: Approve
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Sorry conflicts with trunk.

review: Needs Fixing
Tim Bentley (trb143) :
review: Approve
Tomas Groth (tomasgroth) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/common/settings.py'
2--- openlp/core/common/settings.py 2016-07-31 11:58:54 +0000
3+++ openlp/core/common/settings.py 2016-10-17 18:10:16 +0000
4@@ -214,7 +214,10 @@
5 ('media/players', 'media/players_temp', [(media_players_conv, None)]), # Convert phonon to system
6 ('media/players_temp', 'media/players', []), # Move temp setting from above to correct setting
7 ('advanced/default color', 'core/logo background color', []), # Default image renamed + moved to general > 2.4.
8- ('advanced/default image', '/core/logo file', []) # Default image renamed + moved to general after 2.4.
9+ ('advanced/default image', 'core/logo file', []), # Default image renamed + moved to general after 2.4.
10+ ('shortcuts/escapeItem', 'shortcuts/desktopScreenEnable', []), # Escape item was removed in 2.6.
11+ ('shortcuts/offlineHelpItem', 'shortcuts/HelpItem', []), # Online and Offline help were combined in 2.6.
12+ ('shortcuts/onlineHelpItem', 'shortcuts/HelpItem', []) # Online and Offline help were combined in 2.6.
13 ]
14
15 @staticmethod
16@@ -261,10 +264,10 @@
17 'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)],
18 'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)],
19 'shortcuts/desktopScreen': [QtGui.QKeySequence(QtCore.Qt.Key_D)],
20+ 'shortcuts/desktopScreenEnable': [QtGui.QKeySequence(QtCore.Qt.Key_Escape)],
21 'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
22 'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)],
23 'shortcuts/editSong': [],
24- 'shortcuts/escapeItem': [QtGui.QKeySequence(QtCore.Qt.Key_Escape)],
25 'shortcuts/expand': [QtGui.QKeySequence(QtCore.Qt.Key_Plus)],
26 'shortcuts/exportThemeItem': [],
27 'shortcuts/fileNewItem': [QtGui.QKeySequence(QtGui.QKeySequence.New)],
28@@ -273,6 +276,7 @@
29 'shortcuts/fileSaveItem': [QtGui.QKeySequence(QtGui.QKeySequence.Save)],
30 'shortcuts/fileOpenItem': [QtGui.QKeySequence(QtGui.QKeySequence.Open)],
31 'shortcuts/goLive': [],
32+ 'shortcuts/HelpItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
33 'shortcuts/importThemeItem': [],
34 'shortcuts/importBibleItem': [],
35 'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
36@@ -333,8 +337,6 @@
37 QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
38 'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)],
39 'shortcuts/newService': [],
40- 'shortcuts/offlineHelpItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
41- 'shortcuts/onlineHelpItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
42 'shortcuts/openService': [],
43 'shortcuts/saveService': [],
44 'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up),
45
46=== modified file 'openlp/core/ui/exceptiondialog.py'
47--- openlp/core/ui/exceptiondialog.py 2016-09-09 07:57:11 +0000
48+++ openlp/core/ui/exceptiondialog.py 2016-10-17 18:10:16 +0000
49@@ -107,7 +107,7 @@
50 '<strong>No email app? </strong> You can <strong>save</strong> this '
51 'information to a <strong>file</strong> and<br>'
52 'send it from your <strong>mail on browser</strong> via an <strong>attachment.</strong><br><br>'
53- '<strong>Thank you<strong> for being part of making OpenLP better!<br>'
54+ '<strong>Thank you</strong> for being part of making OpenLP better!<br>'
55 ).format(first_part=exception_part1))
56 self.send_report_button.setText(translate('OpenLP.ExceptionDialog', 'Send E-Mail'))
57 self.save_report_button.setText(translate('OpenLP.ExceptionDialog', 'Save to File'))
58
59=== modified file 'openlp/core/ui/exceptionform.py'
60--- openlp/core/ui/exceptionform.py 2016-08-11 22:12:50 +0000
61+++ openlp/core/ui/exceptionform.py 2016-10-17 18:10:16 +0000
62@@ -208,7 +208,7 @@
63 self.__button_state(False)
64 self.description_word_count.setText(
65 translate('OpenLP.ExceptionDialog', '<strong>Please enter a more detailed description of the situation'
66- ))
67+ '</strong>'))
68
69 def on_attach_file_button_clicked(self):
70 """
71
72=== modified file 'openlp/core/ui/mainwindow.py'
73--- openlp/core/ui/mainwindow.py 2016-08-11 22:12:50 +0000
74+++ openlp/core/ui/mainwindow.py 2016-10-17 18:10:16 +0000
75@@ -309,21 +309,13 @@
76 self.about_item.setMenuRole(QtWidgets.QAction.AboutRole)
77 if is_win():
78 self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm')
79- self.offline_help_item = create_action(main_window, 'offlineHelpItem',
80- icon=':/system/system_help_contents.png',
81- can_shortcuts=True,
82- category=UiStrings().Help, triggers=self.on_offline_help_clicked)
83 elif is_macosx():
84 self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir),
85 '..', 'Resources', 'OpenLP.help')
86- self.offline_help_item = create_action(main_window, 'offlineHelpItem',
87- icon=':/system/system_help_contents.png',
88- can_shortcuts=True,
89- category=UiStrings().Help, triggers=self.on_offline_help_clicked)
90- self.on_line_help_item = create_action(main_window, 'onlineHelpItem',
91- icon=':/system/system_online_help.png',
92- can_shortcuts=True,
93- category=UiStrings().Help, triggers=self.on_online_help_clicked)
94+ self.on_help_item = create_action(main_window, 'HelpItem',
95+ icon=':/system/system_help_contents.png',
96+ can_shortcuts=True,
97+ category=UiStrings().Help, triggers=self.on_help_clicked)
98 self.web_site_item = create_action(main_window, 'webSiteItem', can_shortcuts=True, category=UiStrings().Help)
99 # Shortcuts not connected to buttons or menu entries.
100 self.search_shortcut_action = create_action(main_window,
101@@ -362,11 +354,7 @@
102 add_actions(self.tools_menu, (self.tools_open_data_folder, None))
103 add_actions(self.tools_menu, (self.tools_first_time_wizard, None))
104 add_actions(self.tools_menu, [self.update_theme_images])
105- if (is_win() or is_macosx()) and (hasattr(sys, 'frozen') and sys.frozen == 1):
106- add_actions(self.help_menu, (self.offline_help_item, self.on_line_help_item, None, self.web_site_item,
107- self.about_item))
108- else:
109- add_actions(self.help_menu, (self.on_line_help_item, None, self.web_site_item, self.about_item))
110+ add_actions(self.help_menu, (self.on_help_item, None, self.web_site_item, self.about_item))
111 add_actions(self.menu_bar, (self.file_menu.menuAction(), self.view_menu.menuAction(),
112 self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction()))
113 add_actions(self, [self.search_shortcut_action])
114@@ -462,9 +450,7 @@
115 'from here.'))
116 self.about_item.setText(translate('OpenLP.MainWindow', '&About'))
117 self.about_item.setStatusTip(translate('OpenLP.MainWindow', 'More information about OpenLP.'))
118- if is_win() or is_macosx():
119- self.offline_help_item.setText(translate('OpenLP.MainWindow', '&User Guide'))
120- self.on_line_help_item.setText(translate('OpenLP.MainWindow', '&Online Help'))
121+ self.on_help_item.setText(translate('OpenLP.MainWindow', '&User Manual'))
122 self.search_shortcut_action.setText(UiStrings().Search)
123 self.search_shortcut_action.setToolTip(
124 translate('OpenLP.MainWindow', 'Jump to the search box of the current active plugin.'))
125@@ -778,18 +764,16 @@
126 import webbrowser
127 webbrowser.open_new('http://openlp.org/')
128
129- def on_offline_help_clicked(self):
130- """
131- Load the local OpenLP help file
132- """
133- QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + self.local_help_file))
134-
135- def on_online_help_clicked(self):
136- """
137- Load the online OpenLP manual
138- """
139- import webbrowser
140- webbrowser.open_new('http://manual.openlp.org/')
141+ def on_help_clicked(self):
142+ """
143+ If is_macosx or is_win, open the local OpenLP help file.
144+ Use the Online manual in other cases. (Linux)
145+ """
146+ if is_macosx() or is_win():
147+ QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + self.local_help_file))
148+ else:
149+ import webbrowser
150+ webbrowser.open_new('http://manual.openlp.org/')
151
152 def on_about_item_clicked(self):
153 """
154
155=== modified file 'openlp/core/ui/shortcutlistform.py'
156--- openlp/core/ui/shortcutlistform.py 2016-05-20 16:22:06 +0000
157+++ openlp/core/ui/shortcutlistform.py 2016-10-17 18:10:16 +0000
158@@ -426,11 +426,11 @@
159 is_valid = False
160 if not is_valid:
161 text = translate('OpenLP.ShortcutListDialog',
162- 'The shortcut "{key}" is already assigned to another action, please'
163- ' use a different shortcut.'
164+ 'The shortcut "{key}" is already assigned to another action,\n'
165+ 'please use a different shortcut.'
166 ).format(key=self.get_shortcut_string(key_sequence))
167 self.main_window.warning_message(translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'),
168- text, for_display=True)
169+ text)
170 self.dialog_was_shown = True
171 return is_valid
172
173
174=== modified file 'openlp/core/ui/slidecontroller.py'
175--- openlp/core/ui/slidecontroller.py 2016-08-10 18:50:40 +0000
176+++ openlp/core/ui/slidecontroller.py 2016-10-17 18:10:16 +0000
177@@ -234,25 +234,32 @@
178 self.hide_menu.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
179 self.hide_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
180 self.toolbar.add_toolbar_widget(self.hide_menu)
181- self.blank_screen = create_action(self, 'blankScreen',
182- text=translate('OpenLP.SlideController', 'Blank Screen'),
183- icon=':/slides/slide_blank.png',
184- checked=False, can_shortcuts=True, category=self.category,
185- triggers=self.on_blank_display)
186- self.theme_screen = create_action(self, 'themeScreen',
187- text=translate('OpenLP.SlideController', 'Blank to Theme'),
188- icon=':/slides/slide_theme.png',
189- checked=False, can_shortcuts=True, category=self.category,
190- triggers=self.on_theme_display)
191+ # The order of the blank to modes in Shortcuts list comes from here.
192+ self.desktop_screen_enable = create_action(self, 'desktopScreenEnable',
193+ text=translate('OpenLP.SlideController', 'Show Desktop'),
194+ icon=':/slides/slide_desktop.png', can_shortcuts=True,
195+ context=QtCore.Qt.WidgetWithChildrenShortcut,
196+ category=self.category, triggers=self.on_hide_display_enable)
197 self.desktop_screen = create_action(self, 'desktopScreen',
198- text=translate('OpenLP.SlideController', 'Show Desktop'),
199+ text=translate('OpenLP.SlideController', 'Toggle Desktop'),
200 icon=':/slides/slide_desktop.png',
201 checked=False, can_shortcuts=True, category=self.category,
202 triggers=self.on_hide_display)
203+ self.theme_screen = create_action(self, 'themeScreen',
204+ text=translate('OpenLP.SlideController', 'Toggle Blank to Theme'),
205+ icon=':/slides/slide_theme.png',
206+ checked=False, can_shortcuts=True, category=self.category,
207+ triggers=self.on_theme_display)
208+ self.blank_screen = create_action(self, 'blankScreen',
209+ text=translate('OpenLP.SlideController', 'Toggle Blank Screen'),
210+ icon=':/slides/slide_blank.png',
211+ checked=False, can_shortcuts=True, category=self.category,
212+ triggers=self.on_blank_display)
213 self.hide_menu.setDefaultAction(self.blank_screen)
214 self.hide_menu.menu().addAction(self.blank_screen)
215 self.hide_menu.menu().addAction(self.theme_screen)
216 self.hide_menu.menu().addAction(self.desktop_screen)
217+ self.hide_menu.menu().addAction(self.desktop_screen_enable)
218 # Wide menu of display control buttons.
219 self.blank_screen_button = QtWidgets.QToolButton(self.toolbar)
220 self.blank_screen_button.setObjectName('blank_screen_button')
221@@ -512,23 +519,6 @@
222 can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
223 category=self.category,
224 triggers=self.service_next)
225- self.escape_item = create_action(parent, 'escapeItem',
226- text=translate('OpenLP.SlideController', 'Escape Item'),
227- can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
228- category=self.category,
229- triggers=self.live_escape)
230-
231- def live_escape(self, field=None):
232- """
233- If you press ESC on the live screen it should close the display temporarily.
234- """
235- self.display.setVisible(False)
236- self.media_controller.media_stop(self)
237- # Stop looping if active
238- if self.play_slides_loop.isChecked():
239- self.on_play_slides_loop(False)
240- elif self.play_slides_once.isChecked():
241- self.on_play_slides_once(False)
242
243 def toggle_display(self, action):
244 """
245@@ -622,7 +612,7 @@
246 widget.addActions([
247 self.previous_item, self.next_item,
248 self.previous_service, self.next_service,
249- self.escape_item,
250+ self.desktop_screen_enable,
251 self.desktop_screen,
252 self.theme_screen,
253 self.blank_screen])
254@@ -965,7 +955,7 @@
255 else:
256 Registry().execute('live_display_show')
257 else:
258- self.live_escape()
259+ self.on_hide_display_enable()
260
261 def on_slide_blank(self):
262 """
263@@ -1025,6 +1015,7 @@
264 def on_hide_display(self, checked=None):
265 """
266 Handle the Hide screen button
267+ This toggles the desktop screen.
268
269 :param checked: the new state of the of the widget
270 """
271@@ -1043,6 +1034,20 @@
272 self.update_preview()
273 self.on_toggle_loop()
274
275+ def on_hide_display_enable(self, checked=None):
276+ """
277+ Handle the on_hide_display_enable
278+ This only enables the desktop screen.
279+
280+ :param checked: the new state of the of the widget
281+ """
282+ self.blank_screen.setChecked(False)
283+ self.theme_screen.setChecked(False)
284+ Registry().execute('live_display_hide', HideMode.Screen)
285+ self.desktop_screen.setChecked(True)
286+ self.update_preview()
287+ self.on_toggle_loop()
288+
289 def blank_plugin(self):
290 """
291 Blank/Hide the display screen within a plugin if required.
292
293=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
294--- openlp/plugins/custom/lib/mediaitem.py 2016-05-21 18:19:18 +0000
295+++ openlp/plugins/custom/lib/mediaitem.py 2016-10-17 18:10:16 +0000
296@@ -350,7 +350,7 @@
297 :param string: The search string
298 :param show_error: The error string to be show.
299 """
300- search = '%{search}%'.forma(search=string.lower())
301+ search = '%{search}%'.format(search=string.lower())
302 search_results = self.plugin.db_manager.get_all_objects(CustomSlide,
303 or_(func.lower(CustomSlide.title).like(search),
304 func.lower(CustomSlide.text).like(search)),
305
306=== modified file 'openlp/plugins/songs/forms/editsongform.py'
307--- openlp/plugins/songs/forms/editsongform.py 2016-05-27 08:13:14 +0000
308+++ openlp/plugins/songs/forms/editsongform.py 2016-10-17 18:10:16 +0000
309@@ -317,7 +317,7 @@
310 self.song.verse_order = re.sub('([' + verse.upper() + verse.lower() + '])(\W|$)',
311 r'\g<1>1\2', self.song.verse_order)
312 except:
313- log.exception('Problem processing song Lyrics \n{xml}'.forma(xml=sxml.dump_xml()))
314+ log.exception('Problem processing song Lyrics \n{xml}'.format(xml=sxml.dump_xml()))
315 raise
316
317 def keyPressEvent(self, event):
318
319=== modified file 'resources/images/openlp-2.qrc'
320--- resources/images/openlp-2.qrc 2016-06-14 21:49:29 +0000
321+++ resources/images/openlp-2.qrc 2016-10-17 18:10:16 +0000
322@@ -130,7 +130,6 @@
323 <file>clear_shortcut.png</file>
324 <file>system_about.png</file>
325 <file>system_help_contents.png</file>
326- <file>system_online_help.png</file>
327 <file>system_mediamanager.png</file>
328 <file>system_volunteer.png</file>
329 <file>system_servicemanager.png</file>
330
331=== removed file 'resources/images/system_online_help.png'
332Binary files resources/images/system_online_help.png 2011-05-25 06:56:33 +0000 and resources/images/system_online_help.png 1970-01-01 00:00:00 +0000 differ
333=== modified file 'tests/functional/openlp_core_ui/test_slidecontroller.py'
334--- tests/functional/openlp_core_ui/test_slidecontroller.py 2016-08-13 14:29:12 +0000
335+++ tests/functional/openlp_core_ui/test_slidecontroller.py 2016-10-17 18:10:16 +0000
336@@ -208,29 +208,6 @@
337 mocked_on_theme_display.assert_called_once_with(False)
338 mocked_on_hide_display.assert_called_once_with(False)
339
340- def test_live_escape(self):
341- """
342- Test that when the live_escape() method is called, the display is set to invisible and any media is stopped
343- """
344- # GIVEN: A new SlideController instance and mocked out display and media_controller
345- mocked_display = MagicMock()
346- mocked_media_controller = MagicMock()
347- Registry.create()
348- Registry().register('media_controller', mocked_media_controller)
349- slide_controller = SlideController(None)
350- slide_controller.display = mocked_display
351- play_slides = MagicMock()
352- play_slides.isChecked.return_value = False
353- slide_controller.play_slides_loop = play_slides
354- slide_controller.play_slides_once = play_slides
355-
356- # WHEN: live_escape() is called
357- slide_controller.live_escape()
358-
359- # THEN: the display should be set to invisible and the media controller stopped
360- mocked_display.setVisible.assert_called_once_with(False)
361- mocked_media_controller.media_stop.assert_called_once_with(slide_controller)
362-
363 def test_on_go_live_live_controller(self):
364 """
365 Test that when the on_go_live() method is called the message is sent to the live controller and focus is
366@@ -697,7 +674,7 @@
367 slide_controller.next_item = MagicMock()
368 slide_controller.previous_service = MagicMock()
369 slide_controller.next_service = MagicMock()
370- slide_controller.escape_item = MagicMock()
371+ slide_controller.desktop_screen_enable = MagicMock()
372 slide_controller.desktop_screen = MagicMock()
373 slide_controller.blank_screen = MagicMock()
374 slide_controller.theme_screen = MagicMock()
375@@ -709,7 +686,7 @@
376 mocked_widget.addActions.assert_called_with([
377 slide_controller.previous_item, slide_controller.next_item,
378 slide_controller.previous_service, slide_controller.next_service,
379- slide_controller.escape_item, slide_controller.desktop_screen,
380+ slide_controller.desktop_screen_enable, slide_controller.desktop_screen,
381 slide_controller.theme_screen, slide_controller.blank_screen
382 ])
383
384
385=== modified file 'tests/functional/openlp_plugins/bibles/test_mediaitem.py'
386--- tests/functional/openlp_plugins/bibles/test_mediaitem.py 2016-09-17 23:07:24 +0000
387+++ tests/functional/openlp_plugins/bibles/test_mediaitem.py 2016-10-17 18:10:16 +0000
388@@ -114,6 +114,27 @@
389 self.assertEqual(self.media_item.search_results, {})
390 self.assertEqual(self.media_item.second_search_results, {})
391
392+ def test_required_icons(self):
393+ """
394+ Test that all the required icons are set properly.
395+ """
396+ # GIVEN: Mocked icons that need to be called.
397+ self.media_item.has_import_icon = MagicMock()
398+ self.media_item.has_new_icon = MagicMock()
399+ self.media_item.has_edit_icon = MagicMock()
400+ self.media_item.has_delete_icon = MagicMock()
401+ self.media_item.add_to_service_item = MagicMock()
402+
403+ # WHEN: self.media_item.required_icons is called
404+ self.media_item.required_icons()
405+
406+ # THEN: On windows it should return True, on other platforms False
407+ self.assertTrue(self.media_item.has_import_icon, 'Check that the icon is as True.')
408+ self.assertFalse(self.media_item.has_new_icon, 'Check that the icon is called as False.')
409+ self.assertTrue(self.media_item.has_edit_icon, 'Check that the icon is called as True.')
410+ self.assertTrue(self.media_item.has_delete_icon, 'Check that the icon is called as True.')
411+ self.assertFalse(self.media_item.add_to_service_item, 'Check that the icon is called as False')
412+
413 def test_on_quick_search_button_general(self):
414 """
415 Test that general things, which should be called on all Quick searches are called.
416
417=== modified file 'tests/functional/openlp_plugins/bibles/test_swordimport.py'
418--- tests/functional/openlp_plugins/bibles/test_swordimport.py 2016-09-04 21:16:43 +0000
419+++ tests/functional/openlp_plugins/bibles/test_swordimport.py 2016-10-17 18:10:16 +0000
420@@ -70,8 +70,7 @@
421
422 @patch('openlp.plugins.bibles.lib.importers.sword.SwordBible.application')
423 @patch('openlp.plugins.bibles.lib.importers.sword.modules')
424- @patch('openlp.core.common.languages')
425- def test_simple_import(self, mocked_languages, mocked_pysword_modules, mocked_application):
426+ def test_simple_import(self, mocked_pysword_modules, mocked_application):
427 """
428 Test that a simple SWORD import works
429 """
430@@ -88,7 +87,7 @@
431 importer.create_verse = MagicMock()
432 importer.create_book = MagicMock()
433 importer.session = MagicMock()
434- mocked_languages.get_language.return_value = 'Danish'
435+ importer.get_language = MagicMock(return_value='Danish')
436 mocked_bible = MagicMock()
437 mocked_genesis = MagicMock()
438 mocked_genesis.name = 'Genesis'