MqttMonitor/MqttConnectionProfilesDialog.py

changeset 86
620022b14cb4
parent 84
044df16e55aa
child 92
2fb5c08019fd
--- a/MqttMonitor/MqttConnectionProfilesDialog.py	Sun Apr 25 17:41:32 2021 +0200
+++ b/MqttMonitor/MqttConnectionProfilesDialog.py	Sun Apr 25 17:57:07 2021 +0200
@@ -44,7 +44,7 @@
         @param parent reference to the parent widget
         @type QWidget
         """
-        super(MqttConnectionProfilesDialog, self).__init__(parent)
+        super().__init__(parent)
         self.setupUi(self)
         
         self.__client = client
@@ -127,18 +127,21 @@
         self.minusButton.setEnabled(current is not None)
         self.copyButton.setEnabled(current is not None)
         
-        if current is not previous:
-            if not self.__deletingProfile and self.__isChangedProfile():
-                # modified profile belongs to previous
-                yes = E5MessageBox.yesNo(
-                    self,
-                    self.tr("Changed Connection Profile"),
-                    self.tr("""The current profile has unsaved changes."""
-                            """ Shall these be saved?"""),
-                    icon=E5MessageBox.Warning,
-                    yesDefault=True)
-                if yes:
-                    self.__applyProfile()
+        if (
+            current is not previous and
+            not self.__deletingProfile and
+            self.__isChangedProfile()
+        ):
+            # modified profile belongs to previous
+            yes = E5MessageBox.yesNo(
+                self,
+                self.tr("Changed Connection Profile"),
+                self.tr("""The current profile has unsaved changes."""
+                        """ Shall these be saved?"""),
+                icon=E5MessageBox.Warning,
+                yesDefault=True)
+            if yes:
+                self.__applyProfile()
         
         if current:
             profileName = current.text()
@@ -472,16 +475,16 @@
                   bool(self.brokerAddressEdit.text()))
         
         # condition 2: if client ID is empty, clean session must be selected
-        if not self.__populatingProfile:
-            if (
-                self.clientIdEdit.text() == "" and
-                not self.cleanSessionCheckBox.isChecked()
-            ):
-                enable = False
-                E5MessageBox.critical(
-                    self,
-                    self.tr("Invalid Connection Parameters"),
-                    self.tr("An empty Client ID requires a clean session."))
+        if (
+            not self.__populatingProfile and
+            self.clientIdEdit.text() == "" and
+            not self.cleanSessionCheckBox.isChecked()
+        ):
+            enable = False
+            E5MessageBox.critical(
+                self,
+                self.tr("Invalid Connection Parameters"),
+                self.tr("An empty Client ID requires a clean session."))
         
         if self.tlsGroupBox.isChecked():
             if self.tlsCertsFileButton.isChecked():
@@ -680,12 +683,12 @@
                     E5MessageBox.Save),
                 E5MessageBox.Save)
             if button == E5MessageBox.Save:
-                super(MqttConnectionProfilesDialog, self).accept()
+                super().accept()
                 return
             elif button == E5MessageBox.Abort:
                 return
         
-        super(MqttConnectionProfilesDialog, self).reject()
+        super().reject()
     
     @pyqtSlot()
     def accept(self):
@@ -703,4 +706,4 @@
             if yes:
                 self.__applyProfile()
         
-        super(MqttConnectionProfilesDialog, self).accept()
+        super().accept()

eric ide

mercurial