new GPR parameters and some UI fixes

This commit is contained in:
Ayzen
2026-04-07 12:55:26 +03:00
parent 4b78c2808d
commit 202993325d
27 changed files with 1494 additions and 168 deletions
+48 -4
View File
@@ -36,6 +36,9 @@ class PreprocessDialog(QDialog):
selection_changed = pyqtSignal()
start_sequence_requested = pyqtSignal(str)
capture_next_requested = pyqtSignal()
capture_all_requested = pyqtSignal()
undo_last_requested = pyqtSignal()
finalize_sequence_requested = pyqtSignal()
abort_sequence_requested = pyqtSignal()
def __init__(self, parent=None) -> None:
@@ -97,6 +100,8 @@ class PreprocessDialog(QDialog):
for key in keys:
combo = QComboBox(group)
combo.setPlaceholderText("<not selected>")
combo.setCurrentIndex(-1)
combo.currentTextChanged.connect(self._emit_selection_changed)
self._set_combos[key] = combo
form.addRow(self._asset_row_label(key), combo)
@@ -142,12 +147,27 @@ class PreprocessDialog(QDialog):
self._capture_next_button.clicked.connect(self.capture_next_requested.emit)
self._capture_next_button.setEnabled(False)
self._capture_all_button = QPushButton("Capture All Remaining", parent)
self._capture_all_button.clicked.connect(self.capture_all_requested.emit)
self._capture_all_button.setEnabled(False)
self._undo_last_button = QPushButton("Undo Last Capture", parent)
self._undo_last_button.clicked.connect(self.undo_last_requested.emit)
self._undo_last_button.setEnabled(False)
self._save_sequence_button = QPushButton("Save Captured Set", parent)
self._save_sequence_button.clicked.connect(self.finalize_sequence_requested.emit)
self._save_sequence_button.setEnabled(False)
self._abort_button = QPushButton("Abort Sequence", parent)
self._abort_button.clicked.connect(self.abort_sequence_requested.emit)
self._abort_button.setEnabled(False)
layout = QHBoxLayout()
layout.addWidget(self._capture_next_button)
layout.addWidget(self._capture_all_button)
layout.addWidget(self._undo_last_button)
layout.addWidget(self._save_sequence_button)
layout.addWidget(self._abort_button)
layout.addStretch(1)
return layout
@@ -189,6 +209,10 @@ class PreprocessDialog(QDialog):
"""Clear capture history text box."""
self._capture_log.clear()
def set_capture_log_entries(self, entries: list[str]) -> None:
"""Replace capture history text with provided rows."""
self._capture_log.setPlainText("\n".join(entries))
def append_capture_log_entry(
self,
*,
@@ -212,6 +236,9 @@ class PreprocessDialog(QDialog):
total_count: int,
next_input: int | None,
next_output: int | None,
can_undo: bool,
can_finalize: bool,
can_capture_all: bool,
) -> None:
"""Update sequence progress/status widgets."""
if kind is None:
@@ -219,20 +246,27 @@ class PreprocessDialog(QDialog):
self._progress_label.setText("0 / 0")
self._combo_label.setText("<none>")
self._capture_next_button.setEnabled(False)
self._capture_all_button.setEnabled(False)
self._undo_last_button.setEnabled(False)
self._save_sequence_button.setEnabled(False)
self._abort_button.setEnabled(False)
self._capture_all_button.setText("Capture All Remaining")
return
active_label = preprocess_asset_display_name(kind) if kind in PREPROCESS_ASSET_SPECS else kind
self._active_kind_label.setText(active_label)
self._progress_label.setText(f"{captured_count} / {total_count}")
self._undo_last_button.setEnabled(bool(can_undo))
self._save_sequence_button.setEnabled(bool(can_finalize))
self._capture_all_button.setEnabled(bool(can_capture_all))
self._abort_button.setEnabled(True)
self._capture_all_button.setText("Capture All Remaining")
if next_input is None or next_output is None:
self._combo_label.setText("<complete>")
self._capture_next_button.setEnabled(False)
self._abort_button.setEnabled(True)
else:
self._combo_label.setText(f"input={next_input}, output={next_output}")
self._capture_next_button.setEnabled(True)
self._abort_button.setEnabled(True)
def set_available_sets(self, available_sets: dict[str, list[str]]) -> None:
"""Replace combo-box choices for all preprocess assets."""
@@ -245,10 +279,11 @@ class PreprocessDialog(QDialog):
"""Apply selected set names to all comboboxes and optionally emit update."""
for key in VISIBLE_PREPROCESS_ASSET_KEYS:
selected_value = selected_sets.get(key, "")
if not selected_value:
continue
combo = self._set_combos[key]
with QSignalBlocker(combo):
if not selected_value:
combo.setCurrentIndex(-1)
continue
index = combo.findText(selected_value)
if index < 0:
combo.addItem(selected_value)
@@ -261,6 +296,14 @@ class PreprocessDialog(QDialog):
"""Set short human-readable status line."""
self._status_label.setText(message)
def reset_preview(self) -> None:
"""Clear preview surface and restore default empty-state text when possible."""
if self._preview_plot is not None:
self._preview_plot.clear()
self._preview_plot.setTitle("")
if self._preview_placeholder is not None:
self._preview_placeholder.setText("Preview will appear after the first successful capture.")
def draw_last_trace(self, trace: TraceData, title: str, *, channel: str) -> None:
"""Draw the latest captured sweep trace for the requested channel in dB scale."""
samples = trace.s11 if channel == "s11" else trace.s21
@@ -328,6 +371,7 @@ class PreprocessDialog(QDialog):
combo.clear()
combo.addItems(names)
if not current_text:
combo.setCurrentIndex(-1)
return
index = combo.findText(current_text)
if index < 0: