tweaked PyQT backend
This commit is contained in:
@ -1775,7 +1775,11 @@ def run_pyqtgraph(args):
|
|||||||
interval_ms = int(1000.0 / max_fps)
|
interval_ms = int(1000.0 / max_fps)
|
||||||
|
|
||||||
# PyQtGraph настройки
|
# PyQtGraph настройки
|
||||||
pg.setConfigOptions(useOpenGL=not peak_calibrate_mode, antialias=False)
|
pg.setConfigOptions(
|
||||||
|
useOpenGL=not peak_calibrate_mode,
|
||||||
|
antialias=False,
|
||||||
|
imageAxisOrder="row-major",
|
||||||
|
)
|
||||||
app = QtWidgets.QApplication.instance()
|
app = QtWidgets.QApplication.instance()
|
||||||
if app is None:
|
if app is None:
|
||||||
app = QtWidgets.QApplication([])
|
app = QtWidgets.QApplication([])
|
||||||
@ -1832,7 +1836,7 @@ def run_pyqtgraph(args):
|
|||||||
|
|
||||||
# Водопад спектров (справа-снизу)
|
# Водопад спектров (справа-снизу)
|
||||||
p_spec = win.addPlot(row=1, col=1, title="B-scan (дБ)")
|
p_spec = win.addPlot(row=1, col=1, title="B-scan (дБ)")
|
||||||
p_spec.invertY(True)
|
p_spec.invertY(False)
|
||||||
p_spec.showGrid(x=False, y=False)
|
p_spec.showGrid(x=False, y=False)
|
||||||
p_spec.setLabel("bottom", "Время, с (новое справа)")
|
p_spec.setLabel("bottom", "Время, с (новое справа)")
|
||||||
try:
|
try:
|
||||||
@ -1851,6 +1855,9 @@ def run_pyqtgraph(args):
|
|||||||
|
|
||||||
# Отдельное окно контролов: GraphicsLayoutWidget не принимает обычные QWidget через addItem.
|
# Отдельное окно контролов: GraphicsLayoutWidget не принимает обычные QWidget через addItem.
|
||||||
calib_cb = QtWidgets.QCheckBox("калибровка")
|
calib_cb = QtWidgets.QCheckBox("калибровка")
|
||||||
|
control_window = None
|
||||||
|
control_layout = None
|
||||||
|
if peak_calibrate_mode:
|
||||||
control_window = QtWidgets.QWidget()
|
control_window = QtWidgets.QWidget()
|
||||||
try:
|
try:
|
||||||
control_window.setWindowTitle(f"{args.title} controls")
|
control_window.setWindowTitle(f"{args.title} controls")
|
||||||
@ -1949,9 +1956,11 @@ def run_pyqtgraph(args):
|
|||||||
pass
|
pass
|
||||||
c_layout.addRow(f"C{idx}", edit)
|
c_layout.addRow(f"C{idx}", edit)
|
||||||
c_edits.append(edit)
|
c_edits.append(edit)
|
||||||
|
if control_layout is not None:
|
||||||
control_layout.addWidget(c_widget)
|
control_layout.addWidget(c_widget)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
if control_window is not None:
|
||||||
try:
|
try:
|
||||||
control_window.show()
|
control_window.show()
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -2102,7 +2111,9 @@ def run_pyqtgraph(args):
|
|||||||
cm_mod = getattr(pg, "colormap", None)
|
cm_mod = getattr(pg, "colormap", None)
|
||||||
if cm_mod is not None:
|
if cm_mod is not None:
|
||||||
cm = cm_mod.get(args.cmap)
|
cm = cm_mod.get(args.cmap)
|
||||||
img.setLookupTable(cm.getLookupTable(0.0, 1.0, 256))
|
lut = cm.getLookupTable(0.0, 1.0, 256)
|
||||||
|
img.setLookupTable(lut)
|
||||||
|
img_fft.setLookupTable(lut)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -2189,7 +2200,7 @@ def run_pyqtgraph(args):
|
|||||||
|
|
||||||
if changed and ring is not None:
|
if changed and ring is not None:
|
||||||
disp = ring if head == 0 else np.roll(ring, -head, axis=0)
|
disp = ring if head == 0 else np.roll(ring, -head, axis=0)
|
||||||
disp = disp.T[:, ::-1] # (width, time with newest at left)
|
disp = disp.T # (width, time with newest at right)
|
||||||
levels = _visible_levels_pyqtgraph(disp)
|
levels = _visible_levels_pyqtgraph(disp)
|
||||||
if levels is not None:
|
if levels is not None:
|
||||||
img.setImage(disp, autoLevels=False, levels=levels)
|
img.setImage(disp, autoLevels=False, levels=levels)
|
||||||
@ -2226,10 +2237,9 @@ def run_pyqtgraph(args):
|
|||||||
|
|
||||||
if changed and ring_fft is not None:
|
if changed and ring_fft is not None:
|
||||||
disp_fft = ring_fft if head == 0 else np.roll(ring_fft, -head, axis=0)
|
disp_fft = ring_fft if head == 0 else np.roll(ring_fft, -head, axis=0)
|
||||||
disp_fft = disp_fft.T[:, ::-1]
|
disp_fft = disp_fft.T
|
||||||
if spec_mean_sec > 0.0 and ring_time is not None:
|
if spec_mean_sec > 0.0 and ring_time is not None:
|
||||||
disp_times = ring_time if head == 0 else np.roll(ring_time, -head)
|
disp_times = ring_time if head == 0 else np.roll(ring_time, -head)
|
||||||
disp_times = disp_times[::-1]
|
|
||||||
now_t = time.time()
|
now_t = time.time()
|
||||||
mask = np.isfinite(disp_times) & (disp_times >= (now_t - spec_mean_sec))
|
mask = np.isfinite(disp_times) & (disp_times >= (now_t - spec_mean_sec))
|
||||||
if np.any(mask):
|
if np.any(mask):
|
||||||
@ -2273,6 +2283,7 @@ def run_pyqtgraph(args):
|
|||||||
def on_quit():
|
def on_quit():
|
||||||
stop_event.set()
|
stop_event.set()
|
||||||
reader.join(timeout=1.0)
|
reader.join(timeout=1.0)
|
||||||
|
if control_window is not None:
|
||||||
try:
|
try:
|
||||||
control_window.close()
|
control_window.close()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user