From adcbfa59f3d08ea6cb1cc4529b97cdfcecc2802d Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sat, 28 Jan 2017 13:59:09 +0100 Subject: [PATCH] add information where to find network sdr send button when network sdr is selected in default sending dialog --- src/urh/controller/GeneratorTabController.py | 4 ++++ src/urh/controller/SendRecvDialogController.py | 17 +++++++++++++++++ src/urh/plugins/NetworkSDRInterface/descr.txt | 8 ++------ src/urh/util/Errors.py | 6 ++++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/urh/controller/GeneratorTabController.py b/src/urh/controller/GeneratorTabController.py index e12333a3..35ec03c5 100644 --- a/src/urh/controller/GeneratorTabController.py +++ b/src/urh/controller/GeneratorTabController.py @@ -495,6 +495,10 @@ class GeneratorTabController(QWidget): Errors.no_device() dialog.close() return + elif PluginManager().is_plugin_enabled("NetworkSDRInterface") and dialog.ui.cbDevice.count() == 1: + Errors.network_sdr_send_is_elsewhere() + dialog.close() + return dialog.recording_parameters.connect(self.project_manager.set_recording_parameters) dialog.show() diff --git a/src/urh/controller/SendRecvDialogController.py b/src/urh/controller/SendRecvDialogController.py index d53ddc22..c6a6f8db 100644 --- a/src/urh/controller/SendRecvDialogController.py +++ b/src/urh/controller/SendRecvDialogController.py @@ -8,6 +8,8 @@ from PyQt5.QtCore import Qt, pyqtSlot, QTimer, QRegExp, pyqtSignal from PyQt5.QtGui import QRegExpValidator, QIcon from PyQt5.QtWidgets import QDialog, QMessageBox, QApplication +from urh.plugins.NetworkSDRInterface.NetworkSDRInterfacePlugin import NetworkSDRInterfacePlugin +from urh.plugins.PluginManager import PluginManager from urh.util.Formatter import Formatter from urh.util.Logger import logger @@ -95,6 +97,9 @@ class SendRecvDialogController(QDialog): elif mode in (Mode.receive, Mode.spectrum) and dev.is_enabled and dev.supports_rx: items.append(device_name) + if mode == Mode.send and PluginManager().is_plugin_enabled("NetworkSDRInterface"): + items.append(NetworkSDRInterfacePlugin.NETWORK_SDR_NAME) + self.ui.cbDevice.addItems(items) if device in items: self.ui.cbDevice.setCurrentIndex(items.index(device)) @@ -198,6 +203,14 @@ class SendRecvDialogController(QDialog): @pyqtSlot() def on_selected_device_changed(self): dev_name = self.ui.cbDevice.currentText() + if dev_name == NetworkSDRInterfacePlugin.NETWORK_SDR_NAME: + self.ui.cbDevice.blockSignals(True) + self.ui.cbDevice.setCurrentText(self.device.name) + self.ui.cbDevice.blockSignals(False) + Errors.network_sdr_send_is_elsewhere() + return + + nrep = self.ui.spinBoxNRepeat.value() sts = self.device.samples_to_send self.device.free_data() @@ -399,6 +412,10 @@ class SendRecvDialogController(QDialog): def closeEvent(self, QCloseEvent): + if self.device.backend == Backends.network: + QCloseEvent.accept() + return + self.device.stop("Dialog closed. Killing recording process.") if self.mode == Mode.receive and not self.already_saved and self.device.current_index > 0: reply = QMessageBox.question(self, self.tr("Save data?"), diff --git a/src/urh/plugins/NetworkSDRInterface/descr.txt b/src/urh/plugins/NetworkSDRInterface/descr.txt index aace1ce6..05de335c 100644 --- a/src/urh/plugins/NetworkSDRInterface/descr.txt +++ b/src/urh/plugins/NetworkSDRInterface/descr.txt @@ -1,8 +1,4 @@ With this plugin you can interface external applications using TCP. You can use your external application for performing protocol simulation on logical level or advanced modulation/decoding. -If you activate this plugin, a new SDR will be selectable: - - 1. in protocol sniffer dialog - 2. in sending dialog. - - Furthermore, a new button below generator table will be created. \ No newline at end of file +If you activate this plugin, a new SDR will be selectable in protocol sniffer dialog. +Furthermore, a new button below generator table will be created. \ No newline at end of file diff --git a/src/urh/util/Errors.py b/src/urh/util/Errors.py index 31211077..05f97b25 100644 --- a/src/urh/util/Errors.py +++ b/src/urh/util/Errors.py @@ -73,3 +73,9 @@ class Errors: w = QWidget() QMessageBox.critical(w, w.tr("Invalid Path"), w.tr("The path {0} is invalid.".format(path))) + + @staticmethod + def network_sdr_send_is_elsewhere(): + w = QWidget() + QMessageBox.information(w, "This feature is elsewhere", "You can send your data with the network SDR by " + "using the button below the generator table.")