<div dir="ltr">Oh, I see. I am not familiar with wrappers and those "nasty" things, but I do guess they're a nightmare to deal with!<div><br></div><div>For now, I will stick with a dirty workaround I figured out last night. The molecule itself will be an attribute of the Compound, so it is now available as `Compound.m`. Not perfect, but close :)</div>
<div><br></div><div>Thanks for the help!</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-13 0:58 GMT+02:00 Eric Pettersen <span dir="ltr"><<a href="mailto:pett@cgl.ucsf.edu" target="_blank">pett@cgl.ucsf.edu</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">If you <i>had</i> to do something during Compound/Molecule initialization, you might be able to fake it by listening to the Molecule trigger and doing something to Molecules in the 'created' category. Pretty horrible I know, but desperate times call for desperate measures…<div>
<br></div><div>--Eric</div><div><br><div><div><div><div>On Jun 12, 2014, at 3:49 PM, Greg Couch <<a href="mailto:gregc@cgl.ucsf.edu" target="_blank">gregc@cgl.ucsf.edu</a>> wrote:</div><br></div></div><blockquote type="cite">
<div><div>
<div bgcolor="#FFFFFF" text="#000000">
<div>Molecules can not be subclassed (it is
a Python wrapper around a C++ class), but they can be extended
with custom methods and attributes by adding those methods and
attributes to the Python Molecule class. You can see some
examples of that in chimera/__init__.py, Molecule.sequence is from
another module, and Molecule.metalComplexGroup is defined within
the file. Unfortunately, it is not possible to extend Molecule's
__init__ function.<br>
<br>
HTH,<br>
<br>
Greg<br>
<br>
On 06/12/2014 09:33 AM, Jaime Rodríguez-Guerra wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hello,
<div><br>
</div>
<div>I am trying to extend the chimera.Molecule class() to add a
few methods and attributes, but the followin error arises:</div>
<div><br>
</div>
<div>
<div>TypeError: Error when calling the metaclass bases</div>
<div> type '_molecule.Molecule' is not an acceptable base
type</div>
<div><br>
</div>
<div> File "/home/jr/x/gaudi/gaudi/molecule.py", line 51, in
<module></div>
<div> class Compound(chimera.Molecule):</div>
</div>
<div><br>
</div>
<div>Is there any workaround? I want my Compound objects to
behave like standard chimera Molecules (with all their
attributes and stuff), and also be able to call custom methods
on that Molecule.</div>
<div><br>
</div>
<div>Thanks in advance,</div>
<div>Jaime.</div>
</div>
<br>
<fieldset></fieldset>
<br>
</blockquote>
<br>
</div></div></div>
_______________________________________________<br>Chimera-users mailing list<br><a href="mailto:Chimera-users@cgl.ucsf.edu" target="_blank">Chimera-users@cgl.ucsf.edu</a><br><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" target="_blank">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br>
</blockquote></div><br></div></div></blockquote></div><br></div></div>