[GRASS-SVN] r47226 - grass/trunk/gui/wxpython

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 22 14:50:56 EDT 2011


Author: martinl
Date: 2011-07-22 11:50:56 -0700 (Fri, 22 Jul 2011)
New Revision: 47226

Modified:
   grass/trunk/gui/wxpython/gis_set.py
Log:
wxGUI: #1407 (confusing error message after grass7 crash)


Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2011-07-22 13:49:25 UTC (rev 47225)
+++ grass/trunk/gui/wxpython/gis_set.py	2011-07-22 18:50:56 UTC (rev 47226)
@@ -739,11 +739,27 @@
         
         lockfile = os.path.join(dbase, location, mapset, '.gislock')
         if os.path.isfile(lockfile):
-            GError(_("GRASS is already running in selected mapset <%(mapset)s>\n"
-                     "(File %(lock)s found).\n\n"
-                     "Concurrent use not allowed.") % { 'mapset' : mapset, 'lock' : lockfile },
-                   parent = self)
-            return
+            dlg = wx.MessageDialog(parent = self,
+                                   message = _("GRASS is already running in selected mapset <%(mapset)s>\n"
+                                               "(file %(lock)s found).\n\n"
+                                               "Concurrent use not allowed.\n\n"
+                                               "Do you want to try to remove .gislock (note that you "
+                                               "need permission for this operation) and continue?") % 
+                                   { 'mapset' : mapset, 'lock' : lockfile },
+                                   caption = _("Lock file found"),
+                                   style = wx.YES_NO | wx.NO_DEFAULT |
+                                   wx.ICON_QUESTION | wx.CENTRE)
+            
+            ret = dlg.ShowModal()
+            if ret == wx.ID_YES:
+                try:
+                    os.remove(lockfile)
+                except IOError, e:
+                    GError(_("Unable to remove '%(lock)s'.\n\n"
+                             "Details: %(reason)s") % { 'lock' : lockfile, 'reason' : e})
+                    return
+            else:
+                return
         
         gcmd.RunCommand("g.gisenv",
                         set = "GISDBASE=%s" % dbase)



More information about the grass-commit mailing list