Added the 'addSideWidget()' and 'removeSideWidget()' methods to the UserInterface class to allow plug-in developers to add a plug-in widget to the left or bottom side containers.

Sat, 13 Oct 2012 17:49:13 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 13 Oct 2012 17:49:13 +0200
changeset 2137
5a9bdcb8c934
parent 2133
8e20a87f9809
child 2138
6fa3cda67d42
child 2142
91e3966cbe44

Added the 'addSideWidget()' and 'removeSideWidget()' methods to the UserInterface class to allow plug-in developers to add a plug-in widget to the left or bottom side containers.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.E5Gui.E5ToolBox.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.UI.UserInterface.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Utilities.py3flakes.checker.html file | annotate | diff | comparison | revisions
Documentation/eric5-plugin.odt file | annotate | diff | comparison | revisions
Documentation/eric5-plugin.pdf file | annotate | diff | comparison | revisions
E5Gui/E5ToolBox.py file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Thu Oct 11 19:09:10 2012 +0200
+++ b/APIs/Python3/eric5.api	Sat Oct 13 17:49:13 2012 +0200
@@ -1473,6 +1473,7 @@
 eric5.E5Gui.E5ToolBarManager.E5ToolBarManager?1(ui=None, parent=None)
 eric5.E5Gui.E5ToolBox.E5HorizontalToolBox.addItem?4(widget, icon, text)
 eric5.E5Gui.E5ToolBox.E5HorizontalToolBox.insertItem?4(index, widget, icon, text)
+eric5.E5Gui.E5ToolBox.E5HorizontalToolBox.removeItem?4(index)
 eric5.E5Gui.E5ToolBox.E5HorizontalToolBox.setItemEnabled?4(index, enabled)
 eric5.E5Gui.E5ToolBox.E5HorizontalToolBox.setItemToolTip?4(index, toolTip)
 eric5.E5Gui.E5ToolBox.E5HorizontalToolBox?1(parent=None)
@@ -7383,8 +7384,12 @@
 eric5.UI.UserInterface.Redirector.flush?4()
 eric5.UI.UserInterface.Redirector.write?4(s)
 eric5.UI.UserInterface.Redirector?1(stderr)
+eric5.UI.UserInterface.UserInterface.BottomSide?7
+eric5.UI.UserInterface.UserInterface.LeftSide?7
+eric5.UI.UserInterface.UserInterface.RightSide?7
 eric5.UI.UserInterface.UserInterface.activateCooperationViewer?4()
 eric5.UI.UserInterface.UserInterface.addE5Actions?4(actions, type)
+eric5.UI.UserInterface.UserInterface.addSideWidget?4(side, widget, icon, label)
 eric5.UI.UserInterface.UserInterface.appendStderr?7
 eric5.UI.UserInterface.UserInterface.appendStdout?7
 eric5.UI.UserInterface.UserInterface.appendToStderr?4(s)
@@ -7417,6 +7422,7 @@
 eric5.UI.UserInterface.UserInterface.registerToolbar?4(name, text, toolbar)
 eric5.UI.UserInterface.UserInterface.reloadAPIs?7
 eric5.UI.UserInterface.UserInterface.removeE5Actions?4(actions, type='ui')
+eric5.UI.UserInterface.UserInterface.removeSideWidget?4(widget)
 eric5.UI.UserInterface.UserInterface.reregisterToolbar?4(name, text)
 eric5.UI.UserInterface.UserInterface.setDebugProfile?4(save=True)
 eric5.UI.UserInterface.UserInterface.showAvailableVersionsInfo?4()
@@ -7753,7 +7759,7 @@
 eric5.Utilities.py3flakes.checker.Checker.SETCOMP?7
 eric5.Utilities.py3flakes.checker.Checker.SLICE?7
 eric5.Utilities.py3flakes.checker.Checker.STARRED?4(node)
-eric5.Utilities.py3flakes.checker.Checker.TRYEXCEPT?7
+eric5.Utilities.py3flakes.checker.Checker.TRY?7
 eric5.Utilities.py3flakes.checker.Checker._runDeferred?5(deferred)
 eric5.Utilities.py3flakes.checker.Checker.addArgs?4()
 eric5.Utilities.py3flakes.checker.Checker.addBinding?4(lineno, value, reportRedef=True)
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Thu Oct 11 19:09:10 2012 +0200
+++ b/Documentation/Help/source.qhp	Sat Oct 13 17:49:13 2012 +0200
@@ -3346,6 +3346,7 @@
       <keyword name="E5HorizontalToolBox (Constructor)" id="E5HorizontalToolBox (Constructor)" ref="eric5.E5Gui.E5ToolBox.html#E5HorizontalToolBox.__init__" />
       <keyword name="E5HorizontalToolBox.addItem" id="E5HorizontalToolBox.addItem" ref="eric5.E5Gui.E5ToolBox.html#E5HorizontalToolBox.addItem" />
       <keyword name="E5HorizontalToolBox.insertItem" id="E5HorizontalToolBox.insertItem" ref="eric5.E5Gui.E5ToolBox.html#E5HorizontalToolBox.insertItem" />
+      <keyword name="E5HorizontalToolBox.removeItem" id="E5HorizontalToolBox.removeItem" ref="eric5.E5Gui.E5ToolBox.html#E5HorizontalToolBox.removeItem" />
       <keyword name="E5HorizontalToolBox.setItemEnabled" id="E5HorizontalToolBox.setItemEnabled" ref="eric5.E5Gui.E5ToolBox.html#E5HorizontalToolBox.setItemEnabled" />
       <keyword name="E5HorizontalToolBox.setItemToolTip" id="E5HorizontalToolBox.setItemToolTip" ref="eric5.E5Gui.E5ToolBox.html#E5HorizontalToolBox.setItemToolTip" />
       <keyword name="E5Led" id="E5Led" ref="eric5.E5Gui.E5Led.html#E5Led" />
@@ -11088,6 +11089,7 @@
       <keyword name="UserInterface.__writeTasks" id="UserInterface.__writeTasks" ref="eric5.UI.UserInterface.html#UserInterface.__writeTasks" />
       <keyword name="UserInterface.activateCooperationViewer" id="UserInterface.activateCooperationViewer" ref="eric5.UI.UserInterface.html#UserInterface.activateCooperationViewer" />
       <keyword name="UserInterface.addE5Actions" id="UserInterface.addE5Actions" ref="eric5.UI.UserInterface.html#UserInterface.addE5Actions" />
+      <keyword name="UserInterface.addSideWidget" id="UserInterface.addSideWidget" ref="eric5.UI.UserInterface.html#UserInterface.addSideWidget" />
       <keyword name="UserInterface.appendToStderr" id="UserInterface.appendToStderr" ref="eric5.UI.UserInterface.html#UserInterface.appendToStderr" />
       <keyword name="UserInterface.appendToStdout" id="UserInterface.appendToStdout" ref="eric5.UI.UserInterface.html#UserInterface.appendToStdout" />
       <keyword name="UserInterface.checkConfigurationStatus" id="UserInterface.checkConfigurationStatus" ref="eric5.UI.UserInterface.html#UserInterface.checkConfigurationStatus" />
@@ -11112,6 +11114,7 @@
       <keyword name="UserInterface.processArgs" id="UserInterface.processArgs" ref="eric5.UI.UserInterface.html#UserInterface.processArgs" />
       <keyword name="UserInterface.registerToolbar" id="UserInterface.registerToolbar" ref="eric5.UI.UserInterface.html#UserInterface.registerToolbar" />
       <keyword name="UserInterface.removeE5Actions" id="UserInterface.removeE5Actions" ref="eric5.UI.UserInterface.html#UserInterface.removeE5Actions" />
+      <keyword name="UserInterface.removeSideWidget" id="UserInterface.removeSideWidget" ref="eric5.UI.UserInterface.html#UserInterface.removeSideWidget" />
       <keyword name="UserInterface.reregisterToolbar" id="UserInterface.reregisterToolbar" ref="eric5.UI.UserInterface.html#UserInterface.reregisterToolbar" />
       <keyword name="UserInterface.setDebugProfile" id="UserInterface.setDebugProfile" ref="eric5.UI.UserInterface.html#UserInterface.setDebugProfile" />
       <keyword name="UserInterface.showAvailableVersionsInfo" id="UserInterface.showAvailableVersionsInfo" ref="eric5.UI.UserInterface.html#UserInterface.showAvailableVersionsInfo" />
--- a/Documentation/Source/eric5.E5Gui.E5ToolBox.html	Thu Oct 11 19:09:10 2012 +0200
+++ b/Documentation/Source/eric5.E5Gui.E5ToolBox.html	Sat Oct 13 17:49:13 2012 +0200
@@ -70,6 +70,9 @@
 <td><a href="#E5HorizontalToolBox.insertItem">insertItem</a></td>
 <td>Public method to add a widget to the toolbox.</td>
 </tr><tr>
+<td><a href="#E5HorizontalToolBox.removeItem">removeItem</a></td>
+<td>Public method to remove a widget from the toolbox.</td>
+</tr><tr>
 <td><a href="#E5HorizontalToolBox.setItemEnabled">setItemEnabled</a></td>
 <td>Public method to set the enabled state of an item.</td>
 </tr><tr>
@@ -136,6 +139,16 @@
 <dd>
 index of the added widget (integer)
 </dd>
+</dl><a NAME="E5HorizontalToolBox.removeItem" ID="E5HorizontalToolBox.removeItem"></a>
+<h4>E5HorizontalToolBox.removeItem</h4>
+<b>removeItem</b>(<i>index</i>)
+<p>
+        Public method to remove a widget from the toolbox.
+</p><dl>
+<dt><i>index</i></dt>
+<dd>
+index of the widget to remove (integer)
+</dd>
 </dl><a NAME="E5HorizontalToolBox.setItemEnabled" ID="E5HorizontalToolBox.setItemEnabled"></a>
 <h4>E5HorizontalToolBox.setItemEnabled</h4>
 <b>setItemEnabled</b>(<i>index, enabled</i>)
--- a/Documentation/Source/eric5.UI.UserInterface.html	Thu Oct 11 19:09:10 2012 +0200
+++ b/Documentation/Source/eric5.UI.UserInterface.html	Sat Oct 13 17:49:13 2012 +0200
@@ -170,7 +170,7 @@
 E5MainWindow
 <h3>Class Attributes</h3>
 <table>
-<tr><td>maxFilePathLen</td></tr><tr><td>maxMenuFilePathLen</td></tr><tr><td>maxSbFilePathLen</td></tr>
+<tr><td>BottomSide</td></tr><tr><td>LeftSide</td></tr><tr><td>RightSide</td></tr><tr><td>maxFilePathLen</td></tr><tr><td>maxMenuFilePathLen</td></tr><tr><td>maxSbFilePathLen</td></tr>
 </table>
 <h3>Class Methods</h3>
 <table>
@@ -641,6 +641,9 @@
 <td><a href="#UserInterface.addE5Actions">addE5Actions</a></td>
 <td>Public method to add actions to the list of actions.</td>
 </tr><tr>
+<td><a href="#UserInterface.addSideWidget">addSideWidget</a></td>
+<td>Public method to add a widget to the sides.</td>
+</tr><tr>
 <td><a href="#UserInterface.appendToStderr">appendToStderr</a></td>
 <td>Public slot to append text to the stderr log viewer tab.</td>
 </tr><tr>
@@ -713,6 +716,9 @@
 <td><a href="#UserInterface.removeE5Actions">removeE5Actions</a></td>
 <td>Public method to remove actions from the list of actions.</td>
 </tr><tr>
+<td><a href="#UserInterface.removeSideWidget">removeSideWidget</a></td>
+<td>Public method to remove a widget added using addSideWidget().</td>
+</tr><tr>
 <td><a href="#UserInterface.reregisterToolbar">reregisterToolbar</a></td>
 <td>Public method to change the visible text for the named toolbar.</td>
 </tr><tr>
@@ -1829,6 +1835,26 @@
 <dd>
 list of actions to be added (list of E5Action)
 </dd>
+</dl><a NAME="UserInterface.addSideWidget" ID="UserInterface.addSideWidget"></a>
+<h4>UserInterface.addSideWidget</h4>
+<b>addSideWidget</b>(<i>side, widget, icon, label</i>)
+<p>
+        Public method to add a widget to the sides.
+</p><dl>
+<dt><i>side</i></dt>
+<dd>
+side to add the widget to (UserInterface.LeftSide,
+            UserInterface.BottomSide)
+</dd><dt><i>widget</i></dt>
+<dd>
+reference to the widget to add (QWidget)
+</dd><dt><i>icon</i></dt>
+<dd>
+icon to be used (QIcon)
+</dd><dt><i>label</i></dt>
+<dd>
+label text to be shown (string)
+</dd>
 </dl><a NAME="UserInterface.appendToStderr" ID="UserInterface.appendToStderr"></a>
 <h4>UserInterface.appendToStderr</h4>
 <b>appendToStderr</b>(<i>s</i>)
@@ -2122,6 +2148,16 @@
 <dd>
 list of actions (list of E5Action)
 </dd>
+</dl><a NAME="UserInterface.removeSideWidget" ID="UserInterface.removeSideWidget"></a>
+<h4>UserInterface.removeSideWidget</h4>
+<b>removeSideWidget</b>(<i>widget</i>)
+<p>
+        Public method to remove a widget added using addSideWidget().
+</p><dl>
+<dt><i>widget</i></dt>
+<dd>
+reference to the widget to remove (QWidget)
+</dd>
 </dl><a NAME="UserInterface.reregisterToolbar" ID="UserInterface.reregisterToolbar"></a>
 <h4>UserInterface.reregisterToolbar</h4>
 <b>reregisterToolbar</b>(<i>name, text</i>)
--- a/Documentation/Source/eric5.Utilities.py3flakes.checker.html	Thu Oct 11 19:09:10 2012 +0200
+++ b/Documentation/Source/eric5.Utilities.py3flakes.checker.html	Sat Oct 13 17:49:13 2012 +0200
@@ -184,7 +184,7 @@
 object
 <h3>Class Attributes</h3>
 <table>
-<tr><td>ATTRIBUTES</td></tr><tr><td>BOOLOP</td></tr><tr><td>CALL</td></tr><tr><td>COMPREHENSION</td></tr><tr><td>INVERT</td></tr><tr><td>ISNOT</td></tr><tr><td>LOAD</td></tr><tr><td>MOD</td></tr><tr><td>NONLOCAL</td></tr><tr><td>PASS</td></tr><tr><td>RETURN</td></tr><tr><td>SETCOMP</td></tr><tr><td>SLICE</td></tr><tr><td>TRYEXCEPT</td></tr><tr><td>nodeDepth</td></tr><tr><td>scope</td></tr><tr><td>traceTree</td></tr>
+<tr><td>ATTRIBUTES</td></tr><tr><td>BOOLOP</td></tr><tr><td>CALL</td></tr><tr><td>COMPREHENSION</td></tr><tr><td>INVERT</td></tr><tr><td>ISNOT</td></tr><tr><td>LOAD</td></tr><tr><td>MOD</td></tr><tr><td>NONLOCAL</td></tr><tr><td>PASS</td></tr><tr><td>RETURN</td></tr><tr><td>SETCOMP</td></tr><tr><td>SLICE</td></tr><tr><td>TRY</td></tr><tr><td>nodeDepth</td></tr><tr><td>scope</td></tr><tr><td>traceTree</td></tr>
 </table>
 <h3>Class Methods</h3>
 <table>
Binary file Documentation/eric5-plugin.odt has changed
Binary file Documentation/eric5-plugin.pdf has changed
--- a/E5Gui/E5ToolBox.py	Thu Oct 11 19:09:10 2012 +0200
+++ b/E5Gui/E5ToolBox.py	Sat Oct 13 17:49:13 2012 +0200
@@ -66,6 +66,14 @@
         self.setTabToolTip(index, text)
         return index
     
+    def removeItem(self, index):
+        """
+        Public method to remove a widget from the toolbox.
+        
+        @param index index of the widget to remove (integer)
+        """
+        self.removeTab(index)
+    
     def setItemToolTip(self, index, toolTip):
         """
         Public method to set the tooltip of an item.
--- a/UI/UserInterface.py	Thu Oct 11 19:09:10 2012 +0200
+++ b/UI/UserInterface.py	Sat Oct 13 17:49:13 2012 +0200
@@ -195,6 +195,10 @@
     maxSbFilePathLen = 150
     maxMenuFilePathLen = 75
     
+    LeftSide = 1
+    BottomSide = 2
+    RightSide = 3
+    
     def __init__(self, app, locale, splash, plugin, noOpenAtStartup, restartArguments):
         """
         Constructor
@@ -867,6 +871,46 @@
         else:
             self.setCorner(Qt.BottomRightCorner, Qt.BottomDockWidgetArea)
         
+    def addSideWidget(self, side, widget, icon, label):
+        """
+        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)
+        """
+        assert side in [UserInterface.LeftSide, UserInterface.BottomSide]
+        
+        if self.layout == "Toolboxes":
+            if side == UserInterface.LeftSide:
+                self.vToolbox.addItem(widget, icon, label)
+            elif side == UserInterface.BottomSide:
+                self.hToolbox.addItem(widget, icon, label)
+        elif self.layout == "Sidebars":
+            if side == UserInterface.LeftSide:
+                self.leftSidebar.addTab(widget, icon, label)
+            elif side == UserInterface.BottomSide:
+                self.bottomSidebar.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)
+        """
+        if self.layout == "Toolboxes":
+            for container in [self.vToolbox, self.hToolbox]:
+                index = container.indexOf(widget)
+                if index != -1:
+                    container.removeItem(index)
+        elif self.layout == "Sidebars":
+            for container in [self.leftSidebar, self.bottomSidebar]:
+                index = container.indexOf(widget)
+                if index != -1:
+                    container.removeTab(index)
+        
     def showLogTab(self, tabname):
         """
         Public method to show a particular Log-Viewer tab.
--- a/changelog	Thu Oct 11 19:09:10 2012 +0200
+++ b/changelog	Sat Oct 13 17:49:13 2012 +0200
@@ -16,6 +16,10 @@
   -- improved the package diagram to include subpackages and their module names
   -- added the capability to rebuild a diagram without losing the current item
      positions
+- Plug-ins
+  -- added the 'addSideWidget()' and 'removeSideWidget()' methods to the UserInterface
+     class to allow plug-in developers to add a plug-in widget to the left or bottom
+     side containers
 - Project
   -- made the selectable project types of the project properties dialog dependent
      upon the selected programming language

eric ide

mercurial