From d4a780b99845eb7dc777d8d78a35aa0dca1dce84 Mon Sep 17 00:00:00 2001 From: Dusten Hubbard Date: Wed, 14 Oct 2026 21:59:20 -0500 Subject: [PATCH] fix(align): make importing alignments from another series undoable importTransforms took series_states but never passed it to enumerateSections, so an alignment import rewrote every section with no undo state. A section the user had already worked on kept its snapshot from before the import, and the next undo on that section restored the old transforms. That section then lacked the imported alignment while the others had it, and Series.alignments raised "Sections have differently named alignments." The states are now passed with breakable=False, as modifyAlignments and the .txt transform import already do. The import is one series undo, and it cannot be split into per-section undos that would remove the alignment from some sections only. --- PyReconstruct/modules/datatypes/series.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/PyReconstruct/modules/datatypes/series.py b/PyReconstruct/modules/datatypes/series.py index 8cecde704..8ee47ec67 100644 --- a/PyReconstruct/modules/datatypes/series.py +++ b/PyReconstruct/modules/datatypes/series.py @@ -2420,10 +2420,19 @@ def importTransforms(self, other, import_as : list, series_states=None, log_even Params: other (series): the series to import transforms from import_as (list): the list of (alignment to import, name for alignment in current series) - series_states (dict): optiona dict of undo states for GUI + series_states (SeriesStates): the series undo states from the GUI log_event (bool): True if the event should be logged """ - for s_snum, s_section in self.enumerateSections(message="Importing alignments..."): + # breakable=False: this rewrites section.tforms on every section, so the + # undo has to be all-or-nothing. A breakable series state can be + # dissolved into per-section undos (SeriesStates.undoSection), which + # would leave the imported alignment present on some sections and absent + # on others, a state the Series.alignments property rejects outright. + for s_snum, s_section in self.enumerateSections( + message="Importing alignments...", + series_states=series_states, + breakable=False + ): if s_snum in other.sections: o_section = other.loadSection(s_snum) mags_match = abs(o_section.mag - s_section.mag) <= 1e-8