Skip to content

Commit 20ebd41

Browse files
committed
Backwards compatibility
1 parent fd5d525 commit 20ebd41

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

openmc_plotter/main_window.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ def loadViewFile(self, filename):
549549

550550
if saved['version'] == self.model.version:
551551
self.model.activeView = saved['current']
552+
# Handle backward compatibility for outline attributes
553+
if not hasattr(self.model.activeView, 'outlinesCell'):
554+
self.model.activeView.outlinesCell = False
555+
if not hasattr(self.model.activeView, 'outlinesMat'):
556+
self.model.activeView.outlinesMat = False
552557
self.dock.updateDock()
553558
self.colorDialog.updateDialogValues()
554559
self.applyChanges()

openmc_plotter/plotmodel.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,15 @@ def __init__(self):
991991
self.tallyContours = False
992992
self.tallyContourLevels = ""
993993

994+
def __setstate__(self, state):
995+
"""Handle backward compatibility when unpickling old views"""
996+
self.__dict__.update(state)
997+
# Add missing attributes from older versions
998+
if not hasattr(self, 'outlinesCell'):
999+
self.outlinesCell = False
1000+
if not hasattr(self, 'outlinesMat'):
1001+
self.outlinesMat = False
1002+
9941003
def getDataLimits(self):
9951004
return self.data_minmax
9961005

0 commit comments

Comments
 (0)