MqttConnectionProfilesDialog: started to implement the connections profile dialog. connection_profiles

Mon, 03 Sep 2018 19:57:59 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 03 Sep 2018 19:57:59 +0200
branch
connection_profiles
changeset 17
ee738a0efe9c
parent 16
308db08d66e2
child 18
bbfe5866b6aa

MqttConnectionProfilesDialog: started to implement the connections profile dialog.

MqttMonitor/MqttConnectionOptionsDialog.ui file | annotate | diff | comparison | revisions
MqttMonitor/MqttConnectionProfilesDialog.py file | annotate | diff | comparison | revisions
MqttMonitor/MqttConnectionProfilesDialog.ui file | annotate | diff | comparison | revisions
PluginMqttMonitor.e4p file | annotate | diff | comparison | revisions
--- a/MqttMonitor/MqttConnectionOptionsDialog.ui	Mon Sep 03 18:54:52 2018 +0200
+++ b/MqttMonitor/MqttConnectionOptionsDialog.ui	Mon Sep 03 19:57:59 2018 +0200
@@ -92,6 +92,9 @@
       </item>
       <item row="2" column="0" colspan="3">
        <widget class="QCheckBox" name="cleanSessionCheckBox">
+        <property name="toolTip">
+         <string>Select to start with a clean session</string>
+        </property>
         <property name="text">
          <string>Clean Session</string>
         </property>
@@ -147,7 +150,7 @@
      </property>
      <layout class="QGridLayout" name="gridLayout_3">
       <item row="0" column="0">
-       <widget class="QLineEdit" name="willTopicEdit">
+       <widget class="E5ClearableLineEdit" name="willTopicEdit">
         <property name="toolTip">
          <string>Enter the topic of the last will</string>
         </property>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MqttMonitor/MqttConnectionProfilesDialog.py	Mon Sep 03 19:57:59 2018 +0200
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2018 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to edit the MQTT connection profiles.
+"""
+
+from __future__ import unicode_literals
+
+from PyQt5.QtCore import pyqtSlot
+from PyQt5.QtWidgets import QDialog, QAbstractButton, QListWidgetItem
+
+from .Ui_MqttConnectionProfilesDialog import Ui_MqttConnectionProfilesDialog
+
+
+class MqttConnectionProfilesDialog(QDialog, Ui_MqttConnectionProfilesDialog):
+    """
+    Class implementing a dialog to edit the MQTT connection profiles.
+    """
+    def __init__(self, parent=None):
+        """
+        Constructor
+        
+        @param parent reference to the parent widget
+        @type QWidget
+        """
+        super(MqttConnectionProfilesDialog, self).__init__(parent)
+        self.setupUi(self)
+    
+    @pyqtSlot(str)
+    def on_profileEdit_textChanged(self, p0):
+        """
+        Slot documentation goes here.
+        
+        @param p0 DESCRIPTION
+        @type str
+        """
+        # TODO: not implemented yet
+        raise NotImplementedError
+    
+    @pyqtSlot(QAbstractButton)
+    def on_profileButtonBox_clicked(self, button):
+        """
+        Slot documentation goes here.
+        
+        @param button DESCRIPTION
+        @type QAbstractButton
+        """
+        # TODO: not implemented yet
+        raise NotImplementedError
+    
+    @pyqtSlot(QListWidgetItem, QListWidgetItem)
+    def on_profilesList_currentItemChanged(self, current, previous):
+        """
+        Slot documentation goes here.
+        
+        @param current DESCRIPTION
+        @type QListWidgetItem
+        @param previous DESCRIPTION
+        @type QListWidgetItem
+        """
+        # TODO: not implemented yet
+        raise NotImplementedError
+    
+    @pyqtSlot()
+    def on_plusButton_clicked(self):
+        """
+        Slot documentation goes here.
+        """
+        # TODO: not implemented yet
+        raise NotImplementedError
+    
+    @pyqtSlot()
+    def on_minusButton_clicked(self):
+        """
+        Slot documentation goes here.
+        """
+        # TODO: not implemented yet
+        raise NotImplementedError
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MqttMonitor/MqttConnectionProfilesDialog.ui	Mon Sep 03 19:57:59 2018 +0200
@@ -0,0 +1,466 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MqttConnectionProfilesDialog</class>
+ <widget class="QDialog" name="MqttConnectionProfilesDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MQTT Connection Profiles</string>
+  </property>
+  <property name="sizeGripEnabled">
+   <bool>true</bool>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QSplitter" name="splitter">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="childrenCollapsible">
+      <bool>false</bool>
+     </property>
+     <widget class="QFrame" name="profileListFrame">
+      <property name="frameShape">
+       <enum>QFrame::StyledPanel</enum>
+      </property>
+      <property name="frameShadow">
+       <enum>QFrame::Raised</enum>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QListWidget" name="profilesList">
+         <property name="alternatingRowColors">
+          <bool>true</bool>
+         </property>
+         <property name="sortingEnabled">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QToolButton" name="plusButton">
+           <property name="toolTip">
+            <string>Press to add a new profile</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="minusButton">
+           <property name="toolTip">
+            <string>Press to delete the selected profile</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QFrame" name="profileFrame">
+      <property name="frameShape">
+       <enum>QFrame::StyledPanel</enum>
+      </property>
+      <property name="frameShadow">
+       <enum>QFrame::Raised</enum>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <layout class="QGridLayout" name="gridLayout">
+         <item row="0" column="0">
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>Profile Name:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="E5ClearableLineEdit" name="profileEdit">
+           <property name="toolTip">
+            <string>Enter the name of the profile</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0" colspan="2">
+          <widget class="Line" name="line">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0">
+          <widget class="QLabel" name="label_2">
+           <property name="text">
+            <string>Broker Address:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1">
+          <widget class="E5ClearableLineEdit" name="brokerAddressEdit">
+           <property name="toolTip">
+            <string>Enter the broker server address</string>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="0">
+          <widget class="QLabel" name="label_3">
+           <property name="text">
+            <string>Broker Port:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="1">
+          <layout class="QHBoxLayout" name="horizontalLayout_2">
+           <item>
+            <widget class="QSpinBox" name="brokerPortSpinBox">
+             <property name="toolTip">
+              <string>Enter the broker port number (default 1883)</string>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+             </property>
+             <property name="maximum">
+              <number>65535</number>
+             </property>
+             <property name="value">
+              <number>1883</number>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <spacer name="horizontalSpacer_2">
+             <property name="orientation">
+              <enum>Qt::Horizontal</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>318</width>
+               <height>20</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+          </layout>
+         </item>
+         <item row="4" column="0">
+          <widget class="QLabel" name="label_4">
+           <property name="text">
+            <string>Client ID:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="1">
+          <layout class="QHBoxLayout" name="horizontalLayout_3">
+           <item>
+            <widget class="E5ClearableLineEdit" name="clientIdEdit">
+             <property name="toolTip">
+              <string>Enter the ID string for this client</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QPushButton" name="generateIdButton">
+             <property name="toolTip">
+              <string>Press to generate a client ID</string>
+             </property>
+             <property name="text">
+              <string>Generate</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+         <item row="5" column="0" colspan="2">
+          <widget class="Line" name="line_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QTabWidget" name="tabWidget">
+         <property name="currentIndex">
+          <number>0</number>
+         </property>
+         <widget class="QWidget" name="generalTab">
+          <attribute name="title">
+           <string>General</string>
+          </attribute>
+          <layout class="QGridLayout" name="gridLayout_2">
+           <item row="0" column="0">
+            <widget class="QLabel" name="label_5">
+             <property name="text">
+              <string>Keep Alive Interval:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <layout class="QHBoxLayout" name="horizontalLayout_4">
+             <item>
+              <widget class="QSpinBox" name="keepaliveSpinBox">
+               <property name="toolTip">
+                <string>Enter the keep alive interval in seconds</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+               </property>
+               <property name="suffix">
+                <string> s</string>
+               </property>
+               <property name="maximum">
+                <number>300</number>
+               </property>
+               <property name="singleStep">
+                <number>5</number>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <spacer name="horizontalSpacer_3">
+               <property name="orientation">
+                <enum>Qt::Horizontal</enum>
+               </property>
+               <property name="sizeHint" stdset="0">
+                <size>
+                 <width>148</width>
+                 <height>20</height>
+                </size>
+               </property>
+              </spacer>
+             </item>
+            </layout>
+           </item>
+           <item row="1" column="0" colspan="2">
+            <widget class="QCheckBox" name="cleanSessionCheckBox">
+             <property name="toolTip">
+              <string>Select to start with a clean session</string>
+             </property>
+             <property name="text">
+              <string>Clean Session</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="1">
+            <spacer name="verticalSpacer">
+             <property name="orientation">
+              <enum>Qt::Vertical</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>20</width>
+               <height>227</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="credentialsTab">
+          <attribute name="title">
+           <string>User Credentials</string>
+          </attribute>
+          <layout class="QGridLayout" name="gridLayout_3">
+           <item row="0" column="0">
+            <widget class="QLabel" name="label_7">
+             <property name="text">
+              <string>User Name:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="E5ClearableLineEdit" name="usernameEdit">
+             <property name="toolTip">
+              <string>Enter the user name</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0">
+            <widget class="QLabel" name="label_6">
+             <property name="text">
+              <string>Password:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1">
+            <widget class="E5ClearableLineEdit" name="passwordEdit">
+             <property name="toolTip">
+              <string>Enter the password</string>
+             </property>
+             <property name="echoMode">
+              <enum>QLineEdit::Password</enum>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="0">
+            <spacer name="verticalSpacer_2">
+             <property name="orientation">
+              <enum>Qt::Vertical</enum>
+             </property>
+             <property name="sizeHint" stdset="0">
+              <size>
+               <width>20</width>
+               <height>228</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="lastWillTab">
+          <attribute name="title">
+           <string>Last Will</string>
+          </attribute>
+          <layout class="QGridLayout" name="gridLayout_4">
+           <item row="0" column="0">
+            <widget class="E5ClearableLineEdit" name="willTopicEdit">
+             <property name="toolTip">
+              <string>Enter the topic of the last will</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QSpinBox" name="willQosSpinBox">
+             <property name="toolTip">
+              <string>Enter the desired QoS value</string>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+             </property>
+             <property name="maximum">
+              <number>2</number>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="2">
+            <widget class="QCheckBox" name="willRetainCheckBox">
+             <property name="toolTip">
+              <string>Select to retain the last will message</string>
+             </property>
+             <property name="text">
+              <string>Retain</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0" colspan="3">
+            <widget class="QPlainTextEdit" name="willMessageEdit">
+             <property name="maximumSize">
+              <size>
+               <width>16777215</width>
+               <height>300</height>
+              </size>
+             </property>
+             <property name="toolTip">
+              <string>Enter the last will message to be sent</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </widget>
+       </item>
+       <item>
+        <widget class="QDialogButtonBox" name="profileButtonBox">
+         <property name="standardButtons">
+          <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Reset</set>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>E5ClearableLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>E5Gui/E5LineEdit.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>profilesList</tabstop>
+  <tabstop>plusButton</tabstop>
+  <tabstop>minusButton</tabstop>
+  <tabstop>profileEdit</tabstop>
+  <tabstop>brokerAddressEdit</tabstop>
+  <tabstop>brokerPortSpinBox</tabstop>
+  <tabstop>clientIdEdit</tabstop>
+  <tabstop>generateIdButton</tabstop>
+  <tabstop>tabWidget</tabstop>
+  <tabstop>keepaliveSpinBox</tabstop>
+  <tabstop>cleanSessionCheckBox</tabstop>
+  <tabstop>usernameEdit</tabstop>
+  <tabstop>passwordEdit</tabstop>
+  <tabstop>willTopicEdit</tabstop>
+  <tabstop>willMessageEdit</tabstop>
+  <tabstop>willQosSpinBox</tabstop>
+  <tabstop>willRetainCheckBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>MqttConnectionProfilesDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>227</x>
+     <y>579</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>MqttConnectionProfilesDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>295</x>
+     <y>585</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
--- a/PluginMqttMonitor.e4p	Mon Sep 03 18:54:52 2018 +0200
+++ b/PluginMqttMonitor.e4p	Mon Sep 03 19:57:59 2018 +0200
@@ -18,6 +18,7 @@
   <Sources>
     <Source>MqttMonitor/MqttClient.py</Source>
     <Source>MqttMonitor/MqttConnectionOptionsDialog.py</Source>
+    <Source>MqttMonitor/MqttConnectionProfilesDialog.py</Source>
     <Source>MqttMonitor/MqttMonitorWidget.py</Source>
     <Source>MqttMonitor/__init__.py</Source>
     <Source>PluginMqttMonitor.py</Source>
@@ -25,6 +26,7 @@
   </Sources>
   <Forms>
     <Form>MqttMonitor/MqttConnectionOptionsDialog.ui</Form>
+    <Form>MqttMonitor/MqttConnectionProfilesDialog.ui</Form>
     <Form>MqttMonitor/MqttMonitorWidget.ui</Form>
   </Forms>
   <Translations>

eric ide

mercurial