__init__.py (pymol-v1.8.6.0.tar.bz2) | : | __init__.py (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
self.prompt = None | self.prompt = None | |||
self.panel = None | self.panel = None | |||
self.cmd = _self | self.cmd = _self | |||
self._validate_instance() | self._validate_instance() | |||
def __getstate__(self): | def __getstate__(self): | |||
d = self.__dict__.copy() | d = self.__dict__.copy() | |||
d.pop('cmd', None) | d.pop('cmd', None) | |||
return d | return d | |||
def __reduce__(self): | ||||
# for loading Python 3 (new-style class) pickle with Python 2 | ||||
return (self.__class__, (), self.__getstate__()) | ||||
def _validate_instance(self): | def _validate_instance(self): | |||
_pymol = self.cmd._pymol | _pymol = self.cmd._pymol | |||
if not hasattr(_pymol.session, 'wizard_storage'): | if not hasattr(_pymol.session, 'wizard_storage'): | |||
_pymol.session.wizard_storage = {} | _pymol.session.wizard_storage = {} | |||
wizard_storage = _pymol.session.wizard_storage | wizard_storage = _pymol.session.wizard_storage | |||
class_key = str(self.__class__) | class_key = str(self.__class__) | |||
self.session = wizard_storage.get(class_key,{}) | self.session = wizard_storage.get(class_key,{}) | |||
# create a dictionary for per-class storage in session | # create a dictionary for per-class storage in session | |||
if not self.session: | if not self.session: | |||
wizard_storage[class_key] = self.session | wizard_storage[class_key] = self.session | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 4 lines changed or added |