MqttMonitor/MqttMonitorWidget.py

changeset 67
a19699c0e71f
parent 66
9297e94d7d77
child 78
a22328182bc2
--- a/MqttMonitor/MqttMonitorWidget.py	Wed Jan 01 11:58:55 2020 +0100
+++ b/MqttMonitor/MqttMonitorWidget.py	Tue Apr 07 19:30:20 2020 +0200
@@ -41,12 +41,14 @@
     BrokerStatusTopic = "$SYS/broker/#"
     BrokerStatusTopicLoadPrefix = "$SYS/broker/load/"
     
-    def __init__(self, plugin, parent=None):
+    def __init__(self, plugin, iconSuffix, parent=None):
         """
         Constructor
         
         @param plugin reference to the plug-in object
         @type MqttMonitorPlugin
+        @param iconSuffix suffix for the icons
+        @type str
         @param parent reference to the parent widget
         @type QWidget
         """
@@ -54,12 +56,15 @@
         self.setupUi(self)
         
         self.__plugin = plugin
+        self.__iconSuffix = iconSuffix
         
         self.__connectedToBroker = False
         self.__brokerStatusTopicSubscribed = False
         
         self.pixmapLabel.setPixmap(UI.PixmapCache.getPixmap(
-            os.path.join("MqttMonitor", "icons", "mqtt48.png")))
+            os.path.join("MqttMonitor", "icons",
+                         "mqtt48-{0}".format(self.__iconSuffix))
+        ))
         
         self.publishPayloadFilePicker.setMode(E5PathPickerModes.OpenFileMode)
         self.publishPayloadFilePicker.setFilters(self.tr("All Files (*)"))
@@ -115,7 +120,9 @@
         
         self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect.png"))
         self.brokerConnectionOptionsButton.setIcon(UI.PixmapCache.getIcon(
-            os.path.join("MqttMonitor", "icons", "connectionOptions.png")))
+            os.path.join("MqttMonitor", "icons",
+                         "connectionOptions-{0}".format(self.__iconSuffix))
+        ))
         self.__populateBrokerComboBoxes()
         self.brokerStatusLabel.hide()
         
@@ -987,10 +994,14 @@
         self.__connectionModeProfile = profileMode
         if profileMode:
             self.modeButton.setIcon(UI.PixmapCache.getIcon(
-                os.path.join("MqttMonitor", "icons", "profiles.png")))
+                os.path.join("MqttMonitor", "icons",
+                             "profiles-{0}".format(self.__iconSuffix))
+            ))
         else:
             self.modeButton.setIcon(UI.PixmapCache.getIcon(
-                os.path.join("MqttMonitor", "icons", "quickopen.png")))
+                os.path.join("MqttMonitor", "icons",
+                             "quickopen-{0}".format(self.__iconSuffix))
+            ))
         
         self.profileComboBox.setVisible(profileMode)
         self.brokerConnectionWidget.setVisible(not profileMode)

eric ide

mercurial