diff --git a/RFG_ADC_dataplotter.py b/RFG_ADC_dataplotter.py index 9a912da..b16ba5f 100755 --- a/RFG_ADC_dataplotter.py +++ b/RFG_ADC_dataplotter.py @@ -1775,7 +1775,11 @@ def run_pyqtgraph(args): interval_ms = int(1000.0 / max_fps) # 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() if app is None: app = QtWidgets.QApplication([]) @@ -1832,7 +1836,7 @@ def run_pyqtgraph(args): # Водопад спектров (справа-снизу) 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.setLabel("bottom", "Время, с (новое справа)") try: @@ -1851,15 +1855,18 @@ def run_pyqtgraph(args): # Отдельное окно контролов: GraphicsLayoutWidget не принимает обычные QWidget через addItem. calib_cb = QtWidgets.QCheckBox("калибровка") - control_window = QtWidgets.QWidget() - try: - control_window.setWindowTitle(f"{args.title} controls") - except Exception: - pass - control_layout = QtWidgets.QVBoxLayout(control_window) - control_layout.setContentsMargins(8, 8, 8, 8) - control_layout.setSpacing(6) - control_layout.addWidget(calib_cb) + control_window = None + control_layout = None + if peak_calibrate_mode: + control_window = QtWidgets.QWidget() + try: + control_window.setWindowTitle(f"{args.title} controls") + except Exception: + pass + control_layout = QtWidgets.QVBoxLayout(control_window) + control_layout.setContentsMargins(8, 8, 8, 8) + control_layout.setSpacing(6) + control_layout.addWidget(calib_cb) # Статусная строка (внизу окна) status = pg.LabelItem(justify="left") @@ -1949,13 +1956,15 @@ def run_pyqtgraph(args): pass c_layout.addRow(f"C{idx}", edit) c_edits.append(edit) - control_layout.addWidget(c_widget) + if control_layout is not None: + control_layout.addWidget(c_widget) + except Exception: + pass + if control_window is not None: + try: + control_window.show() except Exception: pass - try: - control_window.show() - except Exception: - pass def ensure_buffer(_w: int): nonlocal ring, ring_time, head, width, x_shared, ring_fft, distance_shared @@ -2102,7 +2111,9 @@ def run_pyqtgraph(args): cm_mod = getattr(pg, "colormap", None) if cm_mod is not None: 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: pass @@ -2189,7 +2200,7 @@ def run_pyqtgraph(args): if changed and ring is not None: 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) if levels is not None: img.setImage(disp, autoLevels=False, levels=levels) @@ -2226,10 +2237,9 @@ def run_pyqtgraph(args): 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 = disp_fft.T[:, ::-1] + disp_fft = disp_fft.T 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 = disp_times[::-1] now_t = time.time() mask = np.isfinite(disp_times) & (disp_times >= (now_t - spec_mean_sec)) if np.any(mask): @@ -2273,10 +2283,11 @@ def run_pyqtgraph(args): def on_quit(): stop_event.set() reader.join(timeout=1.0) - try: - control_window.close() - except Exception: - pass + if control_window is not None: + try: + control_window.close() + except Exception: + pass app.aboutToQuit.connect(on_quit) win.show()