[Chimera-users] restoring sessions with python & triggers

Eric Pettersen pett at cgl.ucsf.edu
Mon Jun 15 10:46:00 PDT 2015

On Jun 14, 2015, at 6:40 PM, "Dougherty, Matthew T" <matthewd at bcm.edu> wrote:

> Normally a save session by a python extension is invoked by a trigger SAVE_SESSION.

Hi Matt, 

Yes, most extensions will only use this trigger.

> For restoring a session, several related chimera APIs are available that are typically not used.
> 1) post model restore: SimpleSession.registerAfterModelsCB(afterModelsRestoredCB, arg)

This is a pretty specialized trigger.  It is used by the few tools/extensions that (as they restore) care about models possibly restored by other extensions, and not just the atomic and surface models restored by the core session code or by themselves.  For example, the distance-monitor tool registers for this trigger since the session may show distances involving volume markers, which are restored by the VolumePath extension.


These are used by tools not involved in the session restore directly, and generally to avoid processing the models created by the session restore or otherwise prevent code from executing during the restore.  For example, there is code in Chimera that judges whether covalent bonds in newly opened models should be converted to metal-coordination pseudobonds.  This code turns itself off during a session restore.  Similarly "smart display" of new models is turned off during a restore.

> I need to reset extension gui values based on midas positions. 
> I presume a normal restore in the session file does not guarantee that these midas positions will be loaded at that time, so I need to delay the gui updates until the restore process has ended or possibly when the models are loaded loaded.

I think you've noticed that there are triggers that fire when positions are saved or deleted (ADD_POSITIONS / REMOVE_POSITIONS).  Your GUI should clearly register for these triggers, and possibly for BEGIN/END_RESTORE_SESSION if you want to prevent or delay updates during a session restore.


                        Eric Pettersen
                        UCSF Computer Graphics Lab

> What is the distinction between END_RESTORE_SESSION and registerAfterModelsCB?
> Matthew Dougherty
> National Center for Macromolecular Imaging
> Baylor College of Medicine
> ===========================================================================
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20150615/756db3bb/attachment.html>

More information about the Chimera-users mailing list