[GRASS-SVN] r42389 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 30 06:42:56 EDT 2010


Author: martinl
Date: 2010-05-30 06:42:55 -0400 (Sun, 30 May 2010)
New Revision: 42389

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/render.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/vdigit.py
Log:
wxGUI: fix GetVectorNumberOfLayers(), various minor fixes

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/render.py	2010-05-29 19:33:40 UTC (rev 42388)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/render.py	2010-05-30 10:42:55 UTC (rev 42389)
@@ -957,19 +957,22 @@
         else:
             del os.environ["GRASS_REGION"]
         
-        # run g.pngcomp to get composite image
-        try:
-            gcmd.Command(complist)
-        except gcmd.CmdError, e:
-            print >> sys.stderr, e
-            return None
-
+        if maps:
+            # run g.pngcomp to get composite image
+            try:
+                gcmd.Command(complist)
+            except gcmd.CmdError, e:
+                print >> sys.stderr, e
+                return None
+            Debug.msg (2, "Map.Render() force=%s file=%s" % (force, self.mapfile))
+        
         # back to original gisrc
         if self.gisrc:
             os.environ["GISRC"] = gisrc_orig
-
-        Debug.msg (2, "Map.Render() force=%s file=%s" % (force, self.mapfile))
-
+        
+        if not maps:
+            return None
+        
         return self.mapfile
 
     def AddLayer(self, type, command, name=None,

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py	2010-05-29 19:33:40 UTC (rev 42388)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py	2010-05-30 10:42:55 UTC (rev 42389)
@@ -247,20 +247,20 @@
 
 def GetVectorNumberOfLayers(vector):
     """Get list of vector layers"""
-    cmdlist = ['v.category',
+    layers = []
+    if not vector:
+        return layers
+    
+    cmdlist = ['v.category', '-g',
                'input=%s' % vector,
                'option=report']
     
-    layers = []
     for line in gcmd.Command(cmdlist, rerr=None).ReadStdOutput():
-        if not 'Layer' in line:
-            continue
-        
-        value = line.split(':')[1].strip()
-        if '/' in value: # value/name
-            layers.append(value.split('/')[0])
-        else:
-            layers.append(value)
+        if 'all' in line:
+            try:
+                layers.append(line.split(' ')[0])
+            except IndexError:
+                pass
     
     return layers
 

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/vdigit.py	2010-05-29 19:33:40 UTC (rev 42388)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/vdigit.py	2010-05-30 10:42:55 UTC (rev 42389)
@@ -60,10 +60,11 @@
     errorMsg = err
     # is there a way to have this display on the terminal before the wx gui exits?
     print >> sys.stderr, "\nWARNING: Vector digitizer is not available (%s).\n\n" \
-        "Note that the vector digitizer is currently not working under MS Windows " \
-        "(hopefully this will be fixed soon). " \
+        "Note that the vector digitizer is currently not working under MS Windows\n" \
+        "(hopefully this will be fixed soon).\n" \
         "Please keep an eye out for updated versions of GRASS." % err
-
+    sys.stderr.flush()
+    
 class AbstractDigit:
     """
     Abstract digitization class



More information about the grass-commit mailing list