PluginMqttMonitor.py

changeset 78
a22328182bc2
parent 77
a580238d85de
child 80
5e3f1c5c293e
equal deleted inserted replaced
77:a580238d85de 78:a22328182bc2
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the MQTT Monitor plug-in. 7 Module implementing the MQTT Monitor plug-in.
8 """ 8 """
9
10 from __future__ import unicode_literals
11 9
12 import os 10 import os
13 import json 11 import json
14 12
15 from PyQt5.QtCore import Qt, QObject, QTranslator, QCoreApplication 13 from PyQt5.QtCore import Qt, QObject, QTranslator, QCoreApplication
24 # Start-Of-Header 22 # Start-Of-Header
25 name = "MQTT Monitor Plugin" 23 name = "MQTT Monitor Plugin"
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 24 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
27 autoactivate = True 25 autoactivate = True
28 deactivateable = True 26 deactivateable = True
29 version = "1.2.3" 27 version = "2.0.0"
30 className = "MqttMonitorPlugin" 28 className = "MqttMonitorPlugin"
31 packageName = "MqttMonitor" 29 packageName = "MqttMonitor"
32 shortDescription = "Plug-in implementing a tool to connect to a MQTT broker" 30 shortDescription = "Plug-in implementing a tool to connect to a MQTT broker"
33 longDescription = ( 31 longDescription = (
34 """Plug-in implementing a tool to connect to a MQTT broker, subscribe""" 32 """Plug-in implementing a tool to connect to a MQTT broker, subscribe"""
39 """ SSL/TLS connections (port 8883)\n\n""" 37 """ SSL/TLS connections (port 8883)\n\n"""
40 """Note: The paho-mqtt Python package must be installed.""" 38 """Note: The paho-mqtt Python package must be installed."""
41 ) 39 )
42 needsRestart = False 40 needsRestart = False
43 pyqtApi = 2 41 pyqtApi = 2
44 python2Compatible = True
45 # End-Of-Header 42 # End-Of-Header
46 43
47 error = "" 44 error = ""
48 45
49 46
60 version = paho.mqtt.__version__ 57 version = paho.mqtt.__version__
61 except ImportError: 58 except ImportError:
62 version = QCoreApplication.translate( 59 version = QCoreApplication.translate(
63 "MqttMonitorPlugin", "(package not available)") 60 "MqttMonitorPlugin", "(package not available)")
64 61
65 data = { 62 return {
66 "programEntry": False, 63 "programEntry": False,
67 "header": QCoreApplication.translate("MqttMonitorPlugin", "MQTT"), 64 "header": QCoreApplication.translate("MqttMonitorPlugin", "MQTT"),
68 "text": QCoreApplication.translate("MqttMonitorPlugin", "paho-mqtt"), 65 "text": QCoreApplication.translate("MqttMonitorPlugin", "paho-mqtt"),
69 "version": version, 66 "version": version,
70 } 67 }
71
72 return data
73 68
74 69
75 def prepareUninstall(): 70 def prepareUninstall():
76 """ 71 """
77 Module function to prepare for an uninstallation. 72 Module function to prepare for an uninstallation.
136 from PyQt5.QtGui import QPalette 131 from PyQt5.QtGui import QPalette
137 palette = e5App().palette() 132 palette = e5App().palette()
138 lightness = palette.color(QPalette.Window).lightness() 133 lightness = palette.color(QPalette.Window).lightness()
139 usesDarkPalette = lightness <= 128 134 usesDarkPalette = lightness <= 128
140 if usesDarkPalette: 135 if usesDarkPalette:
141 iconSuffix = "dark" 136 iconSuffix = "dark"
142 else: 137 else:
143 iconSuffix = "light" 138 iconSuffix = "light"
144 139
145 self.__widget = MqttMonitorWidget(self, iconSuffix) 140 self.__widget = MqttMonitorWidget(self, iconSuffix)
146 self.__ui.addSideWidget( 141 self.__ui.addSideWidget(

eric ide

mercurial