[ui] adding stop button

This commit is contained in:
wendtalexander 2024-10-09 17:15:58 +02:00
parent 3ca48d11fe
commit 22b899e723

View File

@ -78,14 +78,15 @@ class PyRelacs(QMainWindow):
widget.setLayout(layout)
self.setCentralWidget(widget)
SAMPLERATE = 1000
BUFFERSIZE = 1_000
SAMPLERATE = 1_000
BUFFERSIZE = 1_0000
self.buffer = CircBuffer(size=BUFFERSIZE, samplerate=SAMPLERATE)
# self.connect_dac()
# self.daq_producer = DaqProducer(self.buffer, self.daq_device, [1, 1])
self.sin_producer = SinProducer(self.buffer)
self.continously_plot = Continously(self.figure, self.buffer)
self.continously_plot.plot_daq()
def create_actions(self):
self._rlx_exitaction = QAction(QIcon(":/icons/exit.png"), "Exit", self)
@ -125,7 +126,7 @@ class PyRelacs(QMainWindow):
self._run_sinus_action = QAction(QIcon(":/icons/record.png"), "Sinus", self)
self._run_sinus_action.triggered.connect(self.run_sinus)
self._stop_recording = QAction("Stop", self)
self._stop_recording = QAction(QIcon(":/icons/stop.png"), "Stop", self)
self._stop_recording.triggered.connect(self.stop_recording)
self.create_menu()
@ -211,12 +212,19 @@ class PyRelacs(QMainWindow):
sinus_pro.signals.progress.connect(self.progress_fn)
self.threadpool.start(sinus_pro)
# time.sleep(0.05)
self.continously_plot.plot_daq()
# plot_daq = Worker(self.continously_plot.plot_daq)
# plot_daq.signals.result.connect(self.print_output)
# plot_daq.signals.finished.connect(self.thread_complete)
# plot_daq.signals.progress.connect(self.progress_fn)
# self.threadpool.start(plot_daq)
# self.continously_plot.plot_daq()
def stop_recording(self):
self.add_to_textfield("pressed")
self._stop_recording.setEnabled(False)
self.sin_producer.stop_request()
self.continously_plot.stop_plotting()
def connect_dac(self):
devices = uldaq.get_daq_device_inventory(uldaq.InterfaceType.USB)
@ -257,6 +265,7 @@ class PyRelacs(QMainWindow):
def on_exit(self):
log.info("exit button!")
self.stop_recording()
self.add_to_textfield("exiting")
self.disconnect_dac()
self.close()