g4ixt / QtTinySA

A Python 'TinySA' GUI programme using Qt5 and PyQt5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when enabling 3D Spectrum during a running scan.

Ho-Ro opened this issue · comments

commented

Open the program, press Run, select tab 3D Spectrum and enable the checkbox 3D Spectrum.
The program sends repeated Tracebacks:

Traceback (most recent call last):
  File "/home/horo/projects/tinySA/QtTinySA_orig/QtTinySA.py", line 190, in sigProcess
    self.updateTimeSpectrum()
  File "/home/horo/projects/tinySA/QtTinySA_orig/QtTinySA.py", line 216, in updateTimeSpectrum
    self.p2.setData(z=z)
    ^^^^^^^
AttributeError: 'analyser' object has no attribute 'p2'

Workaround:

diff --git a/QtTinySA.py b/QtTinySA.py
index 033900c..678d0ec 100644
--- a/QtTinySA.py
+++ b/QtTinySA.py
@@ -67,6 +67,7 @@ class analyser:
     def __init__(self, dev=None):
         self.dev = getport()
         self._frequencies = None
+        self.p2 = None
         self.sweeping = False
         self.signals = WorkerSignals()
         self.signals.result.connect(self.sigProcess)
@@ -211,6 +212,8 @@ class analyser:
         ui.openGLWidget.addItem(g)
 
     def updateTimeSpectrum(self):
+        if self.p2 is None:
+            self.createTimeSpectrum()
         z = self.sweepresults
         logging.debug(f'z = {z}')
         self.p2.setData(z=z)
commented

Thanks Martin, I had missed this one. 3D scan button disabled when scan running and re-enabled when it stops, which is consistent with other buttons.