<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: -webkit-monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; ">This is my first attempt at writing an extension for Chimera (and writing anything in python, for that matter). Using the ViewDock extension as a starting point (which Scooter suggested to me at CSB2007) made it very easy. There are probably many things that could be done better. If you have any suggestions, we would very much like to know. One thing that would be nice to have is to be able to select a maximum number of matches to load in the ViewMatch Open-File dialog. Right now, that number is hard-coded in the code, which is not ideal.</span></blockquote><br></div><div>First I want to agree with Elaine: ViewMatch is very nice!</div><div><br></div><div>You can definitely customize Open/Save dialogs to get additional parameters that you need. This is documented in good detail in the module doc string of OpenSave (i.e. at the top of OpenSave/__init__.py). Basically you: subclass from OpenModeless; supply the 'clientPos' keyword when you call OpenModeless.__init__ from your __init__ (probably with the value 's'); overrride fillInUI() by calling the parent fillInUI() and then populate self.clientArea with your widgets. In your Apply function you would read the values from your widgets (and the file name from self.getPaths()). There's a reasonably simple example of this usage in the AddAttrDialog class in AddAttr/gui.py. You could use the chimera.tkoptions.IntOption widget to get your integer or Pmw.EntryField.</div><div><br></div><div>You might also like ViewMatch to remember what value the user chose in their last session so you can use it as the widget's default value in the next session. You use Chimera's "preferences" mechanism for that. It's probably easiest to explain by example; here is the prefs.py file of FindHBond:</div><div><br></div><div><div>from chimera import preferences</div><div><br></div><div>BOND_COLOR = 'bondColor'</div><div>RELAX_COLOR = 'relaxColor'</div><div>LINE_WIDTH = 'line width'</div><div><br></div><div>defaults = {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>BOND_COLOR: (0.0, 0.8, 0.9, 1.0),</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>RELAX_COLOR: (0.95, 0.5, 0.0, 1.0),</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>LINE_WIDTH: 1.0,</div><div>}</div><div>prefs = preferences.addCategory("FindHBonds", preferences.HiddenCategory,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>optDict=defaults.copy())</div><div><br></div><div>Basically, the 'prefs' instance can be accessed like a dictionary to fetch the default value of a parameter (prefs[LINE_WIDTH]) or to set a new default (prefs[LINE_WIDTH] = 3) and will be remembered across sessions.</div><div><br></div><div>I hope this helps.</div><div><br></div><div>--Eric</div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font: normal normal normal 16px/normal Helvetica; "><br class="Apple-interchange-newline"> Eric Pettersen</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font: normal normal normal 16px/normal Helvetica; "> UCSF Computer Graphics Lab</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font: normal normal normal 16px/normal Helvetica; "> <a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a></font></div></div></div><br><div></div></div></body></html>