浏览代码

wxGUI: https://trac.osgeo.org/grass/ticket/1407 (confusing error message after grass7 crash)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47226 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 年之前
父节点
当前提交
9a5ac3f965
共有 1 个文件被更改,包括 21 次插入5 次删除
  1. 21 5
      gui/wxpython/gis_set.py

+ 21 - 5
gui/wxpython/gis_set.py

@@ -739,11 +739,27 @@ class GRASSStartup(wx.Frame):
         
         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)