README for the scripting support of the eric3 IDE
eric3 provides some scripting capability using Python as its scripting
language (what a surprise). At startup time eric3 looks for a script called
"startup.py" in two places. To make script programming easier, some
internal objects and methods are exposed via the global context.
Startup scripts
At startup time eric3 looks for a script called "startup.py" in two places.
First a global startup script is looked for in the Scripting directory of the
eric3 installation directory. This file is run for every user. Thereafter eric3
looks for a per user startup script in the users configuration directory
(e.g. $HOME/.eric3).
Global context
To make script programming a little bit easier, access to the most important
internal objects and methods are provided via the global context. These are:
- Eric
- a reference to the UserInterface object, i.e. the main window.
- ViewManager
- a reference to the ViewManager object, which is responsible
for the management of the various editor windows.
- Project
- a reference to the Project object, which handles all project related
actions.
- DebugServer
- a reference to the DebugServer object, which handles the
communication with the remote DebugClient.
- Wizards
- a reference to the Wizards object, which manages all installed wizards.
- ConfigDir
- a string containing the per user configuration directory
(e.g. $HOME/.eric3).
- InstallDir
- a string containing the eric3 installation directory.
- ScriptsMenu
- a reference to the scripts menu object. This can be used to add
scripts to this menu.
- ScriptsToolbar
- a reference to the scripts toolbar object. This can be used to
add scripts to this toolbar.
- installScript
- a global method to attach a previously created
script to a menu and/or a toolbar. The signature is
"installScript(script, menubar = None, toolbar = None)".
Script is a reference to a script object, menubar is a reference
to the menu the script is to be added to and toolbar is a
reference to the toolbat the script is to be added to.
- removeScript
- a global method to remove a previously created
script. The signature is "removeScript(script)". Script is
a reference to the script object to be removed.
- createScript
- a global method to create a new script object. The
signature is "createScript(name, code)". Name is a string
containing the name of the script and code is a string containing
the Python code for the script.
- createDocument
- a global method to create a new document. The
signature is "createDocument()". This new document is made
the active window. A reference can be obtained by calling
ViewManager.activeWindow().
All scripts have full access to the public methods of these internal
objects. For a detailed description of this API please see the eric3
API documentation by opening "Documentation/Source/index.html"
in the eric3 installation directory.
Examples
For examples see "Examples/Scripting" in the eric3 installation directory.
Bugs and other reports
Please send bug reports, feature requests or contributions to eric bugs address.
<eric-bugs@die-offenbachs.de>
|