[GRASS-SVN] r58612 - grass/trunk/gui/wxpython/gmodeler
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 5 03:34:08 PST 2014
Author: martinl
Date: 2014-01-05 03:34:08 -0800 (Sun, 05 Jan 2014)
New Revision: 58612
Modified:
grass/trunk/gui/wxpython/gmodeler/model.py
Log:
wxGUI/modeler: fix Normalize() fn + sort variables
Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py 2014-01-05 04:29:07 UTC (rev 58611)
+++ grass/trunk/gui/wxpython/gmodeler/model.py 2014-01-05 11:34:08 UTC (rev 58612)
@@ -139,6 +139,17 @@
self.canvas.parent.DefineCondition(mo)
def Normalize(self):
+ # check for inconsistecies
+ for idx in range(1, len(self.items)):
+ if not self.items[idx].GetBlock() and \
+ isinstance(self.items[idx-1], ModelLoop):
+ # swap action not-in-block with previously defined
+ # loop
+ itemPrev = self.items[idx-1]
+ self.items[idx-1] = self.items[idx]
+ self.items[idx] = itemPrev
+
+ # update ids
iId = 1
for item in self.items:
item.SetId(iId)
@@ -1096,7 +1107,9 @@
variables.append(p.get('name', ''))
else:
variables = self.parent.GetVariables()
- for variable in variables:
+
+ # order variables by length
+ for variable in sorted(variables, key=len, reverse=True):
pattern= re.compile('%' + variable)
value = ''
if substitute and 'variables' in substitute:
More information about the grass-commit
mailing list