﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	notify_on_close	platform	project
2940	subclassable AtomicStructure	Ben Webb	Eric Pettersen	"{{{
The following bug report has been submitted:
Platform:        Darwin-19.3.0-x86_64-i386-64bit
ChimeraX Version: 0.93 (2020-03-08)
Description
It is difficult to support sessions with objects that inherit from chimerax.atomic.AtomicStructure.

Several ChimeraX classes (e.g. Model, Structure) provide a set_state_from_snapshot() method that makes adding session support for derived classes easy, e.g.

class MyModel(Model):
    @staticmethod
    def restore_snapshot(session, data):
        m = MyModel(session)
        m.set_state_from_snapshot(data)
        return m

    def set_state_from_snapshot(self, session, data):
        Model.set_state_from_snapshot(self, session, data['model state'])
        # do something for MyModel with the rest of data 	

However, AtomicStructure does not follow this pattern. Thus, to provide a restore_snapshot() method for an AtomicStructure subclass, I have to duplicate some of the logic from AtomicStructure.restore_snapshot() (I cannot just call it from my derived class because it creates an AtomicStructure object, not a derived object). (A concrete example is the _RMFState class in the RMF plugin in the ChimeraX toolshed; see https://github.com/salilab/rmf_chimerax/blob/897d2f758/src/io.py#L65-L84 .) This is not ideal because it makes my code strongly dependent on the internals of AtomicStructure.

Could an AtomicStructure.set_state_from_snapshot() method be provided to fix this issue?

OpenGL version: 4.1 ATI-3.5.5
OpenGL renderer: AMD Radeon Pro 560 OpenGL Engine
OpenGL vendor: ATI Technologies Inc.

}}}
"	defect	closed	normal		Core		fixed		Tom Goddard				all	ChimeraX
