schrodinger / pymol-open-source

Open-source foundation of the user-sponsored PyMOL molecular visualization system.
https://pymol.org/
Other
1.2k stars 281 forks source link

Event listening #309

Open pslacerda opened 1 year ago

pslacerda commented 1 year ago

I found no way to listen for session loading, reinitialization, It would be useful for plugins like Views.

Something like Python's atexit module:


from pymol import at_loading, at_reinit

@at_loading
@at_reinit
def my_callee(evt):
    print("This event happened:", evt)
JarrettSJohnson commented 1 year ago

Hi Pedro,

This is something we're currently working toward. We have some C++ events currently, but we're looking to extend this for python scripting as well.

JarrettSJohnson commented 1 year ago

Also, were you able to take a look at the Scene's panel that was introduced to open-source a couple of years ago? It's a very similar premise to the Views plugin and also shows other details like thumbnails.

pslacerda commented 1 year ago

The Scene panel is very similar to my plugin, however it doen't save scenes on the session like Views.

JarrettSJohnson commented 1 year ago

Ah, didn't know that. PyMOL3's Scene's Panel is much more developed than the one in open-source and does save to session files, but that functionality might've not been brought to open-source yet. I'll be sure to revisit what we have this week.