tweaked PyQT backend
This commit is contained in:
@ -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,6 +1855,9 @@ def run_pyqtgraph(args):
|
||||
|
||||
# Отдельное окно контролов: GraphicsLayoutWidget не принимает обычные QWidget через addItem.
|
||||
calib_cb = QtWidgets.QCheckBox("калибровка")
|
||||
control_window = None
|
||||
control_layout = None
|
||||
if peak_calibrate_mode:
|
||||
control_window = QtWidgets.QWidget()
|
||||
try:
|
||||
control_window.setWindowTitle(f"{args.title} controls")
|
||||
@ -1949,9 +1956,11 @@ def run_pyqtgraph(args):
|
||||
pass
|
||||
c_layout.addRow(f"C{idx}", edit)
|
||||
c_edits.append(edit)
|
||||
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:
|
||||
@ -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,6 +2283,7 @@ def run_pyqtgraph(args):
|
||||
def on_quit():
|
||||
stop_event.set()
|
||||
reader.join(timeout=1.0)
|
||||
if control_window is not None:
|
||||
try:
|
||||
control_window.close()
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user