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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 12 18:30:23 EDT 2011


Author: martinl
Date: 2011-09-12 15:30:23 -0700 (Mon, 12 Sep 2011)
New Revision: 48257

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


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py	2011-09-12 21:32:51 UTC (rev 48256)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py	2011-09-12 22:30:23 UTC (rev 48257)
@@ -738,11 +738,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