瀏覽代碼

wxGUI/forms: fix dialogs with more 'save as' buttons (like r.colors)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57989 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 年之前
父節點
當前提交
11df4235d9
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      gui/wxpython/gui_core/forms.py

+ 8 - 2
gui/wxpython/gui_core/forms.py

@@ -1500,7 +1500,7 @@ class CmdPanel(wx.Panel):
                         
                         btnLoad = wx.Button(parent = which_panel, id = wx.ID_ANY, label = _("&Load"))
                         btnLoad.Bind(wx.EVT_BUTTON, self.OnFileLoad)
-                        btnSave = wx.Button(parent = which_panel, id = wx.ID_SAVEAS)
+                        btnSave = wx.Button(parent = which_panel, id = wx.ID_ANY, label = _("&Save as"))
                         btnSave.Bind(wx.EVT_BUTTON, self.OnFileSave)
                         
                         which_sizer.Add(item = wx.StaticText(parent = which_panel, id = wx.ID_ANY,
@@ -1819,7 +1819,13 @@ class CmdPanel(wx.Panel):
             return
         
         data = ''
-        f = open(path, "r")
+        try:
+            f = open(path, "r")
+        except IOError, e:
+            gcmd.GError(parent = self, showTraceback = False,
+                        message = _("Unable to load file.\n\nReason: %s") % e)
+            return
+        
         try:
             data = f.read()
         finally: