Skip to content

Commit c896789

Browse files
committed
Restored previous set_map_property behaviour.
1 parent c2932d3 commit c896789

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

webmapper.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -238,24 +238,32 @@ def set_map_properties(props, map):
238238
for key in props:
239239
if key in ['version']:
240240
continue;
241-
elif key == 'srcs':
242-
srcs = props[key]
243-
i = 0
244-
for srcProps in srcs:
245-
# find src slot index
246-
src = map.source(i)
247-
for srcKey in srcProps:
248-
if srcKey in ['name', 'type', 'length', 'num_instances']:
249-
continue
250-
src.set_property(srcKey, srcProps[srcKey])
251-
i = i + 1
252-
elif key == 'dst':
253-
dstProps = props[key]
254-
dst = map.destination()
255-
for dstKey in dstProps:
256-
if dstKey in ['name', 'type', 'length', 'num_instances']:
257-
continue
258-
dst.set_property(dstKey, dstProps[dstKey])
241+
elif key.startswith('src'):
242+
srcidx = -1
243+
argidx = -1
244+
if key[3] == '[' and key[5:6] == '].':
245+
srcidx = int(key[4])
246+
argidx = 7
247+
elif key[3] == '.':
248+
srcidx = 0
249+
argidx = 4
250+
else:
251+
continue
252+
subkey = key[argidx:]
253+
value = props[key]
254+
if subkey == 'min' or subkey == 'max':
255+
value = as_number(value)
256+
elif subkey == 'bound_min' or subkey == 'bound_max':
257+
value = boundaryStrings[value]
258+
map.source(srcidx).set_property(subkey, value)
259+
elif key.startswith('dst.'):
260+
subkey = key[4:]
261+
value = props[key]
262+
if subkey == 'min' or subkey == 'max':
263+
value = as_number(value)
264+
elif subkey == 'bound_min' or subkey == 'bound_max':
265+
value = boundaryStrings[value]
266+
map.destination().set_property(subkey, value)
259267
elif key == 'mode':
260268
if props['mode'] == 'linear':
261269
map.mode = mapper.MODE_LINEAR

0 commit comments

Comments
 (0)