Fengyuan,
 
Although we cannot answer specific questions about an unsupported interface, your question about "self_cmd" is relevant to the overall project since we are intending to support multiple PyMOL instances within a single Python interpreter via:
 
from pymol2 import PyMOL
 
instance1 = PyMOL()
instance2 = PyMOL()
 
Thus, the old way of messaging the PyMOL API:
 
from pymol import cmd
 
will not work correctly if there two or more active instances.  Instead, each instance has its own "cmd" module and programming interface:
 
instance1.cmd
 
instance2.cmd
 
For example:
 
instance1.cmd.load("pdb1.pdb")
 
instance2.cmd.load("pdb2.pdb")
 
As for "self_cmd", all Python-based code called from the C layer must therefore be given a handle pointing at the instance from which it was called so that it can do useful work. This is the role of the self_cmd argument, and you'll see similar constructs in both the Python-based wizards and the Tcl/Tk GUIs.
 
Cheers,
Warren
 
--
DeLano Scientific LLC
Subscriber Support Services
mailto:support@delsci.com


From: DeLano Scientific [mailto:delsci@delsci.info]
Sent: Monday, June 23, 2008 9:31 AM
To: 'NeO'; 'support@delsci.com'; 'pymol-users@lists.sourceforge.net'
Subject: RE: [PyMOL] Question about PyMOL development

Fengyuan,
 
Unfortunately, the PyMOL's internal gui pop-up menu system was not designed as nor intended to be a programmers interface and is subject to change at any time.  Any code which relies upon its behavior may therefore break with future versions of the software. 
 
 
Cheers,
Warren
--
DeLano Scientific LLC
Subscriber Support Services
mailto:support@delsci.com


From: pymol-users-bounces@lists.sourceforge.net [mailto:pymol-users-bounces@lists.sourceforge.net] On Behalf Of NeO
Sent: Sunday, June 22, 2008 7:46 AM
To: support@delsci.com; pymol-users@lists.sourceforge.net
Subject: Re: [PyMOL] Question about PyMOL development

Hi Warren,

I've read 'Executive.c' under '/trunk/pymol/layer3', it seems that you've pre-defined all the cases that button actions and popup menu changes in function ' ExecutiveClick ', I can understand only part of it. Now, I'm wondering that if I want to implement my thought ( - left-click the C-alpha atom in the structure, there will be a PopUp window coming out with self-defined information in the Viewer window), I have to modify the source code in C-layer and compile the whole source? Am I right? Or, is there any trick to do this in Python-layer?

Fengyuan

On Sun, Jun 22, 2008 at 1:59 PM, NeO <boboppie@gmail.com> wrote:
Dear Warren,

How are you?

I'm writing a wizard, in which I want to implement the function that when I left-click the C-alpha atom, there will be a PopUp window coming out with my defined information in the Viewer window. I can do it using 'tkMessageBox.showinfo', but I want to make it beautiful.

I know that when you left-double click or right-click the protein structure, the popup menu show up. I read the source code of 'menu.py', I'm not sure in the function, the parameter 'self_cmd', what's it for? where the menu functions are called? If I figure it out, I think I can code it in my wizard.

Hope you can help me :)

Best Wishes

Fengyuan