From d36d9d5495163ea305af7d21d2f6dec853a5f21c Mon Sep 17 00:00:00 2001 From: Christoph Schmidt <christoph.,schmidt@tugraz.at> Date: Thu, 4 Jan 2024 11:26:04 +0100 Subject: [PATCH] Changed function for starting the streaming. Now no parameters are needed. --- .../view/AD2CaptDeviceView.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/CaptDeviceControl/view/AD2CaptDeviceView.py b/src/CaptDeviceControl/view/AD2CaptDeviceView.py index a12c24e..d68ffb1 100644 --- a/src/CaptDeviceControl/view/AD2CaptDeviceView.py +++ b/src/CaptDeviceControl/view/AD2CaptDeviceView.py @@ -141,6 +141,7 @@ class ControlWindow(QMainWindow): self.model.device_information.signals.device_name_changed.connect(self._on_device_name_changed) self.model.device_information.signals.device_serial_number_changed.connect( self._on_device_serial_number_changed) + self.model.capturing_information.signals.ready_for_recording_changed.connect(self._on_ready_for_recording_changed) # ================================================================================================================== # Slots @@ -195,7 +196,6 @@ class ControlWindow(QMainWindow): self._ui.btn_reset.setEnabled(True) self._ui.btn_play.setEnabled(True) self._ui.btn_play.setChecked(True) - self.stream_update_timer.start() # ================================================================================================================== # UI Slots @@ -206,17 +206,13 @@ class ControlWindow(QMainWindow): def _ui_on_selected_ain_changed(self, channel_index): """ Gets called if the ui changes the field (should modify the model) """ self.model.analog_in.selected_ain_channel = channel_index + def _on_ui_btn_connect_clicked(self): - #if self.model.device_information.device_connected: - # self.controller.close_device() - # self._ui.btn_connect.setText("Connect") - #else: try: self.controller.open_device() except Exception as e: self.logger.error(f"Error: {e}") - #self._ui.btn_connect.setText("Disconnect") - self.capture_update_timer.start() + def _on_ui_sample_rate_changed(self, sample_rate: int): self.model.sample_rate = sample_rate @@ -280,6 +276,14 @@ class ControlWindow(QMainWindow): self.capt_info.lbl_is_capt.setText(AD2Constants.CapturingState.STOPPED(True)) self._ui.btn_record.setChecked(False) + def _on_ready_for_recording_changed(self, ready): + if ready: + self.capture_update_timer.start() + self.stream_update_timer.start() + else: + self.capture_update_timer.stop() + self.stream_update_timer.stop() + -- GitLab