--- a/MqttMonitor/MqttConnectionOptionsDialog.py Sat Sep 01 20:18:11 2018 +0200 +++ b/MqttMonitor/MqttConnectionOptionsDialog.py Sun Sep 02 18:29:35 2018 +0200 @@ -1,12 +1,15 @@ # -*- coding: utf-8 -*- +# Copyright (c) 2018 Detlev Offenbach <detlev@die-offenbachs.de> +# + """ Module implementing a dialog to enter MQTT connection options. """ from __future__ import unicode_literals -from PyQt5.QtCore import pyqtSlot +from PyQt5.QtCore import pyqtSlot, QUuid from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton from .Ui_MqttConnectionOptionsDialog import Ui_MqttConnectionOptionsDialog @@ -23,7 +26,9 @@ @param client reference to the MQTT client object @type MqttClient @param options dictionary containing the connection options to - populate the dialog with + populate the dialog with. It must have the keys "ClientId", + "Keepalive", "CleanSession", "Username", "Password", "WillTopic", + "WillMessage", "WillQos", "WillRetain". @@type dict @param parent reference to the parent widget @type QWidget @@ -34,7 +39,14 @@ self.__client = client self.__populateDefaults(options=options) - + + @pyqtSlot() + def on_generateIdButton_clicked(self): + """ + Private slot to generate a client ID. + """ + uuid = QUuid.createUuid() + self.clientIdEdit.setText(uuid.toString(QUuid.WithoutBraces)) @pyqtSlot(QAbstractButton) def on_buttonBox_clicked(self, button): @@ -53,6 +65,12 @@ If no options dictionary is given, the dialog will be populated with default values. + + @param options dictionary containing the connection options to populate + the dialog with. It must have the keys "ClientId", "Keepalive", + "CleanSession", "Username", "Password", "WillTopic", "WillMessage", + "WillQos", "WillRetain". + @type dict """ if options is None: options = self.__client.defaultConnectionOptions() @@ -78,7 +96,7 @@ @return dictionary containing the connection options. It has the keys "ClientId", "Keepalive", "CleanSession", "Username", "Password", - "WillTopic", "WillMessage", "WillQos", "WillRetain" + "WillTopic", "WillMessage", "WillQos", "WillRetain". @rtype tuple of (int, dict) """ return {