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

Proposed by Azaziah
Status: Merged
Merged at revision: 2689
Proposed branch: lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank
Merge into: lp:openlp
Diff against target: 247 lines (+85/-6)
6 files modified
openlp/core/common/settings.py (+1/-0)
openlp/core/lib/mediamanageritem.py (+1/-0)
openlp/core/ui/generaltab.py (+7/-0)
openlp/core/ui/slidecontroller.py (+25/-5)
openlp/plugins/presentations/lib/messagelistener.py (+5/-1)
tests/functional/openlp_core_ui/test_slidecontroller.py (+46/-0)
To merge this branch: bzr merge lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Raoul Snyman Approve
Tomas Groth Pending
Review via email: mp+302587@code.launchpad.net

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

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 general
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.

-----------------------------------------------------------------------------

lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank (revision 2664)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1712/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1623/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1561/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1323/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/913/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/981/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/849/
[SUCCESS] https://ci.openlp.io/job/Branch-05c-Code_Analysis2/26/

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

> 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 : Posted in a previous version of this proposal

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

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

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

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

I still do not agree with using settings for temporary flags. Find another way.

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

"I still do not agree with using settings for temporary flags. Find another way."

Well I can't think of an other way.

I tried to fix: https://bugs.launchpad.net/openlp/+bug/1531691 without settings,
but it didn't work properly and was way more complex.

Since we need to trigger actions in many files/functions based on temporary flags,
what would be a proper solution without the use of settings?

Also replied to diff comments.

Thank you for your review.

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

I've just merged the flags section of the Registry object.

Having said that, and looking at your branch, I'm not entirely convinced this is the way to go about this. While you can explain to me what the difference is between this and the other auto-unblank setting, you can't explain it to our users, and I refuse to be lumped with the problem (I'm about the only person who actually actively deals with our users).

I recommend rather merging this with the current "auto-unblank" setting and make a single setting with a set of modes instead.

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

> I've just merged the flags section of the Registry object.
>
> Having said that, and looking at your branch, I'm not entirely convinced this
> is the way to go about this. While you can explain to me what the difference
> is between this and the other auto-unblank setting, you can't explain it to
> our users, and I refuse to be lumped with the problem (I'm about the only
> person who actually actively deals with our users).
>
> I recommend rather merging this with the current "auto-unblank" setting and
> make a single setting with a set of modes instead.

I'll be looking forward to moving the flags to registry.

This branch adds the unblanking of display by clicking slides in Live.

Currently this is possible when using Escape item, but not while using the real blank to modes.
The current behavior is highly confusing.
This setting will make things more understandable and easier to manage.

So ultimately this just makes it possible for users to easily resume Live presentation by clicking a slide they wish to show.

It's not related to sending items to Live, It's more about unblanking display and resuming the projection of the current Live item. Thus they are a very different thing.

After this is merged, I think we should begin working on removing the Escape item,
It's very much a broken and confusing format.

I am sorry about the current user support situation, hope things will be better someday.
Ultimately it would be great if the customer support would be something you wouldn't have to do.

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

Traceback (most recent call last):
  File "/home/tim/Projects/OpenLP/openlp/click-slide-to-go-live-from-blank/openlp/core/ui/slidecontroller.py", line 1401, in on_preview_double_click
    elif not Registry().get_flag('has doubleclick added item to service') is True:
  File "/home/tim/Projects/OpenLP/openlp/click-slide-to-go-live-from-blank/openlp/core/common/registry.py", line 160, in get_flag
    raise KeyError('Working Flag {key} not found in list'.format(key=key))
KeyError: 'Working Flag has doubleclick added item to service not found in list'

Blank live and double click on a preview slide.

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

I am unable to reproduce this traceback,
need to investigate further.

Fixed the commented stuff.

Thank you for the review.

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

> Traceback (most recent call last):
> File "/home/tim/Projects/OpenLP/openlp/click-slide-to-go-live-from-
> blank/openlp/core/ui/slidecontroller.py", line 1401, in
> on_preview_double_click
> elif not Registry().get_flag('has doubleclick added item to service') is
> True:
> File "/home/tim/Projects/OpenLP/openlp/click-slide-to-go-live-from-
> blank/openlp/core/common/registry.py", line 160, in get_flag
> raise KeyError('Working Flag {key} not found in list'.format(key=key))
> KeyError: 'Working Flag has doubleclick added item to service not found in
> list'
>
> Blank live and double click on a preview slide.

Fixed this,
also removed the ??? if statement.

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

Sorry but needs to respin and other merges have broken this

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
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/common/settings.py'
--- openlp/core/common/settings.py 2016-07-01 21:17:20 +0000
+++ openlp/core/common/settings.py 2016-08-10 18:57:47 +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,
147148
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2016-06-12 22:02:24 +0000
+++ openlp/core/lib/mediamanageritem.py 2016-08-10 18:57:47 +0000
@@ -488,6 +488,7 @@
488 'You must select one or more items to preview.'))488 'You must select one or more items to preview.'))
489 else:489 else:
490 log.debug('%s Preview requested' % self.plugin.name)490 log.debug('%s Preview requested' % self.plugin.name)
491 Registry().set_flag('has doubleclick added item to service', False)
491 service_item = self.build_service_item()492 service_item = self.build_service_item()
492 if service_item:493 if service_item:
493 service_item.from_plugin = True494 service_item.from_plugin = True
494495
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2016-07-24 20:20:25 +0000
+++ openlp/core/ui/generaltab.py 2016-08-10 18:57:47 +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)
@@ -258,6 +261,8 @@
258 self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))261 self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
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'))
264 self.click_live_slide_to_unblank_check_box.setText(translate('OpenLP.GeneralTab',
265 'Unblank display when changing slide in Live'))
261 self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when sending '266 self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when sending '
262 'items to Live'))267 'items to Live'))
263 self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab',268 self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab',
@@ -293,6 +298,7 @@
293 self.password_edit.setText(settings.value('songselect password'))298 self.password_edit.setText(settings.value('songselect password'))
294 self.save_check_service_check_box.setChecked(settings.value('save prompt'))299 self.save_check_service_check_box.setChecked(settings.value('save prompt'))
295 self.auto_unblank_check_box.setChecked(settings.value('auto unblank'))300 self.auto_unblank_check_box.setChecked(settings.value('auto unblank'))
301 self.click_live_slide_to_unblank_check_box.setChecked(settings.value('click live slide to unblank'))
296 self.display_on_monitor_check.setChecked(self.screens.display)302 self.display_on_monitor_check.setChecked(self.screens.display)
297 self.warning_check_box.setChecked(settings.value('blank warning'))303 self.warning_check_box.setChecked(settings.value('blank warning'))
298 self.auto_open_check_box.setChecked(settings.value('auto open'))304 self.auto_open_check_box.setChecked(settings.value('auto open'))
@@ -337,6 +343,7 @@
337 settings.setValue('update check', self.check_for_updates_check_box.isChecked())343 settings.setValue('update check', self.check_for_updates_check_box.isChecked())
338 settings.setValue('save prompt', self.save_check_service_check_box.isChecked())344 settings.setValue('save prompt', self.save_check_service_check_box.isChecked())
339 settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())345 settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())
346 settings.setValue('click live slide to unblank', self.click_live_slide_to_unblank_check_box.isChecked())
340 settings.setValue('auto preview', self.auto_preview_check_box.isChecked())347 settings.setValue('auto preview', self.auto_preview_check_box.isChecked())
341 settings.setValue('loop delay', self.timeout_spin_box.value())348 settings.setValue('loop delay', self.timeout_spin_box.value())
342 settings.setValue('ccli number', self.number_edit.displayText())349 settings.setValue('ccli number', self.number_edit.displayText())
343350
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2016-07-24 20:20:25 +0000
+++ openlp/core/ui/slidecontroller.py 2016-08-10 18:57:47 +0000
@@ -87,6 +87,8 @@
87 self.is_live = False87 self.is_live = False
88 self.display = None88 self.display = None
89 self.controller_type = None89 self.controller_type = None
90 Registry().set_flag('has doubleclick added item to service', True)
91 Registry().set_flag('replace service manager item', False)
9092
91 def send_to_plugins(self, *args):93 def send_to_plugins(self, *args):
92 """94 """
@@ -796,12 +798,15 @@
796798
797 def replace_service_manager_item(self, item):799 def replace_service_manager_item(self, item):
798 """800 """
799 Replacement item following a remote edit801 Replacement item following a remote edit.
802 This action also takes place when a song that is sent to live from Service Manager is edited.
800803
801 :param item: The current service item804 :param item: The current service item
802 """805 """
803 if item == self.service_item:806 if item == self.service_item:
807 Registry().set_flag('replace service manager item', True)
804 self._process_item(item, self.preview_widget.current_slide_number())808 self._process_item(item, self.preview_widget.current_slide_number())
809 Registry().set_flag('replace service manager item', False)
805810
806 def add_service_manager_item(self, item, slide_no):811 def add_service_manager_item(self, item, slide_no):
807 """812 """
@@ -970,9 +975,10 @@
970975
971 def on_slide_unblank(self):976 def on_slide_unblank(self):
972 """977 """
973 Handle the slidecontroller unblank event978 Handle the slidecontroller unblank event.
974 """979 """
975 self.on_blank_display(False)980 if not Registry().get_flag('replace service manager item') is True:
981 self.on_blank_display(False)
976982
977 def on_blank_display(self, checked=None):983 def on_blank_display(self, checked=None):
978 """984 """
@@ -1103,6 +1109,11 @@
1103 self.log_debug('Could not get lock in slide_selected after waiting %f, skip to avoid deadlock.'1109 self.log_debug('Could not get lock in slide_selected after waiting %f, skip to avoid deadlock.'
1104 % timeout)1110 % timeout)
1105 return1111 return
1112 # If "click live slide to unblank" is enabled, unblank the display. And start = Item is sent to Live.
1113 # Note: If this if statement is placed at the bottom of this function instead of top slide transitions are lost.
1114 if self.is_live and Settings().value('core/click live slide to unblank'):
1115 if not start:
1116 Registry().execute('slidecontroller_live_unblank')
1106 row = self.preview_widget.current_slide_number()1117 row = self.preview_widget.current_slide_number()
1107 old_selected_row = self.selected_row1118 old_selected_row = self.selected_row
1108 self.selected_row = 01119 self.selected_row = 0
@@ -1285,6 +1296,8 @@
1285 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)1296 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
1286 self.play_slides_menu.setDefaultAction(self.play_slides_loop)1297 self.play_slides_menu.setDefaultAction(self.play_slides_loop)
1287 self.play_slides_once.setChecked(False)1298 self.play_slides_once.setChecked(False)
1299 if Settings().value('core/click live slide to unblank'):
1300 Registry().execute('slidecontroller_live_unblank')
1288 else:1301 else:
1289 self.play_slides_loop.setIcon(build_icon(':/media/media_time.png'))1302 self.play_slides_loop.setIcon(build_icon(':/media/media_time.png'))
1290 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)1303 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
@@ -1308,6 +1321,8 @@
1308 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)1321 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
1309 self.play_slides_menu.setDefaultAction(self.play_slides_once)1322 self.play_slides_menu.setDefaultAction(self.play_slides_once)
1310 self.play_slides_loop.setChecked(False)1323 self.play_slides_loop.setChecked(False)
1324 if Settings().value('core/click live slide to unblank'):
1325 Registry().execute('slidecontroller_live_unblank')
1311 else:1326 else:
1312 self.play_slides_once.setIcon(build_icon(':/media/media_time'))1327 self.play_slides_once.setIcon(build_icon(':/media/media_time'))
1313 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)1328 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
@@ -1362,7 +1377,7 @@
1362 Triggered when a preview slide item is doubleclicked1377 Triggered when a preview slide item is doubleclicked
1363 """1378 """
1364 if self.service_item:1379 if self.service_item:
1365 if Settings().value('advanced/double click live'):1380 if Settings().value('advanced/double click live') and Settings().value('core/auto unblank'):
1366 # Live and Preview have issues if we have video or presentations1381 # Live and Preview have issues if we have video or presentations
1367 # playing in both at the same time.1382 # playing in both at the same time.
1368 if self.service_item.is_command():1383 if self.service_item.is_command():
@@ -1371,8 +1386,13 @@
1371 if self.service_item.is_media():1386 if self.service_item.is_media():
1372 self.on_media_close()1387 self.on_media_close()
1373 self.on_go_live()1388 self.on_go_live()
1374 else:1389 # If ('advanced/double click live') is not enabled, double clicking preview adds the item to Service.
1390 # Prevent same item in preview from being sent to Service multiple times.
1391 # Changing the preview slide resets this flag to False.
1392 # Do note that this still allows to add item to Service multiple times if icon is clicked.
1393 elif not Registry().get_flag('has doubleclick added item to service') is True:
1375 self.on_preview_add_to_service()1394 self.on_preview_add_to_service()
1395 Registry().set_flag('has doubleclick added item to service', True)
13761396
1377 def on_go_live(self, field=None):1397 def on_go_live(self, field=None):
1378 """1398 """
13791399
=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py 2016-07-01 21:17:20 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py 2016-08-10 18:57:47 +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 ServiceItemContext31from openlp.core.lib import ServiceItemContext
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-06-01 21:42:54 +0000
+++ tests/functional/openlp_core_ui/test_slidecontroller.py 2016-08-10 18:57:47 +0000
@@ -713,6 +713,52 @@
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.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 Registry.create()
730 Registry().set_flag('has doubleclick added item to service', True)
731
732 # WHEN: on_preview_double_click is called
733 slide_controller.on_preview_double_click()
734
735 # THEN: The call to addActions should be correct
736 self.assertEqual(1, slide_controller.on_go_live.call_count, 'on_go_live should have been called once.')
737 self.assertEqual(0, slide_controller.on_preview_add_to_service.call_count, 'Should have not been called.')
738
739 @patch('openlp.core.ui.slidecontroller.Settings')
740 def on_preview_double_click_add_to_service_test(self, MockedSettings):
741 # GIVEN: A slide controller, actions needed, settins set to False.
742 slide_controller = SlideController(None)
743 mocked_settings = MagicMock()
744 mocked_settings.value.return_value = False
745 MockedSettings.return_value = mocked_settings
746 slide_controller.service_item = MagicMock()
747 slide_controller.service_item.is_media = MagicMock()
748 slide_controller.on_media_close = MagicMock()
749 slide_controller.on_go_live = MagicMock()
750 slide_controller.on_preview_add_to_service = MagicMock()
751 slide_controller.media_reset = MagicMock()
752 Registry.create()
753 Registry().set_flag('has doubleclick added item to service', False)
754
755 # WHEN: on_preview_double_click is called
756 slide_controller.on_preview_double_click()
757
758 # THEN: The call to addActions should be correct
759 self.assertEqual(0, slide_controller.on_go_live.call_count, 'on_go_live Should have not been called.')
760 self.assertEqual(1, slide_controller.on_preview_add_to_service.call_count, 'Should have been called once.')
761
716 @patch(u'openlp.core.ui.slidecontroller.SlideController.image_manager')762 @patch(u'openlp.core.ui.slidecontroller.SlideController.image_manager')
717 @patch(u'PyQt5.QtCore.QTimer.singleShot')763 @patch(u'PyQt5.QtCore.QTimer.singleShot')
718 def test_update_preview_live(self, mocked_singleShot, mocked_image_manager):764 def test_update_preview_live(self, mocked_singleShot, mocked_image_manager):