[GRASS-SVN] r53815 - in grass/trunk: gui/wxpython/core gui/wxpython/lmgr lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Nov 14 09:19:23 PST 2012
Author: martinl
Date: 2012-11-14 09:19:23 -0800 (Wed, 14 Nov 2012)
New Revision: 53815
Modified:
grass/trunk/gui/wxpython/core/render.py
grass/trunk/gui/wxpython/core/utils.py
grass/trunk/gui/wxpython/lmgr/layertree.py
grass/trunk/lib/python/task.py
Log:
wxGUI: fix command layer (unnamed parameter)
Modified: grass/trunk/gui/wxpython/core/render.py
===================================================================
--- grass/trunk/gui/wxpython/core/render.py 2012-11-14 17:16:41 UTC (rev 53814)
+++ grass/trunk/gui/wxpython/core/render.py 2012-11-14 17:19:23 UTC (rev 53815)
@@ -151,10 +151,10 @@
quiet = True,
**self.cmd[1])
- if msg:
+ if ret != 0:
sys.stderr.write(_("Command '%s' failed\n") % self.GetCmd(string = True))
- sys.stderr.write(_("Details: %s\n") % msg)
- if ret != 0:
+ if msg:
+ sys.stderr.write(_("Details: %s\n") % msg)
raise GException()
except GException:
@@ -277,7 +277,7 @@
for c in cmd:
self.cmd.append(utils.CmdToTuple(c))
else:
- self.cmd = utils.CmdToTuple(cmd)
+ self.cmd = utils.CmdToTuple(cmd)
Debug.msg(3, "Layer.SetCmd(): cmd='%s'" % self.GetCmd(string = True))
# for re-rendering
Modified: grass/trunk/gui/wxpython/core/utils.py
===================================================================
--- grass/trunk/gui/wxpython/core/utils.py 2012-11-14 17:16:41 UTC (rev 53814)
+++ grass/trunk/gui/wxpython/core/utils.py 2012-11-14 17:19:23 UTC (rev 53815)
@@ -493,7 +493,7 @@
"""!Convert command list to tuple for gcmd.RunCommand()"""
if len(cmd) < 1:
return None
-
+
dcmd = {}
for item in cmd[1:]:
if '=' in item: # params
@@ -503,13 +503,15 @@
flag = item[2:]
if flag in ('verbose', 'quiet', 'overwrite'):
dcmd[str(flag)] = True
- else: # -> flags
+ elif len(item) == 2 and item[0] == '-': # -> flags
if 'flags' not in dcmd:
dcmd['flags'] = ''
- dcmd['flags'] += item.replace('-', '')
-
- return (cmd[0],
- dcmd)
+ dcmd['flags'] += item[1]
+ else: # unnamed parameter
+ module = gtask.parse_interface(cmd[0])
+ dcmd[module.define_first()] = item
+
+ return (cmd[0], dcmd)
def PathJoin(*args):
"""!Check path created by os.path.join"""
Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py 2012-11-14 17:16:41 UTC (rev 53814)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py 2012-11-14 17:19:23 UTC (rev 53815)
@@ -1221,14 +1221,13 @@
ctrl = event.GetEventObject().GetId()
cmd = event.GetString()
+ # find layer tree item by ctrl
layer = self.GetFirstVisibleItem()
-
while layer and layer.IsOk():
if self.GetPyData(layer)[0]['ctrl'] == ctrl:
break
-
layer = self.GetNextVisible(layer)
-
+
# change parameters for item in layers list in render.Map
self.ChangeLayer(layer)
@@ -1629,8 +1628,7 @@
self.mapdisplay.GetToolbar('vdigit').UpdateListOfLayers(updateTool = True)
# redraw map if auto-rendering is enabled
- self.rerender = True
- self.reorder = True
+ self.rerender = self.reorder = True
def OnCloseWindow(self, event):
pass
Modified: grass/trunk/lib/python/task.py
===================================================================
--- grass/trunk/lib/python/task.py 2012-11-14 17:16:41 UTC (rev 53814)
+++ grass/trunk/lib/python/task.py 2012-11-14 17:19:23 UTC (rev 53815)
@@ -73,10 +73,14 @@
def define_first(self):
"""!Define first parameter
+
+ @return name of first parameter
"""
if len(self.params) > 0:
self.firstParam = self.params[0]['name']
+ return self.firstParam
+
def get_error_msg(self):
"""!Get error message ('' for no error)
"""
More information about the grass-commit
mailing list