PluginMqttMonitor.py

branch
eric7
changeset 145
3f8e91170c37
parent 143
51bc5bcc672a
child 148
187406bcc8ae
equal deleted inserted replaced
144:48501744f7d0 145:3f8e91170c37
37 # Start-Of-Header 37 # Start-Of-Header
38 name = "MQTT Monitor Plugin" 38 name = "MQTT Monitor Plugin"
39 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 39 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
40 autoactivate = True 40 autoactivate = True
41 deactivateable = True 41 deactivateable = True
42 version = "11.0.0" 42 version = "11.0.1"
43 className = "MqttMonitorPlugin" 43 className = "MqttMonitorPlugin"
44 packageName = "MqttMonitor" 44 packageName = "MqttMonitor"
45 shortDescription = "Plug-in implementing a tool to connect to a MQTT broker" 45 shortDescription = "Plug-in implementing a tool to connect to a MQTT broker"
46 longDescription = ( 46 longDescription = (
47 """Plug-in implementing a tool to connect to a MQTT broker, subscribe""" 47 """Plug-in implementing a tool to connect to a MQTT broker, subscribe"""
278 278
279 if uiLayoutType == "Toolboxes": 279 if uiLayoutType == "Toolboxes":
280 self.__ui.rToolboxDock.show() 280 self.__ui.rToolboxDock.show()
281 self.__ui.rToolbox.setCurrentWidget(self.__widget) 281 self.__ui.rToolbox.setCurrentWidget(self.__widget)
282 elif uiLayoutType == "Sidebars": 282 elif uiLayoutType == "Sidebars":
283 self.__ui.rightSidebar.show() 283 try:
284 self.__ui.rightSidebar.setCurrentWidget(self.__widget) 284 self.__ui.activateLeftRightSidebarWidget(self.__widget)
285 except AttributeError:
286 self.__activateLeftRightSidebarWidget(self.__widget)
285 else: 287 else:
286 self.__widget.show() 288 self.__widget.show()
287 self.__widget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) 289 self.__widget.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
288 290
289 def getPreferences(self, key): 291 def getPreferences(self, key):
352 self.PreferencesKey + "/" + key, int(value) 354 self.PreferencesKey + "/" + key, int(value)
353 ) 355 )
354 else: 356 else:
355 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value) 357 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value)
356 358
359 ############################################################################
360 ## Methods for backward compatibility with eric-ide < 24.9
361 ############################################################################
362
363 def __activateLeftRightSidebarWidget(self, widget):
364 """
365 Private method to activate the given widget in the left or right
366 sidebar.
367
368 @param widget reference to the widget to be activated
369 @type QWidget
370 """
371 # This is for backward compatibility with eric-ide < 24.9.
372 sidebar = (
373 self.__ui.leftSidebar
374 if Preferences.getUI("CombinedLeftRightSidebar")
375 else self.__ui.rightSidebar
376 )
377 sidebar.show()
378 sidebar.setCurrentWidget(widget)
379
357 380
358 def installDependencies(pipInstall): 381 def installDependencies(pipInstall):
359 """ 382 """
360 Function to install dependencies of this plug-in. 383 Function to install dependencies of this plug-in.
361 384

eric ide

mercurial