
I would like to tie a USB foot pedal to the model panel rename button. I can get the foot pedal signal into my chimera extension. From an extension, what would be the easiest way to Python code the activation of the model panel button? Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= =================================================

On Oct 12, 2015, at 10:14 PM, Dougherty, Matthew T <matthewd@bcm.edu> wrote:
I would like to tie a USB foot pedal to the model panel rename button.
I can get the foot pedal signal into my chimera extension. From an extension, what would be the easiest way to Python code the activation of the model panel button?
Hi Matt, I’m envisioning some kind of Rube Goldberg setup where you are. Is anything steam powered? :-) Anyway, the Model Panel isn’t exactly setup for reaching in like that, but nonetheless the code would be: from ModelPanel import renameCmd from ModelPanel.base import _mp as mp renameCmd(mp.selected(moleculesOnly=False, groupsOkay=True)) You might want to test whether mp.selected actually returns something non-empty before then calling renameCmd... —Eric Eric Pettersen UCSF Computer Graphics Lab

On Oct 13, 2015, at 2:31 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
from ModelPanel.base import _mp as mp
Upon further reflection, the above line isn’t the best way to get the Model Panel instance, since it uses a private variable and it doesn’t create the Model Panel if needed. Use the following instead from ModelPanel import ModelPanel from chimera import dialogs mp = dialogs.display(ModelPanel.name) —Eric

thanks, works as intended. More like a cockpit than Rube Goldberg. for the problem at hand I get a session file from a researcher, its organization of model names is essentially random text. I need to rename dozens of models to something that means something. The less I use a mouse for repetitive tasks, less aggravating it is. Moving it a cm is ok, moving it 6" one way, 7" another, keyboard input, then press ok, 50x. Much of my development is making the UI easier to work with. People can be lazy, particularly for what they see as intermediate stuff. When the dialog box comes up, is there a way I can place it in a specific location? Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= ================================================= ________________________________ From: Eric Pettersen <pett@cgl.ucsf.edu> Sent: Tuesday, October 13, 2015 4:56 PM To: Dougherty, Matthew T Cc: chimera-dev@cgl.ucsf.edu Subject: Re: [chimera-dev] Model panel rename On Oct 13, 2015, at 2:31 PM, Eric Pettersen <pett@cgl.ucsf.edu<mailto:pett@cgl.ucsf.edu>> wrote: from ModelPanel.base import _mp as mp Upon further reflection, the above line isn't the best way to get the Model Panel instance, since it uses a private variable and it doesn't create the Model Panel if needed. Use the following instead from ModelPanel import ModelPanel from chimera import dialogs mp = dialogs.display(ModelPanel.name) -Eric

On Oct 13, 2015, at 4:19 PM, Dougherty, Matthew T <matthewd@bcm.edu> wrote:
When the dialog box comes up, is there a way I can place it in a specific location?
The shortest answer is no, not reliably. Chimera does some crazy stuff to get the “tile placement” of its dialogs to (mostly) work. In particular, there’s a bunch of timed waits to try to get accurate final size information for the dialog before it finally gets moved to its tiled position. So, after a second or so, you might be able to move the model panel so that it’s upper left corner is at pixel position x,y (with the origin at the upper left of the screen) with: mp.uiMaster().winfo_toplevel().geometry(“+x+y”) —Eric Eric Pettersen UCSF Computer Graphics Lab

I guess I should add that the craziness only happens during the initial placement. So for dialogs that persist even when hidden/closed (like the model panel) showing them again will bring them back wherever they last were. May or may not matter to you. —Eric
On Oct 14, 2015, at 11:18 AM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
On Oct 13, 2015, at 4:19 PM, Dougherty, Matthew T <matthewd@bcm.edu <mailto:matthewd@bcm.edu>> wrote:
When the dialog box comes up, is there a way I can place it in a specific location?
The shortest answer is no, not reliably. Chimera does some crazy stuff to get the “tile placement” of its dialogs to (mostly) work. In particular, there’s a bunch of timed waits to try to get accurate final size information for the dialog before it finally gets moved to its tiled position. So, after a second or so, you might be able to move the model panel so that it’s upper left corner is at pixel position x,y (with the origin at the upper left of the screen) with:
mp.uiMaster().winfo_toplevel().geometry(“+x+y”)
—Eric
Eric Pettersen UCSF Computer Graphics Lab _______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

thanks. the python did not like the double quotes. had to change. To make it stranger I did this to keep the code for later purposes # mp.uiMaster().winfo_toplevel().geometry("+x+y") The extension aborted, had to switch the double quotes to single regardless it was a comment. also noticed they were " " quotes as opposed to " " similar questions on the model panel buttons 'note', 'show only', 'select', 'hide', Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= ================================================= ________________________________ From: Eric Pettersen <pett@cgl.ucsf.edu> Sent: Wednesday, October 14, 2015 1:31 PM To: Dougherty, Matthew T Cc: chimera-dev@cgl.ucsf.edu Subject: Re: [chimera-dev] Model panel rename I guess I should add that the craziness only happens during the initial placement. So for dialogs that persist even when hidden/closed (like the model panel) showing them again will bring them back wherever they last were. May or may not matter to you. -Eric On Oct 14, 2015, at 11:18 AM, Eric Pettersen <pett@cgl.ucsf.edu<mailto:pett@cgl.ucsf.edu>> wrote: On Oct 13, 2015, at 4:19 PM, Dougherty, Matthew T <matthewd@bcm.edu<mailto:matthewd@bcm.edu>> wrote: When the dialog box comes up, is there a way I can place it in a specific location? The shortest answer is no, not reliably. Chimera does some crazy stuff to get the "tile placement" of its dialogs to (mostly) work. In particular, there's a bunch of timed waits to try to get accurate final size information for the dialog before it finally gets moved to its tiled position. So, after a second or so, you might be able to move the model panel so that it's upper left corner is at pixel position x,y (with the origin at the upper left of the screen) with: mp.uiMaster().winfo_toplevel().geometry("+x+y") -Eric Eric Pettersen UCSF Computer Graphics Lab _______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu<mailto:Chimera-dev@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Yeah, my mail app must have changed the should-have-been-identical double quotes to a starting double quote and an ending double quote. Since the quotes don’t match, the entire remainder of the file becomes part of the “string” and Python complains about never finding the end quote. Anyway, about the buttons, ‘note’ and ‘select’ are very analogous to ‘rename’, just instead of renameCmd use noteCmd and selectCmd respectively. ‘show only’ and ‘hide’ are only slightly different: # ‘show only' from ModelPanel import setModelFieldOnly setModelFieldOnly(mp.selected(moleculesOnly=False, groupsOkay=True), ‘display’) # ‘hide' from ModelPanel import setModelField setModelField(mp.selected(moleculesOnly=False, groupsOkay=True), ‘display’, False) —Eric
On Oct 14, 2015, at 12:27 PM, Dougherty, Matthew T <matthewd@bcm.edu> wrote:
thanks. the python did not like the double quotes. had to change.
To make it stranger I did this to keep the code for later purposes # mp.uiMaster().winfo_toplevel().geometry(“+x+y”)
The extension aborted, had to switch the double quotes to single regardless it was a comment. also noticed they were “ ” quotes as opposed to " "
similar questions on the model panel buttons 'note', 'show only', 'select', 'hide',
Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= =================================================
From: Eric Pettersen <pett@cgl.ucsf.edu> Sent: Wednesday, October 14, 2015 1:31 PM To: Dougherty, Matthew T Cc: chimera-dev@cgl.ucsf.edu Subject: Re: [chimera-dev] Model panel rename
I guess I should add that the craziness only happens during the initial placement. So for dialogs that persist even when hidden/closed (like the model panel) showing them again will bring them back wherever they last were. May or may not matter to you.
—Eric
On Oct 14, 2015, at 11:18 AM, Eric Pettersen <pett@cgl.ucsf.edu <mailto:pett@cgl.ucsf.edu>> wrote:
On Oct 13, 2015, at 4:19 PM, Dougherty, Matthew T <matthewd@bcm.edu <mailto:matthewd@bcm.edu>> wrote:
When the dialog box comes up, is there a way I can place it in a specific location?
The shortest answer is no, not reliably. Chimera does some crazy stuff to get the “tile placement” of its dialogs to (mostly) work. In particular, there’s a bunch of timed waits to try to get accurate final size information for the dialog before it finally gets moved to its tiled position. So, after a second or so, you might be able to move the model panel so that it’s upper left corner is at pixel position x,y (with the origin at the upper left of the screen) with:
mp.uiMaster().winfo_toplevel().geometry(“+x+y”)
—Eric
Eric Pettersen UCSF Computer Graphics Lab _______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu <mailto:Chimera-dev@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

could get half to work. failed on # 'show only' from ModelPanel import setModelFieldOnly setModelFieldOnly(mp.selected(moleculesOnly=False, groupsOkay=True), 'display') # 'hide' from ModelPanel import setModelField setModelField(mp.selected(moleculesOnly=False, groupsOkay=True), 'display', False) I tried adding, but to no avail. from ModelPanel import ModelPanel from chimera import dialogs mp = dialogs.display(ModelPanel.name) Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= =================================================

solved
'display'
having the problem when I comment out the line of code is what makes this quote problem weird. Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= ================================================= ________________________________ From: Eric Pettersen <pett@cgl.ucsf.edu> Sent: Wednesday, October 14, 2015 3:09 PM To: Dougherty, Matthew T Cc: chimera-dev@cgl.ucsf.edu Subject: Re: [chimera-dev] Model panel rename Yeah, my mail app must have changed the should-have-been-identical double quotes to a starting double quote and an ending double quote. Since the quotes don't match, the entire remainder of the file becomes part of the "string" and Python complains about never finding the end quote. Anyway, about the buttons, 'note' and 'select' are very analogous to 'rename', just instead of renameCmd use noteCmd and selectCmd respectively. 'show only' and 'hide' are only slightly different: # 'show only' from ModelPanel import setModelFieldOnly setModelFieldOnly(mp.selected(moleculesOnly=False, groupsOkay=True), 'display') # 'hide' from ModelPanel import setModelField setModelField(mp.selected(moleculesOnly=False, groupsOkay=True), 'display', False) -Eric On Oct 14, 2015, at 12:27 PM, Dougherty, Matthew T <matthewd@bcm.edu<mailto:matthewd@bcm.edu>> wrote: thanks. the python did not like the double quotes. had to change. To make it stranger I did this to keep the code for later purposes # mp.uiMaster().winfo_toplevel().geometry("+x+y") The extension aborted, had to switch the double quotes to single regardless it was a comment. also noticed they were " " quotes as opposed to " " similar questions on the model panel buttons 'note', 'show only', 'select', 'hide', Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= ================================================= ________________________________ From: Eric Pettersen <pett@cgl.ucsf.edu<mailto:pett@cgl.ucsf.edu>> Sent: Wednesday, October 14, 2015 1:31 PM To: Dougherty, Matthew T Cc: chimera-dev@cgl.ucsf.edu<mailto:chimera-dev@cgl.ucsf.edu> Subject: Re: [chimera-dev] Model panel rename I guess I should add that the craziness only happens during the initial placement. So for dialogs that persist even when hidden/closed (like the model panel) showing them again will bring them back wherever they last were. May or may not matter to you. -Eric On Oct 14, 2015, at 11:18 AM, Eric Pettersen <pett@cgl.ucsf.edu<mailto:pett@cgl.ucsf.edu>> wrote: On Oct 13, 2015, at 4:19 PM, Dougherty, Matthew T <matthewd@bcm.edu<mailto:matthewd@bcm.edu>> wrote: When the dialog box comes up, is there a way I can place it in a specific location? The shortest answer is no, not reliably. Chimera does some crazy stuff to get the "tile placement" of its dialogs to (mostly) work. In particular, there's a bunch of timed waits to try to get accurate final size information for the dialog before it finally gets moved to its tiled position. So, after a second or so, you might be able to move the model panel so that it's upper left corner is at pixel position x,y (with the origin at the upper left of the screen) with: mp.uiMaster().winfo_toplevel().geometry("+x+y") -Eric Eric Pettersen UCSF Computer Graphics Lab _______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu<mailto:Chimera-dev@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

when I use from chimera import dialogs ce = dialogs.display('color editor') it brings up the color editor, but model colors do not change. with the color editor viewable, I access color editor through the pull down menu (which does not change the color editor's position), then it works. Seems like I need to associate a model with the editor in the code. I have the model selected before I issue the commands, no difference.

On Oct 14, 2015, at 6:09 PM, Dougherty, Matthew T <matthewd@bcm.edu> wrote:
when I use
from chimera import dialogs ce = dialogs.display('color editor')
it brings up the color editor, but model colors do not change.
with the color editor viewable, I access color editor through the pull down menu (which does not change the color editor's position), then it works. Seems like I need to associate a model with the editor in the code. I have the model selected before I issue the commands, no difference.
I see. The above code is equivalent to doing “Tools->Utilities->Color Editor”, not clicking on a model panel color well. There is no direct hook into those color wells, so doing what you want requires some fancy footwork. Here’s my best shot: import chimera from chimera.tkgui import FakeWell class ModelWell(FakeWell): def showColor(self, color=None, multiple=False, notifyPanel=True, doCallback=True): if multiple or not doCallback: return for model in mp.selected(moleculesOnly=False, groupsOkay=True): if color == None: model.color = None else: model.color = chimera.MaterialColor(*color)) mw = ModelWell() # The ‘mp’ variable holding the model panel instance must already exist # when activate called mw.activate() # pops up the color editor —Eric

similar question, how do I bring up the color editor? Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= ================================================= ________________________________ From: Eric Pettersen <pett@cgl.ucsf.edu> Sent: Tuesday, October 13, 2015 4:56 PM To: Dougherty, Matthew T Cc: chimera-dev@cgl.ucsf.edu Subject: Re: [chimera-dev] Model panel rename On Oct 13, 2015, at 2:31 PM, Eric Pettersen <pett@cgl.ucsf.edu<mailto:pett@cgl.ucsf.edu>> wrote: from ModelPanel.base import _mp as mp Upon further reflection, the above line isn't the best way to get the Model Panel instance, since it uses a private variable and it doesn't create the Model Panel if needed. Use the following instead from ModelPanel import ModelPanel from chimera import dialogs mp = dialogs.display(ModelPanel.name) -Eric

In a somewhat similar fashion: from chimera import dialogs ce = dialogs.display(“color editor”) —Eric
On Oct 13, 2015, at 8:46 PM, Dougherty, Matthew T <matthewd@bcm.edu> wrote:
similar question, how do I bring up the color editor?
Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= =================================================
From: Eric Pettersen <pett@cgl.ucsf.edu> Sent: Tuesday, October 13, 2015 4:56 PM To: Dougherty, Matthew T Cc: chimera-dev@cgl.ucsf.edu Subject: Re: [chimera-dev] Model panel rename
On Oct 13, 2015, at 2:31 PM, Eric Pettersen <pett@cgl.ucsf.edu <mailto:pett@cgl.ucsf.edu>> wrote:
from ModelPanel.base import _mp as mp
Upon further reflection, the above line isn’t the best way to get the Model Panel instance, since it uses a private variable and it doesn’t create the Model Panel if needed. Use the following instead
from ModelPanel import ModelPanel from chimera import dialogs mp = dialogs.display(ModelPanel.name)
—Eric
participants (2)
-
Dougherty, Matthew T
-
Eric Pettersen