forked from FreeOpcUa/opcua-client-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
289 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from PyQt5.QtWidgets import QDialog, QFileDialog | ||
|
||
from uaclient.connection_ui import Ui_ConnectionDialog | ||
|
||
|
||
class ConnectionDialog(QDialog): | ||
def __init__(self, parent, uri): | ||
QDialog.__init__(self) | ||
self.ui = Ui_ConnectionDialog() | ||
self.ui.setupUi(self) | ||
|
||
self.uaclient = parent.uaclient | ||
self.uri = uri | ||
|
||
self.ui.modeComboBox.addItem("None") | ||
self.ui.modeComboBox.addItem("Sign") | ||
self.ui.modeComboBox.addItem("SignAndEncrypt") | ||
|
||
self.ui.policyComboBox.addItem("None") | ||
self.ui.policyComboBox.addItem("Basic128Rsa15") | ||
self.ui.policyComboBox.addItem("Basic256") | ||
|
||
self.ui.closeButton.clicked.connect(self.accept) | ||
self.ui.certificateButton.clicked.connect(self.get_certificate) | ||
self.ui.privateKeyButton.clicked.connect(self.get_private_key) | ||
|
||
@property | ||
def security_mode(self): | ||
return self.ui.modeComboBox.currentText() | ||
|
||
@security_mode.setter | ||
def security_mode(self, value): | ||
self.ui.modeComboBox.setCurrentText(value) | ||
|
||
@property | ||
def security_policy(self): | ||
return self.ui.policyComboBox.currentText() | ||
|
||
@security_policy.setter | ||
def security_policy(self, value): | ||
self.ui.policyComboBox.setCurrentText(value) | ||
|
||
@property | ||
def certificate_path(self): | ||
return self.ui.certificateLabel.text() | ||
|
||
@certificate_path.setter | ||
def certificate_path(self, value): | ||
self.ui.certificateLabel.setText(value) | ||
|
||
@property | ||
def private_key_path(self): | ||
return self.ui.privateKeyLabel.text() | ||
|
||
@private_key_path.setter | ||
def private_key_path(self, value): | ||
self.ui.privateKeyLabel.setText(value) | ||
|
||
def get_certificate(self): | ||
path, ok = QFileDialog.getOpenFileName(self, "Select certificate", self.certificate_path, "Certificate (*.der)") | ||
if ok: | ||
self.ui.certificateLabel.setText(path) | ||
|
||
def get_private_key(self): | ||
path, ok = QFileDialog.getOpenFileName(self, "Select private key", self.private_key_path, "Private key (*.pem)") | ||
if ok: | ||
self.ui.privateKeyLabel.setText(path) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Form implementation generated from reading ui file 'uaclient/connection_ui.ui' | ||
# | ||
# Created by: PyQt5 UI code generator 5.7 | ||
# | ||
# WARNING! All changes made in this file will be lost! | ||
|
||
from PyQt5 import QtCore, QtGui, QtWidgets | ||
|
||
class Ui_ConnectionDialog(object): | ||
def setupUi(self, ConnectionDialog): | ||
ConnectionDialog.setObjectName("ConnectionDialog") | ||
ConnectionDialog.resize(400, 300) | ||
self.gridLayout = QtWidgets.QGridLayout(ConnectionDialog) | ||
self.gridLayout.setContentsMargins(11, 11, 11, 11) | ||
self.gridLayout.setSpacing(6) | ||
self.gridLayout.setObjectName("gridLayout") | ||
self.queryButton = QtWidgets.QPushButton(ConnectionDialog) | ||
self.queryButton.setObjectName("queryButton") | ||
self.gridLayout.addWidget(self.queryButton, 0, 0, 1, 2) | ||
self.label = QtWidgets.QLabel(ConnectionDialog) | ||
self.label.setObjectName("label") | ||
self.gridLayout.addWidget(self.label, 1, 0, 1, 1) | ||
self.policyComboBox = QtWidgets.QComboBox(ConnectionDialog) | ||
self.policyComboBox.setObjectName("policyComboBox") | ||
self.gridLayout.addWidget(self.policyComboBox, 1, 1, 1, 2) | ||
self.label_2 = QtWidgets.QLabel(ConnectionDialog) | ||
self.label_2.setObjectName("label_2") | ||
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1) | ||
self.modeComboBox = QtWidgets.QComboBox(ConnectionDialog) | ||
self.modeComboBox.setObjectName("modeComboBox") | ||
self.gridLayout.addWidget(self.modeComboBox, 2, 1, 1, 2) | ||
self.certificateLabel = QtWidgets.QLabel(ConnectionDialog) | ||
self.certificateLabel.setObjectName("certificateLabel") | ||
self.gridLayout.addWidget(self.certificateLabel, 3, 0, 1, 1) | ||
self.certificateButton = QtWidgets.QPushButton(ConnectionDialog) | ||
self.certificateButton.setObjectName("certificateButton") | ||
self.gridLayout.addWidget(self.certificateButton, 3, 1, 1, 2) | ||
self.privateKeyLabel = QtWidgets.QLabel(ConnectionDialog) | ||
self.privateKeyLabel.setObjectName("privateKeyLabel") | ||
self.gridLayout.addWidget(self.privateKeyLabel, 4, 0, 1, 1) | ||
self.privateKeyButton = QtWidgets.QPushButton(ConnectionDialog) | ||
self.privateKeyButton.setObjectName("privateKeyButton") | ||
self.gridLayout.addWidget(self.privateKeyButton, 4, 1, 1, 2) | ||
self.closeButton = QtWidgets.QPushButton(ConnectionDialog) | ||
self.closeButton.setObjectName("closeButton") | ||
self.gridLayout.addWidget(self.closeButton, 5, 2, 1, 1) | ||
|
||
self.retranslateUi(ConnectionDialog) | ||
QtCore.QMetaObject.connectSlotsByName(ConnectionDialog) | ||
|
||
def retranslateUi(self, ConnectionDialog): | ||
_translate = QtCore.QCoreApplication.translate | ||
ConnectionDialog.setWindowTitle(_translate("ConnectionDialog", "ConnectionDialog")) | ||
self.queryButton.setText(_translate("ConnectionDialog", "Query server capability")) | ||
self.label.setText(_translate("ConnectionDialog", "Security Policy")) | ||
self.label_2.setText(_translate("ConnectionDialog", "Message Security Mode")) | ||
self.certificateLabel.setText(_translate("ConnectionDialog", "None")) | ||
self.certificateButton.setText(_translate("ConnectionDialog", "Select certificate")) | ||
self.privateKeyLabel.setText(_translate("ConnectionDialog", "None")) | ||
self.privateKeyButton.setText(_translate("ConnectionDialog", "Select private key")) | ||
self.closeButton.setText(_translate("ConnectionDialog", "Close")) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>ConnectionDialog</class> | ||
<widget class="QDialog" name="ConnectionDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>ConnectionDialog</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0" colspan="2"> | ||
<widget class="QPushButton" name="queryButton"> | ||
<property name="text"> | ||
<string>Query server capability</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QLabel" name="label"> | ||
<property name="text"> | ||
<string>Security Policy</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="1" colspan="2"> | ||
<widget class="QComboBox" name="policyComboBox"/> | ||
</item> | ||
<item row="2" column="0"> | ||
<widget class="QLabel" name="label_2"> | ||
<property name="text"> | ||
<string>Message Security Mode</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="2" column="1" colspan="2"> | ||
<widget class="QComboBox" name="modeComboBox"/> | ||
</item> | ||
<item row="3" column="0"> | ||
<widget class="QLabel" name="certificateLabel"> | ||
<property name="text"> | ||
<string>None</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="3" column="1" colspan="2"> | ||
<widget class="QPushButton" name="certificateButton"> | ||
<property name="text"> | ||
<string>Select certificate</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="4" column="0"> | ||
<widget class="QLabel" name="privateKeyLabel"> | ||
<property name="text"> | ||
<string>None</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="4" column="1" colspan="2"> | ||
<widget class="QPushButton" name="privateKeyButton"> | ||
<property name="text"> | ||
<string>Select private key</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="5" column="2"> | ||
<widget class="QPushButton" name="closeButton"> | ||
<property name="text"> | ||
<string>Close</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<layoutdefault spacing="6" margin="11"/> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters