Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support mavlink signing key in connection UI #34

Merged
merged 1 commit into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dronecan_gui_tool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class MainWindow(QMainWindow):
MAX_SUCCESSIVE_NODE_ERRORS = 1000

# noinspection PyTypeChecker,PyCallByClass,PyUnresolvedReferences
def __init__(self, node, iface_name):
def __init__(self, node, iface_name, iface_kwargs):
# Parent
super(MainWindow, self).__init__()
self.setWindowTitle('DroneCAN GUI Tool')
Expand Down Expand Up @@ -133,6 +133,8 @@ def __init__(self, node, iface_name):

if args.signing_passphrase is not None:
self._node.can_driver.set_signing_passphrase(args.signing_passphrase)
elif iface_kwargs['mavlink_signing_key']:
self._node.can_driver.set_signing_passphrase(iface_kwargs['mavlink_signing_key'])

#
# File menu
Expand Down Expand Up @@ -630,7 +632,7 @@ def main():
break

logger.info('Creating main window; iface %r', iface)
window = MainWindow(node, iface)
window = MainWindow(node, iface, iface_kwargs)
window.show()

try:
Expand Down
8 changes: 7 additions & 1 deletion dronecan_gui_tool/setup_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .widgets import show_error, get_monospace_font
from PyQt5.QtWidgets import QComboBox, QCompleter, QDialog, QDirModel, QFileDialog, QGroupBox, QHBoxLayout, QLabel, \
QLineEdit, QPushButton, QSpinBox, QVBoxLayout, QGridLayout, QCheckBox
from qtwidgets import PasswordEdit
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QIntValidator
from logging import getLogger
Expand Down Expand Up @@ -230,7 +231,9 @@ def run_setup_window(icon, dsdl_path=None):
target_system.setMaximum(255)
target_system.setMinimum(0)
target_system.setValue(0)


signing_key = PasswordEdit(win)

dir_selection = DirectorySelectionWidget(win, dsdl_path)

ok = QPushButton('OK', win)
Expand Down Expand Up @@ -286,6 +289,7 @@ def on_ok():
kwargs['bus_number'] = int(bus_number.value())
kwargs['filtered'] = filtered.checkState()
kwargs['mavlink_target_system'] = int(target_system.value())
kwargs['mavlink_signing_key'] = signing_key.text()
result_key = str(combo.currentText()).strip()
if not result_key:
show_error('Invalid parameters', 'Interface name cannot be empty', 'Please select a valid interface',
Expand Down Expand Up @@ -316,6 +320,8 @@ def on_ok():
adapter_layout.addWidget(filtered, 3, 1)
adapter_layout.addWidget(QLabel('MAVLink target system (0 for auto):'), 4, 0)
adapter_layout.addWidget(target_system, 4, 1)
adapter_layout.addWidget(QLabel('MAVLink signing key:'), 5, 0)
adapter_layout.addWidget(signing_key, 5, 1)

adapter_group.setLayout(adapter_layout)

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
'ipykernel',
'pygments',
'qtpy',
'pyqtgraph'
'pyqtgraph',
'qtwidgets'
],
# We can't use "scripts" here, because generated shims don't work with multiprocessing pickler.
entry_points={
Expand Down