Thanks Tristan. That was what I was looking for.

From: Tristan Croll <tcroll@altoslabs.com>
Sent: Wednesday, April 19, 2023 3:01 PM
To: BARRY E DEZONIA <barry.dezonia@wisc.edu>
Cc: Tony Schaefer <tony.schaefer.chem@gmail.com>; chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu>
Subject: Re: [chimerax-users] Hopefully simple plugin development question
 
Are you sure you’re talking about the same thing? The shell (Tools/General/Shell) is a full iPython instance with tab completion etc.. I use it on an almost daily basis.

On Wed, 19 Apr 2023 at 20:58, BARRY E DEZONIA via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Thanks Tony. That command line interface is what I have been using (for instance to run the devel tools). It does not have tab completion. I am wondering what command line Tom is using that does have tab completion.

That tip model.opened_data_format.name will come in handy. I just really need to find the "current" model/view window and then use the session variable or else metadata available to the model/view to get it's model id or model name that I can then match to the session.models[] variables.

From: Tony Schaefer <tony.schaefer.chem@gmail.com>
Sent: Wednesday, April 19, 2023 2:09 PM
To: BARRY E DEZONIA <barry.dezonia@wisc.edu>
Cc: Thomas Mulvaney <thomas.mulvaney@cssb-hamburg.de>; chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu>

Subject: Re: [chimerax-users] Hopefully simple plugin development question
 
Barry,

The shell tool is under Tools -> General on the ChimeraX menu. There's some API documentation online here: https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html.

Models should also have an 'opened_data_format' attribute with info about which file parser was used (e.g. model.opened_data_format.name). This could be one way to limit models to only PDB or whatever you'd be able to support.

Tony

On Wed, Apr 19, 2023 at 12:57 PM BARRY E DEZONIA via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Thanks Tom,

How do you invoke this python shell? A quick google search turns up nothing. The command line in the chimerax app does not allow tab completion. I've tried running 'chimerax --nogui' from the command line and that gives me a shell but no tab completion is possible there either.

From: Thomas Mulvaney <thomas.mulvaney@cssb-hamburg.de>
Sent: Wednesday, April 19, 2023 1:36 PM
To: BARRY E DEZONIA <barry.dezonia@wisc.edu>
Cc: chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu>
Subject: Re: [chimerax-users] Hopefully simple plugin development question
 
Hi Barry,

The list of current models the user is viewing is in the `session.models` variable.

Assuming the user has only one PDB file open, you can just do `session.models[0].filename` which will return the path to the PDB file they opened.

I've discovered most of the functionality I needed by poking around in the Python Shell that ships with ChimeraX and hitting tab to find out the attributes and methods that objects have.

Hope that helps,

Tom

Tom Mulvaney
PhD Student 
Centre for Structural Systems Biology (CSSB)
Research Group of Prof. Dr. Maya Topf
c/o DESY, Building 15
Notkestraße 85, 22607 Hamburg
Germany

On 19. Apr 2023, at 20:05, BARRY E DEZONIA via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:

Hello,

I am looking at writing a plugin for chimerax that takes a pdb and runs some python code that will calc some stuff hand stuff to other programs. I know how to do this. What I want to know is how to find the current model's name / associated pdb filename from my plugin. Imagine my plugin really is just a "Run" button that looks up the current model, generates the associated pdb filename, and passes that name to my python script. Can someone tell me how in a chimerax plugin I can make the call that will give me the pdb filename I want? I've read much of the developer docs and could not find what I was looking for.
_______________________________________________
ChimeraX-users mailing list
ChimeraX-users@cgl.ucsf.edu
Manage subscription:
https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

_______________________________________________
ChimeraX-users mailing list
ChimeraX-users@cgl.ucsf.edu
Manage subscription:
https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
_______________________________________________
ChimeraX-users mailing list
ChimeraX-users@cgl.ucsf.edu
Manage subscription:
https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users