Hi,
I’m making a script with an editable vanilla list. I want to save the edits made to that list to be able to keep them at the next run.
For now, I have something like this:
def __init__(self):
self.w.myList = List((m, yPos, -m, 120), self.return_list_content(), columnDescriptions=self.return_columns_titles(),editCallback=self.save_preferences)
def save_preferences(self,sender):
try:
Glyphs.defaults[ "com.joachimvu.Interpolator.ListSettings" ] = self.w.myList.get()
except:
return False
return True
def return_list_content(self):
if not Glyphs.defaults[ "com.joachimvu.Interpolator.ListSettings" ]:
#build the list by default
else:
return Glyphs.defaults[ "com.joachimvu.Interpolator.ListSettings" ]
Every time I try to edit a field of the list, Glyphs crashes with the following error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'
Doing either saving or loading preferences is working, the crash is when I want to do both (load at launch, AND save when edited), so I guess I have an idea of what is going wrong here, but don’t know how to solve it.
Any help appreciated!