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: 195 lines (+44/-5)
6 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/slidecontroller.py (+25/-3)
openlp/plugins/presentations/lib/messagelistener.py (+5/-1)
To merge this branch: bzr merge lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank
Reviewer Review Type Date Requested Status
Tomas Groth Pending
Raoul Snyman Pending
Review via email: mp+292076@code.launchpad.net

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

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

Description of the change

In this re-proposal:

Fixed bug 1462420 (Double clicking preview adds items to service unlimited times)
- Added a hidden setting for controlling this behaviour.
  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)"

lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank (revision 2641)
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-01-Pull/1444/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-02-Functional-Tests/1361/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-03-Interface-Tests/1299/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1106/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/697/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-05a-Code_Analysis/764/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-05b-Test_Coverage/632/

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

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
2643. By Azaziah

Made a better fix for fixing 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.

2644. By Azaziah

Made a better fix for fixing 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.

2645. By Azaziah

- Removed _ from end of one setting name.
- Fixed ident on replace_service_manager

2646. By Azaziah

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

2647. By Azaziah

Noticed I had removed one test from end of the file, added it back.

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
1=== modified file 'openlp/core/common/settings.py'
2--- openlp/core/common/settings.py 2016-04-16 21:01:22 +0000
3+++ openlp/core/common/settings.py 2016-04-17 03:51:22 +0000
4@@ -141,6 +141,7 @@
5 'core/auto preview': False,
6 'core/audio start paused': True,
7 'core/auto unblank': False,
8+ 'core/click live slide to unblank': False,
9 'core/blank warning': False,
10 'core/ccli number': '',
11 'core/has run wizard': False,
12@@ -163,6 +164,8 @@
13 'core/display on monitor': True,
14 'core/override position': False,
15 'core/application version': '0.0',
16+ 'core/is live item edited and replaced': False,
17+ 'core/has doubleclicking preview added item to service': False,
18 'images/background color': '#000000',
19 'media/players': 'system,webkit',
20 'media/override player': QtCore.Qt.Unchecked,
21
22=== modified file 'openlp/core/lib/mediamanageritem.py'
23--- openlp/core/lib/mediamanageritem.py 2016-04-03 19:12:37 +0000
24+++ openlp/core/lib/mediamanageritem.py 2016-04-17 03:51:22 +0000
25@@ -481,6 +481,9 @@
26 'You must select one or more items to preview.'))
27 else:
28 log.debug('%s Preview requested' % self.plugin.name)
29+ # If ('advanced/double click live') is not enabled, double clicking preview adds the item to Service.
30+ # This setting prevents it from being sent to Service multiple times, in here it is reset to False.
31+ Settings().setValue('core/has doubleclicking preview added item to service', False)
32 service_item = self.build_service_item()
33 if service_item:
34 service_item.from_plugin = True
35
36=== modified file 'openlp/core/ui/generaltab.py'
37--- openlp/core/ui/generaltab.py 2016-04-13 15:50:04 +0000
38+++ openlp/core/ui/generaltab.py 2016-04-17 03:51:22 +0000
39@@ -208,6 +208,9 @@
40 self.auto_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box)
41 self.auto_unblank_check_box.setObjectName('auto_unblank_check_box')
42 self.settings_layout.addRow(self.auto_unblank_check_box)
43+ self.click_live_slide_to_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box)
44+ self.click_live_slide_to_unblank_check_box.setObjectName('click_live_slide_to_unblank_')
45+ self.settings_layout.addRow(self.click_live_slide_to_unblank_check_box)
46 self.auto_preview_check_box = QtWidgets.QCheckBox(self.settings_group_box)
47 self.auto_preview_check_box.setObjectName('auto_preview_check_box')
48 self.settings_layout.addRow(self.auto_preview_check_box)
49@@ -258,6 +261,8 @@
50 self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
51 'Prompt to save before starting a new service'))
52 self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
53+ self.click_live_slide_to_unblank_check_box.setText(translate('OpenLP.GeneralTab',
54+ 'Unblank display when changing slide in Live'))
55 self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab',
56 'Automatically preview next item in service'))
57 self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
58@@ -291,6 +296,7 @@
59 self.password_edit.setText(settings.value('songselect password'))
60 self.save_check_service_check_box.setChecked(settings.value('save prompt'))
61 self.auto_unblank_check_box.setChecked(settings.value('auto unblank'))
62+ self.click_live_slide_to_unblank_check_box.setChecked(settings.value('click live slide to unblank'))
63 self.display_on_monitor_check.setChecked(self.screens.display)
64 self.warning_check_box.setChecked(settings.value('blank warning'))
65 self.auto_open_check_box.setChecked(settings.value('auto open'))
66@@ -335,6 +341,7 @@
67 settings.setValue('update check', self.check_for_updates_check_box.isChecked())
68 settings.setValue('save prompt', self.save_check_service_check_box.isChecked())
69 settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked())
70+ settings.setValue('click live slide to unblank', self.click_live_slide_to_unblank_check_box.isChecked())
71 settings.setValue('auto preview', self.auto_preview_check_box.isChecked())
72 settings.setValue('loop delay', self.timeout_spin_box.value())
73 settings.setValue('ccli number', self.number_edit.displayText())
74
75=== modified file 'openlp/core/ui/maindisplay.py'
76--- openlp/core/ui/maindisplay.py 2016-04-01 02:32:36 +0000
77+++ openlp/core/ui/maindisplay.py 2016-04-17 03:51:22 +0000
78@@ -471,7 +471,7 @@
79 self.footer(service_item.foot_text)
80 # if was hidden keep it hidden
81 if self.hide_mode and self.is_live and not service_item.is_media():
82- if Settings().value('core/auto unblank'):
83+ if Settings().value('core/auto unblank') and not Settings().value('core/is live item edited and replaced'):
84 Registry().execute('slidecontroller_live_unblank')
85 else:
86 self.hide_display(self.hide_mode)
87
88=== modified file 'openlp/core/ui/slidecontroller.py'
89--- openlp/core/ui/slidecontroller.py 2016-04-06 05:08:44 +0000
90+++ openlp/core/ui/slidecontroller.py 2016-04-17 03:51:22 +0000
91@@ -789,11 +789,16 @@
92 def replace_service_manager_item(self, item):
93 """
94 Replacement item following a remote edit
95+ This action also takes place when a song that is sent to live from Service Manager is edited.
96+ If display is blanked, it will get unblanked if automatic unblanking is enabled. We prevent this from happening
97+ by setting a hidden setting to "True" and then to "False" after the processing is done.
98
99 :param item: The current service item
100 """
101 if item == self.service_item:
102- self._process_item(item, self.preview_widget.current_slide_number())
103+ Settings().setValue('core/is live item edited and replaced', True)
104+ self._process_item(item, self.preview_widget.current_slide_number())
105+ Settings().setValue('core/is live item edited and replaced', False)
106
107 def add_service_manager_item(self, item, slide_no):
108 """
109@@ -1090,6 +1095,14 @@
110 self.log_debug('Could not get lock in slide_selected after waiting %f, skip to avoid deadlock.'
111 % timeout)
112 return
113+ # If "click live slide to unblank" is enabled, unblank the display.
114+ # Note: If this if statement is placed at the bottom of this function instead of top slide transitions are lost.
115+ if self.is_live and Settings().value('core/click live slide to unblank'):
116+ # With this display stays blanked when "auto unblank" setting is not enabled and new item is sent to Live.
117+ if not Settings().value('core/auto unblank') and start:
118+ ()
119+ if not start and not Settings().value('core/is live item edited and replaced'):
120+ Registry().execute('slidecontroller_live_unblank')
121 row = self.preview_widget.current_slide_number()
122 old_selected_row = self.selected_row
123 self.selected_row = 0
124@@ -1258,6 +1271,8 @@
125 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
126 self.play_slides_menu.setDefaultAction(self.play_slides_loop)
127 self.play_slides_once.setChecked(False)
128+ if Settings().value('core/click live slide to unblank'):
129+ Registry().execute('slidecontroller_live_unblank')
130 else:
131 self.play_slides_loop.setIcon(build_icon(':/media/media_time.png'))
132 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
133@@ -1281,6 +1296,8 @@
134 self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
135 self.play_slides_menu.setDefaultAction(self.play_slides_once)
136 self.play_slides_loop.setChecked(False)
137+ if Settings().value('core/click live slide to unblank'):
138+ Registry().execute('slidecontroller_live_unblank')
139 else:
140 self.play_slides_once.setIcon(build_icon(':/media/media_time'))
141 self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
142@@ -1335,7 +1352,7 @@
143 Triggered when a preview slide item is doubleclicked
144 """
145 if self.service_item:
146- if Settings().value('advanced/double click live'):
147+ if Settings().value('advanced/double click live') and Settings().value('core/auto unblank'):
148 # Live and Preview have issues if we have video or presentations
149 # playing in both at the same time.
150 if self.service_item.is_command():
151@@ -1343,8 +1360,13 @@
152 if self.service_item.is_media():
153 self.on_media_close()
154 self.on_go_live()
155- else:
156+ # If ('advanced/double click live') is not enabled, double clicking preview adds the item to Service.
157+ # Prevent same item in preview from being sent to Service multiple times. Changing preview slide resets
158+ # this setting. Sending to preview from Service does not reset this setting, this is a design choise.
159+ # Do note that this still allows to add item to Service multiple times if icon is clicked.
160+ elif not Settings().value('core/has doubleclicking preview added item to service'):
161 self.on_preview_add_to_service()
162+ Settings().setValue('core/has doubleclicking preview added item to service', True)
163
164 def on_go_live(self, field=None):
165 """
166
167=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
168--- openlp/plugins/presentations/lib/messagelistener.py 2016-02-05 20:11:36 +0000
169+++ openlp/plugins/presentations/lib/messagelistener.py 2016-04-17 03:51:22 +0000
170@@ -26,7 +26,7 @@
171
172 from PyQt5 import QtCore
173
174-from openlp.core.common import Registry
175+from openlp.core.common import Registry, Settings
176 from openlp.core.ui import HideMode
177 from openlp.core.lib import ServiceItemContext, ServiceItem
178 from openlp.plugins.presentations.lib.pdfcontroller import PDF_CONTROLLER_FILETYPES
179@@ -419,6 +419,8 @@
180 is_live = message[1]
181 if is_live:
182 self.live_handler.next()
183+ if Settings().value('core/click live slide to unblank'):
184+ Registry().execute('slidecontroller_live_unblank')
185 else:
186 self.preview_handler.next()
187
188@@ -431,6 +433,8 @@
189 is_live = message[1]
190 if is_live:
191 self.live_handler.previous()
192+ if Settings().value('core/click live slide to unblank'):
193+ Registry().execute('slidecontroller_live_unblank')
194 else:
195 self.preview_handler.previous()
196