ChimeraExtension.py derives a class from
Class
Return the actual name of the extension.
Return the short description that typically appears as
balloon help or in the Tools preference category.
Return the categories in which this extension should appear.
It is either a list or a dictionary. If it is a dictionary
then the keys are the category names and the values are
category-specific descriptions (and the description() method
above is ignored).
Return the name of a file containing an icon that may be used
on the tool bar to provide a shortcut for launching the extension.
Invoke the extension. Note that when this method is called,
the content of "__init__.py" is not available. To simplify
calling functions, the
Call the
Register an instance of chimera.extension.EMO
to define how functionality defined in __init__.py may be invoked
by the Chimera extension manager.
import chimera.extension
MainChainEMO is the derived class.
class MainChainEMO(chimera.extension.EMO):
def name(self):
return 'Backbone'
def description(self):
return 'display only protein backbone'
def categories(self):
return ['Utilities']
def icon(self):
return self.path('mainchain.tiff')
EMO provides a module method that
locates modules in the extension package by name; if no name
is supplied, the "__init__.py" module is returned.
def activate(self):
mainchain function in the "__init__.py" module.
self.module().mainchain()
MainChainEMO with the Chimera
extension manager.
chimera.extension.manager.registerExtension(MainChainEMO(__file__))