[ui/plots] fixing error if nothing has been plotted, the gui could not close

This commit is contained in:
wendtalexander 2024-10-23 11:08:54 +02:00
parent 75619cf1c8
commit 574e9a8110

View File

@ -16,6 +16,7 @@ class Continously:
self.figure = figure
self.buffer = buffer
self.last_plotted_index = 0
self.timer = QTimer()
def plot(self, *args, **kwargs):
self.figure.setBackground("w")
@ -36,7 +37,6 @@ class Continously:
)
# self.plot_index = 0
self.timer = QTimer()
self.CHUNK_PLOT = int(self.buffer.samplerate / 6)
self.PLOT_HISTORY = 500_000 # The amount of data you want to keep on screen
self.timer.setInterval(150)
@ -70,6 +70,7 @@ class Continously:
def stop_plotting(self):
self.timer.stop()
if self.last_plotted_index > 0:
total_count = self.buffer.totalcount()
times, items = self.buffer.read(
self.last_plotted_index,