biosignal-device-interface 0.1.11b0__py3-none-any.whl → 0.1.32a1__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/__init__.py +0 -4
- biosignal_device_interface/constants/devices/__init__.py +3 -0
- biosignal_device_interface/constants/devices/core/base_device_constants.py +10 -0
- biosignal_device_interface/constants/devices/otb/otb_constants.py +0 -0
- biosignal_device_interface/constants/devices/otb/otb_quattrocento_constants.py +289 -35
- biosignal_device_interface/constants/devices/otb/otb_quattrocento_light_constants.py +59 -0
- biosignal_device_interface/constants/devices/otb/otb_syncstation_constants.py +233 -0
- biosignal_device_interface/devices/__init__.py +11 -3
- biosignal_device_interface/devices/core/base_device.py +8 -9
- biosignal_device_interface/devices/otb/__init__.py +27 -7
- biosignal_device_interface/devices/otb/otb_muovi.py +9 -10
- biosignal_device_interface/devices/otb/otb_quattrocento.py +215 -118
- biosignal_device_interface/devices/otb/otb_quattrocento_light.py +210 -0
- biosignal_device_interface/devices/otb/otb_syncstation.py +407 -0
- biosignal_device_interface/gui/device_template_widgets/__init__.py +0 -6
- biosignal_device_interface/gui/device_template_widgets/all_devices_widget.py +19 -7
- biosignal_device_interface/gui/device_template_widgets/core/base_device_widget.py +17 -8
- biosignal_device_interface/gui/device_template_widgets/core/base_multiple_devices_widget.py +7 -4
- biosignal_device_interface/gui/device_template_widgets/otb/__init__.py +0 -10
- biosignal_device_interface/gui/device_template_widgets/otb/otb_devices_widget.py +19 -7
- biosignal_device_interface/gui/device_template_widgets/otb/otb_muovi_plus_widget.py +11 -11
- biosignal_device_interface/gui/device_template_widgets/otb/otb_muovi_widget.py +11 -11
- biosignal_device_interface/gui/device_template_widgets/otb/otb_quattrocento_light_widget.py +61 -57
- 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 +9 -4
- 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/otb_quattrocento_template_widget.py +318 -0
- biosignal_device_interface/gui/ui_compiled/otb_syncstation_template_widget.py +495 -0
- biosignal_device_interface-0.1.32a1.dist-info/LICENSE +675 -0
- {biosignal_device_interface-0.1.11b0.dist-info → biosignal_device_interface-0.1.32a1.dist-info}/METADATA +7 -17
- biosignal_device_interface-0.1.32a1.dist-info/RECORD +46 -0
- biosignal_device_interface-0.1.11b0.dist-info/LICENSE +0 -395
- biosignal_device_interface-0.1.11b0.dist-info/RECORD +0 -35
- {biosignal_device_interface-0.1.11b0.dist-info → biosignal_device_interface-0.1.32a1.dist-info}/WHEEL +0 -0
|
@@ -19,6 +19,7 @@ from biosignal_device_interface.devices.core.base_device import BaseDevice
|
|
|
19
19
|
|
|
20
20
|
if TYPE_CHECKING:
|
|
21
21
|
from enum import Enum
|
|
22
|
+
from PySide6.QtWidgets import QLineEdit
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
class BaseDeviceWidget(QWidget):
|
|
@@ -36,7 +37,7 @@ class BaseDeviceWidget(QWidget):
|
|
|
36
37
|
self.parent_widget: QWidget | QMainWindow | None = parent
|
|
37
38
|
|
|
38
39
|
# Device Setup
|
|
39
|
-
self.
|
|
40
|
+
self._device: BaseDevice | None = None
|
|
40
41
|
self._device_params: Dict[str, Union[str, int, float]] = {}
|
|
41
42
|
|
|
42
43
|
# GUI setup
|
|
@@ -90,16 +91,16 @@ class BaseDeviceWidget(QWidget):
|
|
|
90
91
|
def _set_device(self, device: BaseDevice) -> None:
|
|
91
92
|
""" """
|
|
92
93
|
# Device Setup
|
|
93
|
-
self.
|
|
94
|
+
self._device: BaseDevice = device
|
|
94
95
|
self._initialize_device_params()
|
|
95
96
|
self._set_signals()
|
|
96
97
|
self._initialize_ui()
|
|
97
98
|
|
|
98
99
|
def _set_signals(self) -> None:
|
|
99
100
|
""" """
|
|
100
|
-
self.
|
|
101
|
-
self.
|
|
102
|
-
self.
|
|
101
|
+
self._device.data_available.connect(self.data_arrived.emit)
|
|
102
|
+
self._device.biosignal_data_available.connect(self.biosignal_data_arrived.emit)
|
|
103
|
+
self._device.auxiliary_data_available.connect(self.auxiliary_data_arrived.emit)
|
|
103
104
|
|
|
104
105
|
def get_device_information(self) -> Dict[str, Enum | int | float | str]:
|
|
105
106
|
"""
|
|
@@ -110,12 +111,20 @@ class BaseDeviceWidget(QWidget):
|
|
|
110
111
|
Dictionary that holds information about the
|
|
111
112
|
current device configuration and status.
|
|
112
113
|
"""
|
|
113
|
-
return self.
|
|
114
|
+
return self._device.get_device_information()
|
|
114
115
|
|
|
115
116
|
def disconnect_device(self) -> None:
|
|
116
117
|
""" """
|
|
117
|
-
if self.
|
|
118
|
-
self.
|
|
118
|
+
if self._device.is_connected or self._device._is_streaming:
|
|
119
|
+
self._device.toggle_connection()
|
|
120
|
+
|
|
121
|
+
def _check_ip_input(self, line_edit: QLineEdit, default: str) -> None:
|
|
122
|
+
if not self._device.check_valid_ip(line_edit.text()):
|
|
123
|
+
line_edit.setText(default)
|
|
124
|
+
|
|
125
|
+
def _check_port_input(self, line_edit: QLineEdit, default: str) -> None:
|
|
126
|
+
if not self._device.check_valid_port(line_edit.text()):
|
|
127
|
+
line_edit.setText(default)
|
|
119
128
|
|
|
120
129
|
def closeEvent(self, event: QCloseEvent) -> None:
|
|
121
130
|
self.disconnect_device()
|
|
@@ -49,9 +49,6 @@ class BaseMultipleDevicesWidget(QWidget):
|
|
|
49
49
|
|
|
50
50
|
self.device_stacked_widget = self.ui.deviceStackedWidget
|
|
51
51
|
self.device_selection_combo_box = self.ui.deviceSelectionComboBox
|
|
52
|
-
self.device_selection_combo_box.currentIndexChanged.connect(
|
|
53
|
-
self._update_stacked_widget
|
|
54
|
-
)
|
|
55
52
|
|
|
56
53
|
def get_device_information(self) -> Dict[str, Union[str, int]]:
|
|
57
54
|
return self._get_current_widget().get_device_information()
|
|
@@ -76,13 +73,16 @@ class BaseMultipleDevicesWidget(QWidget):
|
|
|
76
73
|
current_widget.stream_toggled.disconnect(self.stream_toggled)
|
|
77
74
|
|
|
78
75
|
except (TypeError, RuntimeError):
|
|
79
|
-
|
|
76
|
+
...
|
|
80
77
|
|
|
81
78
|
self.device_stacked_widget.setCurrentIndex(index)
|
|
82
79
|
current_widget = self._get_current_widget()
|
|
83
80
|
|
|
81
|
+
# Data arrived
|
|
84
82
|
current_widget.data_arrived.connect(self.data_arrived.emit)
|
|
83
|
+
# Biosignal data arrived
|
|
85
84
|
current_widget.biosignal_data_arrived.connect(self.biosignal_data_arrived.emit)
|
|
85
|
+
# Auxiliary data arrived
|
|
86
86
|
current_widget.auxiliary_data_arrived.connect(self.auxiliary_data_arrived.emit)
|
|
87
87
|
|
|
88
88
|
current_widget.connect_toggled.connect(self.connect_toggled)
|
|
@@ -97,6 +97,9 @@ class BaseMultipleDevicesWidget(QWidget):
|
|
|
97
97
|
self.device_selection_combo_box.addItem(DEVICE_NAME_DICT[device_type])
|
|
98
98
|
|
|
99
99
|
self._update_stacked_widget(0)
|
|
100
|
+
self.device_selection_combo_box.currentIndexChanged.connect(
|
|
101
|
+
self._update_stacked_widget
|
|
102
|
+
)
|
|
100
103
|
|
|
101
104
|
def _get_current_widget(self) -> BaseDeviceWidget:
|
|
102
105
|
return self.device_stacked_widget.currentWidget()
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# OTB Devices
|
|
2
|
-
from biosignal_device_interface.gui.device_template_widgets.otb.otb_muovi_widget import (
|
|
3
|
-
MuoviWidget,
|
|
4
|
-
)
|
|
5
|
-
from biosignal_device_interface.gui.device_template_widgets.otb.otb_muovi_plus_widget import (
|
|
6
|
-
OTBMuoviWidget as MuoviPlusWidget,
|
|
7
|
-
)
|
|
8
|
-
from biosignal_device_interface.gui.device_template_widgets.otb.otb_quattrocento_light_widget import (
|
|
9
|
-
QuattrocentoLightWidget,
|
|
10
|
-
)
|
|
@@ -7,10 +7,20 @@ from biosignal_device_interface.gui.device_template_widgets.core.base_multiple_d
|
|
|
7
7
|
from biosignal_device_interface.constants.devices.core.base_device_constants import (
|
|
8
8
|
DeviceType,
|
|
9
9
|
)
|
|
10
|
-
from biosignal_device_interface.gui.device_template_widgets.otb import (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
from biosignal_device_interface.gui.device_template_widgets.otb.otb_muovi_plus_widget import (
|
|
11
|
+
OTBMuoviPlusWidget,
|
|
12
|
+
)
|
|
13
|
+
from biosignal_device_interface.gui.device_template_widgets.otb.otb_muovi_widget import (
|
|
14
|
+
OTBMuoviWidget,
|
|
15
|
+
)
|
|
16
|
+
from biosignal_device_interface.gui.device_template_widgets.otb.otb_quattrocento_light_widget import (
|
|
17
|
+
OTBQuattrocentoLightWidget,
|
|
18
|
+
)
|
|
19
|
+
from biosignal_device_interface.gui.device_template_widgets.otb.otb_quattrocento_widget import (
|
|
20
|
+
OTBQuattrocentoWidget,
|
|
21
|
+
)
|
|
22
|
+
from biosignal_device_interface.gui.device_template_widgets.otb.otb_syncstation_widget import (
|
|
23
|
+
OTBSyncStationWidget,
|
|
14
24
|
)
|
|
15
25
|
|
|
16
26
|
if TYPE_CHECKING:
|
|
@@ -25,8 +35,10 @@ class OTBDevicesWidget(BaseMultipleDevicesWidget):
|
|
|
25
35
|
super().__init__(parent)
|
|
26
36
|
|
|
27
37
|
self._device_selection: Dict[DeviceType, BaseDeviceWidget] = {
|
|
28
|
-
DeviceType.
|
|
29
|
-
DeviceType.
|
|
30
|
-
DeviceType.
|
|
38
|
+
DeviceType.OTB_QUATTROCENTO: OTBQuattrocentoWidget(self),
|
|
39
|
+
DeviceType.OTB_QUATTROCENTO_LIGHT: OTBQuattrocentoLightWidget(self),
|
|
40
|
+
DeviceType.OTB_MUOVI: OTBMuoviWidget(self),
|
|
41
|
+
DeviceType.OTB_MUOVI_PLUS: OTBMuoviPlusWidget(self),
|
|
42
|
+
DeviceType.OTB_SYNCSTATION: OTBSyncStationWidget(self),
|
|
31
43
|
}
|
|
32
44
|
self._set_devices(self._device_selection)
|
|
@@ -7,7 +7,7 @@ from biosignal_device_interface.gui.device_template_widgets.core.base_device_wid
|
|
|
7
7
|
from biosignal_device_interface.gui.ui_compiled.otb_muovi_template_widget import (
|
|
8
8
|
Ui_MuoviForm,
|
|
9
9
|
)
|
|
10
|
-
from biosignal_device_interface.devices import OTBMuovi
|
|
10
|
+
from biosignal_device_interface.devices.otb.otb_muovi import OTBMuovi
|
|
11
11
|
|
|
12
12
|
# Constants
|
|
13
13
|
from biosignal_device_interface.constants.devices.otb.otb_muovi_constants import (
|
|
@@ -27,17 +27,17 @@ if TYPE_CHECKING:
|
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
class
|
|
30
|
+
class OTBMuoviPlusWidget(BaseDeviceWidget):
|
|
31
31
|
def __init__(self, parent: QWidget | QMainWindow | None = None):
|
|
32
32
|
super().__init__(parent)
|
|
33
33
|
|
|
34
34
|
self._set_device(OTBMuovi(parent=self, is_muovi_plus=True))
|
|
35
35
|
|
|
36
36
|
def _toggle_connection(self) -> None:
|
|
37
|
-
if not self.
|
|
37
|
+
if not self._device.is_connected:
|
|
38
38
|
self.connect_push_button.setEnabled(False)
|
|
39
39
|
|
|
40
|
-
self.
|
|
40
|
+
self._device.toggle_connection(
|
|
41
41
|
(
|
|
42
42
|
self.connection_ip_combo_box.currentText(),
|
|
43
43
|
int(self.connection_port_label.text()),
|
|
@@ -68,7 +68,7 @@ class OTBMuoviWidget(BaseDeviceWidget):
|
|
|
68
68
|
self.input_detection_mode_combo_box.currentIndex() + 1
|
|
69
69
|
)
|
|
70
70
|
|
|
71
|
-
self.
|
|
71
|
+
self._device.configure_device(self._device_params)
|
|
72
72
|
|
|
73
73
|
def _configuration_toggled(self, is_configured: bool) -> None:
|
|
74
74
|
if is_configured:
|
|
@@ -82,7 +82,7 @@ class OTBMuoviWidget(BaseDeviceWidget):
|
|
|
82
82
|
|
|
83
83
|
def _toggle_stream(self) -> None:
|
|
84
84
|
self.stream_push_button.setEnabled(False)
|
|
85
|
-
self.
|
|
85
|
+
self._device.toggle_streaming()
|
|
86
86
|
|
|
87
87
|
def _stream_toggled(self, is_streaming: bool) -> None:
|
|
88
88
|
self.stream_push_button.setEnabled(True)
|
|
@@ -112,17 +112,17 @@ class OTBMuoviWidget(BaseDeviceWidget):
|
|
|
112
112
|
# Command Push Buttons
|
|
113
113
|
self.connect_push_button: QPushButton = self.ui.commandConnectionPushButton
|
|
114
114
|
self.connect_push_button.clicked.connect(self._toggle_connection)
|
|
115
|
-
self.
|
|
115
|
+
self._device.connect_toggled.connect(self._connection_toggled)
|
|
116
116
|
|
|
117
117
|
self.configure_push_button: QPushButton = self.ui.commandConfigurationPushButton
|
|
118
118
|
self.configure_push_button.clicked.connect(self._toggle_configuration)
|
|
119
119
|
self.configure_push_button.setEnabled(False)
|
|
120
|
-
self.
|
|
120
|
+
self._device.configure_toggled.connect(self._configuration_toggled)
|
|
121
121
|
|
|
122
122
|
self.stream_push_button: QPushButton = self.ui.commandStreamPushButton
|
|
123
123
|
self.stream_push_button.clicked.connect(self._toggle_stream)
|
|
124
124
|
self.stream_push_button.setEnabled(False)
|
|
125
|
-
self.
|
|
125
|
+
self._device.stream_toggled.connect(self._stream_toggled)
|
|
126
126
|
|
|
127
127
|
# Connection parameters
|
|
128
128
|
self.connection_group_box: QGroupBox = self.ui.connectionGroupBox
|
|
@@ -135,13 +135,13 @@ class OTBMuoviWidget(BaseDeviceWidget):
|
|
|
135
135
|
lambda: (
|
|
136
136
|
self.connection_ip_combo_box.clear(),
|
|
137
137
|
self.connection_ip_combo_box.addItems(
|
|
138
|
-
self.
|
|
138
|
+
self._device.get_server_wifi_ip_address()
|
|
139
139
|
),
|
|
140
140
|
)
|
|
141
141
|
)
|
|
142
142
|
|
|
143
143
|
self.connection_ip_combo_box.clear()
|
|
144
|
-
self.connection_ip_combo_box.addItems(self.
|
|
144
|
+
self.connection_ip_combo_box.addItems(self._device.get_server_wifi_ip_address())
|
|
145
145
|
|
|
146
146
|
self.connection_port_label.setText(str(MUOVI_NETWORK_PORT))
|
|
147
147
|
|
|
@@ -7,7 +7,7 @@ from biosignal_device_interface.gui.device_template_widgets.core.base_device_wid
|
|
|
7
7
|
from biosignal_device_interface.gui.ui_compiled.otb_muovi_template_widget import (
|
|
8
8
|
Ui_MuoviForm,
|
|
9
9
|
)
|
|
10
|
-
from biosignal_device_interface.devices import OTBMuovi
|
|
10
|
+
from biosignal_device_interface.devices.otb.otb_muovi import OTBMuovi
|
|
11
11
|
|
|
12
12
|
# Constants
|
|
13
13
|
from biosignal_device_interface.constants.devices.otb.otb_muovi_constants import (
|
|
@@ -27,17 +27,17 @@ if TYPE_CHECKING:
|
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
class
|
|
30
|
+
class OTBMuoviWidget(BaseDeviceWidget):
|
|
31
31
|
def __init__(self, parent: QWidget | QMainWindow | None = None):
|
|
32
32
|
super().__init__(parent)
|
|
33
33
|
|
|
34
34
|
self._set_device(OTBMuovi(parent=self))
|
|
35
35
|
|
|
36
36
|
def _toggle_connection(self) -> None:
|
|
37
|
-
if not self.
|
|
37
|
+
if not self._device.is_connected:
|
|
38
38
|
self.connect_push_button.setEnabled(False)
|
|
39
39
|
|
|
40
|
-
self.
|
|
40
|
+
self._device.toggle_connection(
|
|
41
41
|
(
|
|
42
42
|
self.connection_ip_combo_box.currentText(),
|
|
43
43
|
int(self.connection_port_label.text()),
|
|
@@ -68,7 +68,7 @@ class MuoviWidget(BaseDeviceWidget):
|
|
|
68
68
|
self.input_detection_mode_combo_box.currentIndex() + 1
|
|
69
69
|
)
|
|
70
70
|
|
|
71
|
-
self.
|
|
71
|
+
self._device.configure_device(self._device_params)
|
|
72
72
|
|
|
73
73
|
def _configuration_toggled(self, is_configured: bool) -> None:
|
|
74
74
|
if is_configured:
|
|
@@ -82,7 +82,7 @@ class MuoviWidget(BaseDeviceWidget):
|
|
|
82
82
|
|
|
83
83
|
def _toggle_stream(self) -> None:
|
|
84
84
|
self.stream_push_button.setEnabled(False)
|
|
85
|
-
self.
|
|
85
|
+
self._device.toggle_streaming()
|
|
86
86
|
|
|
87
87
|
def _stream_toggled(self, is_streaming: bool) -> None:
|
|
88
88
|
self.stream_push_button.setEnabled(True)
|
|
@@ -112,17 +112,17 @@ class MuoviWidget(BaseDeviceWidget):
|
|
|
112
112
|
# Command Push Buttons
|
|
113
113
|
self.connect_push_button: QPushButton = self.ui.commandConnectionPushButton
|
|
114
114
|
self.connect_push_button.clicked.connect(self._toggle_connection)
|
|
115
|
-
self.
|
|
115
|
+
self._device.connect_toggled.connect(self._connection_toggled)
|
|
116
116
|
|
|
117
117
|
self.configure_push_button: QPushButton = self.ui.commandConfigurationPushButton
|
|
118
118
|
self.configure_push_button.clicked.connect(self._toggle_configuration)
|
|
119
119
|
self.configure_push_button.setEnabled(False)
|
|
120
|
-
self.
|
|
120
|
+
self._device.configure_toggled.connect(self._configuration_toggled)
|
|
121
121
|
|
|
122
122
|
self.stream_push_button: QPushButton = self.ui.commandStreamPushButton
|
|
123
123
|
self.stream_push_button.clicked.connect(self._toggle_stream)
|
|
124
124
|
self.stream_push_button.setEnabled(False)
|
|
125
|
-
self.
|
|
125
|
+
self._device.stream_toggled.connect(self._stream_toggled)
|
|
126
126
|
|
|
127
127
|
# Connection parameters
|
|
128
128
|
self.connection_group_box: QGroupBox = self.ui.connectionGroupBox
|
|
@@ -135,13 +135,13 @@ class MuoviWidget(BaseDeviceWidget):
|
|
|
135
135
|
lambda: (
|
|
136
136
|
self.connection_ip_combo_box.clear(),
|
|
137
137
|
self.connection_ip_combo_box.addItems(
|
|
138
|
-
self.
|
|
138
|
+
self._device.get_server_wifi_ip_address()
|
|
139
139
|
),
|
|
140
140
|
)
|
|
141
141
|
)
|
|
142
142
|
|
|
143
143
|
self.connection_ip_combo_box.clear()
|
|
144
|
-
self.connection_ip_combo_box.addItems(self.
|
|
144
|
+
self.connection_ip_combo_box.addItems(self._device.get_server_wifi_ip_address())
|
|
145
145
|
|
|
146
146
|
self.connection_port_label.setText(str(MUOVI_NETWORK_PORT))
|
|
147
147
|
|
|
@@ -7,10 +7,12 @@ from biosignal_device_interface.gui.device_template_widgets.core.base_device_wid
|
|
|
7
7
|
from biosignal_device_interface.gui.ui_compiled.otb_quattrocento_light_template_widget import (
|
|
8
8
|
Ui_QuattrocentoLightForm,
|
|
9
9
|
)
|
|
10
|
-
from biosignal_device_interface.devices import
|
|
10
|
+
from biosignal_device_interface.devices.otb.otb_quattrocento_light import (
|
|
11
|
+
OTBQuattrocentoLight,
|
|
12
|
+
)
|
|
11
13
|
|
|
12
14
|
# Constants
|
|
13
|
-
from biosignal_device_interface.constants.devices.otb.
|
|
15
|
+
from biosignal_device_interface.constants.devices.otb.otb_quattrocento_light_constants import (
|
|
14
16
|
QuattrocentoLightSamplingFrequency,
|
|
15
17
|
QuattrocentoLightStreamingFrequency,
|
|
16
18
|
)
|
|
@@ -27,80 +29,80 @@ if TYPE_CHECKING:
|
|
|
27
29
|
)
|
|
28
30
|
|
|
29
31
|
|
|
30
|
-
class
|
|
32
|
+
class OTBQuattrocentoLightWidget(BaseDeviceWidget):
|
|
31
33
|
def __init__(self, parent: QWidget | QMainWindow | None = None):
|
|
32
34
|
super().__init__(parent)
|
|
33
35
|
self._set_device(OTBQuattrocentoLight(self))
|
|
34
36
|
|
|
35
37
|
def _toggle_connection(self) -> None:
|
|
36
|
-
if not self.
|
|
37
|
-
self.
|
|
38
|
+
if not self._device.is_connected:
|
|
39
|
+
self._connect_push_button.setEnabled(False)
|
|
38
40
|
|
|
39
|
-
self.
|
|
40
|
-
(self.
|
|
41
|
+
self._device.toggle_connection(
|
|
42
|
+
(self._connection_ip_label.text(), int(self._connection_port_label.text())),
|
|
41
43
|
)
|
|
42
44
|
|
|
43
45
|
def _connection_toggled(self, is_connected: bool) -> None:
|
|
44
|
-
self.
|
|
46
|
+
self._connect_push_button.setEnabled(True)
|
|
45
47
|
if is_connected:
|
|
46
|
-
self.
|
|
47
|
-
self.
|
|
48
|
-
self.
|
|
49
|
-
self.
|
|
48
|
+
self._connect_push_button.setText("Disconnect")
|
|
49
|
+
self._connect_push_button.setChecked(True)
|
|
50
|
+
self._configure_push_button.setEnabled(True)
|
|
51
|
+
self._connection_group_box.setEnabled(False)
|
|
50
52
|
else:
|
|
51
|
-
self.
|
|
52
|
-
self.
|
|
53
|
-
self.
|
|
54
|
-
self.
|
|
55
|
-
self.
|
|
53
|
+
self._connect_push_button.setText("Connect")
|
|
54
|
+
self._connect_push_button.setChecked(False)
|
|
55
|
+
self._configure_push_button.setEnabled(False)
|
|
56
|
+
self._stream_push_button.setEnabled(False)
|
|
57
|
+
self._connection_group_box.setEnabled(True)
|
|
56
58
|
|
|
57
59
|
self.connect_toggled.emit(is_connected)
|
|
58
60
|
|
|
59
61
|
def _toggle_configuration(self) -> None:
|
|
60
62
|
self._device_params["grids"] = [
|
|
61
63
|
i
|
|
62
|
-
for i, check_box in enumerate(self.
|
|
64
|
+
for i, check_box in enumerate(self._grid_selection_check_box_list)
|
|
63
65
|
if check_box.isChecked()
|
|
64
66
|
]
|
|
65
67
|
|
|
66
68
|
self._device_params["streaming_frequency_mode"] = (
|
|
67
69
|
QuattrocentoLightStreamingFrequency(
|
|
68
|
-
self.
|
|
70
|
+
self._acquisition_streaming_frequency_combo_box.currentIndex() + 1
|
|
69
71
|
)
|
|
70
72
|
)
|
|
71
73
|
self._device_params["sampling_frequency_mode"] = (
|
|
72
74
|
QuattrocentoLightSamplingFrequency(
|
|
73
|
-
self.
|
|
75
|
+
self._acquisition_sampling_frequency_combo_box.currentIndex() + 1
|
|
74
76
|
)
|
|
75
77
|
)
|
|
76
78
|
|
|
77
|
-
self.
|
|
79
|
+
self._device.configure_device(self._device_params)
|
|
78
80
|
|
|
79
81
|
def _configuration_toggled(self, is_configured: bool) -> None:
|
|
80
82
|
if is_configured:
|
|
81
|
-
self.
|
|
83
|
+
self._stream_push_button.setEnabled(True)
|
|
82
84
|
|
|
83
85
|
self.configure_toggled.emit(is_configured)
|
|
84
86
|
|
|
85
87
|
def _toggle_configuration_group_boxes(self) -> None:
|
|
86
|
-
for group_box in self.
|
|
88
|
+
for group_box in self._configuration_group_boxes:
|
|
87
89
|
group_box.setEnabled(not group_box.isEnabled())
|
|
88
90
|
|
|
89
91
|
def _toggle_stream(self) -> None:
|
|
90
|
-
self.
|
|
91
|
-
self.
|
|
92
|
+
self._stream_push_button.setEnabled(False)
|
|
93
|
+
self._device.toggle_streaming()
|
|
92
94
|
|
|
93
95
|
def _stream_toggled(self, is_streaming: bool) -> None:
|
|
94
|
-
self.
|
|
96
|
+
self._stream_push_button.setEnabled(True)
|
|
95
97
|
if is_streaming:
|
|
96
|
-
self.
|
|
97
|
-
self.
|
|
98
|
-
self.
|
|
98
|
+
self._stream_push_button.setText("Stop Streaming")
|
|
99
|
+
self._stream_push_button.setChecked(True)
|
|
100
|
+
self._configure_push_button.setEnabled(False)
|
|
99
101
|
self._toggle_configuration_group_boxes()
|
|
100
102
|
else:
|
|
101
|
-
self.
|
|
102
|
-
self.
|
|
103
|
-
self.
|
|
103
|
+
self._stream_push_button.setText("Stream")
|
|
104
|
+
self._stream_push_button.setChecked(False)
|
|
105
|
+
self._configure_push_button.setEnabled(True)
|
|
104
106
|
self._toggle_configuration_group_boxes()
|
|
105
107
|
|
|
106
108
|
self.stream_toggled.emit(is_streaming)
|
|
@@ -117,37 +119,39 @@ class QuattrocentoLightWidget(BaseDeviceWidget):
|
|
|
117
119
|
self.ui.setupUi(self)
|
|
118
120
|
|
|
119
121
|
# Command Push Buttons
|
|
120
|
-
self.
|
|
121
|
-
self.
|
|
122
|
-
self.
|
|
122
|
+
self._connect_push_button: QPushButton = self.ui.commandConnectionPushButton
|
|
123
|
+
self._connect_push_button.clicked.connect(self._toggle_connection)
|
|
124
|
+
self._device.connect_toggled.connect(self._connection_toggled)
|
|
123
125
|
|
|
124
|
-
self.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
self.
|
|
126
|
+
self._configure_push_button: QPushButton = (
|
|
127
|
+
self.ui.commandConfigurationPushButton
|
|
128
|
+
)
|
|
129
|
+
self._configure_push_button.clicked.connect(self._toggle_configuration)
|
|
130
|
+
self._configure_push_button.setEnabled(False)
|
|
131
|
+
self._device.configure_toggled.connect(self._configuration_toggled)
|
|
128
132
|
|
|
129
|
-
self.
|
|
130
|
-
self.
|
|
131
|
-
self.
|
|
132
|
-
self.
|
|
133
|
+
self._stream_push_button: QPushButton = self.ui.commandStreamPushButton
|
|
134
|
+
self._stream_push_button.clicked.connect(self._toggle_stream)
|
|
135
|
+
self._stream_push_button.setEnabled(False)
|
|
136
|
+
self._device.stream_toggled.connect(self._stream_toggled)
|
|
133
137
|
|
|
134
138
|
# Connection parameters
|
|
135
|
-
self.
|
|
136
|
-
self.
|
|
137
|
-
self.
|
|
139
|
+
self._connection_group_box: QGroupBox = self.ui.connectionGroupBox
|
|
140
|
+
self._connection_ip_label: QLabel = self.ui.connectionIPLabel
|
|
141
|
+
self._connection_port_label: QLabel = self.ui.connectionPortLabel
|
|
138
142
|
|
|
139
143
|
# Acquisition parameters
|
|
140
|
-
self.
|
|
141
|
-
self.
|
|
144
|
+
self._acquisition_group_box: QGroupBox = self.ui.acquisitionGroupBox
|
|
145
|
+
self._acquisition_sampling_frequency_combo_box: QComboBox = (
|
|
142
146
|
self.ui.acquisitionSamplingFrequencyComboBox
|
|
143
147
|
)
|
|
144
|
-
self.
|
|
148
|
+
self._acquisition_streaming_frequency_combo_box: QComboBox = (
|
|
145
149
|
self.ui.acquisitionStreamingFrequencyComboBox
|
|
146
150
|
)
|
|
147
151
|
|
|
148
152
|
# Grid parameters
|
|
149
|
-
self.
|
|
150
|
-
self.
|
|
153
|
+
self._grid_selection_group_box: QGroupBox = self.ui.gridSelectionGroupBox
|
|
154
|
+
self._grid_selection_check_box_list: list[QCheckBox] = [
|
|
151
155
|
self.ui.gridOneCheckBox,
|
|
152
156
|
self.ui.gridTwoCheckBox,
|
|
153
157
|
self.ui.gridThreeCheckBox,
|
|
@@ -158,13 +162,13 @@ class QuattrocentoLightWidget(BaseDeviceWidget):
|
|
|
158
162
|
|
|
159
163
|
[
|
|
160
164
|
check_box.setChecked(False)
|
|
161
|
-
for check_box in self.
|
|
165
|
+
for check_box in self._grid_selection_check_box_list
|
|
162
166
|
]
|
|
163
|
-
self.
|
|
164
|
-
self.
|
|
167
|
+
self._grid_selection_check_box_list[2].setChecked(True)
|
|
168
|
+
self._grid_selection_check_box_list[3].setChecked(True)
|
|
165
169
|
|
|
166
170
|
# Configuration parameters
|
|
167
|
-
self.
|
|
168
|
-
self.
|
|
169
|
-
self.
|
|
171
|
+
self._configuration_group_boxes: list[QGroupBox] = [
|
|
172
|
+
self._acquisition_group_box,
|
|
173
|
+
self._grid_selection_group_box,
|
|
170
174
|
]
|