[GRASS-SVN] r45237 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 28 09:35:09 EST 2011


Author: martinl
Date: 2011-01-28 06:35:09 -0800 (Fri, 28 Jan 2011)
New Revision: 45237

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm.py
   grass/trunk/gui/wxpython/gui_modules/gdialogs.py
   grass/trunk/gui/wxpython/gui_modules/goutput.py
   grass/trunk/gui/wxpython/gui_modules/layertree.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
   grass/trunk/gui/wxpython/gui_modules/menuform.py
   grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/profile.py
   grass/trunk/gui/wxpython/gui_modules/render.py
Log:
wxGUI: fix adding legend/barscale from command prompt


Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -95,7 +95,7 @@
             keyColumn = self.LoadData(layer)
         except gcmd.GException, e:
             GError(parent = self,
-                   message = e)
+                   message = e.value)
             return
         
         #

Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -290,7 +290,7 @@
                             **cmd[1])
         except gcmd.GException, e:
             gcmd.GError(parent = self,
-                        message = e)
+                        message = e.value)
             return (None, None)
         
         #

Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -475,28 +475,27 @@
                                  'd.grid'         : 'grid',
                                  'd.geodesic'     : 'geodesic',
                                  'd.rhumbline'    : 'rhumb',
-                                 'd.labels'       : 'labels'}[command[0]]
+                                 'd.labels'       : 'labels',
+                                 'd.barscale'     : 'barscale'}[command[0]]
                 except KeyError:
                     gcmd.GMessage(parent = self.parent,
                                   message = _("Command '%s' not yet implemented in the WxGUI. "
                                               "Try adding it as a command layer instead.") % command[0])
                     return None
                 
-                # add layer into layer tree
-                if command[0] == 'd.rast':
-                    lname, found = utils.GetLayerNameFromCmd(command, fullyQualified = True,
-                                                             layerType = 'raster')
-                elif command[0] == 'd.vect':
-                    lname, found = utils.GetLayerNameFromCmd(command, fullyQualified = True,
-                                                             layerType = 'vector')
+                if layertype == 'barscale':
+                    self.parent.curr_page.maptree.GetMapDisplay().OnAddBarscale(None)
+                elif layertype == 'rastleg':
+                    self.parent.curr_page.maptree.GetMapDisplay().OnAddLegend(None)
                 else:
-                    lname = None
+                    # add layer into layer tree
+                    lname, found = utils.GetLayerNameFromCmd(command, fullyQualified = True,
+                                                             layerType = layertype)
+                    if self.parent.GetName() == "LayerManager":
+                        self.parent.curr_page.maptree.AddLayer(ltype = layertype,
+                                                               lname = lname,
+                                                               lcmd = command)
                 
-                if self.parent.GetName() == "LayerManager":
-                    self.parent.curr_page.maptree.AddLayer(ltype=layertype,
-                                                           lname=lname,
-                                                           lcmd=command)
-            
             else:
                 # other GRASS commands (r|v|g|...)
                 # switch to 'Command output' if required

Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -458,7 +458,8 @@
         self.lmgr.goutput.RunCmd(cmd)
          
     def OnSetCompRegFromMap(self, event):
-        """!Set computational region from selected raster/vector map"""
+        """!Set computational region from selected raster/vector map
+        """
         rast = []
         vect = []
         rast3d = []

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -1754,7 +1754,7 @@
         """
         if self.dialogs['barscale']:
             return
-
+        
         id = 0 # unique index for overlay layer
 
         # If location is latlon, only display north arrow (scale won't work)
@@ -1769,7 +1769,7 @@
             gdialogs.DecorationDialog(parent = self, title = _('Scale and North arrow'),
                                       size = (350, 200),
                                       style = wx.DEFAULT_DIALOG_STYLE | wx.CENTRE,
-                                      cmd = ['d.barscale', 'at = 0,5'],
+                                      cmd = ['d.barscale', 'at=0,5'],
                                       ovlId = id,
                                       name = 'barscale',
                                       checktxt = _("Show/hide scale and North arrow"),

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -741,7 +741,7 @@
             else:
                 self.mapfile = self.Map.Render(force = False, mapWindow = self.parent)
         except gcmd.GException, e:
-            gcmd.GError(message = e)
+            gcmd.GError(message = e.value)
             self.mapfile = None
         
         self.img = self.GetImage() # id=99

Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -397,7 +397,7 @@
                 processTask(tree = etree.fromstring(getInterfaceDescription(grassModule)),
                             task = self)
             except gcmd.GException, e:
-                self.errorMsg = str(e)
+                self.errorMsg = e.value
                 
             self.define_first()
         
@@ -2147,7 +2147,7 @@
                                      stderr = grass.PIPE).communicate()
     except OSError, e:
         raise gcmd.GException, _("Unable to fetch interface description for command '%s'. "
-                                 "Details: %s") % (cmd, repr(e))
+                                 "Details: %s") % (cmd, e.value)
     if cmderr and cmderr[:7] != 'WARNING':
         raise gcmd.GException, _("Unable to fetch interface description for command '%s'. "
                                  "Details: %s") % (cmd, cmderr)

Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -446,7 +446,7 @@
                         self.LoadVector(item, points = False)
             except gcmd.GException, e:
                 GError(parent = self,
-                       message = e)
+                       message = e.value)
             self.init = False
         
         stop = time.time()
@@ -485,7 +485,7 @@
                     self.UpdateView(None)
                 except gcmd.GException, e:
                     gcmd.GError(parent = self,
-                                message = e)
+                                message = e.value)
                 
                 self.lmgr.nviz.UpdateSettings()        
         

Modified: grass/trunk/gui/wxpython/gui_modules/profile.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/profile.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/profile.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -439,7 +439,7 @@
             return datalist
         except gcmd.GException, e:
             gcmd.GError(parent = self,
-                        message = e)
+                        message = e.value)
             return None
 
     def OnCreateProfile(self, event):

Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py	2011-01-28 13:50:20 UTC (rev 45236)
+++ grass/trunk/gui/wxpython/gui_modules/render.py	2011-01-28 14:35:09 UTC (rev 45237)
@@ -125,7 +125,7 @@
         layertypes = ('raster', 'rgb', 'his', 'shaded', 'rastarrow', 'rastnum',
                       'vector','thememap','themechart',
                       'grid', 'geodesic', 'rhumb', 'labels',
-                      'command',
+                      'command', 'rastleg',
                       'overlay')
         
         if self.type not in layertypes:
@@ -159,7 +159,7 @@
             # if len(msg):
             # sys.stderr.write(_("Running") + " '" + utils.GetCmdString(self.cmd) + "'")
             # sys.stderr.write(msg)
-                
+            
             if ret != 0:
                 # clean up after problem
                 try:
@@ -172,7 +172,7 @@
                 self.maskfile = None
         
         except gcmd.GException, e:
-            sys.stderr.write(e)
+            sys.stderr.write(e.value)
             # clean up after problems
             try:
                 os.remove(self.mapfile)
@@ -263,7 +263,7 @@
                         'shaded', 'rgb', 'his', 'rastarrow', 'rastnum',
                         'thememap', 'themechart', 'grid', 'labels',
                         'geodesic','rhumb'):
-            raise gcmd.GException(_("Unsupported map layer type '%s'") % str(type))
+            raise gcmd.GException(_("Unsupported map layer type '%s'") % type)
         
         self.type = type
 
@@ -953,7 +953,7 @@
         Debug.msg (3, "Map.AddLayer(): layer=%s" % layer.name)
         if l_render:
             if not layer.Render():
-                raise gcmd.GException(_("Unable to render map layer <%s>.") % (name))
+                raise gcmd.GException(_("Unable to render map layer <%s>.") % name)
         
         return layer
 
@@ -1036,7 +1036,7 @@
         
         if render and not layer.Render():
             raise gcmd.GException(_("Unable to render map layer <%s>.") % 
-                                  (name))
+                                  name)
         
         return layer
 
@@ -1145,7 +1145,7 @@
         
         if l_render and command != '' and not overlay.Render():
             raise gcmd.GException(_("Unable render overlay <%s>.") % 
-                                  (name))
+                                  name)
         
         return self.overlays[-1]
 
@@ -1184,7 +1184,7 @@
         
         if render and command != [] and not overlay.Render():
             raise gcmd.GException(_("Unable render overlay <%s>") % 
-                                  (name))
+                                  name)
         
         return overlay
 



More information about the grass-commit mailing list