PluginMqttMonitor.py

branch
eric7
changeset 145
3f8e91170c37
parent 143
51bc5bcc672a
child 148
187406bcc8ae
diff -r 48501744f7d0 -r 3f8e91170c37 PluginMqttMonitor.py
--- a/PluginMqttMonitor.py	Fri Apr 19 15:15:28 2024 +0200
+++ b/PluginMqttMonitor.py	Thu Aug 01 11:14:29 2024 +0200
@@ -39,7 +39,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "11.0.0"
+version = "11.0.1"
 className = "MqttMonitorPlugin"
 packageName = "MqttMonitor"
 shortDescription = "Plug-in implementing a tool to connect to a MQTT broker"
@@ -280,8 +280,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)
@@ -354,6 +356,27 @@
         else:
             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 installDependencies(pipInstall):
     """

eric ide

mercurial