gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / scripts / examples / TOC / addTOCEntry.py @ 462
History | View | Annotate | Download (928 Bytes)
1 |
|
---|---|
2 |
from gvsig import * |
3 |
|
4 |
from commonsdialog import msgbox |
5 |
|
6 |
from org.gvsig.app import ApplicationLocator |
7 |
from org.gvsig.andami import PluginsLocator |
8 |
from org.gvsig.app.project.documents.view import ViewManager |
9 |
from org.gvsig.scripting.app.extension import ScriptingExtension |
10 |
|
11 |
def main(): |
12 |
application = ApplicationLocator.getManager() |
13 |
|
14 |
# Creamos la accion si no existe ya
|
15 |
actionManager = PluginsLocator.getActionInfoManager() |
16 |
action = actionManager.createAction(ScriptingExtension, "tools-hello", "Hello", "hello", "tools-scripting-launcher", None, 1009000000, "Hello world") |
17 |
action = actionManager.registerAction(action) |
18 |
|
19 |
# Y con ella damos de alta una accion en el TOC
|
20 |
projectManager = ApplicationLocator.getProjectManager() |
21 |
viewManager = projectManager.getDocumentManager(ViewManager.TYPENAME) |
22 |
viewManager.addTOCContextAction("tools-hello")
|
23 |
|
24 |
msgbox("Insertada la entrada 'Hello' al TOC de la vista.")
|
25 |
|