[GRASS-SVN] r54894 - grass/trunk/gui/wxpython/mapdisp

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 4 03:35:23 PST 2013


Author: wenzeslaus
Date: 2013-02-04 03:35:23 -0800 (Mon, 04 Feb 2013)
New Revision: 54894

Modified:
   grass/trunk/gui/wxpython/mapdisp/main.py
Log:
wxGUI/d.mon: adding only layers which are new

Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py	2013-02-04 11:27:47 UTC (rev 54893)
+++ grass/trunk/gui/wxpython/mapdisp/main.py	2013-02-04 11:35:23 UTC (rev 54894)
@@ -32,7 +32,7 @@
 from core          import utils
 from core.giface   import StandaloneGrassInterface
 from core.gcmd     import RunCommand
-from core.render   import Map
+from core.render   import Map, MapLayer
 from mapdisp.frame import MapFrame
 from grass.script  import core as grass
 from core.debug    import Debug
@@ -87,6 +87,7 @@
         nlayers = 0
         try:
             fd = open(self.cmdfile, 'r')
+            existingLayers = self.GetListOfLayers()
             for line in fd.readlines():
                 cmd = utils.split(line.strip())
                 ltype = None
@@ -100,6 +101,21 @@
                 name = utils.GetLayerNameFromCmd(cmd, fullyQualified = True,
                                                  layerType = ltype)[0]
 
+                # creating temporary layer object to compare commands
+                # neccessary to get the same format
+                # supposing that there are no side effects
+                tmpMapLayer = MapLayer(ltype = ltype, name = name,
+                                       cmd = cmd, Map = None,
+                                       active = False, hidden = True,
+                                       opacity = 0)
+                exists = False
+                for layer in existingLayers:
+                    if layer.GetCmd(string=True) == tmpMapLayer.GetCmd(string=True):
+                        exists = True
+                        break
+                if exists:
+                    continue
+
                 self.AddLayer(ltype = ltype, command = cmd, active = False, name = name)
                 nlayers += 1
         except IOError, e:



More information about the grass-commit mailing list