← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/testing into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/testing into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Proposal showing what I was trying (and failing) to clearly explain to superfly.

Refactors the new mode code to remove duplication and make the method names better reflect what they do.
-- 
https://code.launchpad.net/~meths/openlp/testing/+merge/29338
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/testing into lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2010-07-06 20:27:57 +0000
+++ openlp/core/ui/mainwindow.py	2010-07-06 21:27:24 +0000
@@ -559,10 +559,10 @@
             self.toggleThemeManager)
         QtCore.QObject.connect(self.ViewPreviewPanel,
             QtCore.SIGNAL(u'toggled(bool)'),
-            self.togglePreviewPanel)
+            self.setPreviewPanelVisibility)
         QtCore.QObject.connect(self.ViewLivePanel,
             QtCore.SIGNAL(u'toggled(bool)'),
-            self.toggleLivePanel)
+            self.setLivePanelVisibility)
         QtCore.QObject.connect(self.MediaManagerDock,
             QtCore.SIGNAL(u'visibilityChanged(bool)'),
             self.ViewMediaManagerItem.setChecked)
@@ -753,12 +753,8 @@
         self.MediaManagerDock.setVisible(True)
         self.ServiceManagerDock.setVisible(True)
         self.ThemeManagerDock.setVisible(True)
-        self.PreviewController.Panel.setVisible(True)
-        self.LiveController.Panel.setVisible(True)
-        self.settingsmanager.set_preview_visibility(True)
-        self.settingsmanager.set_live_visibility(True)
-        self.ViewPreviewPanel.setChecked(True)
-        self.ViewLivePanel.setChecked(True)
+        self.setPreviewPanelVisibility(True)
+        self.setLivePanelVisibility(True)
 
     def onModeSetupItemClicked(self):
         """
@@ -767,12 +763,8 @@
         self.MediaManagerDock.setVisible(True)
         self.ServiceManagerDock.setVisible(True)
         self.ThemeManagerDock.setVisible(False)
-        self.PreviewController.Panel.setVisible(True)
-        self.LiveController.Panel.setVisible(False)
-        self.settingsmanager.set_preview_visibility(True)
-        self.settingsmanager.set_live_visibility(False)
-        self.ViewPreviewPanel.setChecked(True)
-        self.ViewLivePanel.setChecked(False)
+        self.setPreviewPanelVisibility(True)
+        self.setLivePanelVisibility(False)
 
     def onModeLiveItemClicked(self):
         """
@@ -781,12 +773,8 @@
         self.MediaManagerDock.setVisible(False)
         self.ServiceManagerDock.setVisible(True)
         self.ThemeManagerDock.setVisible(False)
-        self.PreviewController.Panel.setVisible(False)
-        self.LiveController.Panel.setVisible(True)
-        self.settingsmanager.set_preview_visibility(False)
-        self.settingsmanager.set_live_visibility(True)
-        self.ViewPreviewPanel.setChecked(False)
-        self.ViewLivePanel.setChecked(True)
+        self.setPreviewPanelVisibility(False)
+        self.setLivePanelVisibility(True)
 
     def screenChanged(self):
         """
@@ -880,12 +868,30 @@
         if self.ThemeManagerDock.isVisible() != visible:
             self.ThemeManagerDock.setVisible(visible)
 
-    def togglePreviewPanel(self, visible):
+    def setPreviewPanelVisibility(self, visible):
+        """
+        Sets the visibility of the preview panel including saving the setting
+        and updating the menu.
+
+        ``visible``
+            A bool giving the state to set the panel to
+                True - Visible
+                False - Hidden
+        """
         self.PreviewController.Panel.setVisible(visible)
         self.settingsmanager.set_preview_visibility(visible)
         self.ViewPreviewPanel.setChecked(visible)
 
-    def toggleLivePanel(self, visible):
+    def setLivePanelVisibility(self, visible):
+        """
+        Sets the visibility of the live panel including saving the setting and
+        updating the menu.
+
+        ``visible``
+            A bool giving the state to set the panel to
+                True - Visible
+                False - Hidden
+        """
         self.LiveController.Panel.setVisible(visible)
         self.settingsmanager.set_live_visibility(visible)
         self.ViewLivePanel.setChecked(visible)


Follow ups