Revision 469
org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib/uselib.py | ||
---|---|---|
1 |
|
|
2 |
|
|
3 |
def use_plugin(pluginName): |
|
4 |
from org.gvsig.andami import PluginsLocator |
|
5 |
|
|
6 |
pluginsManager = PluginsLocator.getManager() |
|
7 |
other = pluginsManager.getPlugin(pluginName) |
|
8 |
scripting = pluginsManager.getPlugin("org.gvsig.scripting.app.extension") |
|
9 |
scripting.addDependencyWithPlugin(other) |
|
10 |
|
|
11 |
def use_jar(fname, root=__file__): |
|
12 |
from java.io import File |
|
13 |
import sys |
|
14 |
import os |
|
15 |
|
|
16 |
if isinstance(fname,File): |
|
17 |
f = fname |
|
18 |
fname = f.getPath() |
|
19 |
else: |
|
20 |
f = File(fname) |
|
21 |
if not f.isAbsolute() : |
|
22 |
rf = File(root) |
|
23 |
if rf.isFile() : |
|
24 |
rf = rf.getParentFile() |
|
25 |
f = File( rf,fname) |
|
26 |
|
|
27 |
fname = f.getCanonicalPath() |
|
28 |
if not fname in sys.path: |
|
29 |
sys.path.append(fname) |
|
30 |
|
Also available in: Unified diff