24 from E5Gui import E5MessageBox, E5FileDialog |
18 from E5Gui import E5MessageBox, E5FileDialog |
25 from E5Gui.E5PathPicker import E5PathPickerModes |
19 from E5Gui.E5PathPicker import E5PathPickerModes |
26 |
20 |
27 from .Ui_MqttMonitorWidget import Ui_MqttMonitorWidget |
21 from .Ui_MqttMonitorWidget import Ui_MqttMonitorWidget |
28 |
22 |
29 from .MqttClient import MqttClient, mqttConnackMessage, mqttErrorMessage, \ |
23 from .MqttClient import ( |
30 mqttLogLevelString |
24 MqttClient, mqttConnackMessage, mqttErrorMessage, mqttLogLevelString |
|
25 ) |
31 |
26 |
32 import UI.PixmapCache |
27 import UI.PixmapCache |
33 import Utilities |
28 import Utilities |
34 |
29 |
35 |
30 |
443 """ |
438 """ |
444 Private slot to show a dialog to modify connection options or a |
439 Private slot to show a dialog to modify connection options or a |
445 dialog to edit connection profiles. |
440 dialog to edit connection profiles. |
446 """ |
441 """ |
447 if self.__connectionModeProfile: |
442 if self.__connectionModeProfile: |
448 from .MqttConnectionProfilesDialog import \ |
443 from .MqttConnectionProfilesDialog import ( |
449 MqttConnectionProfilesDialog |
444 MqttConnectionProfilesDialog |
|
445 ) |
450 dlg = MqttConnectionProfilesDialog( |
446 dlg = MqttConnectionProfilesDialog( |
451 self.__client, self.__plugin.getPreferences("BrokerProfiles"), |
447 self.__client, self.__plugin.getPreferences("BrokerProfiles"), |
452 parent=self) |
448 parent=self) |
453 if dlg.exec_() == QDialog.Accepted: |
449 if dlg.exec_() == QDialog.Accepted: |
454 profilesDict = dlg.getProfiles() |
450 profilesDict = dlg.getProfiles() |
455 self.__plugin.setPreferences("BrokerProfiles", profilesDict) |
451 self.__plugin.setPreferences("BrokerProfiles", profilesDict) |
456 self.__populateProfileComboBox() |
452 self.__populateProfileComboBox() |
457 else: |
453 else: |
458 from .MqttConnectionOptionsDialog import \ |
454 from .MqttConnectionOptionsDialog import ( |
459 MqttConnectionOptionsDialog |
455 MqttConnectionOptionsDialog |
|
456 ) |
460 dlg = MqttConnectionOptionsDialog( |
457 dlg = MqttConnectionOptionsDialog( |
461 self.__client, self.__connectionOptions, parent=self) |
458 self.__client, self.__connectionOptions, parent=self) |
462 if dlg.exec_() == QDialog.Accepted: |
459 if dlg.exec_() == QDialog.Accepted: |
463 self.__connectionOptions = dlg.getConnectionOptions() |
460 self.__connectionOptions = dlg.getConnectionOptions() |
464 if self.__connectionOptions["TlsEnable"]: |
461 if self.__connectionOptions["TlsEnable"]: |
558 """ |
555 """ |
559 topic = self.publishTopicComboBox.currentText() |
556 topic = self.publishTopicComboBox.currentText() |
560 qos = self.publishQosSpinBox.value() |
557 qos = self.publishQosSpinBox.value() |
561 retain = self.publishRetainCheckBox.isChecked() |
558 retain = self.publishRetainCheckBox.isChecked() |
562 payloadFile = self.publishPayloadFilePicker.text() |
559 payloadFile = self.publishPayloadFilePicker.text() |
563 if bool(payloadFile) and os.path.exists(payloadFile) and \ |
560 if ( |
564 os.path.getsize(payloadFile) <= 268435455: |
561 bool(payloadFile) and |
|
562 os.path.exists(payloadFile) and |
|
563 os.path.getsize(payloadFile) <= 268435455 |
|
564 ): |
565 # payload size limit is 268,435,455 bytes |
565 # payload size limit is 268,435,455 bytes |
566 try: |
566 try: |
567 f = open(payloadFile, "rb") |
567 f = open(payloadFile, "rb") |
568 payloadStr = f.read() |
568 payloadStr = f.read() |
569 f.close() |
569 f.close() |