Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected. release-10.3.1

Thu, 01 Aug 2024 11:09:54 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 01 Aug 2024 11:09:54 +0200
changeset 52
d9792a2b46fd
parent 51
0143a56b2831
child 53
066ff93b038b

Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.

PipxInterface/Documentation/Source/Plugin_Pipx_Interface.PluginPipxInterface.html file | annotate | diff | comparison | revisions
PluginPipxInterface.py file | annotate | diff | comparison | revisions
PluginPipxInterface.zip file | annotate | diff | comparison | revisions
changelog.md file | annotate | diff | comparison | revisions
--- a/PipxInterface/Documentation/Source/Plugin_Pipx_Interface.PluginPipxInterface.html	Wed Jul 31 13:32:27 2024 +0200
+++ b/PipxInterface/Documentation/Source/Plugin_Pipx_Interface.PluginPipxInterface.html	Thu Aug 01 11:09:54 2024 +0200
@@ -78,6 +78,10 @@
 <td>Constructor</td>
 </tr>
 <tr>
+<td><a href="#PluginPipxInterface.__activateLeftRightSidebarWidget">__activateLeftRightSidebarWidget</a></td>
+<td>Private method to activate the given widget in the left or right sidebar.</td>
+</tr>
+<tr>
 <td><a href="#PluginPipxInterface.__activateWidget">__activateWidget</a></td>
 <td>Private slot to handle the activation of the MQTT Monitor.</td>
 </tr>
@@ -90,6 +94,10 @@
 <td>Private method to load the translation file.</td>
 </tr>
 <tr>
+<td><a href="#PluginPipxInterface.__setLeftRightSidebarWidgetIcon">__setLeftRightSidebarWidgetIcon</a></td>
+<td>Private method to set the icon of the given widget in the left or right sidebar.</td>
+</tr>
+<tr>
 <td><a href="#PluginPipxInterface.activate">activate</a></td>
 <td>Public method to activate this plug-in.</td>
 </tr>
@@ -131,6 +139,21 @@
 reference to the user interface object
 </dd>
 </dl>
+<a NAME="PluginPipxInterface.__activateLeftRightSidebarWidget" ID="PluginPipxInterface.__activateLeftRightSidebarWidget"></a>
+<h4>PluginPipxInterface.__activateLeftRightSidebarWidget</h4>
+<b>__activateLeftRightSidebarWidget</b>(<i>widget</i>)
+<p>
+        Private method to activate the given widget in the left or right
+        sidebar.
+</p>
+
+<dl>
+
+<dt><i>widget</i> (QWidget)</dt>
+<dd>
+reference to the widget to be activated
+</dd>
+</dl>
 <a NAME="PluginPipxInterface.__activateWidget" ID="PluginPipxInterface.__activateWidget"></a>
 <h4>PluginPipxInterface.__activateWidget</h4>
 <b>__activateWidget</b>(<i></i>)
@@ -152,6 +175,25 @@
         Private method to load the translation file.
 </p>
 
+<a NAME="PluginPipxInterface.__setLeftRightSidebarWidgetIcon" ID="PluginPipxInterface.__setLeftRightSidebarWidgetIcon"></a>
+<h4>PluginPipxInterface.__setLeftRightSidebarWidgetIcon</h4>
+<b>__setLeftRightSidebarWidgetIcon</b>(<i>widget, icon</i>)
+<p>
+        Private method to set the icon of the given widget in the left or right
+        sidebar.
+</p>
+
+<dl>
+
+<dt><i>widget</i> (QWidget)</dt>
+<dd>
+reference to the widget to set the icon for
+</dd>
+<dt><i>icon</i> (QIcon)</dt>
+<dd>
+icon to be set
+</dd>
+</dl>
 <a NAME="PluginPipxInterface.activate" ID="PluginPipxInterface.activate"></a>
 <h4>PluginPipxInterface.activate</h4>
 <b>activate</b>(<i></i>)
--- a/PluginPipxInterface.py	Wed Jul 31 13:32:27 2024 +0200
+++ b/PluginPipxInterface.py	Thu Aug 01 11:09:54 2024 +0200
@@ -36,7 +36,7 @@
     "author": "Detlev Offenbach <detlev@die-offenbachs.de>",
     "autoactivate": True,
     "deactivateable": True,
-    "version": "10.3.0",
+    "version": "10.3.1",
     "className": "PluginPipxInterface",
     "packageName": "PipxInterface",
     "shortDescription": "Graphical interface to the 'pipx' command.",
@@ -257,8 +257,10 @@
             self.__ui.rToolboxDock.show()
             self.__ui.rToolbox.setCurrentWidget(self.__widget)
         elif uiLayoutType == "Sidebars":
-            self.__ui.rightSidebar.show()
-            self.__ui.rightSidebar.setCurrentWidget(self.__widget)
+            try:
+                self.__ui.activateLeftRightSidebarWidget(self.__widget)
+            except AttributeError:
+                self.__activateLeftRightSidebarWidget(self.__widget)
         else:
             self.__widget.show()
         self.__widget.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
@@ -283,13 +285,20 @@
             )
         elif uiLayoutType == "Sidebars":
             iconName = "pipxOutdated96" if outdated else "pipx96"
-            index = self.__ui.rightSidebar.indexOf(self.__widget)
-            self.__ui.rightSidebar.setTabIcon(
-                index,
-                EricPixmapCache.getIcon(
-                    os.path.join("PipxInterface", "icons", iconName)
-                ),
-            )
+            try:
+                self.__ui.setLeftRightSidebarWidgetIcon(
+                    self.__widget,
+                    EricPixmapCache.getIcon(
+                        os.path.join("PipxInterface", "icons", iconName)
+                    ),
+                )
+            except AttributeError:
+                self.__setLeftRightSidebarWidgetIcon(
+                    self.__widget,
+                    EricPixmapCache.getIcon(
+                        os.path.join("PipxInterface", "icons", iconName)
+                    ),
+                )
 
     def getPreferences(self, key):
         """
@@ -336,6 +345,45 @@
         """
         Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value)
 
+    ############################################################################
+    ## Methods for backward compatibility with eric-ide < 24.9
+    ############################################################################
+
+    def __activateLeftRightSidebarWidget(self, widget):
+        """
+        Private method to activate the given widget in the left or right
+        sidebar.
+
+        @param widget reference to the widget to be activated
+        @type QWidget
+        """
+        # This is for backward compatibility with eric-ide < 24.9.
+        sidebar = (
+            self.__ui.leftSidebar
+            if Preferences.getUI("CombinedLeftRightSidebar")
+            else self.__ui.rightSidebar
+        )
+        sidebar.show()
+        sidebar.setCurrentWidget(widget)
+
+    def __setLeftRightSidebarWidgetIcon(self, widget, icon):
+        """
+        Private method to set the icon of the given widget in the left or right
+        sidebar.
+
+        @param widget reference to the widget to set the icon for
+        @type QWidget
+        @param icon icon to be set
+        @type QIcon
+        """
+        sidebar = (
+            self.__ui.leftSidebar
+            if Preferences.getUI("CombinedLeftRightSidebar")
+            else self.__ui.rightSidebar
+        )
+        index = sidebar.indexOf(widget)
+        sidebar.setTabIcon(index, icon)
+
 
 def installDependencies(pipInstall):
     """
Binary file PluginPipxInterface.zip has changed
--- a/changelog.md	Wed Jul 31 13:32:27 2024 +0200
+++ b/changelog.md	Thu Aug 01 11:09:54 2024 +0200
@@ -1,6 +1,12 @@
 ChangeLog
 ---------
 
+__Version 10.3.1__
+
+- Fixed an issue causing an exception on computers with a small screen or when
+  the `Combined Sidebars` option is selected.
+- Updated Russian translations.
+
 __Version 10.3.0__
 
 - Implemented actions to show the dependencies of a package and upgrade them

eric ide

mercurial