Преглед изворни кода

wxGUI: fix bug introduced in https://trac.osgeo.org/grass/changeset/51758 (author Vaclav Petras)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51804 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová пре 13 година
родитељ
комит
577f6952a3
2 измењених фајлова са 21 додато и 21 уклоњено
  1. 13 2
      gui/wxpython/core/render.py
  2. 8 19
      gui/wxpython/mapdisp/main.py

+ 13 - 2
gui/wxpython/core/render.py

@@ -361,10 +361,21 @@ class Map(object):
         # setting some initial env. variables
         self._initGisEnv() # g.gisenv
         self.GetWindow()
-        
+
+        # GRASS environment variable (for rendering)
+        self.env = {"GRASS_BACKGROUNDCOLOR" : "FFFFFF",
+               "GRASS_COMPRESSION"     : "0",
+               "GRASS_TRUECOLOR"       : "TRUE",
+               "GRASS_TRANSPARENT"     : "TRUE",
+               "GRASS_PNG_READ"        : "FALSE",
+               }
+
+        for k, v in self.env.iteritems():
+            os.environ[k] = v
+
         # projection info
         self.projinfo = self._projInfo()
-        
+
     def _runCommand(self, cmd, **kwargs):
         """!Run command in environment defined by self.gisrc if
         defined"""

+ 8 - 19
gui/wxpython/mapdisp/main.py

@@ -51,42 +51,31 @@ class DMonMap(Map):
     def __init__(self, gisrc = None, cmdfile = None, mapfile = None, envfile = None, monitor = None):
         """!Map composition (stack of map layers and overlays)
 
-        
         @param cmdline full path to the cmd file (defined by d.mon)
         @param mapfile full path to the map file (defined by d.mon)
         @param envfile full path to the env file (defined by d.mon)
         @param monitor name of monitor (defined by d.mon)
         """
-        
+
         Map.__init__(self)
-        
+
         # environment settings
         self.env   = dict()
-        
+
         self.cmdfile = cmdfile
         self.envfile = envfile
         self.monitor = monitor
-        
+
         if mapfile:
             self.mapfileCmd = mapfile
             self.maskfileCmd = os.path.splitext(mapfile)[0] + '.pgm'
-        
+
         # generated file for g.pnmcomp output for rendering the map
         self.mapfile = grass.tempfile(create = False) + '.ppm'
-        
-        # GRASS environment variable (for rendering)
-        env = {"GRASS_BACKGROUNDCOLOR" : "FFFFFF",
-               "GRASS_COMPRESSION"     : "0",
-               "GRASS_TRUECOLOR"       : "TRUE",
-               "GRASS_TRANSPARENT"     : "TRUE",
-               "GRASS_PNG_READ"        : "FALSE",
-               }
-        
-        self._writeEnvFile(env)
+
+        self._writeEnvFile(self.env) # self.env is expected to be defined in parent class
         self._writeEnvFile({"GRASS_PNG_READ" : "TRUE"})
-        for k, v in env.iteritems():
-            os.environ[k] = v
-    
+
     def GetLayersFromCmdFile(self):
         """!Get list of map layers from cmdfile
         """