<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 14, 2015, at 6:09 PM, Dougherty, Matthew T <<a href="mailto:matthewd@bcm.edu" class="">matthewd@bcm.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" class="">
<style type="text/css" style="display:none;" class=""><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div dir="ltr" class="">
<div id="divtagdefaultwrapper" style="font-size: 12pt; background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif;" class=""><p class="">when I use</p><p class=""><br class="">
</p><p class=""> from chimera import dialogs</p><p class=""> ce = dialogs.display('color editor')</p><p class=""><br class="">
</p><p class=""><br class="">
</p><p class="">it brings up the color editor, but model colors do not change.</p><p class=""><br class="">
</p><p class="">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.</p><p class="">Seems like I need to associate a model with the editor in the code.</p><p class="">I have the model selected before I issue the commands, no difference.</p></div></div></div></blockquote><br class=""></div><div>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:</div><div><br class=""></div><div><br class=""></div><div>import chimera</div><div>from chimera.tkgui import FakeWell</div><div>class ModelWell(FakeWell):</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>def showColor(self, color=None, multiple=False, notifyPanel=True, doCallback=True):</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if multiple or not doCallback:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>for model in mp.selected(moleculesOnly=False, groupsOkay=True):</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if color == None:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>model.color = None</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>else:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>model.color = chimera.MaterialColor(*color))</div><div>mw = ModelWell()</div><div># The ‘mp’ variable holding the model panel instance must already exist </div><div># when activate called</div><div>mw.activate() # pops up the color editor</div><div><br class=""></div><div>—Eric</div><div><br class=""></div><div><br class=""></div><br class=""></body></html>