← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~suutari-olli/openlp/fix-blank-to-modes-during-single-screen into lp:openlp

 

Azaziah has proposed merging lp:~suutari-olli/openlp/fix-blank-to-modes-during-single-screen into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~suutari-olli/openlp/fix-blank-to-modes-during-single-screen/+merge/287386

This branch fixes the issue where Blank to desktop,
black and theme won't work if Live screen has stolen focus.

Examples of this happening: Clicking anything in the live window or certain single screen mode scenarios.

This was achieved by adding 3 lines of code, one for each method under the definition of methods available in this screen mode.

I also explained this in a comment I inserted to the code.

Since the only way to screw this seems to be by removing these additions,
a test for them being there makes no sense at all.

Jenkins seems to be broken at the moment, but these 3
rows of code should not really break anything.

Re-edit: Blank to x won't still work with single
screen PPT/Impress as they have stolen focus from OLP.
To fix this, global hotkeys could be used when
displaying in single screen mode.
https://bugs.launchpad.net/openlp/+bug/1512037

Took me about 10 minutes to find the fix,
several hours to write the test...

In this re-proposal: Added 2nd empty row after last test in class.
Noticed this is required after Jenkins started working.

Jenkins:

--------------------------------
lp:~suutari-olli/openlp/fix-blank-to-modes-during-single-screen (revision 2614)
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-01-Pull/1297/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-02-Functional-Tests/1219/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-03-Interface-Tests/1158/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tes
ts/993/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Test
s/584/
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-05a-Code_Analysis/650/
[←[1;31mFAILURE←[1;m] https://ci.openlp.io/job/Branch-05b-Test_Coverage/519/
Stopping after failure


-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2016-02-06 19:43:54 +0000
+++ openlp/core/ui/slidecontroller.py	2016-02-27 14:37:15 +0000
@@ -601,13 +601,21 @@
     def __add_actions_to_widget(self, widget):
         """
         Add actions to the widget specified by `widget`
+        This defines the controls available when Live display has stolen focus.
+        Examples of this happening: Clicking anything in the live window or certain single screen mode scenarios.
+        Needles to say, blank to modes should not be removed from here.
+        For some reason this required a test. It may be found in test_slidecontroller.py as
+        "live_stolen_focus_shortcuts_test. If you want to modify things here, you must also modify them there. (Duh)
 
         :param widget: The UI widget for the actions
         """
         widget.addActions([
             self.previous_item, self.next_item,
             self.previous_service, self.next_service,
-            self.escape_item])
+            self.escape_item,
+            self.desktop_screen,
+            self.theme_screen,
+            self.blank_screen])
 
     def preview_size_changed(self):
         """

=== modified file 'tests/functional/openlp_core_ui/test_slidecontroller.py'
--- tests/functional/openlp_core_ui/test_slidecontroller.py	2015-12-31 22:46:06 +0000
+++ tests/functional/openlp_core_ui/test_slidecontroller.py	2016-02-27 14:37:15 +0000
@@ -685,6 +685,34 @@
         self.assertEqual('mocked_presentation_item_stop', mocked_execute.call_args_list[1][0][0],
                          'The presentation should have been stopped.')
 
+    def live_stolen_focus_shortcuts_test(self):
+        """
+        Test that all the needed shortcuts are available in scenarios where Live has stolen focus.
+        These are found under def __add_actions_to_widget(self, widget): in slidecontroller.py
+        """
+        # GIVEN: A slide controller, actions needed
+        slide_controller = SlideController(None)
+        mocked_widget = MagicMock()
+        slide_controller.previous_item = MagicMock()
+        slide_controller.next_item = MagicMock()
+        slide_controller.previous_service = MagicMock()
+        slide_controller.next_service = MagicMock()
+        slide_controller.escape_item = MagicMock()
+        slide_controller.desktop_screen = MagicMock()
+        slide_controller.blank_screen = MagicMock()
+        slide_controller.theme_screen = MagicMock()
+
+        # WHEN: __add_actions_to_widget is called
+        slide_controller._SlideController__add_actions_to_widget(mocked_widget)
+
+        # THEN: The call to addActions should be correct
+        mocked_widget.addActions.assert_called_with([
+            slide_controller.previous_item, slide_controller.next_item,
+            slide_controller.previous_service, slide_controller.next_service,
+            slide_controller.escape_item, slide_controller.desktop_screen,
+            slide_controller.theme_screen, slide_controller.blank_screen
+        ])
+
 
 class TestInfoLabel(TestCase):
 


Follow ups