eric6/UI/UserInterface.py

branch
micropython
changeset 7065
e3d04faced34
parent 7054
fb84d8489bc1
child 7089
9f9816b19aa4
--- a/eric6/UI/UserInterface.py	Thu Jul 11 19:48:14 2019 +0200
+++ b/eric6/UI/UserInterface.py	Tue Jul 16 20:12:53 2019 +0200
@@ -1211,11 +1211,15 @@
         """
         Public method to add a widget to the sides.
         
-        @param side side to add the widget to (UserInterface.LeftSide,
-            UserInterface.BottomSide)
-        @param widget reference to the widget to add (QWidget)
-        @param icon icon to be used (QIcon)
-        @param label label text to be shown (string)
+        @param side side to add the widget to
+        @type int (one of UserInterface.LeftSide, UserInterface.BottomSide,
+            UserInterface.RightSide)
+        @param widget reference to the widget to add
+        @type QWidget
+        @param icon icon to be used
+        @type QIcon
+        @param label label text to be shown
+        @type str
         """
         assert side in [UserInterface.LeftSide, UserInterface.BottomSide,
                         UserInterface.RightSide]
@@ -1234,12 +1238,13 @@
                 self.bottomSidebar.addTab(widget, icon, label)
             elif side == UserInterface.RightSide:
                 self.rightSidebar.addTab(widget, icon, label)
-        
+    
     def removeSideWidget(self, widget):
         """
         Public method to remove a widget added using addSideWidget().
         
-        @param widget reference to the widget to remove (QWidget)
+        @param widget reference to the widget to remove
+        @type QWidget
         """
         if self.__layoutType == "Toolboxes":
             for container in [self.lToolbox, self.hToolbox, self.rToolbox]:
@@ -1252,7 +1257,34 @@
                 index = container.indexOf(widget)
                 if index != -1:
                     container.removeTab(index)
-        
+    
+    def showSideWidget(self, widget):
+        """
+        Public method to show a specific widget placed in the side widgets.
+        
+        @param widget reference to the widget to be shown
+        @type QWidget
+        """
+        if self.__layoutType == "Toolboxes":
+            for dock in [self.lToolboxDock, self.hToolboxDock,
+                              self.rToolboxDock]:
+                container = dock.widget()
+                index = container.indexOf(widget)
+                if index != -1:
+                    dock.show()
+                    container.setCurrentIndex(index)
+                    dock.raise_()
+        elif self.__layoutType == "Sidebars":
+            for container in [self.leftSidebar, self.bottomSidebar,
+                              self.rightSidebar]:
+                index = container.indexOf(widget)
+                if index != -1:
+                    container.show()
+                    container.setCurrentIndex(index)
+                    container.raise_()
+                    if container.isAutoHiding():
+                        container.setFocus()
+    
     def showLogViewer(self):
         """
         Public method to show the Log-Viewer.

eric ide

mercurial