eric7/UI/UserInterface.py

branch
eric7
changeset 8812
01775e32d80b
parent 8774
d728227e8ebb
child 8819
982fb074be98
--- a/eric7/UI/UserInterface.py	Sat Dec 04 19:36:44 2021 +0100
+++ b/eric7/UI/UserInterface.py	Sun Dec 05 12:15:18 2021 +0100
@@ -1023,6 +1023,14 @@
         
         splitter.addWidget(self.__disViewer)
         
+        # Initialize the widgets of the layouts to None
+        self.lToolbox = None
+        self.rToolbox = None
+        self.hToolbox = None
+        self.leftSidebar = None
+        self.rightSidebar = None
+        self.bottomSidebar = None
+        
         # Create layout with toolbox windows embedded in dock windows
         if self.__layoutType == "Toolboxes":
             logging.debug("Creating toolboxes...")
@@ -2027,58 +2035,70 @@
                 self.__activateTemplateViewer)
             self.actions.append(self.templateViewerActivateAct)
             self.addAction(self.templateViewerActivateAct)
-
-        self.ltAct = EricAction(
-            self.tr('Left Toolbox'),
-            self.tr('&Left Toolbox'), 0, 0, self, 'vertical_toolbox', True)
-        self.ltAct.setStatusTip(self.tr('Toggle the Left Toolbox window'))
-        self.ltAct.setWhatsThis(self.tr(
-            """<b>Toggle the Left Toolbox window</b>"""
-            """<p>If the Left Toolbox window is hidden then display it."""
-            """ If it is displayed then close it.</p>"""
-        ))
-        self.ltAct.triggered.connect(self.__toggleLeftToolbox)
-        self.actions.append(self.ltAct)
-        
-        self.rtAct = EricAction(
-            self.tr('Right Toolbox'),
-            self.tr('&Right Toolbox'),
-            0, 0, self, 'vertical_toolbox', True)
-        self.rtAct.setStatusTip(self.tr('Toggle the Right Toolbox window'))
-        self.rtAct.setWhatsThis(self.tr(
-            """<b>Toggle the Right Toolbox window</b>"""
-            """<p>If the Right Toolbox window is hidden then display it."""
-            """ If it is displayed then close it.</p>"""
-        ))
-        self.rtAct.triggered.connect(self.__toggleRightToolbox)
-        self.actions.append(self.rtAct)
-        
-        self.htAct = EricAction(
-            self.tr('Horizontal Toolbox'),
-            self.tr('&Horizontal Toolbox'), 0, 0, self,
-            'horizontal_toolbox', True)
-        self.htAct.setStatusTip(self.tr(
-            'Toggle the Horizontal Toolbox window'))
-        self.htAct.setWhatsThis(self.tr(
-            """<b>Toggle the Horizontal Toolbox window</b>"""
-            """<p>If the Horizontal Toolbox window is hidden then display"""
-            """ it. If it is displayed then close it.</p>"""
-        ))
-        self.htAct.triggered.connect(self.__toggleHorizontalToolbox)
-        self.actions.append(self.htAct)
-        
-        self.lsbAct = EricAction(
-            self.tr('Left Sidebar'),
-            self.tr('&Left Sidebar'),
-            0, 0, self, 'left_sidebar', True)
-        self.lsbAct.setStatusTip(self.tr('Toggle the left sidebar window'))
-        self.lsbAct.setWhatsThis(self.tr(
-            """<b>Toggle the left sidebar window</b>"""
-            """<p>If the left sidebar window is hidden then display it."""
-            """ If it is displayed then close it.</p>"""
-        ))
-        self.lsbAct.triggered.connect(self.__toggleLeftSidebar)
-        self.actions.append(self.lsbAct)
+        
+        if self.lToolbox:
+            self.ltAct = EricAction(
+                self.tr('Left Toolbox'),
+                self.tr('&Left Toolbox'), 0, 0, self, 'vertical_toolbox', True)
+            self.ltAct.setStatusTip(self.tr('Toggle the Left Toolbox window'))
+            self.ltAct.setWhatsThis(self.tr(
+                """<b>Toggle the Left Toolbox window</b>"""
+                """<p>If the Left Toolbox window is hidden then display it."""
+                """ If it is displayed then close it.</p>"""
+            ))
+            self.ltAct.triggered.connect(self.__toggleLeftToolbox)
+            self.actions.append(self.ltAct)
+        else:
+            self.ltAct = None
+        
+        if self.rToolbox:
+            self.rtAct = EricAction(
+                self.tr('Right Toolbox'),
+                self.tr('&Right Toolbox'),
+                0, 0, self, 'vertical_toolbox', True)
+            self.rtAct.setStatusTip(self.tr('Toggle the Right Toolbox window'))
+            self.rtAct.setWhatsThis(self.tr(
+                """<b>Toggle the Right Toolbox window</b>"""
+                """<p>If the Right Toolbox window is hidden then display it."""
+                """ If it is displayed then close it.</p>"""
+            ))
+            self.rtAct.triggered.connect(self.__toggleRightToolbox)
+            self.actions.append(self.rtAct)
+        else:
+            self.rtAct = None
+        
+        if self.hToolbox:
+            self.htAct = EricAction(
+                self.tr('Horizontal Toolbox'),
+                self.tr('&Horizontal Toolbox'), 0, 0, self,
+                'horizontal_toolbox', True)
+            self.htAct.setStatusTip(self.tr(
+                'Toggle the Horizontal Toolbox window'))
+            self.htAct.setWhatsThis(self.tr(
+                """<b>Toggle the Horizontal Toolbox window</b>"""
+                """<p>If the Horizontal Toolbox window is hidden then"""
+                """ display it. If it is displayed then close it.</p>"""
+            ))
+            self.htAct.triggered.connect(self.__toggleHorizontalToolbox)
+            self.actions.append(self.htAct)
+        else:
+            self.htAct = None
+        
+        if self.leftSidebar:
+            self.lsbAct = EricAction(
+                self.tr('Left Sidebar'),
+                self.tr('&Left Sidebar'),
+                0, 0, self, 'left_sidebar', True)
+            self.lsbAct.setStatusTip(self.tr('Toggle the left sidebar window'))
+            self.lsbAct.setWhatsThis(self.tr(
+                """<b>Toggle the left sidebar window</b>"""
+                """<p>If the left sidebar window is hidden then display it."""
+                """ If it is displayed then close it.</p>"""
+            ))
+            self.lsbAct.triggered.connect(self.__toggleLeftSidebar)
+            self.actions.append(self.lsbAct)
+        else:
+            self.lsbAct = None
         
         if self.rightSidebar:
             self.rsbAct = EricAction(
@@ -2097,19 +2117,22 @@
         else:
             self.rsbAct = None
         
-        self.bsbAct = EricAction(
-            self.tr('Bottom Sidebar'),
-            self.tr('&Bottom Sidebar'), 0, 0, self,
-            'bottom_sidebar', True)
-        self.bsbAct.setStatusTip(self.tr(
-            'Toggle the bottom sidebar window'))
-        self.bsbAct.setWhatsThis(self.tr(
-            """<b>Toggle the bottom sidebar window</b>"""
-            """<p>If the bottom sidebar window is hidden then display it."""
-            """ If it is displayed then close it.</p>"""
-        ))
-        self.bsbAct.triggered.connect(self.__toggleBottomSidebar)
-        self.actions.append(self.bsbAct)
+        if self.bottomSidebar:
+            self.bsbAct = EricAction(
+                self.tr('Bottom Sidebar'),
+                self.tr('&Bottom Sidebar'), 0, 0, self,
+                'bottom_sidebar', True)
+            self.bsbAct.setStatusTip(self.tr(
+                'Toggle the bottom sidebar window'))
+            self.bsbAct.setWhatsThis(self.tr(
+                """<b>Toggle the bottom sidebar window</b>"""
+                """<p>If the bottom sidebar window is hidden then display"""
+                """ it. If it is displayed then close it.</p>"""
+            ))
+            self.bsbAct.triggered.connect(self.__toggleBottomSidebar)
+            self.actions.append(self.bsbAct)
+        else:
+            self.bsbAct = None
         
         if self.cooperation is not None:
             self.cooperationViewerActivateAct = EricAction(

eric ide

mercurial