Opened 6 years ago
Closed 6 years ago
#2940 closed defect (fixed)
subclassable AtomicStructure
Reported by: | Ben Webb | Owned by: | Eric Pettersen |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | Cc: | Tom Goddard | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
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.
Change History (2)
comment:1 by , 6 years ago
Cc: | added |
---|---|
Component: | Unassigned → Core |
Owner: | set to |
Platform: | → all |
Project: | → ChimeraX |
Status: | new → accepted |
Summary: | ChimeraX bug report submission → subclassable AtomicStructure |
comment:2 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Note:
See TracTickets
for help on using tickets.
Hi Ben,
--Eric