Browse Source

wxGUI: fix startup dialog when gisdbase is not available
(merge https://trac.osgeo.org/grass/changeset/46947 from relbr64)


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

Martin Landa 14 years ago
parent
commit
9124d318b1
2 changed files with 9 additions and 2 deletions
  1. 1 1
      gui/wxpython/gis_set.py
  2. 8 1
      gui/wxpython/gui_modules/utils.py

+ 1 - 1
gui/wxpython/gis_set.py

@@ -91,7 +91,7 @@ class GRASSStartup(wx.Frame):
         versionFile = open(os.path.join(globalvar.ETCDIR, "VERSIONNUMBER"))
         versionFile = open(os.path.join(globalvar.ETCDIR, "VERSIONNUMBER"))
         grassVersion = versionFile.readline().split(' ')[0].rstrip('\n')
         grassVersion = versionFile.readline().split(' ')[0].rstrip('\n')
         versionFile.close()
         versionFile.close()
-
+        
         self.select_box = wx.StaticBox (parent = self.panel, id = wx.ID_ANY,
         self.select_box = wx.StaticBox (parent = self.panel, id = wx.ID_ANY,
                                         label = " %s " % _("Choose project location and mapset"))
                                         label = " %s " % _("Choose project location and mapset"))
 
 

+ 8 - 1
gui/wxpython/gui_modules/utils.py

@@ -756,7 +756,14 @@ def GetFormats():
 def GetSettingsPath():
 def GetSettingsPath():
     """!Get full path to the settings directory
     """!Get full path to the settings directory
     """
     """
-    version = int(grass.version()['version'].split('.', 1)[0])
+    try:
+        verFd = open(os.path.join(globalvar.ETCDIR, "VERSIONNUMBER"))
+        version = int(verFd.readlines()[0].split(' ')[0].split('.')[0])
+    except (IOError, ValueError, TypeError, IndexError), e:
+        sys.exit(_("ERROR: Unable to determine GRASS version. Details: %s") % e)
+    
+    verFd.close()
+    
     if sys.platform == 'win32':
     if sys.platform == 'win32':
         return os.path.join(os.getenv('APPDATA'), '.grass%d' % version)
         return os.path.join(os.getenv('APPDATA'), '.grass%d' % version)