Merge lp:~suutari-olli/openlp/escape-fixes-1294111-1497637 into lp:openlp

Proposed by Azaziah
Status: Superseded
Proposed branch: lp:~suutari-olli/openlp/escape-fixes-1294111-1497637
Merge into: lp:openlp
Diff against target: 128 lines (+44/-23)
2 files modified
openlp/core/ui/slidecontroller.py (+31/-18)
tests/functional/openlp_core_ui/test_slidecontroller.py (+13/-5)
To merge this branch: bzr merge lp:~suutari-olli/openlp/escape-fixes-1294111-1497637
Reviewer Review Type Date Requested Status
Tim Bentley Pending
Review via email: mp+274649@code.launchpad.net

This proposal supersedes a proposal from 2015-10-12.

Description of the change

- Escape item does not work unless “Live” has focus. https://bugs.launchpad.net/openlp/+bug/1294111
- Escape item does not work with Impress/PowerPoint. https://bugs.launchpad.net/openlp/+bug/1497637

Focus issue was fixed by moving the escape item
definitions away from set_live_hot_keys to the same
section where definitions for blank to … are located.

-- Upper text EXPLAINED --
Old definition was under set_live_hot_keys and thus,
 it only works when "Live" has focus.
For an example using escape item won’t work while
Service manager or Library has focus.

Whereas Blank to desktop, theme and black work everywhere
within the program. The live_escape definition was moved to
the same place, thus it works everywhere. Live_escape is not
a new feature, it is the default ESC-key behavior and part
of OpenLP core features.

Impress/PowerPoint issue was fixed by
using script to hide them.

test_slidecontroller.py was modified so it is compatible
with the service_item which is used to determine if
Impress/PowerPoint presentations are running.

New bug:
If PowerPoint/Impress presentation is shut with escape_item,clicking on it @ Live manager won’t
send it back to Live, it must be re-sent there.

This may be fixable by modifying:
def slide_selected(self, start=False):
#Starting from line 1073 of slidecontroller.py

Jenkins
https://ci.openlp.io/job/branch-01-pull/1135/console

https://ci.openlp.io/job/Branch-02-Functional-Tests/1058/console

https://ci.openlp.io/view/Branch/job/Branch-03-Interface-Tests/999/console

https://ci.openlp.io/view/Branch/job/Branch-04a-Windows_Functional_Tests/846/console

https://ci.openlp.io/view/Branch/job/Branch-04b-Windows_Interface_Tests/443/console

https://ci.openlp.io/view/Branch/job/Branch-05a-Code_Analysis/566/console

https://ci.openlp.io/view/Branch/job/Branch-05b-Test_Coverage/437/console

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

See below.
Should have a new test not just a fix to an existing one.

review: Needs Fixing
2566. By Azaziah

Added back end part of one comment that was previously deleted.

2567. By Azaziah

Merge to trunk on 1/7/2015.

I noticed this branch also seems to be fixing this bug:
https://bugs.launchpad.net/openlp/+bug/1531691

However, escape item still remains buggy with problems related to resuming
video and presentations.

2568. By Azaziah

Merge to trunk on 7.1.2015
I noticed this branch also seems to fix this bug:
https://bugs.launchpad.net/openlp/+bug/1531691

However, escape item still remains buggy with problems
related to resuming Live from video or presentations.

Unmerged revisions

2568. By Azaziah

Merge to trunk on 7.1.2015
I noticed this branch also seems to fix this bug:
https://bugs.launchpad.net/openlp/+bug/1531691

However, escape item still remains buggy with problems
related to resuming Live from video or presentations.

2567. By Azaziah

Merge to trunk on 1/7/2015.

I noticed this branch also seems to be fixing this bug:
https://bugs.launchpad.net/openlp/+bug/1531691

However, escape item still remains buggy with problems related to resuming
video and presentations.

2566. By Azaziah

Added back end part of one comment that was previously deleted.

2565. By Azaziah

Noticed I made one comment duplicate.

2564. By Azaziah

Made 1 line 3 chars shorter to fit 120.

2563. By Azaziah

Improved test for live_escape + Comments + Fixes

2562. By Azaziah

Edited out one comment, removed one empty line on test.

2561. By Azaziah

Reverted some useless changes I noticed.

2560. By Azaziah

Done some cleanup for proper merging part 7.

2559. By Azaziah

Done some cleanup for proper merging part 6.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/ui/slidecontroller.py'
2--- openlp/core/ui/slidecontroller.py 2015-09-03 19:21:43 +0000
3+++ openlp/core/ui/slidecontroller.py 2015-10-16 01:13:11 +0000
4@@ -222,7 +222,16 @@
5 self.controller_type = DisplayControllerType.Preview
6 if self.is_live:
7 self.controller_type = DisplayControllerType.Live
8- # Hide Menu
9+ '''
10+ Hide Menu
11+ blank_screen = Blank display to black
12+ theme_screen = Blank to theme
13+ desktop_screen = Blank to desktop
14+ escape_item = Escape item hides what is in live,
15+ just like desktop screen but it does not require un-blanking
16+ Default hotkey for escape item is "Esc"
17+ The actual definitions on what these do are found further in code
18+ '''
19 self.hide_menu = QtGui.QToolButton(self.toolbar)
20 self.hide_menu.setObjectName('hide_menu')
21 self.hide_menu.setText(translate('OpenLP.SlideController', 'Hide'))
22@@ -244,10 +253,15 @@
23 icon=':/slides/slide_desktop.png',
24 checked=False, can_shortcuts=True, category=self.category,
25 triggers=self.on_hide_display)
26+ self.escape_item = create_action(self, 'escapeItem',
27+ text=translate('OpenLP.SlideController', 'Escape Item'),
28+ checked=False, can_shortcuts=True, category=self.category,
29+ triggers=self.live_escape)
30 self.hide_menu.setDefaultAction(self.blank_screen)
31 self.hide_menu.menu().addAction(self.blank_screen)
32 self.hide_menu.menu().addAction(self.theme_screen)
33 self.hide_menu.menu().addAction(self.desktop_screen)
34+ self.hide_menu.menu().addAction(self.escape_item)
35 # Wide menu of display control buttons.
36 self.blank_screen_button = QtGui.QToolButton(self.toolbar)
37 self.blank_screen_button.setObjectName('blank_screen_button')
38@@ -502,23 +516,6 @@
39 can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
40 category=self.category,
41 triggers=self.service_next)
42- self.escape_item = create_action(parent, 'escapeItem',
43- text=translate('OpenLP.SlideController', 'Escape Item'),
44- can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
45- category=self.category,
46- triggers=self.live_escape)
47-
48- def live_escape(self, field=None):
49- """
50- If you press ESC on the live screen it should close the display temporarily.
51- """
52- self.display.setVisible(False)
53- self.media_controller.media_stop(self)
54- # Stop looping if active
55- if self.play_slides_loop.isChecked():
56- self.on_play_slides_loop(False)
57- elif self.play_slides_once.isChecked():
58- self.on_play_slides_once(False)
59
60 def toggle_display(self, action):
61 """
62@@ -1060,6 +1057,22 @@
63 else:
64 Registry().execute('live_display_show')
65
66+ def live_escape(self, checked=None):
67+ """
68+ Pressing ESC (default) triggers live_escape and hides current Live item.
69+ """
70+ # This will hide songs, media etc.. but not Impress/PowerPoint.
71+ self.display.setVisible(False)
72+ self.media_controller.media_stop(self)
73+ # This will stop any Impress/PowerPoint in Live.
74+ if self.service_item is not None:
75+ Registry().execute('%s_hide' % self.service_item.name.lower(), [self.service_item, self.is_live])
76+ # Stop looping if active
77+ if self.play_slides_loop.isChecked():
78+ self.on_play_slides_loop(False)
79+ elif self.play_slides_once.isChecked():
80+ self.on_play_slides_once(False)
81+
82 def on_slide_selected(self, field=None):
83 """
84 Slide selected in controller
85
86=== modified file 'tests/functional/openlp_core_ui/test_slidecontroller.py'
87--- tests/functional/openlp_core_ui/test_slidecontroller.py 2015-09-09 13:45:57 +0000
88+++ tests/functional/openlp_core_ui/test_slidecontroller.py 2015-10-16 01:13:11 +0000
89@@ -212,7 +212,7 @@
90 """
91 Test that when the live_escape() method is called, the display is set to invisible and any media is stopped
92 """
93- # GIVEN: A new SlideController instance and mocked out display and media_controller
94+ # GIVEN: A new SlideController instance, mocked out display, media_controller and service_item
95 mocked_display = MagicMock()
96 mocked_media_controller = MagicMock()
97 Registry.create()
98@@ -223,18 +223,26 @@
99 play_slides.isChecked.return_value = False
100 slide_controller.play_slides_loop = play_slides
101 slide_controller.play_slides_once = play_slides
102+ service_item = MagicMock()
103+ toolbar = MagicMock()
104+ toolbar.set_widget_visible = MagicMock()
105+ slide_controller.toolbar = toolbar
106+ slide_controller.service_item = service_item
107+ slide_controller.service_item.is_text = MagicMock(return_value=False)
108
109- # WHEN: live_escape() is called
110+ # WHEN: live_escape() is called, set_blank simulates the part where Impress/PowerPoint is closed.
111 slide_controller.live_escape()
112+ slide_controller.set_blank_menu()
113
114- # THEN: the display should be set to invisible and the media controller stopped
115+ # THEN: the display should be set to invisible, media controller stopped and any service_item on live hidden.
116 mocked_display.setVisible.assert_called_once_with(False)
117 mocked_media_controller.media_stop.assert_called_once_with(slide_controller)
118+ toolbar.set_widget_visible.assert_called_with(NON_TEXT_MENU, True)
119
120 def on_go_live_live_controller_test(self):
121 """
122- Test that when the on_go_live() method is called the message is sent to the live controller and focus is
123- set correctly.
124+ Test that when the on_go_live() method is called the message is
125+ sent to the live controller and focus is set correctly
126 """
127 # GIVEN: A new SlideController instance and plugin preview then pressing go live should respond
128 mocked_display = MagicMock()