<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Elisabeth,<div><span class="Apple-tab-span" style="white-space:pre"> </span>I guess my recommendation is to structure your code like an extension, so that Chimera will execute a ChimeraExtension.py file at startup that you've written. Normally, you put code into a ChimeraExtension.py file to do all the stuff to get your extension into the Tools menu, add a command version, etc.. but the code in that file can actually be almost anything. Just put your code to add your top-level menu in there instead of normal extension-adding code.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Let me know if you need more details.</div><div><br></div><div>--Eric</div><div><br><div><div>On Jan 21, 2011, at 10:58 AM, Elisabeth Ortega wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Eric,<br> <br>I'm testing the two options. Your option works only when I execute ">>chimera mymenu.py" .How can I auto-execute your code when I start Chimera?<br><br>Thanks<br><br><div class="gmail_quote"> 2011/1/21 Eric Pettersen <span dir="ltr"><<a href="mailto:pett@cgl.ucsf.edu">pett@cgl.ucsf.edu</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div style="word-wrap: break-word;">Hi Elisabeth,<div><span style="white-space: pre-wrap;"> </span>As Tom says, the code he refers to is really more complex than you need. Just do this:</div><div><br></div><div>from chimera.tkgui import addMenu</div> <div>myMenu = addMenu(label="menu name")</div><div><br></div><div>to create a top-level menu that you can add items to. An example of its use in Chimera itself is in the _getAliasMenu() function in Midas/midas_text.py.</div> <div><br></div><div>--Eric</div><br><div><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;"> <div style="margin: 0px;"><font size="5" face="Helvetica"> Eric Pettersen</font></div><div style="margin: 0px;"><font size="5" face="Helvetica"> UCSF Computer Graphics Lab</font></div> <div style="margin: 0px;"><font size="5" face="Helvetica">   p; <a href="http://www.cgl.ucsf.edu" target="_blank">http://www.cgl.ucsf.edu</a></font></div></div></span></div><div><br><div><div class="im"><div>On Jan 21, 2011, at 9:20 AM, Tom Goddard wrote:</div><br></div> <blockquote type="cite"><div><div class="im"> Hi Elisabeth,<br><br> There is some code in Chimera that makes a new top-level menu called <br>Volume that is a copy of the Tools / Volume Data submenu. That Volume <br>menu is displayed using menu entry Tools / Volume Data / Volume Menu on <br> Menubar and if you show it it is remembered in the Chimera preferences <br>file so it will appear every time you run Chimera. This is a more <br>complex than you need. But the main routine that would be useful to <br>study is called create_toplevel_volume_menu() in file<br> <br> chimera / share / VolumeMenu / __init__.py<br><br>in your Chimera distribution. It would be easy to make a similar <br></div>Ch a toplevel Scripts menu and simply read all <br><div class="im">the files in one of your directories and made menu entries which caused <br>the file to be opened in Chimera. If you need more help with writing it <br>ask.<br> <br> Tom<br><br><br><blockquote type="cite">Dear Chimera Dev Team,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'm trying to put other option in the menu bar (File, Select, Actions, <br> </blockquote><blockquote type="cite">... , myOption, Help) to store my own scripts. I'm doing a deep search <br></blockquote><blockquote type="cite">on your python and C++ codes but I don't find which is the code that I <br> </blockquote><blockquote type="cite">have to modify.<br></blockquote><blockquote type="cite">I know that is easy to store my scripts in the Tools menu, but I <br></blockquote><blockquote type="cite">prefer to put my scripts in a new option of the menu bar.<br> <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks a lot for taking the time to reply.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote> <blockquote type="cite"><br></blockquote><blockquote type="cite">Elisabeth Ortega<br></blockquote><blockquote type="cite">Autonomous University of Barcelona (UAB)<br></blockquote><br></div>_______________________________________________<br> Chimera-dev mailing list<br><a href="mailto:Chimera-dev@cgl.ucsf.edu" target="_blank">Chimera-dev@cgl.ucsf.edu</a><br><a href="http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev" target="_blank">http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev</a><br> </div></blockquote></div><br></div><div><span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;"> <span style="font-size: medium;"><br></span><br></div></span> </div><br></div> </blockquote></div><br></blockquote></div><br></div></body></html>