Revision 741 org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib/gvsig/utils.py
utils.py | ||
---|---|---|
43 | 43 |
f.getvalue() |
44 | 44 |
ScriptingExtension.log(mode,f.getvalue(),None) |
45 | 45 |
|
46 |
def getResource(*args): |
|
47 |
base = args[0] |
|
48 |
if os.path.isfile(base): |
|
49 |
base = os.path.dirname(base) |
|
50 |
x = [ base,] |
|
51 |
x.extend(args[1:]) |
|
52 |
return os.path.join(*x) |
|
46 | 53 |
|
54 |
def openStore(type, **parameters): |
|
55 |
from gvsig.utils import copyToDynObject |
|
56 |
application = ApplicationLocator.getManager() |
|
57 |
datamanager = application.getDataManager() |
|
58 |
store_parameters = datamanager.createStoreParameters(type) |
|
59 |
copyToDynObject(parameters, store_parameters) |
|
60 |
store = datamanager.openStore(type, store_parameters) |
|
61 |
return store |
|
62 |
|
|
47 | 63 |
def createFeatureType(schema = None): |
48 | 64 |
"""Returns attributes definition. If Schema is recived then makes a copy and |
49 | 65 |
returns editable instance. Otherwise returns empty Schema. |
... | ... | |
438 | 454 |
name = field.getName() |
439 | 455 |
for k in keys: |
440 | 456 |
if k.lower() == name.lower(): |
441 |
value = values[name]
|
|
457 |
value = values[k]
|
|
442 | 458 |
target.setDynValue(name, value) |
443 | 459 |
break |
444 | 460 |
# ==================================== |
Also available in: Unified diff