瀏覽代碼

better use of tempfile.mkstemp() (https://trac.osgeo.org/grass/ticket/560, https://trac.osgeo.org/grass/ticket/943,comment:10, merge from devbr6 https://trac.osgeo.org/grass/changeset/56444)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56445 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 12 年之前
父節點
當前提交
e07592b623
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      gui/wxpython/core/render.py

+ 7 - 7
gui/wxpython/core/render.py

@@ -69,17 +69,17 @@ class Layer(object):
         
         # generated file for each layer
         if USE_GPNMCOMP or ltype == 'overlay':
-            tmpfile = tempfile.mkstemp()[1]
-            self.maskfile = tmpfile + '.pgm'
             if ltype == 'overlay':
-                self.mapfile  = tmpfile + '.png'
+                tempfile_sfx = ".png"
             else:
-                self.mapfile  = tmpfile + '.ppm'
-            grass.try_remove(tmpfile)
+                tempfile_sfx = ".ppm"
+
+            self.mapfile = tempfile.mkstemp(suffix = tempfile_sfx)[1]
+            self.maskfile = self.mapfile.rsplit(".",1)[0] + ".pgm"
         else:
             self.mapfile = self.maskfile = None
-        
-        # stores class which manages rendering instead of simple command - e. g. wms
+
+        # stores class which manages rendering instead of simple command - e.g. WMS
         self.renderMgr = None
 
         self.Map = Map