← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~alisonken1/openlp/bug-1390702 into lp:openlp

 

Ken Roberts has proposed merging lp:~alisonken1/openlp/bug-1390702 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1390702 in OpenLP: "Lock panels doesn't lock projector manager"
  https://bugs.launchpad.net/openlp/+bug/1390702

For more details, see:
https://code.launchpad.net/~alisonken1/openlp/bug-1390702/+merge/241199

Bug #1390702

Fix Projector Manager dock so View->Lock Panels will lock/unlock the UI features

p:~alisonken1/openlp/bug-1390702 (revision 2444)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/763/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/701/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/645/
[SUCCESS] http://ci.openlp.org/job/Branch-04a-Windows_Functional_Tests/584/
[SUCCESS] http://ci.openlp.org/job/Branch-04b-Windows_Interface_Tests/193/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/398/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/272/

-- 
https://code.launchpad.net/~alisonken1/openlp/bug-1390702/+merge/241199
Your team OpenLP Core is requested to review the proposed merge of lp:~alisonken1/openlp/bug-1390702 into lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2014-11-08 19:22:22 +0000
+++ openlp/core/ui/mainwindow.py	2014-11-09 03:00:15 +0000
@@ -641,10 +641,10 @@
         if view_mode == 'default':
             self.mode_default_item.setChecked(True)
         elif view_mode == 'setup':
-            self.set_view_mode(True, True, False, True, False)
+            self.set_view_mode(True, True, False, True, False, True)
             self.mode_setup_item.setChecked(True)
         elif view_mode == 'live':
-            self.set_view_mode(False, True, False, False, True)
+            self.set_view_mode(False, True, False, False, True, True)
             self.mode_live_item.setChecked(True)
 
     def app_startup(self):
@@ -1000,21 +1000,21 @@
         """
         Put OpenLP into "Default" view mode.
         """
-        self.set_view_mode(True, True, True, True, True, 'default')
+        self.set_view_mode(True, True, True, True, True, True, 'default')
 
     def on_mode_setup_item_clicked(self):
         """
         Put OpenLP into "Setup" view mode.
         """
-        self.set_view_mode(True, True, False, True, False, 'setup')
+        self.set_view_mode(True, True, False, True, False, True, 'setup')
 
     def on_mode_live_item_clicked(self):
         """
         Put OpenLP into "Live" view mode.
         """
-        self.set_view_mode(False, True, False, False, True, 'live')
+        self.set_view_mode(False, True, False, False, True, True, 'live')
 
-    def set_view_mode(self, media=True, service=True, theme=True, preview=True, live=True, mode=''):
+    def set_view_mode(self, media=True, service=True, theme=True, preview=True, live=True, projector=True, mode=''):
         """
         Set OpenLP to a different view mode.
         """
@@ -1024,6 +1024,7 @@
         self.media_manager_dock.setVisible(media)
         self.service_manager_dock.setVisible(service)
         self.theme_manager_dock.setVisible(theme)
+        self.projector_manager_dock.setVisible(projector)
         self.set_preview_panel_visibility(preview)
         self.set_live_panel_visibility(live)
 
@@ -1186,18 +1187,22 @@
             self.theme_manager_dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
             self.service_manager_dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
             self.media_manager_dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
+            self.projector_manager_dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
             self.view_media_manager_item.setEnabled(False)
             self.view_service_manager_item.setEnabled(False)
             self.view_theme_manager_item.setEnabled(False)
+            self.view_projector_manager_item.setEnabled(False)
             self.view_preview_panel.setEnabled(False)
             self.view_live_panel.setEnabled(False)
         else:
             self.theme_manager_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
             self.service_manager_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
             self.media_manager_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
+            self.projector_manager_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
             self.view_media_manager_item.setEnabled(True)
             self.view_service_manager_item.setEnabled(True)
             self.view_theme_manager_item.setEnabled(True)
+            self.view_projector_manager_item.setEnabled(True)
             self.view_preview_panel.setEnabled(True)
             self.view_live_panel.setEnabled(True)
         Settings().setValue('user interface/lock panel', lock)

=== modified file 'tests/interfaces/openlp_core_ui/test_mainwindow.py'
--- tests/interfaces/openlp_core_ui/test_mainwindow.py	2014-10-22 20:43:05 +0000
+++ tests/interfaces/openlp_core_ui/test_mainwindow.py	2014-11-09 03:00:15 +0000
@@ -62,6 +62,7 @@
                 patch('openlp.core.ui.mainwindow.QtGui.QMainWindow.addDockWidget') as mocked_add_dock_method, \
                 patch('openlp.core.ui.mainwindow.ServiceManager') as mocked_service_manager, \
                 patch('openlp.core.ui.mainwindow.ThemeManager') as mocked_theme_manager, \
+                patch('openlp.core.ui.mainwindow.ProjectorManager') as mocked_projector_manager, \
                 patch('openlp.core.ui.mainwindow.Renderer') as mocked_renderer:
             self.main_window = MainWindow()
 
@@ -85,3 +86,29 @@
 
             # THEN: The current widget should have been set.
             self.main_window.media_tool_box.setCurrentIndex.assert_called_with(2)
+
+    def projector_manager_dock_locked_test(self):
+        """
+        Projector Manager enable UI options -  bug #1390702
+        """
+        # GIVEN: A mocked projector manager dock item:
+        projector_dock = self.main_window.projector_manager_dock
+
+        # WHEN: main_window.lock_panel action is triggered
+        self.main_window.lock_panel.triggered.emit(True)
+
+        # THEN: Projector manager dock should have been called with disable UI features
+        projector_dock.setFeatures.assert_called_with(0)
+
+    def projector_manager_dock_unlocked_test(self):
+        """
+        Projector Manager disable UI options -  bug #1390702
+        """
+        # GIVEN: A mocked projector manager dock item:
+        projector_dock = self.main_window.projector_manager_dock
+
+        # WHEN: main_window.lock_panel action is triggered
+        self.main_window.lock_panel.triggered.emit(False)
+
+        # THEN: Projector manager dock should have been called with enable UI features
+        projector_dock.setFeatures.assert_called_with(7)


Follow ups