UI/UserInterface.py

changeset 6434
872d10fa686a
parent 6433
92680b6a3585
child 6455
22a6fc33ab6d
child 6477
096fefd24a26
--- a/UI/UserInterface.py	Sun Jul 15 19:00:10 2018 +0200
+++ b/UI/UserInterface.py	Sun Jul 15 19:21:28 2018 +0200
@@ -209,7 +209,7 @@
         self.__disableCrashSession = disableCrashSession
         self.__disabledPlugins = disabledPlugins[:]
         
-        self.layoutType = Preferences.getUI("LayoutType")
+        self.__layoutType = Preferences.getUI("LayoutType")
         
         self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled")
         
@@ -762,18 +762,18 @@
         splitter.addWidget(self.__previewer)
         
         # Create layout with toolbox windows embedded in dock windows
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             logging.debug("Creating toolboxes...")
             self.__createToolboxesLayout(debugServer)
         
         # Create layout with sidebar windows embedded in dock windows
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             logging.debug("Creating sidebars...")
             self.__createSidebarsLayout(debugServer)
         
         else:
             raise ValueError("Wrong layout type given ({0})".format(
-                self.layoutType))
+                self.__layoutType))
         logging.debug("Created Layout")
 
     def __createToolboxesLayout(self, debugServer):
@@ -1114,14 +1114,14 @@
         """
         assert side in [UserInterface.LeftSide, UserInterface.BottomSide]
         
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             if side == UserInterface.LeftSide:
                 self.lToolbox.addItem(widget, icon, label)
             elif side == UserInterface.BottomSide:
                 self.hToolbox.addItem(widget, icon, label)
             elif side == UserInterface.RightSide:
                 self.rToolbox.addItem(widget, icon, label)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             if side == UserInterface.LeftSide:
                 self.leftSidebar.addTab(widget, icon, label)
             elif side == UserInterface.BottomSide:
@@ -1135,12 +1135,12 @@
         
         @param widget reference to the widget to remove (QWidget)
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             for container in [self.lToolbox, self.hToolbox, self.rToolbox]:
                 index = container.indexOf(widget)
                 if index != -1:
                     container.removeItem(index)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             for container in [self.leftSidebar, self.bottomSidebar,
                               self.rightSidebar]:
                 index = container.indexOf(widget)
@@ -1152,11 +1152,11 @@
         Public method to show the Log-Viewer.
         """
         if Preferences.getUI("LogViewerAutoRaise"):
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.hToolboxDock.show()
                 self.hToolbox.setCurrentWidget(self.logViewer)
                 self.hToolboxDock.raise_()
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.bottomSidebar.show()
                 self.bottomSidebar.setCurrentWidget(self.logViewer)
                 self.bottomSidebar.raise_()
@@ -3826,14 +3826,14 @@
         self.__menus["window"].addActions(self.viewProfileActGrp.actions())
         self.__menus["window"].addSeparator()
         
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.__menus["window"].addAction(self.ltAct)
             self.ltAct.setChecked(not self.lToolboxDock.isHidden())
             self.__menus["window"].addAction(self.rtAct)
             self.rtAct.setChecked(not self.lToolboxDock.isHidden())
             self.__menus["window"].addAction(self.htAct)
             self.htAct.setChecked(not self.hToolboxDock.isHidden())
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.__menus["window"].addAction(self.lsbAct)
             self.lsbAct.setChecked(not self.leftSidebar.isHidden())
             self.__menus["window"].addAction(self.rsbAct)
@@ -3958,10 +3958,10 @@
         """
         if self.currentProfile and save:
             # step 1: save the window geometries of the active profile
-            if self.layoutType in ["Toolboxes", "Sidebars"]:
+            if self.__layoutType in ["Toolboxes", "Sidebars"]:
                 state = self.saveState()
                 self.profiles[self.currentProfile][0] = state
-                if self.layoutType == "Sidebars":
+                if self.__layoutType == "Sidebars":
                     state = self.leftSplitter.saveState()
                     self.profiles[self.currentProfile][2][0] = state
                     state = self.verticalSplitter.saveState()
@@ -3975,14 +3975,14 @@
                     state = self.rightSidebar.saveState()
                     self.profiles[self.currentProfile][2][5] = state
             # step 2: save the visibility of the windows of the active profile
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.profiles[self.currentProfile][1][0] = \
                     self.lToolboxDock.isVisible()
                 self.profiles[self.currentProfile][1][1] = \
                     self.hToolboxDock.isVisible()
                 self.profiles[self.currentProfile][1][2] = \
                     self.rToolboxDock.isVisible()
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.profiles[self.currentProfile][1][0] = \
                     self.leftSidebar.isVisible()
                 self.profiles[self.currentProfile][1][1] = \
@@ -4004,11 +4004,11 @@
             self.__saveCurrentViewProfile(save)
             
             # step 2: set the window geometries of the new profile
-            if self.layoutType in ["Toolboxes", "Sidebars"]:
+            if self.__layoutType in ["Toolboxes", "Sidebars"]:
                 state = self.profiles[name][0]
                 if not state.isEmpty():
                     self.restoreState(state)
-                if self.layoutType == "Sidebars":
+                if self.__layoutType == "Sidebars":
                     state = self.profiles[name][2][0]
                     if not state.isEmpty():
                         self.leftSplitter.restoreState(state)
@@ -4030,11 +4030,11 @@
                 self.__configureDockareaCornerUsage()
             
             # step 3: activate the windows of the new profile
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.lToolboxDock.setVisible(self.profiles[name][1][0])
                 self.hToolboxDock.setVisible(self.profiles[name][1][1])
                 self.rToolboxDock.setVisible(self.profiles[name][1][2])
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.leftSidebar.setVisible(self.profiles[name][1][0])
                 self.bottomSidebar.setVisible(self.profiles[name][1][1])
                 self.rightSidebar.setVisible(self.profiles[name][1][2])
@@ -4057,12 +4057,12 @@
         Private slot to handle the start of a debugging session.
         """
         self.setDebugProfile()
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.__currentRightWidget = self.rToolbox.currentWidget()
             self.rToolbox.setCurrentWidget(self.debugViewer)
             self.__currentBottomWidget = self.hToolbox.currentWidget()
             self.hToolbox.setCurrentWidget(self.shellAssembly)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.__currentRightWidget = self.rightSidebar.currentWidget()
             self.rightSidebar.setCurrentWidget(self.debugViewer)
             self.__currentBottomWidget = self.bottomSidebar.currentWidget()
@@ -4073,12 +4073,12 @@
         Private slot to handle the end of a debugging session.
         """
         self.__setEditProfile()
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             if self.__currentRightWidget:
                 self.rToolbox.setCurrentWidget(self.__currentRightWidget)
             if self.__currentBottomWidget:
                 self.hToolbox.setCurrentWidget(self.__currentBottomWidget)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             if self.__currentRightWidget:
                 self.rightSidebar.setCurrentWidget(self.__currentRightWidget)
             if self.__currentBottomWidget:
@@ -4118,15 +4118,24 @@
         @return the name of the current view profile (string)
         """
         return self.currentProfile
-        
+    
+    def getLayoutType(self):
+        """
+        Public method to get the current layout type.
+        
+        @return current layout type
+        @rtype str
+        """
+        return self.__layoutType
+    
     def __activateProjectBrowser(self):
         """
         Private slot to handle the activation of the project browser.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.lToolboxDock.show()
             self.lToolbox.setCurrentWidget(self.projectBrowser)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.leftSidebar.show()
             self.leftSidebar.setCurrentWidget(self.projectBrowser)
         else:
@@ -4138,10 +4147,10 @@
         """
         Private slot to handle the activation of the project browser.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.lToolboxDock.show()
             self.lToolbox.setCurrentWidget(self.multiProjectBrowser)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.leftSidebar.show()
             self.leftSidebar.setCurrentWidget(self.multiProjectBrowser)
         else:
@@ -4152,10 +4161,10 @@
         """
         Public slot to handle the activation of the debug viewer.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.rToolboxDock.show()
             self.rToolbox.setCurrentWidget(self.debugViewer)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.rightSidebar.show()
             self.rightSidebar.setCurrentWidget(self.debugViewer)
         else:
@@ -4166,10 +4175,10 @@
         """
         Private slot to handle the activation of the Shell window.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.hToolboxDock.show()
             self.hToolbox.setCurrentWidget(self.shellAssembly)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.bottomSidebar.show()
             self.bottomSidebar.setCurrentWidget(self.shellAssembly)
         else:
@@ -4180,10 +4189,10 @@
         """
         Private slot to handle the activation of the Log Viewer.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.hToolboxDock.show()
             self.hToolbox.setCurrentWidget(self.logViewer)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.bottomSidebar.show()
             self.bottomSidebar.setCurrentWidget(self.logViewer)
         else:
@@ -4194,10 +4203,10 @@
         """
         Private slot to handle the activation of the Task Viewer.
         """
-        if self.layoutType == "Toolboxes":
+        if self.__layoutType == "Toolboxes":
             self.hToolboxDock.show()
             self.hToolbox.setCurrentWidget(self.taskViewer)
-        elif self.layoutType == "Sidebars":
+        elif self.__layoutType == "Sidebars":
             self.bottomSidebar.show()
             self.bottomSidebar.setCurrentWidget(self.taskViewer)
         else:
@@ -4209,10 +4218,10 @@
         Private slot to handle the activation of the Template Viewer.
         """
         if self.templateViewer is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.lToolboxDock.show()
                 self.lToolbox.setCurrentWidget(self.templateViewer)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.leftSidebar.show()
                 self.leftSidebar.setCurrentWidget(self.templateViewer)
             else:
@@ -4224,10 +4233,10 @@
         Private slot to handle the activation of the file browser.
         """
         if self.browser is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.lToolboxDock.show()
                 self.lToolbox.setCurrentWidget(self.browser)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.leftSidebar.show()
                 self.leftSidebar.setCurrentWidget(self.browser)
             else:
@@ -4314,10 +4323,10 @@
         Public slot to handle the activation of the cooperation window.
         """
         if self.cooperation is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.rToolboxDock.show()
                 self.rToolbox.setCurrentWidget(self.cooperation)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(self.cooperation)
             else:
@@ -4329,10 +4338,10 @@
         Private slot to handle the activation of the IRC window.
         """
         if self.irc is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.rToolboxDock.show()
                 self.rToolbox.setCurrentWidget(self.irc)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(self.irc)
             else:
@@ -4344,10 +4353,10 @@
         Private slot to handle the activation of the Symbols Viewer.
         """
         if self.symbolsViewer is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.lToolboxDock.show()
                 self.lToolbox.setCurrentWidget(self.symbolsViewer)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.leftSidebar.show()
                 self.leftSidebar.setCurrentWidget(self.symbolsViewer)
             else:
@@ -4359,10 +4368,10 @@
         Private slot to handle the activation of the Numbers Viewer.
         """
         if self.numbersViewer is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.hToolboxDock.show()
                 self.hToolbox.setCurrentWidget(self.numbersViewer)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.bottomSidebar.show()
                 self.bottomSidebar.setCurrentWidget(self.numbersViewer)
             else:
@@ -4385,10 +4394,10 @@
         @type bool
         """
         if self.codeDocumentationViewer is not None:
-            if self.layoutType == "Toolboxes":
+            if self.__layoutType == "Toolboxes":
                 self.rToolboxDock.show()
                 self.rToolbox.setCurrentWidget(self.codeDocumentationViewer)
-            elif self.layoutType == "Sidebars":
+            elif self.__layoutType == "Sidebars":
                 self.rightSidebar.show()
                 self.rightSidebar.setCurrentWidget(
                     self.codeDocumentationViewer)
@@ -5799,7 +5808,7 @@
         SpellChecker.setDefaultLanguage(
             Preferences.getEditor("SpellCheckingDefaultLanguage"))
         
-        if self.layoutType == "Sidebars":
+        if self.__layoutType == "Sidebars":
             delay = Preferences.getUI("SidebarDelay")
             self.leftSidebar.setDelay(delay)
             self.bottomSidebar.setDelay(delay)
@@ -5863,7 +5872,7 @@
         Private slot to configure the various view profiles.
         """
         from Preferences.ViewProfileDialog import ViewProfileDialog
-        dlg = ViewProfileDialog(self.layoutType, self.profiles['edit'][1],
+        dlg = ViewProfileDialog(self.__layoutType, self.profiles['edit'][1],
                                 self.profiles['debug'][1])
         if dlg.exec_() == QDialog.Accepted:
             edit, debug = dlg.getVisibilities()
@@ -6565,7 +6574,7 @@
         
         self.virtualenvManager.shutdown()
         
-        if self.layoutType == "Sidebars":
+        if self.__layoutType == "Sidebars":
             self.leftSidebar.shutdown()
             self.bottomSidebar.shutdown()
             self.rightSidebar.shutdown()

eric ide

mercurial