Merge lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank into lp:openlp

Proposed by Azaziah
Status: Superseded
Proposed branch: lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank
Merge into: lp:openlp
Diff against target: 263 lines (+90/-4)
8 files modified
openlp/core/common/settings.py (+3/-0)
openlp/core/lib/mediamanageritem.py (+3/-0)
openlp/core/ui/generaltab.py (+7/-0)
openlp/core/ui/maindisplay.py (+1/-1)
openlp/core/ui/mainwindow.py (+3/-0)
openlp/core/ui/slidecontroller.py (+26/-2)
openlp/plugins/presentations/lib/messagelistener.py (+5/-1)
tests/functional/openlp_core_ui/test_slidecontroller.py (+42/-0)
To merge this branch: bzr merge lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank
Reviewer Review Type Date Requested Status
Raoul Snyman Needs Fixing
Tomas Groth Pending
Tim Bentley Pending
Review via email: mp+292407@code.launchpad.net

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

This proposal has been superseded by a proposal from 2016-04-27.

Description of the change

This branch introduces the functionality of unblanking
display from Blank to Black/Theme/Desktop for:

a) Clicking slide in "Live panel"
b) Next/Previous shortcuts (Green arrows)
c) Go to verse x.
d) When starting automatic playback (To end or Loop)
Also added "Unblank display when changing slide in Live" to advanced
options tab for disabling/enabling this behavior for a-c.

Additionally this branch also includes fix for bug
https://bugs.launchpad.net/openlp/+bug/1531691
Do note that this branch does not fix this for Escape item blanking,
creating yet an another Escape exclusive bug.

-----------------------------------------------------------------------------
The only reason Escape item has been a good alternative for other
blank to methods is the functionality of resuming Live by clicking
slides and the fact it worked in single screen scenarios.
I can’t see any reason why it should not be removed after this branch
is merged since the single screen issue was already fixed earlier.

-----------------------------------------------------------------------------
Added 3 tests for checking display is re-blanked if it was
blanked before re-processing edited Live item.
Also fixed the issue where Next/Previous slide does not
unblank display for PowerPoint/Impress.

-----------------------------------------------------------------------------
Better fix for bug where display is unblanked on editing current live item.
This now sets a hidden setting to true while processing Live item and then changes it back to false. Display is thus not unblanked at all during the
process. (Old fix showed the edited slide for a small time)

Downside: All the new tests were based on the old
method and thus they were removed.

Fixed bug 1462420 (Double clicking preview adds items to service unlimited times)
- Added a hidden setting for controlling this behavior.
  It is reset if any item is sent to preview from library.
- Sending the same item to service multiple times is still
  possible by using the "Add button (icon)"
-----------------------------------------------------------------------------
In this re-proposal:

- Added two tests for checking if doubleclicking preview should
  add item to service or send it to live.

lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank (revision 2647)
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-01-Pull/1467/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-02-Functional-Tests/1383/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-03-Interface-Tests/1321/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1123/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/714/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-05a-Code_Analysis/781/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-05b-Test_Coverage/649/

To post a comment you must log in.
Revision history for this message
Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal

Just tested a bit.
You have introduced the "Click live slide to unblank" setting, but a "Unblank display when adding new item" also exists in the general tab. You should probably move yours to be under the exiting one to keep similar settings in the same place. Currently your code doesn't honor the "Unblank display when adding new item", which it will have to do. As it is now the item goes live no matter if the setting is enabled or not.
Also the new setting should be "false" as default, this is new behavior, so users should enabled it if they want it.
Also added a code-comment below.

review: Needs Fixing
Revision history for this message
Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

Hi Tomas and thank you for your comments!

"Unblank display when adding new item" also exists in the general tab. You should probably move yours to be under the exiting one to keep similar settings in the same place. Currently your code doesn't honor the "Unblank display when adding new item

# Done and Done, now also honoring double clicking preview

Also the new setting should be "false" as default, this is new behavior, so users should enabled it if they want it.

# Done
# Currently this is default behavior for Escape item and probably easier
to use than our current blank to modes. I think this and some other settings
should eventually be changed to be more user friendly by default.

Revision history for this message
Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal

Looks good now. As you mention in one of your source-comments the previous slide is shortly visible when display is unblanked. Don't know if it can be helped.
Added a comment to the code below.
Besides that, you need tests :)

review: Needs Fixing
Revision history for this message
Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

Thanks again,

if by previous slide being shortly visible you mean it happens once you change slide inside the Live Panel
and the transition effect is applied, yes that can be changed. I've heard people complaining there's no transition effects when unblanking or changing items so maybe it should be left as it is since it would mean loosing effects.

If you were talking about this happening on song edit:
Think it would be possible but would require quite a effort,
maybe we can let it pass for the time being, it's still mostly fixed.

I really suck at writing tests, is one enough for a rookie?

I also replied to the code comment.

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Looks good to me. Nice tests.

review: Approve
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Couple of tests and some tests are needed.

review: Needs Fixing
Revision history for this message
Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

I need to start working on tests...

Fixed the diff comments.

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Check my comment. I'll try to look at this more in-depth over the weekend and give you more feedback.

review: Needs Fixing
Revision history for this message
Azaziah (suutari-olli) wrote :

> Check my comment. I'll try to look at this more in-depth over the weekend and
> give you more feedback.

Thank you for checking this out, I've replied to your comment.

I'm away from my coding station until next week, so no new commits
(if required) will be made until then.

I wish you all the best for your day.

Revision history for this message
Azaziah (suutari-olli) wrote :

I noticed the comment was not saved, so here it is. ^^ Sorry about that :/

Revision history for this message
Azaziah (suutari-olli) wrote :

I commented on replace live item function and resetting the setting.

2648. By Azaziah

Added this to program startup code, should replace_service_manager_item ever crash the program.

Settings().setValue('core/is live item edited and replaced', False)

2649. By Azaziah

merged trunk on 14.6.16

2650. By Azaziah

- Turned the two new hidden settings into registry flags

2651. By Azaziah

Comment cleanup / Improvements

2652. By Azaziah

- Merged trunk on 27.6.16

2653. By Azaziah

- Tried to make the new text work with the registry changes but failed.
 > Test is broken, do not merge!

2654. By Azaziah

Merged trunk on 14.7.16

2655. By Azaziah

pep8 fixes, test still broken.

2656. By Azaziah

Fixed the tests.

2657. By Azaziah

- Reduced comments
- Removed unrequired reg_value from test.

2658. By Azaziah

- Fixed the issue where items sent to Preview from Service may cause tracebacks.

2659. By Azaziah

- Moved the 2nd new registry flag from one init to an another init which also has the 1st

2660. By Azaziah

- Moved them to another init since something broke

2661. By Azaziah

- removed one unrequired if statement.

2662. By Azaziah

- Merged trunk on 31.7.16

2663. By Azaziah

- Merged trunk on 10/8/16.

2664. By Azaziah

- Merged trunk and resolved conflict that was created by ui-messages-part-1 branch.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/common/settings.py'
--- openlp/core/common/settings.py 2016-04-21 21:16:24 +0000
+++ openlp/core/common/settings.py 2016-04-27 20:40:38 +0000
@@ -141,6 +141,7 @@
141 'core/auto preview': False,141 'core/auto preview': False,
142 'core/audio start paused': True,142 'core/audio start paused': True,
143 'core/auto unblank': False,143 'core/auto unblank': False,
144 'core/click live slide to unblank': False,
144 'core/blank warning': False,145 'core/blank warning': False,
145 'core/ccli number': '',146 'core/ccli number': '',
146 'core/has run wizard': False,147 'core/has run wizard': False,
@@ -163,6 +164,8 @@
163 'core/display on monitor': True,164 'core/display on monitor': True,
164 'core/override position': False,165 'core/override position': False,
165 'core/application version': '0.0',166 'core/application version': '0.0',
167 'core/is live item edited and replaced': False,
168 'core/has doubleclicking preview added item to service': False,
166 'images/background color': '#000000',169 'images/background color': '#000000',
167 'media/players': 'system,webkit',170 'media/players': 'system,webkit',
168 'media/override player': QtCore.Qt.Unchecked,171 'media/override player': QtCore.Qt.Unchecked,
169172
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2016-04-17 19:32:15 +0000
+++ openlp/core/lib/mediamanageritem.py 2016-04-27 20:40:38 +0000
@@ -482,6 +482,9 @@
482 'You must select one or more items to preview.'))482 'You must select one or more items to preview.'))
483 else:483 else:
484 log.debug('%s Preview requested' % self.plugin.name)484 log.debug('%s Preview requested' % self.plugin.name)
485 # If ('advanced/double click live') is not enabled, double clicking preview adds the item to Service.
486 # This setting prevents it from being sent to Service multiple times, in here it is reset to False.
487 Settings().setValue('core/has doubleclicking preview added item to service', False)
485 service_item = self.build_service_item()488 service_item = self.build_service_item()
486 if service_item:489 if service_item:
487 service_item.from_plugin = True490 service_item.from_plugin = True
488491
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2016-04-17 18:57:03 +0000
+++ openlp/core/ui/generaltab.py 2016-04-27 20:40:38 +0000
@@ -209,6 +209,9 @@
209 self.auto_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box)209 self.auto_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box)
210 self.auto_unblank_check_box.setObjectName('auto_unblank_check_box')210 self.auto_unblank_check_box.setObjectName('auto_unblank_check_box')
211 self.settings_layout.addRow(self.auto_unblank_check_box)211 self.settings_layout.addRow(self.auto_unblank_check_box)
212 self.click_live_slide_to_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box)
213 self.click_live_slide_to_unblank_check_box.setObjectName('click_live_slide_to_unblank')
214 self.settings_layout.addRow(self.click_live_slide_to_unblank_check_box)
212 self.auto_preview_check_box = QtWidgets.QCheckBox(self.settings_group_box)215 self.auto_preview_check_box = QtWidgets.QCheckBox(self.settings_group_box)
213 self.auto_preview_check_box.setObjectName('auto_preview_check_box')216 self.auto_preview_check_box.setObjectName('auto_preview_check_box')
214 self.settings_layout.addRow(self.auto_preview_check_box)217 self.settings_layout.addRow(self.auto_preview_check_box)
@@ -259,6 +262,8 @@
259 self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',262 self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
260 'Prompt to save before starting a new service'))263 'Prompt to save before starting a new service'))
261 self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))264 self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
265 self.click_live_slide_to_unblank_check_box.setText(translate('OpenLP.GeneralTab',
266 'Unblank display when changing slide in Live'))
262 self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab',267 self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab',
263 'Automatically preview next item in service'))268 'Automatically preview next item in service'))
264 self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))269 self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
@@ -292,6 +297,7 @@
292 self.password_edit.setText(settings.value('songselect password'))297 self.password_edit.setText(settings.value('songselect password'))
293 self.save_check_service_check_box.setChecked(settings.value('save prompt'))298 self.save_check_service_check_box.setChecked(settings.value('save prompt'))
294 self.auto_unblank_check_box.setChecked(settings.value('auto unblank'))299 self.auto_unblank_check_box.setChecked(settings.value('auto unblank'))
300 self.click_live_slide_to_unblank_check_box.setChecked(settings.value('click live slide to unblank'))
295 self.display_on_monitor_check.setChecked(self.screens.display)301 self.display_on_monitor_check.setChecked(self.screens.display)
296 self.warning_check_box.setChecked(settings.value('blank warning'))302 self.warning_check_box.setChecked(settings.value('blank warning'))
297 self.auto_open_check_box.setChecked(settings.value('auto open'))303 self.auto_open_check_box.setChecked(settings.value('auto open'))
@@ -336,6 +342,7 @@
336 settings.setValue('update check', self.check_for_updates_check_box.isChecked())342 settings.setValue('update check', self.check_for_updates_check_box.isChecked())
337 settings.setValue('save prompt', self.save_check_service_check_box.isChecked())343 settings.setValue('save prompt', self.save_check_service_check_box.isChecked())
338 settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())344 settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())
345 settings.setValue('click live slide to unblank', self.click_live_slide_to_unblank_check_box.isChecked())
339 settings.setValue('auto preview', self.auto_preview_check_box.isChecked())346 settings.setValue('auto preview', self.auto_preview_check_box.isChecked())
340 settings.setValue('loop delay', self.timeout_spin_box.value())347 settings.setValue('loop delay', self.timeout_spin_box.value())
341 settings.setValue('ccli number', self.number_edit.displayText())348 settings.setValue('ccli number', self.number_edit.displayText())
342349
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2016-04-01 02:32:36 +0000
+++ openlp/core/ui/maindisplay.py 2016-04-27 20:40:38 +0000
@@ -471,7 +471,7 @@
471 self.footer(service_item.foot_text)471 self.footer(service_item.foot_text)
472 # if was hidden keep it hidden472 # if was hidden keep it hidden
473 if self.hide_mode and self.is_live and not service_item.is_media():473 if self.hide_mode and self.is_live and not service_item.is_media():
474 if Settings().value('core/auto unblank'):474 if Settings().value('core/auto unblank') and not Settings().value('core/is live item edited and replaced'):
475 Registry().execute('slidecontroller_live_unblank')475 Registry().execute('slidecontroller_live_unblank')
476 else:476 else:
477 self.hide_display(self.hide_mode)477 self.hide_display(self.hide_mode)
478478
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2016-04-23 13:46:59 +0000
+++ openlp/core/ui/mainwindow.py 2016-04-27 20:40:38 +0000
@@ -656,6 +656,9 @@
656 """656 """
657 Give all the plugins a chance to perform some tasks at startup657 Give all the plugins a chance to perform some tasks at startup
658 """658 """
659 # This setting is set to false, in case def replace_service_manager_item in slidecontroller would crash the
660 # program and make blank to modes unavailable.
661 Settings().setValue('core/is live item edited and replaced', False)
659 self.application.process_events()662 self.application.process_events()
660 for plugin in self.plugin_manager.plugins:663 for plugin in self.plugin_manager.plugins:
661 if plugin.is_active():664 if plugin.is_active():
662665
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2016-04-22 18:32:45 +0000
+++ openlp/core/ui/slidecontroller.py 2016-04-27 20:40:38 +0000
@@ -792,11 +792,17 @@
792 def replace_service_manager_item(self, item):792 def replace_service_manager_item(self, item):
793 """793 """
794 Replacement item following a remote edit794 Replacement item following a remote edit
795 This action also takes place when a song that is sent to live from Service Manager is edited.
796 If display is blanked, it will get unblanked if automatic unblanking is enabled. We prevent this from happening
797 by setting a hidden setting to "True" and then to "False" after the processing is done.
798 The setting is also set to "False" on every start up, should the program ever crash during this process.
795799
796 :param item: The current service item800 :param item: The current service item
797 """801 """
798 if item == self.service_item:802 if item == self.service_item:
803 Settings().setValue('core/is live item edited and replaced', True)
799 self._process_item(item, self.preview_widget.current_slide_number())804 self._process_item(item, self.preview_widget.current_slide_number())
805 Settings().setValue('core/is live item edited and replaced', False)
800806
801 def add_service_manager_item(self, item, slide_no):807 def add_service_manager_item(self, item, slide_no):
802 """808 """
@@ -1093,6 +1099,15 @@
1093 self.log_debug('Could not get lock in slide_selected after waiting %f, skip to avoid deadlock.'1099 self.log_debug('Could not get lock in slide_selected after waiting %f, skip to avoid deadlock.'
1094 % timeout)1100 % timeout)
1095 return1101 return
1102 # If "click live slide to unblank" is enabled, unblank the display. And start = Item is sent to Live.
1103 # 'core/is live item edited and replaced' is only True when replacing Live item with the same item from Service.
1104 # Note: If this if statement is placed at the bottom of this function instead of top slide transitions are lost.
1105 if self.is_live and Settings().value('core/click live slide to unblank'):
1106 # With this display stays blanked when "auto unblank" setting is not enabled and new item is sent to Live.
1107 if not Settings().value('core/auto unblank') and start:
1108 ()
1109 if not start and not Settings().value('core/is live item edited and replaced'):
1110 Registry().execute('slidecontroller_live_unblank')
1096 row = self.preview_widget.current_slide_number()1111 row = self.preview_widget.current_slide_number()
1097 old_selected_row = self.selected_row1112 old_selected_row = self.selected_row
1098 self.selected_row = 01113 self.selected_row = 0
@@ -1261,6 +1276,8 @@
1261 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)1276 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
1262 self.play_slides_menu.setDefaultAction(self.play_slides_loop)1277 self.play_slides_menu.setDefaultAction(self.play_slides_loop)
1263 self.play_slides_once.setChecked(False)1278 self.play_slides_once.setChecked(False)
1279 if Settings().value('core/click live slide to unblank'):
1280 Registry().execute('slidecontroller_live_unblank')
1264 else:1281 else:
1265 self.play_slides_loop.setIcon(build_icon(':/media/media_time.png'))1282 self.play_slides_loop.setIcon(build_icon(':/media/media_time.png'))
1266 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)1283 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
@@ -1284,6 +1301,8 @@
1284 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)1301 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
1285 self.play_slides_menu.setDefaultAction(self.play_slides_once)1302 self.play_slides_menu.setDefaultAction(self.play_slides_once)
1286 self.play_slides_loop.setChecked(False)1303 self.play_slides_loop.setChecked(False)
1304 if Settings().value('core/click live slide to unblank'):
1305 Registry().execute('slidecontroller_live_unblank')
1287 else:1306 else:
1288 self.play_slides_once.setIcon(build_icon(':/media/media_time'))1307 self.play_slides_once.setIcon(build_icon(':/media/media_time'))
1289 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)1308 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
@@ -1338,7 +1357,7 @@
1338 Triggered when a preview slide item is doubleclicked1357 Triggered when a preview slide item is doubleclicked
1339 """1358 """
1340 if self.service_item:1359 if self.service_item:
1341 if Settings().value('advanced/double click live'):1360 if Settings().value('advanced/double click live') and Settings().value('core/auto unblank'):
1342 # Live and Preview have issues if we have video or presentations1361 # Live and Preview have issues if we have video or presentations
1343 # playing in both at the same time.1362 # playing in both at the same time.
1344 if self.service_item.is_command():1363 if self.service_item.is_command():
@@ -1346,8 +1365,13 @@
1346 if self.service_item.is_media():1365 if self.service_item.is_media():
1347 self.on_media_close()1366 self.on_media_close()
1348 self.on_go_live()1367 self.on_go_live()
1349 else:1368 # If ('advanced/double click live') is not enabled, double clicking preview adds the item to Service.
1369 # Prevent same item in preview from being sent to Service multiple times. Changing preview slide resets
1370 # this setting. Sending to preview from Service does not reset this setting, this is a design choise.
1371 # Do note that this still allows to add item to Service multiple times if icon is clicked.
1372 elif not Settings().value('core/has doubleclicking preview added item to service'):
1350 self.on_preview_add_to_service()1373 self.on_preview_add_to_service()
1374 Settings().setValue('core/has doubleclicking preview added item to service', True)
13511375
1352 def on_go_live(self, field=None):1376 def on_go_live(self, field=None):
1353 """1377 """
13541378
=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py 2016-02-05 20:11:36 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py 2016-04-27 20:40:38 +0000
@@ -26,7 +26,7 @@
2626
27from PyQt5 import QtCore27from PyQt5 import QtCore
2828
29from openlp.core.common import Registry29from openlp.core.common import Registry, Settings
30from openlp.core.ui import HideMode30from openlp.core.ui import HideMode
31from openlp.core.lib import ServiceItemContext, ServiceItem31from openlp.core.lib import ServiceItemContext, ServiceItem
32from openlp.plugins.presentations.lib.pdfcontroller import PDF_CONTROLLER_FILETYPES32from openlp.plugins.presentations.lib.pdfcontroller import PDF_CONTROLLER_FILETYPES
@@ -419,6 +419,8 @@
419 is_live = message[1]419 is_live = message[1]
420 if is_live:420 if is_live:
421 self.live_handler.next()421 self.live_handler.next()
422 if Settings().value('core/click live slide to unblank'):
423 Registry().execute('slidecontroller_live_unblank')
422 else:424 else:
423 self.preview_handler.next()425 self.preview_handler.next()
424426
@@ -431,6 +433,8 @@
431 is_live = message[1]433 is_live = message[1]
432 if is_live:434 if is_live:
433 self.live_handler.previous()435 self.live_handler.previous()
436 if Settings().value('core/click live slide to unblank'):
437 Registry().execute('slidecontroller_live_unblank')
434 else:438 else:
435 self.preview_handler.previous()439 self.preview_handler.previous()
436440
437441
=== modified file 'tests/functional/openlp_core_ui/test_slidecontroller.py'
--- tests/functional/openlp_core_ui/test_slidecontroller.py 2016-02-27 14:25:31 +0000
+++ tests/functional/openlp_core_ui/test_slidecontroller.py 2016-04-27 20:40:38 +0000
@@ -713,6 +713,48 @@
713 slide_controller.theme_screen, slide_controller.blank_screen713 slide_controller.theme_screen, slide_controller.blank_screen
714 ])714 ])
715715
716 @patch('openlp.core.ui.slidecontroller.Settings')
717 def on_preview_double_click_unblank_display_test(self, MockedSettings):
718 # GIVEN: A slide controller, actions needed, settins set to True.
719 slide_controller = SlideController(None)
720 mocked_settings = MagicMock()
721 mocked_settings.value.return_value = True
722 MockedSettings.return_value = mocked_settings
723 slide_controller.service_item = MagicMock()
724 slide_controller.service_item.is_media = MagicMock()
725 slide_controller.on_media_close = MagicMock()
726 slide_controller.on_go_live = MagicMock()
727 slide_controller.on_preview_add_to_service = MagicMock()
728 slide_controller.media_reset = MagicMock()
729
730 # WHEN: on_preview_double_click is called
731 slide_controller.on_preview_double_click()
732
733 # THEN: The call to addActions should be correct
734 self.assertEqual(1, slide_controller.on_go_live.call_count, 'on_go_live should have been called once.')
735 self.assertEqual(0, slide_controller.on_preview_add_to_service.call_count, 'Should have not been called.')
736
737 @patch('openlp.core.ui.slidecontroller.Settings')
738 def on_preview_double_click_add_to_service_test(self, MockedSettings):
739 # GIVEN: A slide controller, actions needed, settins set to False.
740 slide_controller = SlideController(None)
741 mocked_settings = MagicMock()
742 mocked_settings.value.return_value = False
743 MockedSettings.return_value = mocked_settings
744 slide_controller.service_item = MagicMock()
745 slide_controller.service_item.is_media = MagicMock()
746 slide_controller.on_media_close = MagicMock()
747 slide_controller.on_go_live = MagicMock()
748 slide_controller.on_preview_add_to_service = MagicMock()
749 slide_controller.media_reset = MagicMock()
750
751 # WHEN: on_preview_double_click is called
752 slide_controller.on_preview_double_click()
753
754 # THEN: The call to addActions should be correct
755 self.assertEqual(0, slide_controller.on_go_live.call_count, 'on_go_live Should have not been called.')
756 self.assertEqual(1, slide_controller.on_preview_add_to_service.call_count, 'Should have been called once.')
757
716758
717class TestInfoLabel(TestCase):759class TestInfoLabel(TestCase):
718760