biosignal-device-interface 0.1.311__py3-none-any.whl → 0.2.1a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- biosignal_device_interface/constants/devices/__init__.py +3 -3
- biosignal_device_interface/constants/devices/core/base_device_constants.py +61 -51
- biosignal_device_interface/constants/devices/otb/otb_muovi_constants.py +129 -129
- biosignal_device_interface/constants/devices/otb/otb_quattrocento_constants.py +313 -0
- biosignal_device_interface/constants/devices/otb/otb_quattrocento_light_constants.py +59 -59
- biosignal_device_interface/constants/devices/otb/otb_syncstation_constants.py +233 -0
- biosignal_device_interface/constants/plots/color_palette.py +59 -59
- biosignal_device_interface/devices/__init__.py +17 -15
- biosignal_device_interface/devices/core/base_device.py +424 -410
- biosignal_device_interface/devices/otb/__init__.py +29 -21
- biosignal_device_interface/devices/otb/otb_muovi.py +290 -291
- biosignal_device_interface/devices/otb/otb_quattrocento.py +332 -0
- biosignal_device_interface/devices/otb/otb_quattrocento_light.py +210 -213
- biosignal_device_interface/devices/otb/otb_syncstation.py +407 -0
- biosignal_device_interface/gui/device_template_widgets/all_devices_widget.py +51 -43
- biosignal_device_interface/gui/device_template_widgets/core/base_device_widget.py +130 -121
- biosignal_device_interface/gui/device_template_widgets/core/base_multiple_devices_widget.py +108 -108
- biosignal_device_interface/gui/device_template_widgets/otb/otb_devices_widget.py +44 -36
- biosignal_device_interface/gui/device_template_widgets/otb/otb_muovi_plus_widget.py +158 -158
- biosignal_device_interface/gui/device_template_widgets/otb/otb_muovi_widget.py +158 -158
- biosignal_device_interface/gui/device_template_widgets/otb/otb_quattrocento_light_widget.py +174 -170
- biosignal_device_interface/gui/device_template_widgets/otb/otb_quattrocento_widget.py +260 -0
- biosignal_device_interface/gui/device_template_widgets/otb/otb_syncstation_widget.py +262 -0
- biosignal_device_interface/gui/plot_widgets/biosignal_plot_widget.py +501 -500
- biosignal_device_interface/gui/ui/devices_template_widget.ui +38 -38
- biosignal_device_interface/gui/ui/otb_muovi_plus_template_widget.ui +171 -171
- biosignal_device_interface/gui/ui/otb_muovi_template_widget.ui +171 -171
- biosignal_device_interface/gui/ui/otb_quattrocento_light_template_widget.ui +266 -266
- biosignal_device_interface/gui/ui/otb_quattrocento_template_widget.ui +415 -0
- biosignal_device_interface/gui/ui/otb_syncstation_template_widget.ui +732 -0
- biosignal_device_interface/gui/ui_compiled/devices_template_widget.py +56 -56
- biosignal_device_interface/gui/ui_compiled/otb_muovi_plus_template_widget.py +153 -153
- biosignal_device_interface/gui/ui_compiled/otb_muovi_template_widget.py +153 -153
- biosignal_device_interface/gui/ui_compiled/otb_quattrocento_light_template_widget.py +217 -217
- biosignal_device_interface/gui/ui_compiled/otb_quattrocento_template_widget.py +318 -0
- biosignal_device_interface/gui/ui_compiled/otb_syncstation_template_widget.py +495 -0
- biosignal_device_interface-0.2.1a2.dist-info/LICENSE +675 -0
- {biosignal_device_interface-0.1.311.dist-info → biosignal_device_interface-0.2.1a2.dist-info}/METADATA +6 -4
- biosignal_device_interface-0.2.1a2.dist-info/RECORD +46 -0
- {biosignal_device_interface-0.1.311.dist-info → biosignal_device_interface-0.2.1a2.dist-info}/WHEEL +1 -1
- biosignal_device_interface-0.1.311.dist-info/LICENSE +0 -395
- biosignal_device_interface-0.1.311.dist-info/RECORD +0 -36
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
from typing import TYPE_CHECKING
|
|
3
|
-
|
|
4
|
-
from biosignal_device_interface.gui.device_template_widgets.core.base_device_widget import (
|
|
5
|
-
BaseDeviceWidget,
|
|
6
|
-
)
|
|
7
|
-
from biosignal_device_interface.gui.ui_compiled.otb_muovi_template_widget import (
|
|
8
|
-
Ui_MuoviForm,
|
|
9
|
-
)
|
|
10
|
-
from biosignal_device_interface.devices.otb.otb_muovi import OTBMuovi
|
|
11
|
-
|
|
12
|
-
# Constants
|
|
13
|
-
from biosignal_device_interface.constants.devices.otb.otb_muovi_constants import (
|
|
14
|
-
MuoviWorkingMode,
|
|
15
|
-
MuoviDetectionMode,
|
|
16
|
-
MUOVI_NETWORK_PORT,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
if TYPE_CHECKING:
|
|
20
|
-
from PySide6.QtWidgets import (
|
|
21
|
-
QMainWindow,
|
|
22
|
-
QWidget,
|
|
23
|
-
QGroupBox,
|
|
24
|
-
QPushButton,
|
|
25
|
-
QComboBox,
|
|
26
|
-
QLabel,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class OTBMuoviPlusWidget(BaseDeviceWidget):
|
|
31
|
-
def __init__(self, parent: QWidget | QMainWindow | None = None):
|
|
32
|
-
super().__init__(parent)
|
|
33
|
-
|
|
34
|
-
self._set_device(OTBMuovi(parent=self, is_muovi_plus=True))
|
|
35
|
-
|
|
36
|
-
def _toggle_connection(self) -> None:
|
|
37
|
-
if not self.
|
|
38
|
-
self.connect_push_button.setEnabled(False)
|
|
39
|
-
|
|
40
|
-
self.
|
|
41
|
-
(
|
|
42
|
-
self.connection_ip_combo_box.currentText(),
|
|
43
|
-
int(self.connection_port_label.text()),
|
|
44
|
-
)
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
def _connection_toggled(self, is_connected: bool) -> None:
|
|
48
|
-
self.connect_push_button.setEnabled(True)
|
|
49
|
-
if is_connected:
|
|
50
|
-
self.connect_push_button.setText("Disconnect")
|
|
51
|
-
self.connect_push_button.setChecked(True)
|
|
52
|
-
self.configure_push_button.setEnabled(True)
|
|
53
|
-
self.connection_group_box.setEnabled(False)
|
|
54
|
-
else:
|
|
55
|
-
self.connect_push_button.setText("Connect")
|
|
56
|
-
self.connect_push_button.setChecked(False)
|
|
57
|
-
self.configure_push_button.setEnabled(False)
|
|
58
|
-
self.stream_push_button.setEnabled(False)
|
|
59
|
-
self.connection_group_box.setEnabled(True)
|
|
60
|
-
|
|
61
|
-
self.connect_toggled.emit(is_connected)
|
|
62
|
-
|
|
63
|
-
def _toggle_configuration(self) -> None:
|
|
64
|
-
self._device_params["working_mode"] = MuoviWorkingMode(
|
|
65
|
-
self.input_working_mode_combo_box.currentIndex() + 1
|
|
66
|
-
)
|
|
67
|
-
self._device_params["detection_mode"] = MuoviDetectionMode(
|
|
68
|
-
self.input_detection_mode_combo_box.currentIndex() + 1
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
self.
|
|
72
|
-
|
|
73
|
-
def _configuration_toggled(self, is_configured: bool) -> None:
|
|
74
|
-
if is_configured:
|
|
75
|
-
self.stream_push_button.setEnabled(True)
|
|
76
|
-
|
|
77
|
-
self.configure_toggled.emit(is_configured)
|
|
78
|
-
|
|
79
|
-
def _toggle_configuration_group_boxes(self) -> None:
|
|
80
|
-
for group_box in self.configuration_group_boxes:
|
|
81
|
-
group_box.setEnabled(not group_box.isEnabled())
|
|
82
|
-
|
|
83
|
-
def _toggle_stream(self) -> None:
|
|
84
|
-
self.stream_push_button.setEnabled(False)
|
|
85
|
-
self.
|
|
86
|
-
|
|
87
|
-
def _stream_toggled(self, is_streaming: bool) -> None:
|
|
88
|
-
self.stream_push_button.setEnabled(True)
|
|
89
|
-
if is_streaming:
|
|
90
|
-
self.stream_push_button.setText("Stop Streaming")
|
|
91
|
-
self.stream_push_button.setChecked(True)
|
|
92
|
-
self.configure_push_button.setEnabled(False)
|
|
93
|
-
self._toggle_configuration_group_boxes()
|
|
94
|
-
else:
|
|
95
|
-
self.stream_push_button.setText("Stream")
|
|
96
|
-
self.stream_push_button.setChecked(False)
|
|
97
|
-
self.configure_push_button.setEnabled(True)
|
|
98
|
-
self._toggle_configuration_group_boxes()
|
|
99
|
-
|
|
100
|
-
self.stream_toggled.emit(is_streaming)
|
|
101
|
-
|
|
102
|
-
def _initialize_device_params(self) -> None:
|
|
103
|
-
self._device_params = {
|
|
104
|
-
"working_mode": MuoviWorkingMode.EMG,
|
|
105
|
-
"detection_mode": MuoviDetectionMode.MONOPOLAR_GAIN_8,
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
def _initialize_ui(self) -> None:
|
|
109
|
-
self.ui = Ui_MuoviForm()
|
|
110
|
-
self.ui.setupUi(self)
|
|
111
|
-
|
|
112
|
-
# Command Push Buttons
|
|
113
|
-
self.connect_push_button: QPushButton = self.ui.commandConnectionPushButton
|
|
114
|
-
self.connect_push_button.clicked.connect(self._toggle_connection)
|
|
115
|
-
self.
|
|
116
|
-
|
|
117
|
-
self.configure_push_button: QPushButton = self.ui.commandConfigurationPushButton
|
|
118
|
-
self.configure_push_button.clicked.connect(self._toggle_configuration)
|
|
119
|
-
self.configure_push_button.setEnabled(False)
|
|
120
|
-
self.
|
|
121
|
-
|
|
122
|
-
self.stream_push_button: QPushButton = self.ui.commandStreamPushButton
|
|
123
|
-
self.stream_push_button.clicked.connect(self._toggle_stream)
|
|
124
|
-
self.stream_push_button.setEnabled(False)
|
|
125
|
-
self.
|
|
126
|
-
|
|
127
|
-
# Connection parameters
|
|
128
|
-
self.connection_group_box: QGroupBox = self.ui.connectionGroupBox
|
|
129
|
-
self.connection_ip_combo_box: QComboBox = self.ui.connectionIPComboBox
|
|
130
|
-
self.connection_port_label: QLabel = self.ui.connectionPortLabel
|
|
131
|
-
self.connection_update_push_button: QPushButton = (
|
|
132
|
-
self.ui.connectionUpdatePushButton
|
|
133
|
-
)
|
|
134
|
-
self.connection_update_push_button.clicked.connect(
|
|
135
|
-
lambda: (
|
|
136
|
-
self.connection_ip_combo_box.clear(),
|
|
137
|
-
self.connection_ip_combo_box.addItems(
|
|
138
|
-
self.
|
|
139
|
-
),
|
|
140
|
-
)
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
self.connection_ip_combo_box.clear()
|
|
144
|
-
self.connection_ip_combo_box.addItems(self.
|
|
145
|
-
|
|
146
|
-
self.connection_port_label.setText(str(MUOVI_NETWORK_PORT))
|
|
147
|
-
|
|
148
|
-
# Input parameters
|
|
149
|
-
self.input_parameters_group_box: QGroupBox = self.ui.inputGroupBox
|
|
150
|
-
self.input_working_mode_combo_box: QComboBox = self.ui.inputWorkingModeComboBox
|
|
151
|
-
self.input_detection_mode_combo_box: QComboBox = (
|
|
152
|
-
self.ui.inputDetectionModeComboBox
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
# Configuration parameters
|
|
156
|
-
self.configuration_group_boxes: list[QGroupBox] = [
|
|
157
|
-
self.input_parameters_group_box,
|
|
158
|
-
]
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
|
+
|
|
4
|
+
from biosignal_device_interface.gui.device_template_widgets.core.base_device_widget import (
|
|
5
|
+
BaseDeviceWidget,
|
|
6
|
+
)
|
|
7
|
+
from biosignal_device_interface.gui.ui_compiled.otb_muovi_template_widget import (
|
|
8
|
+
Ui_MuoviForm,
|
|
9
|
+
)
|
|
10
|
+
from biosignal_device_interface.devices.otb.otb_muovi import OTBMuovi
|
|
11
|
+
|
|
12
|
+
# Constants
|
|
13
|
+
from biosignal_device_interface.constants.devices.otb.otb_muovi_constants import (
|
|
14
|
+
MuoviWorkingMode,
|
|
15
|
+
MuoviDetectionMode,
|
|
16
|
+
MUOVI_NETWORK_PORT,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from PySide6.QtWidgets import (
|
|
21
|
+
QMainWindow,
|
|
22
|
+
QWidget,
|
|
23
|
+
QGroupBox,
|
|
24
|
+
QPushButton,
|
|
25
|
+
QComboBox,
|
|
26
|
+
QLabel,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class OTBMuoviPlusWidget(BaseDeviceWidget):
|
|
31
|
+
def __init__(self, parent: QWidget | QMainWindow | None = None):
|
|
32
|
+
super().__init__(parent)
|
|
33
|
+
|
|
34
|
+
self._set_device(OTBMuovi(parent=self, is_muovi_plus=True))
|
|
35
|
+
|
|
36
|
+
def _toggle_connection(self) -> None:
|
|
37
|
+
if not self._device.is_connected:
|
|
38
|
+
self.connect_push_button.setEnabled(False)
|
|
39
|
+
|
|
40
|
+
self._device.toggle_connection(
|
|
41
|
+
(
|
|
42
|
+
self.connection_ip_combo_box.currentText(),
|
|
43
|
+
int(self.connection_port_label.text()),
|
|
44
|
+
)
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def _connection_toggled(self, is_connected: bool) -> None:
|
|
48
|
+
self.connect_push_button.setEnabled(True)
|
|
49
|
+
if is_connected:
|
|
50
|
+
self.connect_push_button.setText("Disconnect")
|
|
51
|
+
self.connect_push_button.setChecked(True)
|
|
52
|
+
self.configure_push_button.setEnabled(True)
|
|
53
|
+
self.connection_group_box.setEnabled(False)
|
|
54
|
+
else:
|
|
55
|
+
self.connect_push_button.setText("Connect")
|
|
56
|
+
self.connect_push_button.setChecked(False)
|
|
57
|
+
self.configure_push_button.setEnabled(False)
|
|
58
|
+
self.stream_push_button.setEnabled(False)
|
|
59
|
+
self.connection_group_box.setEnabled(True)
|
|
60
|
+
|
|
61
|
+
self.connect_toggled.emit(is_connected)
|
|
62
|
+
|
|
63
|
+
def _toggle_configuration(self) -> None:
|
|
64
|
+
self._device_params["working_mode"] = MuoviWorkingMode(
|
|
65
|
+
self.input_working_mode_combo_box.currentIndex() + 1
|
|
66
|
+
)
|
|
67
|
+
self._device_params["detection_mode"] = MuoviDetectionMode(
|
|
68
|
+
self.input_detection_mode_combo_box.currentIndex() + 1
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
self._device.configure_device(self._device_params)
|
|
72
|
+
|
|
73
|
+
def _configuration_toggled(self, is_configured: bool) -> None:
|
|
74
|
+
if is_configured:
|
|
75
|
+
self.stream_push_button.setEnabled(True)
|
|
76
|
+
|
|
77
|
+
self.configure_toggled.emit(is_configured)
|
|
78
|
+
|
|
79
|
+
def _toggle_configuration_group_boxes(self) -> None:
|
|
80
|
+
for group_box in self.configuration_group_boxes:
|
|
81
|
+
group_box.setEnabled(not group_box.isEnabled())
|
|
82
|
+
|
|
83
|
+
def _toggle_stream(self) -> None:
|
|
84
|
+
self.stream_push_button.setEnabled(False)
|
|
85
|
+
self._device.toggle_streaming()
|
|
86
|
+
|
|
87
|
+
def _stream_toggled(self, is_streaming: bool) -> None:
|
|
88
|
+
self.stream_push_button.setEnabled(True)
|
|
89
|
+
if is_streaming:
|
|
90
|
+
self.stream_push_button.setText("Stop Streaming")
|
|
91
|
+
self.stream_push_button.setChecked(True)
|
|
92
|
+
self.configure_push_button.setEnabled(False)
|
|
93
|
+
self._toggle_configuration_group_boxes()
|
|
94
|
+
else:
|
|
95
|
+
self.stream_push_button.setText("Stream")
|
|
96
|
+
self.stream_push_button.setChecked(False)
|
|
97
|
+
self.configure_push_button.setEnabled(True)
|
|
98
|
+
self._toggle_configuration_group_boxes()
|
|
99
|
+
|
|
100
|
+
self.stream_toggled.emit(is_streaming)
|
|
101
|
+
|
|
102
|
+
def _initialize_device_params(self) -> None:
|
|
103
|
+
self._device_params = {
|
|
104
|
+
"working_mode": MuoviWorkingMode.EMG,
|
|
105
|
+
"detection_mode": MuoviDetectionMode.MONOPOLAR_GAIN_8,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
def _initialize_ui(self) -> None:
|
|
109
|
+
self.ui = Ui_MuoviForm()
|
|
110
|
+
self.ui.setupUi(self)
|
|
111
|
+
|
|
112
|
+
# Command Push Buttons
|
|
113
|
+
self.connect_push_button: QPushButton = self.ui.commandConnectionPushButton
|
|
114
|
+
self.connect_push_button.clicked.connect(self._toggle_connection)
|
|
115
|
+
self._device.connect_toggled.connect(self._connection_toggled)
|
|
116
|
+
|
|
117
|
+
self.configure_push_button: QPushButton = self.ui.commandConfigurationPushButton
|
|
118
|
+
self.configure_push_button.clicked.connect(self._toggle_configuration)
|
|
119
|
+
self.configure_push_button.setEnabled(False)
|
|
120
|
+
self._device.configure_toggled.connect(self._configuration_toggled)
|
|
121
|
+
|
|
122
|
+
self.stream_push_button: QPushButton = self.ui.commandStreamPushButton
|
|
123
|
+
self.stream_push_button.clicked.connect(self._toggle_stream)
|
|
124
|
+
self.stream_push_button.setEnabled(False)
|
|
125
|
+
self._device.stream_toggled.connect(self._stream_toggled)
|
|
126
|
+
|
|
127
|
+
# Connection parameters
|
|
128
|
+
self.connection_group_box: QGroupBox = self.ui.connectionGroupBox
|
|
129
|
+
self.connection_ip_combo_box: QComboBox = self.ui.connectionIPComboBox
|
|
130
|
+
self.connection_port_label: QLabel = self.ui.connectionPortLabel
|
|
131
|
+
self.connection_update_push_button: QPushButton = (
|
|
132
|
+
self.ui.connectionUpdatePushButton
|
|
133
|
+
)
|
|
134
|
+
self.connection_update_push_button.clicked.connect(
|
|
135
|
+
lambda: (
|
|
136
|
+
self.connection_ip_combo_box.clear(),
|
|
137
|
+
self.connection_ip_combo_box.addItems(
|
|
138
|
+
self._device.get_server_wifi_ip_address()
|
|
139
|
+
),
|
|
140
|
+
)
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
self.connection_ip_combo_box.clear()
|
|
144
|
+
self.connection_ip_combo_box.addItems(self._device.get_server_wifi_ip_address())
|
|
145
|
+
|
|
146
|
+
self.connection_port_label.setText(str(MUOVI_NETWORK_PORT))
|
|
147
|
+
|
|
148
|
+
# Input parameters
|
|
149
|
+
self.input_parameters_group_box: QGroupBox = self.ui.inputGroupBox
|
|
150
|
+
self.input_working_mode_combo_box: QComboBox = self.ui.inputWorkingModeComboBox
|
|
151
|
+
self.input_detection_mode_combo_box: QComboBox = (
|
|
152
|
+
self.ui.inputDetectionModeComboBox
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
# Configuration parameters
|
|
156
|
+
self.configuration_group_boxes: list[QGroupBox] = [
|
|
157
|
+
self.input_parameters_group_box,
|
|
158
|
+
]
|
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
from typing import TYPE_CHECKING
|
|
3
|
-
|
|
4
|
-
from biosignal_device_interface.gui.device_template_widgets.core.base_device_widget import (
|
|
5
|
-
BaseDeviceWidget,
|
|
6
|
-
)
|
|
7
|
-
from biosignal_device_interface.gui.ui_compiled.otb_muovi_template_widget import (
|
|
8
|
-
Ui_MuoviForm,
|
|
9
|
-
)
|
|
10
|
-
from biosignal_device_interface.devices.otb.otb_muovi import OTBMuovi
|
|
11
|
-
|
|
12
|
-
# Constants
|
|
13
|
-
from biosignal_device_interface.constants.devices.otb.otb_muovi_constants import (
|
|
14
|
-
MuoviWorkingMode,
|
|
15
|
-
MuoviDetectionMode,
|
|
16
|
-
MUOVI_NETWORK_PORT,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
if TYPE_CHECKING:
|
|
20
|
-
from PySide6.QtWidgets import (
|
|
21
|
-
QWidget,
|
|
22
|
-
QMainWindow,
|
|
23
|
-
QGroupBox,
|
|
24
|
-
QPushButton,
|
|
25
|
-
QComboBox,
|
|
26
|
-
QLabel,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class OTBMuoviWidget(BaseDeviceWidget):
|
|
31
|
-
def __init__(self, parent: QWidget | QMainWindow | None = None):
|
|
32
|
-
super().__init__(parent)
|
|
33
|
-
|
|
34
|
-
self._set_device(OTBMuovi(parent=self))
|
|
35
|
-
|
|
36
|
-
def _toggle_connection(self) -> None:
|
|
37
|
-
if not self.
|
|
38
|
-
self.connect_push_button.setEnabled(False)
|
|
39
|
-
|
|
40
|
-
self.
|
|
41
|
-
(
|
|
42
|
-
self.connection_ip_combo_box.currentText(),
|
|
43
|
-
int(self.connection_port_label.text()),
|
|
44
|
-
)
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
def _connection_toggled(self, is_connected: bool) -> None:
|
|
48
|
-
self.connect_push_button.setEnabled(True)
|
|
49
|
-
if is_connected:
|
|
50
|
-
self.connect_push_button.setText("Disconnect")
|
|
51
|
-
self.connect_push_button.setChecked(True)
|
|
52
|
-
self.configure_push_button.setEnabled(True)
|
|
53
|
-
self.connection_group_box.setEnabled(False)
|
|
54
|
-
else:
|
|
55
|
-
self.connect_push_button.setText("Connect")
|
|
56
|
-
self.connect_push_button.setChecked(False)
|
|
57
|
-
self.configure_push_button.setEnabled(False)
|
|
58
|
-
self.stream_push_button.setEnabled(False)
|
|
59
|
-
self.connection_group_box.setEnabled(True)
|
|
60
|
-
|
|
61
|
-
self.connect_toggled.emit(is_connected)
|
|
62
|
-
|
|
63
|
-
def _toggle_configuration(self) -> None:
|
|
64
|
-
self._device_params["working_mode"] = MuoviWorkingMode(
|
|
65
|
-
self.input_working_mode_combo_box.currentIndex() + 1
|
|
66
|
-
)
|
|
67
|
-
self._device_params["detection_mode"] = MuoviDetectionMode(
|
|
68
|
-
self.input_detection_mode_combo_box.currentIndex() + 1
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
self.
|
|
72
|
-
|
|
73
|
-
def _configuration_toggled(self, is_configured: bool) -> None:
|
|
74
|
-
if is_configured:
|
|
75
|
-
self.stream_push_button.setEnabled(True)
|
|
76
|
-
|
|
77
|
-
self.configure_toggled.emit(is_configured)
|
|
78
|
-
|
|
79
|
-
def _toggle_configuration_group_boxes(self) -> None:
|
|
80
|
-
for group_box in self.configuration_group_boxes:
|
|
81
|
-
group_box.setEnabled(not group_box.isEnabled())
|
|
82
|
-
|
|
83
|
-
def _toggle_stream(self) -> None:
|
|
84
|
-
self.stream_push_button.setEnabled(False)
|
|
85
|
-
self.
|
|
86
|
-
|
|
87
|
-
def _stream_toggled(self, is_streaming: bool) -> None:
|
|
88
|
-
self.stream_push_button.setEnabled(True)
|
|
89
|
-
if is_streaming:
|
|
90
|
-
self.stream_push_button.setText("Stop Streaming")
|
|
91
|
-
self.stream_push_button.setChecked(True)
|
|
92
|
-
self.configure_push_button.setEnabled(False)
|
|
93
|
-
self._toggle_configuration_group_boxes()
|
|
94
|
-
else:
|
|
95
|
-
self.stream_push_button.setText("Stream")
|
|
96
|
-
self.stream_push_button.setChecked(False)
|
|
97
|
-
self.configure_push_button.setEnabled(True)
|
|
98
|
-
self._toggle_configuration_group_boxes()
|
|
99
|
-
|
|
100
|
-
self.stream_toggled.emit(is_streaming)
|
|
101
|
-
|
|
102
|
-
def _initialize_device_params(self) -> None:
|
|
103
|
-
self._device_params = {
|
|
104
|
-
"working_mode": MuoviWorkingMode.EMG,
|
|
105
|
-
"detection_mode": MuoviDetectionMode.MONOPOLAR_GAIN_8,
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
def _initialize_ui(self) -> None:
|
|
109
|
-
self.ui = Ui_MuoviForm()
|
|
110
|
-
self.ui.setupUi(self)
|
|
111
|
-
|
|
112
|
-
# Command Push Buttons
|
|
113
|
-
self.connect_push_button: QPushButton = self.ui.commandConnectionPushButton
|
|
114
|
-
self.connect_push_button.clicked.connect(self._toggle_connection)
|
|
115
|
-
self.
|
|
116
|
-
|
|
117
|
-
self.configure_push_button: QPushButton = self.ui.commandConfigurationPushButton
|
|
118
|
-
self.configure_push_button.clicked.connect(self._toggle_configuration)
|
|
119
|
-
self.configure_push_button.setEnabled(False)
|
|
120
|
-
self.
|
|
121
|
-
|
|
122
|
-
self.stream_push_button: QPushButton = self.ui.commandStreamPushButton
|
|
123
|
-
self.stream_push_button.clicked.connect(self._toggle_stream)
|
|
124
|
-
self.stream_push_button.setEnabled(False)
|
|
125
|
-
self.
|
|
126
|
-
|
|
127
|
-
# Connection parameters
|
|
128
|
-
self.connection_group_box: QGroupBox = self.ui.connectionGroupBox
|
|
129
|
-
self.connection_ip_combo_box: QComboBox = self.ui.connectionIPComboBox
|
|
130
|
-
self.connection_port_label: QLabel = self.ui.connectionPortLabel
|
|
131
|
-
self.connection_update_push_button: QPushButton = (
|
|
132
|
-
self.ui.connectionUpdatePushButton
|
|
133
|
-
)
|
|
134
|
-
self.connection_update_push_button.clicked.connect(
|
|
135
|
-
lambda: (
|
|
136
|
-
self.connection_ip_combo_box.clear(),
|
|
137
|
-
self.connection_ip_combo_box.addItems(
|
|
138
|
-
self.
|
|
139
|
-
),
|
|
140
|
-
)
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
self.connection_ip_combo_box.clear()
|
|
144
|
-
self.connection_ip_combo_box.addItems(self.
|
|
145
|
-
|
|
146
|
-
self.connection_port_label.setText(str(MUOVI_NETWORK_PORT))
|
|
147
|
-
|
|
148
|
-
# Input parameters
|
|
149
|
-
self.input_parameters_group_box: QGroupBox = self.ui.inputGroupBox
|
|
150
|
-
self.input_working_mode_combo_box: QComboBox = self.ui.inputWorkingModeComboBox
|
|
151
|
-
self.input_detection_mode_combo_box: QComboBox = (
|
|
152
|
-
self.ui.inputDetectionModeComboBox
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
# Configuration parameters
|
|
156
|
-
self.configuration_group_boxes: list[QGroupBox] = [
|
|
157
|
-
self.input_parameters_group_box,
|
|
158
|
-
]
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
|
+
|
|
4
|
+
from biosignal_device_interface.gui.device_template_widgets.core.base_device_widget import (
|
|
5
|
+
BaseDeviceWidget,
|
|
6
|
+
)
|
|
7
|
+
from biosignal_device_interface.gui.ui_compiled.otb_muovi_template_widget import (
|
|
8
|
+
Ui_MuoviForm,
|
|
9
|
+
)
|
|
10
|
+
from biosignal_device_interface.devices.otb.otb_muovi import OTBMuovi
|
|
11
|
+
|
|
12
|
+
# Constants
|
|
13
|
+
from biosignal_device_interface.constants.devices.otb.otb_muovi_constants import (
|
|
14
|
+
MuoviWorkingMode,
|
|
15
|
+
MuoviDetectionMode,
|
|
16
|
+
MUOVI_NETWORK_PORT,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from PySide6.QtWidgets import (
|
|
21
|
+
QWidget,
|
|
22
|
+
QMainWindow,
|
|
23
|
+
QGroupBox,
|
|
24
|
+
QPushButton,
|
|
25
|
+
QComboBox,
|
|
26
|
+
QLabel,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class OTBMuoviWidget(BaseDeviceWidget):
|
|
31
|
+
def __init__(self, parent: QWidget | QMainWindow | None = None):
|
|
32
|
+
super().__init__(parent)
|
|
33
|
+
|
|
34
|
+
self._set_device(OTBMuovi(parent=self))
|
|
35
|
+
|
|
36
|
+
def _toggle_connection(self) -> None:
|
|
37
|
+
if not self._device.is_connected:
|
|
38
|
+
self.connect_push_button.setEnabled(False)
|
|
39
|
+
|
|
40
|
+
self._device.toggle_connection(
|
|
41
|
+
(
|
|
42
|
+
self.connection_ip_combo_box.currentText(),
|
|
43
|
+
int(self.connection_port_label.text()),
|
|
44
|
+
)
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def _connection_toggled(self, is_connected: bool) -> None:
|
|
48
|
+
self.connect_push_button.setEnabled(True)
|
|
49
|
+
if is_connected:
|
|
50
|
+
self.connect_push_button.setText("Disconnect")
|
|
51
|
+
self.connect_push_button.setChecked(True)
|
|
52
|
+
self.configure_push_button.setEnabled(True)
|
|
53
|
+
self.connection_group_box.setEnabled(False)
|
|
54
|
+
else:
|
|
55
|
+
self.connect_push_button.setText("Connect")
|
|
56
|
+
self.connect_push_button.setChecked(False)
|
|
57
|
+
self.configure_push_button.setEnabled(False)
|
|
58
|
+
self.stream_push_button.setEnabled(False)
|
|
59
|
+
self.connection_group_box.setEnabled(True)
|
|
60
|
+
|
|
61
|
+
self.connect_toggled.emit(is_connected)
|
|
62
|
+
|
|
63
|
+
def _toggle_configuration(self) -> None:
|
|
64
|
+
self._device_params["working_mode"] = MuoviWorkingMode(
|
|
65
|
+
self.input_working_mode_combo_box.currentIndex() + 1
|
|
66
|
+
)
|
|
67
|
+
self._device_params["detection_mode"] = MuoviDetectionMode(
|
|
68
|
+
self.input_detection_mode_combo_box.currentIndex() + 1
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
self._device.configure_device(self._device_params)
|
|
72
|
+
|
|
73
|
+
def _configuration_toggled(self, is_configured: bool) -> None:
|
|
74
|
+
if is_configured:
|
|
75
|
+
self.stream_push_button.setEnabled(True)
|
|
76
|
+
|
|
77
|
+
self.configure_toggled.emit(is_configured)
|
|
78
|
+
|
|
79
|
+
def _toggle_configuration_group_boxes(self) -> None:
|
|
80
|
+
for group_box in self.configuration_group_boxes:
|
|
81
|
+
group_box.setEnabled(not group_box.isEnabled())
|
|
82
|
+
|
|
83
|
+
def _toggle_stream(self) -> None:
|
|
84
|
+
self.stream_push_button.setEnabled(False)
|
|
85
|
+
self._device.toggle_streaming()
|
|
86
|
+
|
|
87
|
+
def _stream_toggled(self, is_streaming: bool) -> None:
|
|
88
|
+
self.stream_push_button.setEnabled(True)
|
|
89
|
+
if is_streaming:
|
|
90
|
+
self.stream_push_button.setText("Stop Streaming")
|
|
91
|
+
self.stream_push_button.setChecked(True)
|
|
92
|
+
self.configure_push_button.setEnabled(False)
|
|
93
|
+
self._toggle_configuration_group_boxes()
|
|
94
|
+
else:
|
|
95
|
+
self.stream_push_button.setText("Stream")
|
|
96
|
+
self.stream_push_button.setChecked(False)
|
|
97
|
+
self.configure_push_button.setEnabled(True)
|
|
98
|
+
self._toggle_configuration_group_boxes()
|
|
99
|
+
|
|
100
|
+
self.stream_toggled.emit(is_streaming)
|
|
101
|
+
|
|
102
|
+
def _initialize_device_params(self) -> None:
|
|
103
|
+
self._device_params = {
|
|
104
|
+
"working_mode": MuoviWorkingMode.EMG,
|
|
105
|
+
"detection_mode": MuoviDetectionMode.MONOPOLAR_GAIN_8,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
def _initialize_ui(self) -> None:
|
|
109
|
+
self.ui = Ui_MuoviForm()
|
|
110
|
+
self.ui.setupUi(self)
|
|
111
|
+
|
|
112
|
+
# Command Push Buttons
|
|
113
|
+
self.connect_push_button: QPushButton = self.ui.commandConnectionPushButton
|
|
114
|
+
self.connect_push_button.clicked.connect(self._toggle_connection)
|
|
115
|
+
self._device.connect_toggled.connect(self._connection_toggled)
|
|
116
|
+
|
|
117
|
+
self.configure_push_button: QPushButton = self.ui.commandConfigurationPushButton
|
|
118
|
+
self.configure_push_button.clicked.connect(self._toggle_configuration)
|
|
119
|
+
self.configure_push_button.setEnabled(False)
|
|
120
|
+
self._device.configure_toggled.connect(self._configuration_toggled)
|
|
121
|
+
|
|
122
|
+
self.stream_push_button: QPushButton = self.ui.commandStreamPushButton
|
|
123
|
+
self.stream_push_button.clicked.connect(self._toggle_stream)
|
|
124
|
+
self.stream_push_button.setEnabled(False)
|
|
125
|
+
self._device.stream_toggled.connect(self._stream_toggled)
|
|
126
|
+
|
|
127
|
+
# Connection parameters
|
|
128
|
+
self.connection_group_box: QGroupBox = self.ui.connectionGroupBox
|
|
129
|
+
self.connection_ip_combo_box: QComboBox = self.ui.connectionIPComboBox
|
|
130
|
+
self.connection_port_label: QLabel = self.ui.connectionPortLabel
|
|
131
|
+
self.connection_update_push_button: QPushButton = (
|
|
132
|
+
self.ui.connectionUpdatePushButton
|
|
133
|
+
)
|
|
134
|
+
self.connection_update_push_button.clicked.connect(
|
|
135
|
+
lambda: (
|
|
136
|
+
self.connection_ip_combo_box.clear(),
|
|
137
|
+
self.connection_ip_combo_box.addItems(
|
|
138
|
+
self._device.get_server_wifi_ip_address()
|
|
139
|
+
),
|
|
140
|
+
)
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
self.connection_ip_combo_box.clear()
|
|
144
|
+
self.connection_ip_combo_box.addItems(self._device.get_server_wifi_ip_address())
|
|
145
|
+
|
|
146
|
+
self.connection_port_label.setText(str(MUOVI_NETWORK_PORT))
|
|
147
|
+
|
|
148
|
+
# Input parameters
|
|
149
|
+
self.input_parameters_group_box: QGroupBox = self.ui.inputGroupBox
|
|
150
|
+
self.input_working_mode_combo_box: QComboBox = self.ui.inputWorkingModeComboBox
|
|
151
|
+
self.input_detection_mode_combo_box: QComboBox = (
|
|
152
|
+
self.ui.inputDetectionModeComboBox
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
# Configuration parameters
|
|
156
|
+
self.configuration_group_boxes: list[QGroupBox] = [
|
|
157
|
+
self.input_parameters_group_box,
|
|
158
|
+
]
|