<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; ">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>On Jun 12, 2014, at 3:49 PM, Greg Couch <<a href="mailto:gregc@cgl.ucsf.edu">gregc@cgl.ucsf.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">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 cite="mid:CAM2AJuKS01AAwk-k7ysJ=3HDEVkATKJkNCfhVWkY9Gwt8Cz4cQ@mail.gmail.com" 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 class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</div>
_______________________________________________<br>Chimera-users mailing list<br><a href="mailto:Chimera-users@cgl.ucsf.edu">Chimera-users@cgl.ucsf.edu</a><br>http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users<br></blockquote></div><br></div></body></html>