← 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/274173

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

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

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

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

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

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

https://ci.openlp.io/view/Branch/job/Branch-05b-Test_Coverage/425/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 17:01:17 +0000
@@ -244,10 +244,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 +507,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):
         """
@@ -1060,6 +1048,23 @@
             else:
                 Registry().execute('live_display_show')
 
+    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):
         """
         Slide selected in controller

=== 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 17:01:17 +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,35 @@
 
     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):
         """