Thu, 22 Jul 2021 19:02:32 +0200
Continued implementing support for MQTT v5 user properties.
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
2 | |
84
044df16e55aa
Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
82
diff
changeset
|
3 | # Copyright (c) 2018 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
4 | # |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
5 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
6 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
7 | Module implementing the MQTT Monitor plug-in. |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
8 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
9 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
10 | import os |
10
7e0e921dc7ea
Started to implement the connection options dialog and methods to specify these connection options connecting to the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
11 | import json |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
12 | |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
13 | from PyQt6.QtCore import Qt, QObject, QTranslator, QCoreApplication |
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
14 | from PyQt6.QtGui import QKeySequence |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
15 | |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
16 | from EricWidgets.EricApplication import ericApp |
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
17 | from EricGui.EricAction import EricAction |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
18 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
19 | import UI.PixmapCache |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
20 | import Preferences |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
21 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
22 | # Start-Of-Header |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
23 | name = "MQTT Monitor Plugin" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
24 | author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
25 | autoactivate = True |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
26 | deactivateable = True |
103
5fe4f179975f
Continued implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
102
diff
changeset
|
27 | version = "1.1.0" |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
28 | className = "MqttMonitorPlugin" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
29 | packageName = "MqttMonitor" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
30 | shortDescription = "Plug-in implementing a tool to connect to a MQTT broker" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
31 | longDescription = ( |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
32 | """Plug-in implementing a tool to connect to a MQTT broker, subscribe""" |
41
68f19bd4e61c
Extended the plug-in descriptive text and added some more TODO comments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
30
diff
changeset
|
33 | """ to topics, present received messages and publish messages.""" |
68f19bd4e61c
Extended the plug-in descriptive text and added some more TODO comments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
30
diff
changeset
|
34 | """ It displays broker statistics (the $SYS/# topic tree) and""" |
68f19bd4e61c
Extended the plug-in descriptive text and added some more TODO comments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
30
diff
changeset
|
35 | """ log messages of the underlying paho-mqtt client. This tool""" |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
36 | """ supports unencrypted connections (port 1883) as well as encrypted""" |
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
37 | """ SSL/TLS connections (port 8883).""" |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
38 | ) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
39 | needsRestart = False |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
40 | pyqtApi = 2 |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
41 | # End-Of-Header |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
42 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
43 | error = "" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
44 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
45 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
46 | def exeDisplayData(): |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
47 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
48 | Module function to support the display of some executable info. |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
49 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
50 | @return dictionary containing the data to query the presence of |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
51 | the executable |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
52 | @rtype dict |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
53 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
54 | try: |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
55 | import paho.mqtt |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
56 | version = paho.mqtt.__version__ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
57 | except ImportError: |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
58 | version = QCoreApplication.translate( |
77
a580238d85de
Changed fail message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
75
diff
changeset
|
59 | "MqttMonitorPlugin", "(package not available)") |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
60 | |
78
a22328182bc2
Removed support for Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
77
diff
changeset
|
61 | return { |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
62 | "programEntry": False, |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
63 | "header": QCoreApplication.translate("MqttMonitorPlugin", "MQTT"), |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
64 | "text": QCoreApplication.translate("MqttMonitorPlugin", "paho-mqtt"), |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
65 | "version": version, |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
66 | } |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
67 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
68 | |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
69 | def prepareUninstall(): |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
70 | """ |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
71 | Module function to prepare for an uninstallation. |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
72 | """ |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
73 | Preferences.Prefs.settings.remove(MqttMonitorPlugin.PreferencesKey) |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
74 | |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
75 | |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
76 | class MqttMonitorPlugin(QObject): |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
77 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
78 | Class implementing the MQTT Monitor plug-in. |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
79 | """ |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
80 | PreferencesKey = "MqttMonitor" |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
81 | |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
82 | def __init__(self, ui): |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
83 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
84 | Constructor |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
85 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
86 | @param ui reference to the user interface object |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
87 | @type UI.UserInterface |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
88 | """ |
86
620022b14cb4
Implemented some code simplifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
85
diff
changeset
|
89 | super().__init__(ui) |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
90 | self.__ui = ui |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
91 | self.__initialize() |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
92 | |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
93 | self.__defaults = { |
10
7e0e921dc7ea
Started to implement the connection options dialog and methods to specify these connection options connecting to the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
94 | "RecentBrokersWithPort": "[]", # JSON formatted empty list |
18
bbfe5866b6aa
MqttConnectionProfilesDialog: continued implementing the connections profile dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10
diff
changeset
|
95 | "BrokerProfiles": "{}", # JSON formatted empty dict |
19
889a7c3c0e63
MqttConnectionProfilesDialog: continued implementing the connections profile dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
96 | # __IGNORE_WARNING_M613__ |
30
17ef10819773
Some smaller improvements and added some TODOs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
19
diff
changeset
|
97 | "MostRecentProfile": "", # most recently used profile |
103
5fe4f179975f
Continued implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
102
diff
changeset
|
98 | "PublishProperties": "{}", # JSON formatted empty dict |
5fe4f179975f
Continued implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
102
diff
changeset
|
99 | # __IGNORE_WARNING_M613__ |
102
70b8858199f5
Started implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
95
diff
changeset
|
100 | "SubscribeProperties": "{}", # JSON formatted empty dict |
70b8858199f5
Started implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
95
diff
changeset
|
101 | # __IGNORE_WARNING_M613__ |
103
5fe4f179975f
Continued implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
102
diff
changeset
|
102 | "UnsubscribeProperties": "{}", # JSON formatted empty dict |
102
70b8858199f5
Started implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
95
diff
changeset
|
103 | # __IGNORE_WARNING_M613__ |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
104 | } |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
105 | |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
106 | self.__translator = None |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
107 | self.__loadTranslator() |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
108 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
109 | def __initialize(self): |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
110 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
111 | Private slot to (re)initialize the plugin. |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
112 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
113 | self.__widget = None |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
114 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
115 | def activate(self): |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
116 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
117 | Public method to activate this plug-in. |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
118 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
119 | @return tuple of None and activation status |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
120 | @rtype tuple of (None, bool) |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
121 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
122 | global error |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
123 | error = "" # clear previous error |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
124 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
125 | try: |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
126 | import paho.mqtt # __IGNORE_WARNING__ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
127 | except ImportError: |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
128 | error = self.tr("The 'paho-mqtt' package is not available.") |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
129 | return None, False |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
130 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
131 | from MqttMonitor.MqttMonitorWidget import MqttMonitorWidget |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
132 | |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
133 | usesDarkPalette = ericApp().usesDarkPalette() |
86
620022b14cb4
Implemented some code simplifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
85
diff
changeset
|
134 | iconSuffix = "dark" if usesDarkPalette else "light" |
67
a19699c0e71f
Replaced pixmap icons by vector icons.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
66
diff
changeset
|
135 | |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
136 | self.__widget = MqttMonitorWidget(self, usesDarkPalette) |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
137 | self.__ui.addSideWidget( |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
138 | self.__ui.RightSide, self.__widget, |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
139 | UI.PixmapCache.getIcon( |
67
a19699c0e71f
Replaced pixmap icons by vector icons.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
66
diff
changeset
|
140 | os.path.join("MqttMonitor", "icons", |
a19699c0e71f
Replaced pixmap icons by vector icons.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
66
diff
changeset
|
141 | "mqtt22-{0}".format(iconSuffix))), |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
142 | self.tr("MQTT Monitor")) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
143 | |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
144 | self.__activateAct = EricAction( |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
145 | self.tr('MQTT Monitor'), |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
146 | self.tr('M&QTT Monitor'), |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
147 | QKeySequence(self.tr("Alt+Shift+Q")), |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
148 | 0, self, |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
149 | 'mqtt_monitor_activate') |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
150 | self.__activateAct.setStatusTip(self.tr( |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
151 | "Switch the input focus to the MQTT Monitor window.")) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
152 | self.__activateAct.setWhatsThis(self.tr( |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
153 | """<b>Activate MQTT Monitor</b>""" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
154 | """<p>This switches the input focus to the MQTT Monitor""" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
155 | """ window.</p>""" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
156 | )) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
157 | self.__activateAct.triggered.connect(self.__activateWidget) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
158 | |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
159 | self.__ui.addEricActions([self.__activateAct], 'ui') |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
160 | menu = self.__ui.getMenu("subwindow") |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
161 | menu.addAction(self.__activateAct) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
162 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
163 | return None, True |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
164 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
165 | def deactivate(self): |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
166 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
167 | Public method to deactivate this plug-in. |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
168 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
169 | menu = self.__ui.getMenu("subwindow") |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
170 | menu.removeAction(self.__activateAct) |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
171 | self.__ui.removeEricActions([self.__activateAct], 'ui') |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
172 | self.__ui.removeSideWidget(self.__widget) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
173 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
174 | self.__initialize() |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
175 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
176 | def __loadTranslator(self): |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
177 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
178 | Private method to load the translation file. |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
179 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
180 | if self.__ui is not None: |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
181 | loc = self.__ui.getLocale() |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
182 | if loc and loc != "C": |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
183 | locale_dir = os.path.join( |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
184 | os.path.dirname(__file__), "MqttMonitor", "i18n") |
61
008d32130cdf
PluginMqttMonitor: fixed a typo causing translation files to not being loaded.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
41
diff
changeset
|
185 | translation = "mqttmonitor_{0}".format(loc) |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
186 | translator = QTranslator(None) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
187 | loaded = translator.load(translation, locale_dir) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
188 | if loaded: |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
189 | self.__translator = translator |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
190 | ericApp().installTranslator(self.__translator) |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
191 | else: |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
192 | print("Warning: translation file '{0}' could not be" |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
193 | " loaded.".format(translation)) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
194 | print("Using default.") |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
195 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
196 | def __activateWidget(self): |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
197 | """ |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
198 | Private slot to handle the activation of the MQTT Monitor. |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
199 | """ |
85
1ee3f393af03
Removed support for obsolete eric6 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
84
diff
changeset
|
200 | uiLayoutType = self.__ui.getLayoutType() |
1
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
201 | |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
202 | if uiLayoutType == "Toolboxes": |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
203 | self.__ui.rToolboxDock.show() |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
204 | self.__ui.rToolbox.setCurrentWidget(self.__widget) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
205 | elif uiLayoutType == "Sidebars": |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
206 | self.__ui.rightSidebar.show() |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
207 | self.__ui.rightSidebar.setCurrentWidget(self.__widget) |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
208 | else: |
bf1a17419d44
Added first outline of the MQTT Monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
209 | self.__widget.show() |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
210 | self.__widget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
211 | |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
212 | def getPreferences(self, key): |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
213 | """ |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
214 | Public method to retrieve the various settings. |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
215 | |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
216 | @param key key of the setting |
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
217 | @type str |
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
218 | @return value of the requested setting |
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
219 | @rtype Any |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
220 | """ |
102
70b8858199f5
Started implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
95
diff
changeset
|
221 | if key in ["RecentBrokersWithPort", "BrokerProfiles", |
103
5fe4f179975f
Continued implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
102
diff
changeset
|
222 | "SubscribeProperties", "UnsubscribeProperties", |
5fe4f179975f
Continued implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
102
diff
changeset
|
223 | "PublishProperties"]: |
10
7e0e921dc7ea
Started to implement the connection options dialog and methods to specify these connection options connecting to the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
224 | return json.loads(Preferences.Prefs.settings.value( |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
225 | self.PreferencesKey + "/" + key, self.__defaults[key])) |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
226 | else: |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
227 | return Preferences.Prefs.settings.value( |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
228 | self.PreferencesKey + "/" + key, self.__defaults[key]) |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
229 | |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
230 | def setPreferences(self, key, value): |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
231 | """ |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
232 | Public method to store the various settings. |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
233 | |
92
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
234 | @param key key of the setting to be set |
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
235 | @type str |
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
236 | @param value value to be set |
2fb5c08019fd
Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
88
diff
changeset
|
237 | @type Any |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
238 | """ |
102
70b8858199f5
Started implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
95
diff
changeset
|
239 | if key in ["RecentBrokersWithPort", "BrokerProfiles", |
103
5fe4f179975f
Continued implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
102
diff
changeset
|
240 | "SubscribeProperties", "UnsubscribeProperties", |
5fe4f179975f
Continued implementing support for MQTT v5 user properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
102
diff
changeset
|
241 | "PublishProperties"]: |
10
7e0e921dc7ea
Started to implement the connection options dialog and methods to specify these connection options connecting to the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
242 | Preferences.Prefs.settings.setValue( |
7e0e921dc7ea
Started to implement the connection options dialog and methods to specify these connection options connecting to the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
243 | self.PreferencesKey + "/" + key, json.dumps(value)) |
7e0e921dc7ea
Started to implement the connection options dialog and methods to specify these connection options connecting to the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
244 | else: |
7e0e921dc7ea
Started to implement the connection options dialog and methods to specify these connection options connecting to the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
245 | Preferences.Prefs.settings.setValue( |
7e0e921dc7ea
Started to implement the connection options dialog and methods to specify these connection options connecting to the server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
246 | self.PreferencesKey + "/" + key, value) |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
247 | |
88
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
248 | |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
249 | def installDependencies(pipInstall): |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
250 | """ |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
251 | Function to install dependencies of this plug-in. |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
252 | |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
253 | @param pipInstall function to be called with a list of package names. |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
254 | @type function |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
255 | """ |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
256 | try: |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
257 | import paho.mqtt # __IGNORE_WARNING__ |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
258 | except ImportError: |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
259 | pipInstall(["paho-mqtt"]) |
59323cbabb7e
Added code to install the 'paho-mqtt' library as a plug-in dependency (eric > 21.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
86
diff
changeset
|
260 | |
3
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
261 | # |
82845c0fd550
Fixed some code style issues and implemented the broker connect/disconnect group of the MqttMonitorWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
262 | # eflag: noqa = M801 |