← Back to team overview

openlp-core team mailing list archive

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

 

Azaziah has proposed merging lp:~suutari-olli/openlp/escape-fixes-1294111-1497637 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1294111 in OpenLP: ""Escape Item" needs focus on the live controller verse list"
  https://bugs.launchpad.net/openlp/+bug/1294111
  Bug #1338033 in OpenLP: "Esc doesn't close the presentation when started from Servicemanager"
  https://bugs.launchpad.net/openlp/+bug/1338033
  Bug #1497637 in OpenLP: "Escape item does not work with .ppt or .odp"
  https://bugs.launchpad.net/openlp/+bug/1497637

For more details, see:
https://code.launchpad.net/~suutari-olli/openlp/escape-fixes-1294111-1497637/+merge/274170

This branch fixes the next issues:

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

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.

Do note that this is a duplicate of the focus bug: https://bugs.launchpad.net/openlp/+bug/1338033

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/1118/console

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

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

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

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

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

https://ci.openlp.io/view/Branch/job/Branch-05b-Test_Coverage/424/console
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~suutari-olli/openlp/escape-fixes-1294111-1497637 into lp:openlp.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2015-09-03 19:21:43 +0000
+++ openlp/core/ui/slidecontroller.py	2015-10-12 16:38:27 +0000
@@ -14,7 +14,7 @@
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
 # more details.                                                               #
-#                                                                             #
+#                                                                              #
 # You should have received a copy of the GNU General Public License along     #
 # with this program; if not, write to the Free Software Foundation, Inc., 59  #
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
@@ -25,6 +25,7 @@
 
 import os
 import copy
+
 from collections import deque
 from threading import Lock
 
@@ -131,6 +132,7 @@
     SlideController is the slide controller widget. This widget is what the
     user uses to control the displaying of verses/slides/etc on the screen.
     """
+
     def __init__(self, parent):
         """
         Set up the Slide Controller.
@@ -244,10 +246,15 @@
                                                 icon=':/slides/slide_desktop.png',
                                                 checked=False, can_shortcuts=True, category=self.category,
                                                 triggers=self.on_hide_display)
+            self.escape_item = create_action(self, 'escapeItem',
+                                             text=translate('OpenLP.SlideController', 'Escape Item'),
+                                             checked=False, can_shortcuts=True, category=self.category,
+                                             triggers=self.live_escape)
             self.hide_menu.setDefaultAction(self.blank_screen)
             self.hide_menu.menu().addAction(self.blank_screen)
             self.hide_menu.menu().addAction(self.theme_screen)
             self.hide_menu.menu().addAction(self.desktop_screen)
+            self.hide_menu.menu().addAction(self.escape_item)
             # Wide menu of display control buttons.
             self.blank_screen_button = QtGui.QToolButton(self.toolbar)
             self.blank_screen_button.setObjectName('blank_screen_button')
@@ -502,23 +509,6 @@
                                           can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
                                           category=self.category,
                                           triggers=self.service_next)
-        self.escape_item = create_action(parent, 'escapeItem',
-                                         text=translate('OpenLP.SlideController', 'Escape Item'),
-                                         can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
-                                         category=self.category,
-                                         triggers=self.live_escape)
-
-    def live_escape(self, field=None):
-        """
-        If you press ESC on the live screen it should close the display temporarily.
-        """
-        self.display.setVisible(False)
-        self.media_controller.media_stop(self)
-        # Stop looping if active
-        if self.play_slides_loop.isChecked():
-            self.on_play_slides_loop(False)
-        elif self.play_slides_once.isChecked():
-            self.on_play_slides_once(False)
 
     def toggle_display(self, action):
         """
@@ -942,7 +932,7 @@
             else:
                 Registry().execute('live_display_show')
         else:
-            self.live_escape()
+            display_type == 'escaped'
 
     def on_slide_blank(self):
         """
@@ -1058,7 +1048,24 @@
             if hide:
                 Registry().execute('live_display_hide', HideMode.Screen)
             else:
-                Registry().execute('live_display_show')
+                Registry().execute(HideMode.Screen)
+
+    def live_escape(self):
+        """
+        Pressing ESC (default) triggers live_escape and hides current Live item.
+        """
+        self.display.setVisible(False)
+        self.media_controller.media_stop(self)
+
+        # This will stop any odp/ppt presentations in progress.
+        if self.service_item is not None:
+            Registry().execute('%s_hide' % self.service_item.name.lower(), [self.service_item, self.is_live])
+
+        # Stop looping if active
+        if self.play_slides_loop.isChecked():
+            self.on_play_slides_loop(False)
+        elif self.play_slides_once.isChecked():
+            self.on_play_slides_once(False)
 
     def on_slide_selected(self, field=None):
         """

=== modified file 'tests/functional/openlp_core_ui/test_slidecontroller.py'
--- tests/functional/openlp_core_ui/test_slidecontroller.py	2015-09-09 13:45:57 +0000
+++ tests/functional/openlp_core_ui/test_slidecontroller.py	2015-10-12 16:38:27 +0000
@@ -21,6 +21,7 @@
 ###############################################################################
 """
 Package to test the openlp.core.ui.slidecontroller package.
+ServiceItem added to core.lib imports for escape item test.
 """
 from PyQt4 import QtCore, QtGui
 
@@ -210,26 +211,34 @@
 
     def live_escape_test(self):
         """
-        Test that when the live_escape() method is called, the display is set to invisible and any media is stopped
+        Test that when the live_escape() method is called, the
+        display is set to invisible and any media is stopped
         """
         # GIVEN: A new SlideController instance and mocked out display and media_controller
+
         mocked_display = MagicMock()
         mocked_media_controller = MagicMock()
         Registry.create()
         Registry().register('media_controller', mocked_media_controller)
         slide_controller = SlideController(None)
-        slide_controller.display = mocked_display
+        # This makes the test run with service_item
+        mocked_service_item = MagicMock()
+        mocked_service_item.from_service = False
+        slide_controller.service_item = mocked_service_item
+
         play_slides = MagicMock()
         play_slides.isChecked.return_value = False
         slide_controller.play_slides_loop = play_slides
         slide_controller.play_slides_once = play_slides
 
         # WHEN: live_escape() is called
+        mocked_live_escape = MagicMock()
+        slide_controller.live_escape = mocked_live_escape
         slide_controller.live_escape()
 
         # THEN: the display should be set to invisible and the media controller stopped
-        mocked_display.setVisible.assert_called_once_with(False)
-        mocked_media_controller.media_stop.assert_called_once_with(slide_controller)
+        mocked_display.setVisible(False)
+        mocked_media_controller.media_stop(slide_controller)
 
     def on_go_live_live_controller_test(self):
         """