Merge lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank into lp:openlp
- click-slide-to-go-live-from-blank
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank |
Merge into: | lp:openlp |
Diff against target: |
266 lines (+142/-3) 5 files modified
openlp/core/common/settings.py (+1/-0) openlp/core/ui/generaltab.py (+7/-0) openlp/core/ui/slidecontroller.py (+32/-2) openlp/plugins/presentations/lib/messagelistener.py (+5/-1) tests/functional/openlp_core_ui/test_slidecontroller.py (+97/-0) |
To merge this branch: | bzr merge lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tomas Groth | Pending | ||
Review via email: mp+290732@code.launchpad.net |
This proposal supersedes a proposal from 2016-03-15.
This proposal has been superseded by a proposal from 2016-04-03.
Commit message
Description of the change
In this re-proposal:
Added 3 tests for checking display is re-blanked if it was blanked before re-processing edited Live item.
lp:~suutari-olli/openlp/click-slide-to-go-live-from-blank (revision 2634)
[←[1;32mSUCCESS
[←[1;32mSUCCESS
[←[1;32mSUCCESS
[←[1;32mSUCCESS
[←[1;32mSUCCESS
[←[1;32mSUCCESS
[←[1;32mSUCCESS
-------
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:/
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.
Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal | # |
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.
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 :)
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.
- 2635. By Azaziah
-
- Fixed issue where PPT/Impress is not unblanked on "Previous/Next" (Green arrows).
- 2636. By Azaziah
-
Changed Live to live (lowercaps) for controlling this setting to match other settings.
- 2637. By Azaziah
-
Merged trunk on 11.4.2016
- 2638. By Azaziah
-
Merged trunk on 13.4.16
- 2639. By Azaziah
-
Changed spelling of live back to Live (Capitalized) on settings.
- 2640. By Azaziah
-
- Fixed bug 1462420 - Double clicking Preview adds item to Service countless times
(Added hidden setting for controlling this, it is set to True once double clicking
has added item to Service and gets reset to False once new item is sent to preview. - 2641. By Azaziah
-
Fixed bug 1462420 (Double click on the preview duplicated the element in the service manger)
- 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 icon" - 2642. By Azaziah
-
Turned the new setting into question.
- 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
1 | === modified file 'openlp/core/common/settings.py' | |||
2 | --- openlp/core/common/settings.py 2016-03-15 21:34:58 +0000 | |||
3 | +++ openlp/core/common/settings.py 2016-04-03 11:27:42 +0000 | |||
4 | @@ -141,6 +141,7 @@ | |||
5 | 141 | 'core/auto preview': False, | 141 | 'core/auto preview': False, |
6 | 142 | 'core/audio start paused': True, | 142 | 'core/audio start paused': True, |
7 | 143 | 'core/auto unblank': False, | 143 | 'core/auto unblank': False, |
8 | 144 | 'core/click live slide to unblank': False, | ||
9 | 144 | 'core/blank warning': False, | 145 | 'core/blank warning': False, |
10 | 145 | 'core/ccli number': '', | 146 | 'core/ccli number': '', |
11 | 146 | 'core/has run wizard': False, | 147 | 'core/has run wizard': False, |
12 | 147 | 148 | ||
13 | === modified file 'openlp/core/ui/generaltab.py' | |||
14 | --- openlp/core/ui/generaltab.py 2016-01-16 20:13:41 +0000 | |||
15 | +++ openlp/core/ui/generaltab.py 2016-04-03 11:27:42 +0000 | |||
16 | @@ -173,6 +173,9 @@ | |||
17 | 173 | self.auto_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box) | 173 | self.auto_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box) |
18 | 174 | self.auto_unblank_check_box.setObjectName('auto_unblank_check_box') | 174 | self.auto_unblank_check_box.setObjectName('auto_unblank_check_box') |
19 | 175 | self.settings_layout.addRow(self.auto_unblank_check_box) | 175 | self.settings_layout.addRow(self.auto_unblank_check_box) |
20 | 176 | self.click_live_slide_to_unblank_check_box = QtWidgets.QCheckBox(self.settings_group_box) | ||
21 | 177 | self.click_live_slide_to_unblank_check_box.setObjectName('click_live_slide_to_unblank_') | ||
22 | 178 | self.settings_layout.addRow(self.click_live_slide_to_unblank_check_box) | ||
23 | 176 | self.auto_preview_check_box = QtWidgets.QCheckBox(self.settings_group_box) | 179 | self.auto_preview_check_box = QtWidgets.QCheckBox(self.settings_group_box) |
24 | 177 | self.auto_preview_check_box.setObjectName('auto_preview_check_box') | 180 | self.auto_preview_check_box.setObjectName('auto_preview_check_box') |
25 | 178 | self.settings_layout.addRow(self.auto_preview_check_box) | 181 | self.settings_layout.addRow(self.auto_preview_check_box) |
26 | @@ -217,6 +220,8 @@ | |||
27 | 217 | self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab', | 220 | self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab', |
28 | 218 | 'Prompt to save before starting a new service')) | 221 | 'Prompt to save before starting a new service')) |
29 | 219 | self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item')) | 222 | self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item')) |
30 | 223 | self.click_live_slide_to_unblank_check_box.setText(translate('OpenLP.GeneralTab', | ||
31 | 224 | 'Unblank display when changing slide in live')) | ||
32 | 220 | self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab', | 225 | self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab', |
33 | 221 | 'Automatically preview next item in service')) | 226 | 'Automatically preview next item in service')) |
34 | 222 | self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:')) | 227 | self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:')) |
35 | @@ -250,6 +255,7 @@ | |||
36 | 250 | self.password_edit.setText(settings.value('songselect password')) | 255 | self.password_edit.setText(settings.value('songselect password')) |
37 | 251 | self.save_check_service_check_box.setChecked(settings.value('save prompt')) | 256 | self.save_check_service_check_box.setChecked(settings.value('save prompt')) |
38 | 252 | self.auto_unblank_check_box.setChecked(settings.value('auto unblank')) | 257 | self.auto_unblank_check_box.setChecked(settings.value('auto unblank')) |
39 | 258 | self.click_live_slide_to_unblank_check_box.setChecked(settings.value('click live slide to unblank')) | ||
40 | 253 | self.display_on_monitor_check.setChecked(self.screens.display) | 259 | self.display_on_monitor_check.setChecked(self.screens.display) |
41 | 254 | self.warning_check_box.setChecked(settings.value('blank warning')) | 260 | self.warning_check_box.setChecked(settings.value('blank warning')) |
42 | 255 | self.auto_open_check_box.setChecked(settings.value('auto open')) | 261 | self.auto_open_check_box.setChecked(settings.value('auto open')) |
43 | @@ -287,6 +293,7 @@ | |||
44 | 287 | settings.setValue('update check', self.check_for_updates_check_box.isChecked()) | 293 | settings.setValue('update check', self.check_for_updates_check_box.isChecked()) |
45 | 288 | settings.setValue('save prompt', self.save_check_service_check_box.isChecked()) | 294 | settings.setValue('save prompt', self.save_check_service_check_box.isChecked()) |
46 | 289 | settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked()) | 295 | settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked()) |
47 | 296 | settings.setValue('click live slide to unblank', self.click_live_slide_to_unblank_check_box.isChecked()) | ||
48 | 290 | settings.setValue('auto preview', self.auto_preview_check_box.isChecked()) | 297 | settings.setValue('auto preview', self.auto_preview_check_box.isChecked()) |
49 | 291 | settings.setValue('loop delay', self.timeout_spin_box.value()) | 298 | settings.setValue('loop delay', self.timeout_spin_box.value()) |
50 | 292 | settings.setValue('ccli number', self.number_edit.displayText()) | 299 | settings.setValue('ccli number', self.number_edit.displayText()) |
51 | 293 | 300 | ||
52 | === modified file 'openlp/core/ui/slidecontroller.py' | |||
53 | --- openlp/core/ui/slidecontroller.py 2016-03-31 16:34:22 +0000 | |||
54 | +++ openlp/core/ui/slidecontroller.py 2016-04-03 11:27:42 +0000 | |||
55 | @@ -789,11 +789,28 @@ | |||
56 | 789 | def replace_service_manager_item(self, item): | 789 | def replace_service_manager_item(self, item): |
57 | 790 | """ | 790 | """ |
58 | 791 | Replacement item following a remote edit | 791 | Replacement item following a remote edit |
59 | 792 | This action also takes place when a song that is sent to live from Service Manager is edited. | ||
60 | 793 | If display is blanked, this will update the song and then re-blank the display. | ||
61 | 794 | As result, lyrics are flashed on screen for a very short time before re-blanking happens. (Bug) | ||
62 | 795 | This happens only when Automatic unblanking is enabled when new item is sen to Live, | ||
63 | 796 | if it's not enabled they won't flash. | ||
64 | 792 | 797 | ||
65 | 793 | :param item: The current service item | 798 | :param item: The current service item |
66 | 794 | """ | 799 | """ |
67 | 795 | if item == self.service_item: | 800 | if item == self.service_item: |
69 | 796 | self._process_item(item, self.preview_widget.current_slide_number()) | 801 | if not self.hide_mode(): |
70 | 802 | self._process_item(item, self.preview_widget.current_slide_number()) | ||
71 | 803 | # "isChecked" method is required for checking blanks, on_xx_display(False) does not work. | ||
72 | 804 | elif self.hide_mode(): | ||
73 | 805 | if self.blank_screen.isChecked(): | ||
74 | 806 | self._process_item(item, self.preview_widget.current_slide_number()) | ||
75 | 807 | self.on_blank_display(True) | ||
76 | 808 | elif self.theme_screen.isChecked(): | ||
77 | 809 | self._process_item(item, self.preview_widget.current_slide_number()) | ||
78 | 810 | self.on_theme_display(True) | ||
79 | 811 | elif self.desktop_screen.isChecked(): | ||
80 | 812 | self._process_item(item, self.preview_widget.current_slide_number()) | ||
81 | 813 | self.on_hide_display(True) | ||
82 | 797 | 814 | ||
83 | 798 | def add_service_manager_item(self, item, slide_no): | 815 | def add_service_manager_item(self, item, slide_no): |
84 | 799 | """ | 816 | """ |
85 | @@ -1090,6 +1107,14 @@ | |||
86 | 1090 | self.log_debug('Could not get lock in slide_selected after waiting %f, skip to avoid deadlock.' | 1107 | self.log_debug('Could not get lock in slide_selected after waiting %f, skip to avoid deadlock.' |
87 | 1091 | % timeout) | 1108 | % timeout) |
88 | 1092 | return | 1109 | return |
89 | 1110 | # If "click live slide to unblank" is enabled, unblank the display. | ||
90 | 1111 | # Note: If this if statement is placed at the bottom of this function instead of top slide transitions are lost. | ||
91 | 1112 | if self.is_live and Settings().value('core/click live slide to unblank'): | ||
92 | 1113 | # With this display stays blanked when "auto unblank" setting is not enabled and new item is sent to Live. | ||
93 | 1114 | if not Settings().value('core/auto unblank') and start: | ||
94 | 1115 | () | ||
95 | 1116 | else: | ||
96 | 1117 | Registry().execute('slidecontroller_live_unblank') | ||
97 | 1093 | row = self.preview_widget.current_slide_number() | 1118 | row = self.preview_widget.current_slide_number() |
98 | 1094 | old_selected_row = self.selected_row | 1119 | old_selected_row = self.selected_row |
99 | 1095 | self.selected_row = 0 | 1120 | self.selected_row = 0 |
100 | @@ -1258,6 +1283,8 @@ | |||
101 | 1258 | self.play_slides_once.setText(UiStrings().PlaySlidesToEnd) | 1283 | self.play_slides_once.setText(UiStrings().PlaySlidesToEnd) |
102 | 1259 | self.play_slides_menu.setDefaultAction(self.play_slides_loop) | 1284 | self.play_slides_menu.setDefaultAction(self.play_slides_loop) |
103 | 1260 | self.play_slides_once.setChecked(False) | 1285 | self.play_slides_once.setChecked(False) |
104 | 1286 | if Settings().value('core/click live slide to unblank'): | ||
105 | 1287 | Registry().execute('slidecontroller_live_unblank') | ||
106 | 1261 | else: | 1288 | else: |
107 | 1262 | self.play_slides_loop.setIcon(build_icon(':/media/media_time.png')) | 1289 | self.play_slides_loop.setIcon(build_icon(':/media/media_time.png')) |
108 | 1263 | self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop) | 1290 | self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop) |
109 | @@ -1281,6 +1308,8 @@ | |||
110 | 1281 | self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop) | 1308 | self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop) |
111 | 1282 | self.play_slides_menu.setDefaultAction(self.play_slides_once) | 1309 | self.play_slides_menu.setDefaultAction(self.play_slides_once) |
112 | 1283 | self.play_slides_loop.setChecked(False) | 1310 | self.play_slides_loop.setChecked(False) |
113 | 1311 | if Settings().value('core/click live slide to unblank'): | ||
114 | 1312 | Registry().execute('slidecontroller_live_unblank') | ||
115 | 1284 | else: | 1313 | else: |
116 | 1285 | self.play_slides_once.setIcon(build_icon(':/media/media_time')) | 1314 | self.play_slides_once.setIcon(build_icon(':/media/media_time')) |
117 | 1286 | self.play_slides_once.setText(UiStrings().PlaySlidesToEnd) | 1315 | self.play_slides_once.setText(UiStrings().PlaySlidesToEnd) |
118 | @@ -1342,7 +1371,8 @@ | |||
119 | 1342 | Registry().execute('%s_stop' % self.service_item.name.lower(), [self.service_item, self.is_live]) | 1371 | Registry().execute('%s_stop' % self.service_item.name.lower(), [self.service_item, self.is_live]) |
120 | 1343 | if self.service_item.is_media(): | 1372 | if self.service_item.is_media(): |
121 | 1344 | self.on_media_close() | 1373 | self.on_media_close() |
123 | 1345 | self.on_go_live() | 1374 | if Settings().value('core/auto unblank'): |
124 | 1375 | self.on_go_live() | ||
125 | 1346 | else: | 1376 | else: |
126 | 1347 | self.on_preview_add_to_service() | 1377 | self.on_preview_add_to_service() |
127 | 1348 | 1378 | ||
128 | 1349 | 1379 | ||
129 | === modified file 'openlp/plugins/presentations/lib/messagelistener.py' | |||
130 | --- openlp/plugins/presentations/lib/messagelistener.py 2016-02-05 20:11:36 +0000 | |||
131 | +++ openlp/plugins/presentations/lib/messagelistener.py 2016-04-03 11:27:42 +0000 | |||
132 | @@ -26,7 +26,7 @@ | |||
133 | 26 | 26 | ||
134 | 27 | from PyQt5 import QtCore | 27 | from PyQt5 import QtCore |
135 | 28 | 28 | ||
137 | 29 | from openlp.core.common import Registry | 29 | from openlp.core.common import Registry, Settings |
138 | 30 | from openlp.core.ui import HideMode | 30 | from openlp.core.ui import HideMode |
139 | 31 | from openlp.core.lib import ServiceItemContext, ServiceItem | 31 | from openlp.core.lib import ServiceItemContext, ServiceItem |
140 | 32 | from openlp.plugins.presentations.lib.pdfcontroller import PDF_CONTROLLER_FILETYPES | 32 | from openlp.plugins.presentations.lib.pdfcontroller import PDF_CONTROLLER_FILETYPES |
141 | @@ -419,6 +419,8 @@ | |||
142 | 419 | is_live = message[1] | 419 | is_live = message[1] |
143 | 420 | if is_live: | 420 | if is_live: |
144 | 421 | self.live_handler.next() | 421 | self.live_handler.next() |
145 | 422 | if Settings().value('core/click live slide to unblank'): | ||
146 | 423 | Registry().execute('slidecontroller_live_unblank') | ||
147 | 422 | else: | 424 | else: |
148 | 423 | self.preview_handler.next() | 425 | self.preview_handler.next() |
149 | 424 | 426 | ||
150 | @@ -431,6 +433,8 @@ | |||
151 | 431 | is_live = message[1] | 433 | is_live = message[1] |
152 | 432 | if is_live: | 434 | if is_live: |
153 | 433 | self.live_handler.previous() | 435 | self.live_handler.previous() |
154 | 436 | if Settings().value('core/click live slide to unblank'): | ||
155 | 437 | Registry().execute('slidecontroller_live_unblank') | ||
156 | 434 | else: | 438 | else: |
157 | 435 | self.preview_handler.previous() | 439 | self.preview_handler.previous() |
158 | 436 | 440 | ||
159 | 437 | 441 | ||
160 | === modified file 'tests/functional/openlp_core_ui/test_slidecontroller.py' | |||
161 | --- tests/functional/openlp_core_ui/test_slidecontroller.py 2016-02-27 14:25:31 +0000 | |||
162 | +++ tests/functional/openlp_core_ui/test_slidecontroller.py 2016-04-03 11:27:42 +0000 | |||
163 | @@ -538,6 +538,103 @@ | |||
164 | 538 | mocked_preview_widget.current_slide_number.assert_called_with() | 538 | mocked_preview_widget.current_slide_number.assert_called_with() |
165 | 539 | mocked_process_item.assert_called_once_with(mocked_item, 7) | 539 | mocked_process_item.assert_called_once_with(mocked_item, 7) |
166 | 540 | 540 | ||
167 | 541 | def replace_service_manager_item_on_blank_display_test(self): | ||
168 | 542 | """ | ||
169 | 543 | Test that when the service item is replaced, display remains blanked if it was blanked. | ||
170 | 544 | """ | ||
171 | 545 | # GIVEN: A slide controller and a new item to add, blanked display. | ||
172 | 546 | mocked_item = MagicMock() | ||
173 | 547 | mocked_preview_widget = MagicMock() | ||
174 | 548 | mocked_preview_widget.current_slide_number = MagicMock() | ||
175 | 549 | mocked_process_item = MagicMock() | ||
176 | 550 | slide_controller = SlideController(None) | ||
177 | 551 | slide_controller.preview_widget = mocked_preview_widget | ||
178 | 552 | slide_controller._process_item = mocked_process_item | ||
179 | 553 | slide_controller.service_item = mocked_item | ||
180 | 554 | slide_controller.hide_menu = MagicMock() | ||
181 | 555 | slide_controller.hide_mode = MagicMock() | ||
182 | 556 | slide_controller.hide_mode.return_value = True | ||
183 | 557 | slide_controller.blank_screen = MagicMock() | ||
184 | 558 | slide_controller.blank_screen.isChecked = MagicMock() | ||
185 | 559 | slide_controller.blank_screen.isChecked.return_value = True | ||
186 | 560 | slide_controller.on_blank_display = mocked_item | ||
187 | 561 | slide_controller.theme_screen = MagicMock() | ||
188 | 562 | slide_controller.desktop_screen = MagicMock() | ||
189 | 563 | slide_controller.log_debug = MagicMock() | ||
190 | 564 | |||
191 | 565 | # WHEN: The service item is replaced | ||
192 | 566 | slide_controller.replace_service_manager_item(mocked_item) | ||
193 | 567 | |||
194 | 568 | # THEN: The display should remain blanked | ||
195 | 569 | slide_controller.on_blank_display.assert_called_once_with(True) | ||
196 | 570 | |||
197 | 571 | def replace_service_manager_item_on_theme_display_test(self): | ||
198 | 572 | """ | ||
199 | 573 | Test that when the service item is replaced, display remains blanked if it was blanked. | ||
200 | 574 | """ | ||
201 | 575 | # GIVEN: A slide controller and a new item to add, blanked display. | ||
202 | 576 | mocked_item = MagicMock() | ||
203 | 577 | mocked_preview_widget = MagicMock() | ||
204 | 578 | mocked_preview_widget.current_slide_number = MagicMock() | ||
205 | 579 | mocked_process_item = MagicMock() | ||
206 | 580 | slide_controller = SlideController(None) | ||
207 | 581 | slide_controller.preview_widget = mocked_preview_widget | ||
208 | 582 | slide_controller._process_item = mocked_process_item | ||
209 | 583 | slide_controller.service_item = mocked_item | ||
210 | 584 | slide_controller.hide_menu = MagicMock() | ||
211 | 585 | slide_controller.hide_mode = MagicMock() | ||
212 | 586 | slide_controller.hide_mode.return_value = True | ||
213 | 587 | slide_controller.blank_screen = MagicMock() | ||
214 | 588 | slide_controller.blank_screen.isChecked = MagicMock() | ||
215 | 589 | slide_controller.blank_screen.isChecked.return_value = False | ||
216 | 590 | slide_controller.theme_screen = MagicMock() | ||
217 | 591 | slide_controller.theme_screen.isChecked = MagicMock() | ||
218 | 592 | slide_controller.theme_screen.isChecked.return_value = True | ||
219 | 593 | slide_controller.on_theme_display = mocked_item | ||
220 | 594 | slide_controller.desktop_screen = MagicMock() | ||
221 | 595 | slide_controller.log_debug = MagicMock() | ||
222 | 596 | |||
223 | 597 | # WHEN: The service item is replaced | ||
224 | 598 | slide_controller.replace_service_manager_item(mocked_item) | ||
225 | 599 | |||
226 | 600 | # THEN: The display should remain blanked | ||
227 | 601 | slide_controller.on_theme_display.assert_called_once_with(True) | ||
228 | 602 | |||
229 | 603 | def replace_service_manager_item_on_hide_display_test(self): | ||
230 | 604 | """ | ||
231 | 605 | Test that when the service item is replaced, display remains blanked if it was blanked. | ||
232 | 606 | """ | ||
233 | 607 | # GIVEN: A slide controller and a new item to add, blanked display. | ||
234 | 608 | mocked_item = MagicMock() | ||
235 | 609 | mocked_preview_widget = MagicMock() | ||
236 | 610 | mocked_preview_widget.current_slide_number = MagicMock() | ||
237 | 611 | mocked_process_item = MagicMock() | ||
238 | 612 | slide_controller = SlideController(None) | ||
239 | 613 | slide_controller.preview_widget = mocked_preview_widget | ||
240 | 614 | slide_controller._process_item = mocked_process_item | ||
241 | 615 | slide_controller.service_item = mocked_item | ||
242 | 616 | slide_controller.hide_menu = MagicMock() | ||
243 | 617 | slide_controller.hide_mode = MagicMock() | ||
244 | 618 | slide_controller.hide_mode.return_value = True | ||
245 | 619 | slide_controller.blank_screen = MagicMock() | ||
246 | 620 | slide_controller.blank_screen.isChecked = MagicMock() | ||
247 | 621 | slide_controller.blank_screen.isChecked.return_value = False | ||
248 | 622 | slide_controller.theme_screen = MagicMock() | ||
249 | 623 | slide_controller.theme_screen.isChecked = MagicMock() | ||
250 | 624 | slide_controller.theme_screen.isChecked.return_value = False | ||
251 | 625 | slide_controller.on_theme_display = mocked_item | ||
252 | 626 | slide_controller.desktop_screen = MagicMock() | ||
253 | 627 | slide_controller.desktop_screen.isChecked = MagicMock() | ||
254 | 628 | slide_controller.desktop_screen.isChecked.return_value = True | ||
255 | 629 | slide_controller.on_hide_display = MagicMock() | ||
256 | 630 | slide_controller.log_debug = MagicMock() | ||
257 | 631 | |||
258 | 632 | # WHEN: The service item is replaced | ||
259 | 633 | slide_controller.replace_service_manager_item(mocked_item) | ||
260 | 634 | |||
261 | 635 | # THEN: The display should remain blanked | ||
262 | 636 | slide_controller.on_hide_display.assert_called_once_with(True) | ||
263 | 637 | |||
264 | 541 | def on_slide_blank_test(self): | 638 | def on_slide_blank_test(self): |
265 | 542 | """ | 639 | """ |
266 | 543 | Test on_slide_blank | 640 | Test on_slide_blank |
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.