Hi Charlie, The answer is: sort of. You can't get a callback for when a specific model moves, but you can get callbacks for when any models move and from there it's pretty easy to deduce if models you are interested in moved. There are two possible triggers you could use. The one most typically used is chimera.MOTION_STOP (mentioned in the Trigger Notifications programming example), which fires one second after models have stopped moving (the motion can be due to user interaction or programmatic repositioning). On the assumption that what you want to do in response to the trigger is somewhat heavyweight, this is the trigger you would want to use.
The other trigger is 'OpenState', which will fire many times as a motion occurs. If you use this trigger, you could check to see if the trigger data's 'modified' attribute contains the OpenState instance of the model(s) you care about and whether the trigger data's 'reasons' attribute contains the string "transformation change".
There is an OpenState instance for each model ID/subID pair. So some models share a single OpenState instance (e.g. a structure model and corresponding surface model). Models have an 'openState' attribute, and OpenState instances have an 'xform' attribute containing the transformation matrix. If you use the MOTION_STOP trigger, you would compare the transforms of the models you care about with previous ones that you'd saved to determine if the models had moved.
UndoMove is an example of an extension that uses MOTION_STOP.
--Eric
On Nov 10, 2005, at 12:06 PM, Charlie Moad wrote:
Is it possible to register a python callback for when a protein is
rotated and get the rotation information?
Thanks,
Charlie
_______________________________________________
Chimera-users mailing list