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
@@ -24,6 +24,8 @@ class SequentialCaptureState:
captured_count: int
total_count: int
current_combo: ComboModel | None
can_undo: bool
is_complete: bool
class SequentialCaptureSession:
@@ -112,6 +114,8 @@ class SequentialCaptureSession:
captured_count=len(self._traces),
total_count=len(self._combos),
current_combo=current_combo,
can_undo=bool(self._traces),
is_complete=self.is_complete(),
)
def capture_current_combo(self) -> TraceData:
@@ -138,6 +142,34 @@ class SequentialCaptureSession:
self._next_index += 1
return trace
def undo_last_capture(self) -> TraceData:
"""Remove the most recently captured trace and rewind cursor by one combo."""
if not self._opened:
raise RuntimeError("Capture session is not opened")
if not self._traces or self._next_index <= 0:
raise RuntimeError("No captured combo is available to undo")
expected_combo = self._combos[self._next_index - 1]
removed_trace = self._traces[-1]
if (
int(removed_trace.combo.input_pos) != int(expected_combo.input)
or int(removed_trace.combo.output_pos) != int(expected_combo.output)
):
raise RuntimeError("Capture session state is inconsistent; last trace does not match rewind combo")
self._next_index -= 1
self._traces.pop()
return removed_trace
def last_captured_trace(self) -> TraceData | None:
"""Return the most recently captured trace, if any."""
if not self._traces:
return None
return self._traces[-1]
def captured_traces(self) -> list[TraceData]:
"""Return captured traces in acquisition order."""
return list(self._traces)
def is_complete(self) -> bool:
"""Return `True` when all combos were captured."""
return self._next_index >= len(self._combos)