[GRASS-SVN] r50898 - grass/branches/develbranch_6/gui/wxpython/psmap

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 20 05:17:53 EST 2012


Author: annakrat
Date: 2012-02-20 02:17:52 -0800 (Mon, 20 Feb 2012)
New Revision: 50898

Modified:
   grass/branches/develbranch_6/gui/wxpython/psmap/instructions.py
   grass/branches/develbranch_6/gui/wxpython/psmap/utils.py
Log:
wxGUI/wxpsmap: use GISBASE shortcut in eps file path if possible (merge from trunk, r50897)

Modified: grass/branches/develbranch_6/gui/wxpython/psmap/instructions.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/psmap/instructions.py	2012-02-20 10:13:55 UTC (rev 50897)
+++ grass/branches/develbranch_6/gui/wxpython/psmap/instructions.py	2012-02-20 10:17:52 UTC (rev 50898)
@@ -889,9 +889,10 @@
         
     def __str__(self):
         self.ChangeRefPoint(toCenter = True)
+        epsfile = self.instruction['epsfile'].replace(os.getenv('GISBASE'), "$GISBASE")
         
         instr = "eps %s %s\n" % (self.instruction['east'], self.instruction['north'])
-        instr += string.Template("    epsfile $epsfile\n").substitute(self.instruction)
+        instr += "    epsfile %s\n" % epsfile
         if self.instruction["rotate"]:
             instr += string.Template("    rotate $rotate\n").substitute(self.instruction)
         if self.instruction["scale"]:
@@ -916,7 +917,8 @@
                         instr['east'], instr['north'] = float(e), float(n)
                 
                 elif sub == 'epsfile':
-                    instr['epsfile'] = line.split(None, 1)[1]
+                    epsfile = line.split(None, 1)[1]
+                    instr['epsfile'] = epsfile.replace("$GISBASE", os.getenv("GISBASE"))
                 elif sub == 'rotate':
                     instr['rotate'] = float(line.split(None, 1)[1])
                 elif sub == 'scale':
@@ -999,10 +1001,11 @@
         
     def __str__(self):
         self.ChangeRefPoint(toCenter = True)
-        
+        epsfile = self.instruction['epsfile'].replace(os.getenv('GISBASE'), "$GISBASE")
+
         instr = "eps %s %s\n" % (self.instruction['east'], self.instruction['north'])
         instr += "# north arrow\n"
-        instr += string.Template("    epsfile $epsfile\n").substitute(self.instruction)
+        instr += "    epsfile %s\n" % epsfile
         if self.instruction["rotate"]:
             instr += string.Template("    rotate $rotate\n").substitute(self.instruction)
         if self.instruction["scale"]:
@@ -1663,7 +1666,8 @@
                     
         if self.subType == 'areas':
             if dic['pat'] is not None:
-                vInstruction += string.Template("    pat $pat\n").substitute(dic)
+                patternFile = dic['pat'].replace(os.getenv("GISBASE"), "$GISBASE")
+                vInstruction += "    pat %s\n" % patternFile
                 vInstruction += string.Template("    pwidth $pwidth\n").substitute(dic)
                 vInstruction += string.Template("    scale $scale\n").substitute(dic)
                 
@@ -1775,7 +1779,8 @@
                 if line.startswith('fcolor'):
                     instr['fcolor'] = line.split()[1]    
                 elif line.startswith('pat'):
-                    instr['pat'] = line.split()[1]
+                    patternFile = line.split()[1]
+                    instr['pat'] = patternFile.replace("$GISBASE", os.getenv("GISBASE"))
                 elif line.startswith('pwidth'):
                     instr['pwidth'] = float(line.split()[1])
                 elif line.startswith('scale'):

Modified: grass/branches/develbranch_6/gui/wxpython/psmap/utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/psmap/utils.py	2012-02-20 10:13:55 UTC (rev 50897)
+++ grass/branches/develbranch_6/gui/wxpython/psmap/utils.py	2012-02-20 10:17:52 UTC (rev 50898)
@@ -15,7 +15,7 @@
 
 @author Anna Kratochvilova <kratochanna gmail.com>
 """
-
+import os
 import wx
 from math import ceil, floor, sin, cos, pi
 



More information about the grass-commit mailing list