registermethod is passed a language setting as abbreviation of a locale (currently
es). The method needs to call the
registerMenuItemfunction implemented in the
viewmolmodule to pass a string back which will appear as the identification of this script in the submenu.
run method does not take any argument, but is the entry
point for the script when the user selects the corresponding menu
item in the ``Run script" submenu.
A minimal Python script which will install itself in the ``Run script"
menu would be the following (available at
import viewmol class template: def run(self): print "This is a script template which just prints this silly message." def register(self, language): viewmol.registerMenuItem("Script template") # The following three lines are not necessary for running this script # from the "Run script" menu, but allow the script to also be run # standalone if __name__ == '__main__': script=template() script.run()
All scripts which are to appear in the ``Run script" menu have to be
installed in the
scripts subdirectory under