MqttMonitor/MqttMonitorWidget.py

changeset 67
a19699c0e71f
parent 66
9297e94d7d77
child 78
a22328182bc2
equal deleted inserted replaced
66:9297e94d7d77 67:a19699c0e71f
39 """ 39 """
40 BrokerStatusTopicPrefix = "$SYS/broker/" 40 BrokerStatusTopicPrefix = "$SYS/broker/"
41 BrokerStatusTopic = "$SYS/broker/#" 41 BrokerStatusTopic = "$SYS/broker/#"
42 BrokerStatusTopicLoadPrefix = "$SYS/broker/load/" 42 BrokerStatusTopicLoadPrefix = "$SYS/broker/load/"
43 43
44 def __init__(self, plugin, parent=None): 44 def __init__(self, plugin, iconSuffix, parent=None):
45 """ 45 """
46 Constructor 46 Constructor
47 47
48 @param plugin reference to the plug-in object 48 @param plugin reference to the plug-in object
49 @type MqttMonitorPlugin 49 @type MqttMonitorPlugin
50 @param iconSuffix suffix for the icons
51 @type str
50 @param parent reference to the parent widget 52 @param parent reference to the parent widget
51 @type QWidget 53 @type QWidget
52 """ 54 """
53 super(MqttMonitorWidget, self).__init__(parent) 55 super(MqttMonitorWidget, self).__init__(parent)
54 self.setupUi(self) 56 self.setupUi(self)
55 57
56 self.__plugin = plugin 58 self.__plugin = plugin
59 self.__iconSuffix = iconSuffix
57 60
58 self.__connectedToBroker = False 61 self.__connectedToBroker = False
59 self.__brokerStatusTopicSubscribed = False 62 self.__brokerStatusTopicSubscribed = False
60 63
61 self.pixmapLabel.setPixmap(UI.PixmapCache.getPixmap( 64 self.pixmapLabel.setPixmap(UI.PixmapCache.getPixmap(
62 os.path.join("MqttMonitor", "icons", "mqtt48.png"))) 65 os.path.join("MqttMonitor", "icons",
66 "mqtt48-{0}".format(self.__iconSuffix))
67 ))
63 68
64 self.publishPayloadFilePicker.setMode(E5PathPickerModes.OpenFileMode) 69 self.publishPayloadFilePicker.setMode(E5PathPickerModes.OpenFileMode)
65 self.publishPayloadFilePicker.setFilters(self.tr("All Files (*)")) 70 self.publishPayloadFilePicker.setFilters(self.tr("All Files (*)"))
66 71
67 self.__messagesFormat = self.messagesEdit.currentCharFormat() 72 self.__messagesFormat = self.messagesEdit.currentCharFormat()
113 self.__setConnectionMode(True) # initial mode is 'profile connection' 118 self.__setConnectionMode(True) # initial mode is 'profile connection'
114 self.__populateProfileComboBox() 119 self.__populateProfileComboBox()
115 120
116 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect.png")) 121 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect.png"))
117 self.brokerConnectionOptionsButton.setIcon(UI.PixmapCache.getIcon( 122 self.brokerConnectionOptionsButton.setIcon(UI.PixmapCache.getIcon(
118 os.path.join("MqttMonitor", "icons", "connectionOptions.png"))) 123 os.path.join("MqttMonitor", "icons",
124 "connectionOptions-{0}".format(self.__iconSuffix))
125 ))
119 self.__populateBrokerComboBoxes() 126 self.__populateBrokerComboBoxes()
120 self.brokerStatusLabel.hide() 127 self.brokerStatusLabel.hide()
121 128
122 self.subscribeButton.setIcon(UI.PixmapCache.getIcon("plus.png")) 129 self.subscribeButton.setIcon(UI.PixmapCache.getIcon("plus.png"))
123 self.subscribeButton.setEnabled(False) 130 self.subscribeButton.setEnabled(False)
985 @type bool 992 @type bool
986 """ 993 """
987 self.__connectionModeProfile = profileMode 994 self.__connectionModeProfile = profileMode
988 if profileMode: 995 if profileMode:
989 self.modeButton.setIcon(UI.PixmapCache.getIcon( 996 self.modeButton.setIcon(UI.PixmapCache.getIcon(
990 os.path.join("MqttMonitor", "icons", "profiles.png"))) 997 os.path.join("MqttMonitor", "icons",
998 "profiles-{0}".format(self.__iconSuffix))
999 ))
991 else: 1000 else:
992 self.modeButton.setIcon(UI.PixmapCache.getIcon( 1001 self.modeButton.setIcon(UI.PixmapCache.getIcon(
993 os.path.join("MqttMonitor", "icons", "quickopen.png"))) 1002 os.path.join("MqttMonitor", "icons",
1003 "quickopen-{0}".format(self.__iconSuffix))
1004 ))
994 1005
995 self.profileComboBox.setVisible(profileMode) 1006 self.profileComboBox.setVisible(profileMode)
996 self.brokerConnectionWidget.setVisible(not profileMode) 1007 self.brokerConnectionWidget.setVisible(not profileMode)
997 self.__setConnectButtonState() 1008 self.__setConnectButtonState()
998 1009

eric ide

mercurial