From 08e7e3e54be9279679c92e37dd76ab55b253a6a3 Mon Sep 17 00:00:00 2001 From: Dusten Hubbard Date: Wed, 14 Oct 2026 20:49:04 -0500 Subject: [PATCH] fix(save): write the b section's unsaved edits on save A flicker changes section without saving, so edits made on the section you flicker away from stay in memory as the b section. saveAllData wrote only the current section, so Save and Save As left those edits out of the .jser. saveAllData now writes the b section too. Section.save skips a section that is no longer in the series, because a deleted section can still be the b section and must not get its file back. --- PyReconstruct/modules/datatypes/section.py | 5 +++++ PyReconstruct/modules/gui/main/main_window.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/PyReconstruct/modules/datatypes/section.py b/PyReconstruct/modules/datatypes/section.py index b280891c0..afc11085b 100644 --- a/PyReconstruct/modules/datatypes/section.py +++ b/PyReconstruct/modules/datatypes/section.py @@ -319,6 +319,11 @@ def save(self, update_series_data=True): if self.series.isWelcomeSeries(): return + # a deleted section can still be the b section: do not write its + # file back + if self.n not in self.series.sections: + return + # update the series data if update_series_data: self.series.data.updateSection(self, update_traces=True) diff --git a/PyReconstruct/modules/gui/main/main_window.py b/PyReconstruct/modules/gui/main/main_window.py index d28a594b1..62461ec62 100644 --- a/PyReconstruct/modules/gui/main/main_window.py +++ b/PyReconstruct/modules/gui/main/main_window.py @@ -1489,6 +1489,10 @@ def saveAllData(self): # if button.isChecked(): # self.series.current_trace = button.trace self.field.section.save(update_series_data=False) + # the b section can hold unsaved edits (flicker changes section + # without saving), so it is written too + if self.field.b_section: + self.field.b_section.save(update_series_data=False) self.series.save() def backup(self, check_auto=False, comment=""):