[GRASS-SVN] r36087 - grass/branches/develbranch_6/gui/wxpython
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 25 05:32:30 EST 2009
Author: martinl
Date: 2009-02-25 05:32:29 -0500 (Wed, 25 Feb 2009)
New Revision: 36087
Modified:
grass/branches/develbranch_6/gui/wxpython/gis_set.py
Log:
wxGUI: backport first run message from TCL/TK GUI
Modified: grass/branches/develbranch_6/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gis_set.py 2009-02-25 09:52:32 UTC (rev 36086)
+++ grass/branches/develbranch_6/gui/wxpython/gis_set.py 2009-02-25 10:32:29 UTC (rev 36087)
@@ -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
@@ -166,7 +166,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"))
@@ -191,7 +191,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
@@ -208,7 +208,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),
@@ -383,7 +383,7 @@
return grassrc
- def _getRCValue(self, value):
+ def GetRCValue(self, value):
"Return GRASS variable (read from GISRC)"""
if self.grassrc.has_key(value):
@@ -611,7 +611,11 @@
disabled = []
idx = 0
- locationName = self.listOfLocations[self.lblocations.GetSelection()]
+ try:
+ locationName = self.listOfLocations[self.lblocations.GetSelection()]
+ except IndexError:
+ locationName = ''
+
for mapset in self.listOfMapsets:
if mapset not in self.listOfMapsetsSelectable or \
os.path.isfile(os.path.join(self.gisdbase,
@@ -812,6 +816,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