[GRASS-SVN] r36089 - grass/branches/releasebranch_6_4/gui/wxpython

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 25 05:38:32 EST 2009


Author: martinl
Date: 2009-02-25 05:38:32 -0500 (Wed, 25 Feb 2009)
New Revision: 36089

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py
Log:
wxGUI: backport first run message from TCL/TK GUI
  (merge from devbr6, r36087)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py	2009-02-25 10:36:00 UTC (rev 36088)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py	2009-02-25 10:38:32 UTC (rev 36089)
@@ -48,7 +48,7 @@
         #
         self.gisbase  = os.getenv("GISBASE")
         self.grassrc  = self._read_grassrc()
-        self.gisdbase = self._getRCValue("GISDBASE")
+        self.gisdbase = self.GetRCValue("GISDBASE")
 
         #
         # list of locations/mapsets
@@ -168,7 +168,7 @@
         self.lbmapsets.Bind(wx.EVT_LIST_ITEM_SELECTED,   self.OnSelectMapset)
         self.tgisdbase.Bind(wx.EVT_TEXT_ENTER, self.OnSetDatabase)
         self.Bind(wx.EVT_CLOSE,               self.OnCloseWindow)
-
+        
     def _set_properties(self):
         """Set frame properties"""
         self.SetTitle(_("Welcome to GRASS GIS"))
@@ -193,7 +193,7 @@
         self.tgisdbase.SetValue(self.gisdbase)
 
         self.OnSetDatabase(None)
-        location = self._getRCValue("LOCATION_NAME")
+        location = self.GetRCValue("LOCATION_NAME")
         if location == "<UNKNOWN>" or \
                 not os.path.isdir(os.path.join(self.gisdbase, location)):
             location = None
@@ -210,7 +210,7 @@
                 
             # list of mapsets
             self.UpdateMapsets(os.path.join(self.gisdbase,location))
-            mapset = self._getRCValue("MAPSET")
+            mapset = self.GetRCValue("MAPSET")
             if mapset:
                 try:
                     self.lbmapsets.SetSelection(self.listOfMapsets.index(mapset),
@@ -385,7 +385,7 @@
 
         return grassrc
 
-    def _getRCValue(self, value):
+    def GetRCValue(self, value):
         "Return GRASS variable (read from GISRC)"""
 
         if self.grassrc.has_key(value):
@@ -607,6 +607,7 @@
 
         disabled = []
         idx = 0
+        
         for mapset in self.listOfMapsets:
             if mapset not in self.listOfMapsetsSelectable:
                 disabled.append(idx)
@@ -800,6 +801,18 @@
         StartUp.CenterOnScreen()
         self.SetTopWindow(StartUp)
         StartUp.Show()
+        
+        if StartUp.GetRCValue("LOCATION_NAME") == "<UNKNOWN>":
+            wx.MessageBox(parent=StartUp,
+                          caption=_('Starting GRASS for the first time'),
+                          message=_('GRASS needs a directory in which to store its data. '
+                                    'Create one now if you have not already done so. '
+                                    'A popular choice is "grassdata", located in '
+                                    'your home directory.'),
+                          style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
+            
+            StartUp.OnBrowse(None)
+        
         return 1
 
 if __name__ == "__main__":



More information about the grass-commit mailing list