Explorar el Código

wxGUI: fail gracefully when g.region/g.proj are missing
(merge https://trac.osgeo.org/grass/changeset/45760 from devbr6)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45761 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa hace 14 años
padre
commit
857a757802
Se han modificado 2 ficheros con 7 adiciones y 0 borrados
  1. 4 0
      gui/wxpython/gui_modules/mapdisp.py
  2. 3 0
      gui/wxpython/gui_modules/render.py

+ 4 - 0
gui/wxpython/gui_modules/mapdisp.py

@@ -512,6 +512,10 @@ class MapFrame(wx.Frame):
     def _initDisplay(self):
         """!Initialize map display, set dimensions and map region
         """
+        if not grass.find_program('g.region', ['--help']):
+            sys.exit(_("GRASS module '%s' not found. Unable to start map "
+                       "display window.") % 'g.region')
+        
         self.width, self.height = self.GetClientSize()
         
         Debug.msg(2, "MapFrame._initDisplay():")

+ 3 - 0
gui/wxpython/gui_modules/render.py

@@ -416,6 +416,9 @@ class Map(object):
         """!Return region projection and map units information
         """
         projinfo = dict()
+        if not grass.find_program('g.proj', ['--help']):
+            sys.exit(_("GRASS module '%s' not found. Unable to start map "
+                       "display window.") % 'g.proj')
         
         ret = self._runCommand(gcmd.RunCommand, prog = 'g.proj',
                                read = True, flags = 'p')