Fri, 26 Aug 2022 14:49:15 +0200
Interface
- added capability to expand or shrink the sidebar by clicking on the empty part of the icon bar (see Issue 441)
--- a/docs/changelog Thu Aug 25 19:35:37 2022 +0200 +++ b/docs/changelog Fri Aug 26 14:49:15 2022 +0200 @@ -11,6 +11,9 @@ -- added capability to suppress reporting of unhandled exceptions - Editor -- extended the Pygments based lexer to support the various comment variants +- Interface + -- added capability to expand or shrink the sidebar by clicking on the empty + part of the icon bar - MicroPython -- added capability to connect to devices for which only the serial port name is available
--- a/src/eric7/APIs/Python3/eric7.api Thu Aug 25 19:35:37 2022 +0200 +++ b/src/eric7/APIs/Python3/eric7.api Fri Aug 26 14:49:15 2022 +0200 @@ -1310,7 +1310,9 @@ eric7.EricWidgets.EricIconBar.EricIconBar.currentChanged?7 eric7.EricWidgets.EricIconBar.EricIconBar.currentClicked?7 eric7.EricWidgets.EricIconBar.EricIconBar.currentIndex?4() +eric7.EricWidgets.EricIconBar.EricIconBar.emptyClicked?7 eric7.EricWidgets.EricIconBar.EricIconBar.insertIcon?4(index, icon, label="") +eric7.EricWidgets.EricIconBar.EricIconBar.mouseReleaseEvent?4(evt) eric7.EricWidgets.EricIconBar.EricIconBar.nextIcon?4() eric7.EricWidgets.EricIconBar.EricIconBar.orientation?4() eric7.EricWidgets.EricIconBar.EricIconBar.previousIcon?4()
--- a/src/eric7/Documentation/Help/source.qhp Thu Aug 25 19:35:37 2022 +0200 +++ b/src/eric7/Documentation/Help/source.qhp Fri Aug 26 14:49:15 2022 +0200 @@ -5064,6 +5064,7 @@ <keyword name="EricIconBar.count" id="EricIconBar.count" ref="eric7.EricWidgets.EricIconBar.html#EricIconBar.count" /> <keyword name="EricIconBar.currentIndex" id="EricIconBar.currentIndex" ref="eric7.EricWidgets.EricIconBar.html#EricIconBar.currentIndex" /> <keyword name="EricIconBar.insertIcon" id="EricIconBar.insertIcon" ref="eric7.EricWidgets.EricIconBar.html#EricIconBar.insertIcon" /> + <keyword name="EricIconBar.mouseReleaseEvent" id="EricIconBar.mouseReleaseEvent" ref="eric7.EricWidgets.EricIconBar.html#EricIconBar.mouseReleaseEvent" /> <keyword name="EricIconBar.nextIcon" id="EricIconBar.nextIcon" ref="eric7.EricWidgets.EricIconBar.html#EricIconBar.nextIcon" /> <keyword name="EricIconBar.orientation" id="EricIconBar.orientation" ref="eric7.EricWidgets.EricIconBar.html#EricIconBar.orientation" /> <keyword name="EricIconBar.previousIcon" id="EricIconBar.previousIcon" ref="eric7.EricWidgets.EricIconBar.html#EricIconBar.previousIcon" /> @@ -5451,9 +5452,9 @@ <keyword name="EricSideBar (Constructor)" id="EricSideBar (Constructor)" ref="eric7.EricWidgets.EricSideBar.html#EricSideBar.__init__" /> <keyword name="EricSideBar (Module)" id="EricSideBar (Module)" ref="eric7.EricWidgets.EricSideBar.html" /> <keyword name="EricSideBar.__currentIconChanged" id="EricSideBar.__currentIconChanged" ref="eric7.EricWidgets.EricSideBar.html#EricSideBar.__currentIconChanged" /> - <keyword name="EricSideBar.__currentIconClicked" id="EricSideBar.__currentIconClicked" ref="eric7.EricWidgets.EricSideBar.html#EricSideBar.__currentIconClicked" /> <keyword name="EricSideBar.__expandIt" id="EricSideBar.__expandIt" ref="eric7.EricWidgets.EricSideBar.html#EricSideBar.__expandIt" /> <keyword name="EricSideBar.__shrinkIt" id="EricSideBar.__shrinkIt" ref="eric7.EricWidgets.EricSideBar.html#EricSideBar.__shrinkIt" /> + <keyword name="EricSideBar.__shrinkOrExpandIt" id="EricSideBar.__shrinkOrExpandIt" ref="eric7.EricWidgets.EricSideBar.html#EricSideBar.__shrinkOrExpandIt" /> <keyword name="EricSideBar.addTab" id="EricSideBar.addTab" ref="eric7.EricWidgets.EricSideBar.html#EricSideBar.addTab" /> <keyword name="EricSideBar.barSize" id="EricSideBar.barSize" ref="eric7.EricWidgets.EricSideBar.html#EricSideBar.barSize" /> <keyword name="EricSideBar.clear" id="EricSideBar.clear" ref="eric7.EricWidgets.EricSideBar.html#EricSideBar.clear" />
--- a/src/eric7/Documentation/Source/eric7.EricWidgets.EricIconBar.html Thu Aug 25 19:35:37 2022 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricWidgets.EricIconBar.html Fri Aug 26 14:49:15 2022 +0200 @@ -51,6 +51,11 @@ emitted to indicate, that the current icon was clicked </dd> +<dt>emptyClicked()</dt> +<dd> +emitted to indicate a mouse click on the empty part + of the icon bar +</dd> </dl> <h3>Derived from</h3> QWidget @@ -117,6 +122,10 @@ <td>Public method to insert an icon into the bar.</td> </tr> <tr> +<td><a href="#EricIconBar.mouseReleaseEvent">mouseReleaseEvent</a></td> +<td>Protected method to handle a click on the empty space.</td> +</tr> +<tr> <td><a href="#EricIconBar.nextIcon">nextIcon</a></td> <td>Public slot to set the icon after the current one.</td> </tr> @@ -368,6 +377,20 @@ label text to be shown as a tooltip (defaults to "") </dd> </dl> +<a NAME="EricIconBar.mouseReleaseEvent" ID="EricIconBar.mouseReleaseEvent"></a> +<h4>EricIconBar.mouseReleaseEvent</h4> +<b>mouseReleaseEvent</b>(<i>evt</i>) + +<p> + Protected method to handle a click on the empty space. +</p> +<dl> + +<dt><i>evt</i> (QMouseEvent)</dt> +<dd> +reference to the mouse event +</dd> +</dl> <a NAME="EricIconBar.nextIcon" ID="EricIconBar.nextIcon"></a> <h4>EricIconBar.nextIcon</h4> <b>nextIcon</b>(<i></i>)
--- a/src/eric7/Documentation/Source/eric7.EricWidgets.EricSideBar.html Thu Aug 25 19:35:37 2022 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricWidgets.EricSideBar.html Fri Aug 26 14:49:15 2022 +0200 @@ -68,10 +68,6 @@ <td>Private slot to handle a change of the current icon.</td> </tr> <tr> -<td><a href="#EricSideBar.__currentIconClicked">__currentIconClicked</a></td> -<td>Private slot to handle a click of the current icon.</td> -</tr> -<tr> <td><a href="#EricSideBar.__expandIt">__expandIt</a></td> <td>Private method to expand the sidebar.</td> </tr> @@ -80,6 +76,10 @@ <td>Private method to shrink the sidebar.</td> </tr> <tr> +<td><a href="#EricSideBar.__shrinkOrExpandIt">__shrinkOrExpandIt</a></td> +<td>Private slot to shrink or expand the widget stack.</td> +</tr> +<tr> <td><a href="#EricSideBar.addTab">addTab</a></td> <td>Public method to add a tab to the sidebar.</td> </tr> @@ -211,20 +211,6 @@ index of the current icon </dd> </dl> -<a NAME="EricSideBar.__currentIconClicked" ID="EricSideBar.__currentIconClicked"></a> -<h4>EricSideBar.__currentIconClicked</h4> -<b>__currentIconClicked</b>(<i>index</i>) - -<p> - Private slot to handle a click of the current icon. -</p> -<dl> - -<dt><i>index</i> (int)</dt> -<dd> -index of the clicked icon -</dd> -</dl> <a NAME="EricSideBar.__expandIt" ID="EricSideBar.__expandIt"></a> <h4>EricSideBar.__expandIt</h4> <b>__expandIt</b>(<i></i>) @@ -239,6 +225,13 @@ <p> Private method to shrink the sidebar. </p> +<a NAME="EricSideBar.__shrinkOrExpandIt" ID="EricSideBar.__shrinkOrExpandIt"></a> +<h4>EricSideBar.__shrinkOrExpandIt</h4> +<b>__shrinkOrExpandIt</b>(<i></i>) + +<p> + Private slot to shrink or expand the widget stack. +</p> <a NAME="EricSideBar.addTab" ID="EricSideBar.addTab"></a> <h4>EricSideBar.addTab</h4> <b>addTab</b>(<i>widget, icon, label=None</i>)
--- a/src/eric7/EricWidgets/EricIconBar.py Thu Aug 25 19:35:37 2022 +0200 +++ b/src/eric7/EricWidgets/EricIconBar.py Fri Aug 26 14:49:15 2022 +0200 @@ -28,6 +28,8 @@ index @signal currentClicked(index) emitted to indicate, that the current icon was clicked + @signal emptyClicked() emitted to indicate a mouse click on the empty part + of the icon bar """ BarSizes = { @@ -53,6 +55,7 @@ currentChanged = pyqtSignal(int) currentClicked = pyqtSignal(int) + emptyClicked = pyqtSignal() def __init__( self, orientation=Qt.Orientation.Horizontal, barSize=DefaultBarSize, parent=None @@ -505,3 +508,12 @@ iconLabel = self.__layout.itemAt(index) if iconLabel: iconLabel.widget().show() + + def mouseReleaseEvent(self, evt): + """ + Protected method to handle a click on the empty space. + + @param evt reference to the mouse event + @type QMouseEvent + """ + self.emptyClicked.emit()
--- a/src/eric7/EricWidgets/EricSideBar.py Thu Aug 25 19:35:37 2022 +0200 +++ b/src/eric7/EricWidgets/EricSideBar.py Fri Aug 26 14:49:15 2022 +0200 @@ -82,7 +82,8 @@ self.__iconBar.currentChanged.connect(self.__stackedWidget.setCurrentIndex) self.__iconBar.currentChanged.connect(self.__currentIconChanged) - self.__iconBar.currentClicked.connect(self.__currentIconClicked) + self.__iconBar.currentClicked.connect(self.__shrinkOrExpandIt) + self.__iconBar.emptyClicked.connect(self.__shrinkOrExpandIt) def __shrinkIt(self): """ @@ -120,6 +121,16 @@ self.setMinimumWidth(minSize) self.setMaximumWidth(self.__maxSize) + @pyqtSlot() + def __shrinkOrExpandIt(self): + """ + Private slot to shrink or expand the widget stack. + """ + if self.isMinimized(): + self.__expandIt() + else: + self.__shrinkIt() + def isMinimized(self): """ Public method to check the minimized state. @@ -139,19 +150,6 @@ if self.isMinimized(): self.__expandIt() - @pyqtSlot(int) - def __currentIconClicked(self, index): - """ - Private slot to handle a click of the current icon. - - @param index index of the clicked icon - @type int - """ - if self.isMinimized(): - self.__expandIt() - else: - self.__shrinkIt() - def addTab(self, widget, icon, label=None): """ Public method to add a tab to the sidebar.