openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #29427
[Merge] lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank into lp:openlp
Azaziah has proposed merging lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Tim Bentley (trb143)
Tomas Groth (tomasgroth)
Related bugs:
Bug #1462420 in OpenLP: "Double click on the preview duplicated the element in the service manger"
https://bugs.launchpad.net/openlp/+bug/1462420
Bug #1531691 in OpenLP: "Song is sent back to live after edit if blanked"
https://bugs.launchpad.net/openlp/+bug/1531691
For more details, see:
https://code.launchpad.net/~suutari-olli/openlp/click-slide-to-go-live-from-blank/+merge/293173
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)"
-----------------------------------------------------------------------------
- Added two tests for checking if doubleclicking preview should
add item to service or send it to live.
-----------------------------------------------------------------------------
In this re-proposal:
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)
--------------------------------
lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank (revision 2648)
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-01-Pull/1504/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-02-Functional-Tests/1415/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-03-Interface-Tests/1353/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1149/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/740/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-05a-Code_Analysis/807/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-05b-Test_Coverage/675/
--
Your team OpenLP Core is subscribed to branch lp:openlp.
=== 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:53:26 +0000
@@ -141,6 +141,7 @@
'core/auto preview': False,
'core/audio start paused': True,
'core/auto unblank': False,
+ 'core/click live slide to unblank': False,
'core/blank warning': False,
'core/ccli number': '',
'core/has run wizard': False,
@@ -163,6 +164,8 @@
'core/display on monitor': True,
'core/override position': False,
'core/application version': '0.0',
+ 'core/is live item edited and replaced': False,
+ 'core/has doubleclicking preview added item to service': False,
'images/background color': '#000000',
'media/players': 'system,webkit',
'media/override player': QtCore.Qt.Unchecked,
=== 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:53:26 +0000
@@ -482,6 +482,9 @@
'You must select one or more items to preview.'))
else:
log.debug('%s Preview requested' % self.plugin.name)
+ # If ('advanced/double click live') is not enabled, double clicking preview adds the item to Service.
+ # This setting prevents it from being sent to Service multiple times, in here it is reset to False.
+ Settings().setValue('core/has doubleclicking preview added item to service', False)
service_item = self.build_service_item()
if service_item:
service_item.from_plugin = True
=== 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:53:26 +0000
@@ -209,6 +209,9 @@
self.auto_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box)
self.auto_unblank_check_box.setObjectName('auto_unblank_check_box')
self.settings_layout.addRow(self.auto_unblank_check_box)
+ self.click_live_slide_to_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box)
+ self.click_live_slide_to_unblank_check_box.setObjectName('click_live_slide_to_unblank')
+ self.settings_layout.addRow(self.click_live_slide_to_unblank_check_box)
self.auto_preview_check_box = QtWidgets.QCheckBox(self.settings_group_box)
self.auto_preview_check_box.setObjectName('auto_preview_check_box')
self.settings_layout.addRow(self.auto_preview_check_box)
@@ -259,6 +262,8 @@
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
'Prompt to save before starting a new service'))
self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
+ self.click_live_slide_to_unblank_check_box.setText(translate('OpenLP.GeneralTab',
+ 'Unblank display when changing slide in Live'))
self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab',
'Automatically preview next item in service'))
self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
@@ -292,6 +297,7 @@
self.password_edit.setText(settings.value('songselect password'))
self.save_check_service_check_box.setChecked(settings.value('save prompt'))
self.auto_unblank_check_box.setChecked(settings.value('auto unblank'))
+ self.click_live_slide_to_unblank_check_box.setChecked(settings.value('click live slide to unblank'))
self.display_on_monitor_check.setChecked(self.screens.display)
self.warning_check_box.setChecked(settings.value('blank warning'))
self.auto_open_check_box.setChecked(settings.value('auto open'))
@@ -336,6 +342,7 @@
settings.setValue('update check', self.check_for_updates_check_box.isChecked())
settings.setValue('save prompt', self.save_check_service_check_box.isChecked())
settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())
+ settings.setValue('click live slide to unblank', self.click_live_slide_to_unblank_check_box.isChecked())
settings.setValue('auto preview', self.auto_preview_check_box.isChecked())
settings.setValue('loop delay', self.timeout_spin_box.value())
settings.setValue('ccli number', self.number_edit.displayText())
=== 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:53:26 +0000
@@ -471,7 +471,7 @@
self.footer(service_item.foot_text)
# if was hidden keep it hidden
if self.hide_mode and self.is_live and not service_item.is_media():
- if Settings().value('core/auto unblank'):
+ if Settings().value('core/auto unblank') and not Settings().value('core/is live item edited and replaced'):
Registry().execute('slidecontroller_live_unblank')
else:
self.hide_display(self.hide_mode)
=== 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:53:26 +0000
@@ -656,6 +656,9 @@
"""
Give all the plugins a chance to perform some tasks at startup
"""
+ # This setting is set to false, in case def replace_service_manager_item in slidecontroller would crash the
+ # program and make blank to modes unavailable.
+ Settings().setValue('core/is live item edited and replaced', False)
self.application.process_events()
for plugin in self.plugin_manager.plugins:
if plugin.is_active():
=== 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:53:26 +0000
@@ -792,11 +792,17 @@
def replace_service_manager_item(self, item):
"""
Replacement item following a remote edit
+ This action also takes place when a song that is sent to live from Service Manager is edited.
+ If display is blanked, it will get unblanked if automatic unblanking is enabled. We prevent this from happening
+ by setting a hidden setting to "True" and then to "False" after the processing is done.
+ The setting is also set to "False" on every start up, should the program ever crash during this process.
:param item: The current service item
"""
if item == self.service_item:
+ Settings().setValue('core/is live item edited and replaced', True)
self._process_item(item, self.preview_widget.current_slide_number())
+ Settings().setValue('core/is live item edited and replaced', False)
def add_service_manager_item(self, item, slide_no):
"""
@@ -1093,6 +1099,15 @@
self.log_debug('Could not get lock in slide_selected after waiting %f, skip to avoid deadlock.'
% timeout)
return
+ # If "click live slide to unblank" is enabled, unblank the display. And start = Item is sent to Live.
+ # 'core/is live item edited and replaced' is only True when replacing Live item with the same item from Service.
+ # Note: If this if statement is placed at the bottom of this function instead of top slide transitions are lost.
+ if self.is_live and Settings().value('core/click live slide to unblank'):
+ # With this display stays blanked when "auto unblank" setting is not enabled and new item is sent to Live.
+ if not Settings().value('core/auto unblank') and start:
+ ()
+ if not start and not Settings().value('core/is live item edited and replaced'):
+ Registry().execute('slidecontroller_live_unblank')
row = self.preview_widget.current_slide_number()
old_selected_row = self.selected_row
self.selected_row = 0
@@ -1261,6 +1276,8 @@
self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
self.play_slides_menu.setDefaultAction(self.play_slides_loop)
self.play_slides_once.setChecked(False)
+ if Settings().value('core/click live slide to unblank'):
+ Registry().execute('slidecontroller_live_unblank')
else:
self.play_slides_loop.setIcon(build_icon(':/media/media_time.png'))
self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
@@ -1284,6 +1301,8 @@
self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
self.play_slides_menu.setDefaultAction(self.play_slides_once)
self.play_slides_loop.setChecked(False)
+ if Settings().value('core/click live slide to unblank'):
+ Registry().execute('slidecontroller_live_unblank')
else:
self.play_slides_once.setIcon(build_icon(':/media/media_time'))
self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
@@ -1338,7 +1357,7 @@
Triggered when a preview slide item is doubleclicked
"""
if self.service_item:
- if Settings().value('advanced/double click live'):
+ if Settings().value('advanced/double click live') and Settings().value('core/auto unblank'):
# Live and Preview have issues if we have video or presentations
# playing in both at the same time.
if self.service_item.is_command():
@@ -1346,8 +1365,13 @@
if self.service_item.is_media():
self.on_media_close()
self.on_go_live()
- else:
+ # If ('advanced/double click live') is not enabled, double clicking preview adds the item to Service.
+ # Prevent same item in preview from being sent to Service multiple times. Changing preview slide resets
+ # this setting. Sending to preview from Service does not reset this setting, this is a design choise.
+ # Do note that this still allows to add item to Service multiple times if icon is clicked.
+ elif not Settings().value('core/has doubleclicking preview added item to service'):
self.on_preview_add_to_service()
+ Settings().setValue('core/has doubleclicking preview added item to service', True)
def on_go_live(self, field=None):
"""
=== 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:53:26 +0000
@@ -26,7 +26,7 @@
from PyQt5 import QtCore
-from openlp.core.common import Registry
+from openlp.core.common import Registry, Settings
from openlp.core.ui import HideMode
from openlp.core.lib import ServiceItemContext, ServiceItem
from openlp.plugins.presentations.lib.pdfcontroller import PDF_CONTROLLER_FILETYPES
@@ -419,6 +419,8 @@
is_live = message[1]
if is_live:
self.live_handler.next()
+ if Settings().value('core/click live slide to unblank'):
+ Registry().execute('slidecontroller_live_unblank')
else:
self.preview_handler.next()
@@ -431,6 +433,8 @@
is_live = message[1]
if is_live:
self.live_handler.previous()
+ if Settings().value('core/click live slide to unblank'):
+ Registry().execute('slidecontroller_live_unblank')
else:
self.preview_handler.previous()
=== 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:53:26 +0000
@@ -713,6 +713,48 @@
slide_controller.theme_screen, slide_controller.blank_screen
])
+ @patch('openlp.core.ui.slidecontroller.Settings')
+ def on_preview_double_click_unblank_display_test(self, MockedSettings):
+ # GIVEN: A slide controller, actions needed, settins set to True.
+ slide_controller = SlideController(None)
+ mocked_settings = MagicMock()
+ mocked_settings.value.return_value = True
+ MockedSettings.return_value = mocked_settings
+ slide_controller.service_item = MagicMock()
+ slide_controller.service_item.is_media = MagicMock()
+ slide_controller.on_media_close = MagicMock()
+ slide_controller.on_go_live = MagicMock()
+ slide_controller.on_preview_add_to_service = MagicMock()
+ slide_controller.media_reset = MagicMock()
+
+ # WHEN: on_preview_double_click is called
+ slide_controller.on_preview_double_click()
+
+ # THEN: The call to addActions should be correct
+ self.assertEqual(1, slide_controller.on_go_live.call_count, 'on_go_live should have been called once.')
+ self.assertEqual(0, slide_controller.on_preview_add_to_service.call_count, 'Should have not been called.')
+
+ @patch('openlp.core.ui.slidecontroller.Settings')
+ def on_preview_double_click_add_to_service_test(self, MockedSettings):
+ # GIVEN: A slide controller, actions needed, settins set to False.
+ slide_controller = SlideController(None)
+ mocked_settings = MagicMock()
+ mocked_settings.value.return_value = False
+ MockedSettings.return_value = mocked_settings
+ slide_controller.service_item = MagicMock()
+ slide_controller.service_item.is_media = MagicMock()
+ slide_controller.on_media_close = MagicMock()
+ slide_controller.on_go_live = MagicMock()
+ slide_controller.on_preview_add_to_service = MagicMock()
+ slide_controller.media_reset = MagicMock()
+
+ # WHEN: on_preview_double_click is called
+ slide_controller.on_preview_double_click()
+
+ # THEN: The call to addActions should be correct
+ self.assertEqual(0, slide_controller.on_go_live.call_count, 'on_go_live Should have not been called.')
+ self.assertEqual(1, slide_controller.on_preview_add_to_service.call_count, 'Should have been called once.')
+
class TestInfoLabel(TestCase):
Follow ups