[GRASS-SVN] r54629 - grass/trunk/gui/wxpython
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 14 12:34:36 PST 2013
Author: martinl
Date: 2013-01-14 12:34:35 -0800 (Mon, 14 Jan 2013)
New Revision: 54629
Modified:
grass/trunk/gui/wxpython/gis_set.py
Log:
wxGUI/startup: check if gisdbase exists or contains at least one GRASS location
Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py 2013-01-14 15:03:57 UTC (rev 54628)
+++ grass/trunk/gui/wxpython/gis_set.py 2013-01-14 20:34:35 UTC (rev 54629)
@@ -11,7 +11,7 @@
- gis_set::GListBox
- gis_set::StartUp
-(C) 2006-2012 by the GRASS Development Team
+(C) 2006-2013 by the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
@@ -635,11 +635,10 @@
try:
self.listOfLocations = GetListOfLocations(dbase)
except UnicodeEncodeError:
- wx.MessageBox(parent = self, caption = _("Error"),
- message = _("Unable to set GRASS database. "
- "Check your locale settings."),
- style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
-
+ GError(parent = self,
+ message = _("Unable to set GRASS database. "
+ "Check your locale settings."))
+
self.lblocations.Clear()
self.lblocations.InsertItems(self.listOfLocations, 0)
@@ -647,7 +646,9 @@
self.lblocations.SetSelection(0)
else:
self.lblocations.SetSelection(wx.NOT_FOUND)
-
+ GWarning(_("No GRASS location found in '%s'.") % self.gisdbase,
+ parent = self)
+
return self.listOfLocations
def UpdateMapsets(self, location):
@@ -749,10 +750,15 @@
def OnSetDatabase(self, event):
"""!Database set"""
+ gisdbase = self.tgisdbase.GetValue()
+ if not os.path.exists(gisdbase):
+ GError(_("Path '%s' doesn't exist.") % gisdbase,
+ parent = self)
+ return
+
self.gisdbase = self.tgisdbase.GetValue()
+ self.UpdateLocations(self.gisdbase)
- self.UpdateLocations(self.gisdbase)
-
self.OnSelectLocation(None)
def OnBrowse(self, event):
More information about the grass-commit
mailing list