[GRASS-SVN] r45884 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 9 15:40:01 EDT 2011


Author: martinl
Date: 2011-04-09 12:40:01 -0700 (Sat, 09 Apr 2011)
New Revision: 45884

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
Log:
wxGUI: fix formatting distance, multi-line output


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2011-04-09 19:24:09 UTC (rev 45883)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2011-04-09 19:40:01 UTC (rev 45884)
@@ -1665,12 +1665,16 @@
             if angle < 0:
                 angle = 360+angle
             
-            mstring = '%s = %s %s\t%s = %s %s\tbearing = %d %s' \
-                % (_('segment'), strdist, dunits, _('total distance'), strtotdist, tdunits,
-                   angle, _('deg'))
+            mstring = '%s = %s %s\n%s = %s %s\n%s = %d %s\n%s' \
+                % (_('segment'), strdist, dunits,
+                   _('total distance'), strtotdist, tdunits,
+                   _('bearing'), angle, _('deg'),
+                   '-' * 60)
         else:
-            mstring = '%s = %s %s\t%s = %s %s' \
-                % (_('segment'), strdist, dunits, _('total distance'), strtotdist, tdunits)
+            mstring = '%s = %s %s\n%s = %s %s\n%s' \
+                % (_('segment'), strdist, dunits,
+                   _('total distance'), strtotdist, tdunits,
+                   '-' * 60)
         
         self._layerManager.goutput.WriteLog(mstring)
         
@@ -1698,7 +1702,8 @@
         Grass Development Team 2006"""
         
         mapunits = self.Map.projinfo['units']
-        if mapunits == 'metres': mapunits = 'meters'
+        if mapunits == 'metres':
+            mapunits = 'meters'
         outunits = mapunits
         dist = float(dist)
         divisor = 1.0
@@ -1737,7 +1742,7 @@
             outdist = float(dist/divisor)
         
         return (outdist, outunits)
-
+    
     def Histogram(self, event):
         """!Init histogram display canvas and tools
         """

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2011-04-09 19:24:09 UTC (rev 45883)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2011-04-09 19:40:01 UTC (rev 45884)
@@ -459,8 +459,10 @@
         
         for line in ret.splitlines():
             if ':' in line:
-                key, val = line.split(':')
-                projinfo[key.strip()] = val.strip()
+                key, val = map(lambda x: x.strip(), line.split(':'))
+                if key in ['units']:
+                    val = val.lower()
+                projinfo[key] = val
             elif "XY location (unprojected)" in line:
                 projinfo['proj'] = 'xy'
                 projinfo['units'] = ''



More information about the grass-commit mailing list