Browse Source

wxGUI/colortable: fix saving color table to fi

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@66951 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 years ago
parent
commit
3d6469f7f6
1 changed files with 11 additions and 2 deletions
  1. 11 2
      gui/wxpython/modules/colorrules.py

+ 11 - 2
gui/wxpython/modules/colorrules.py

@@ -12,7 +12,7 @@ Classes:
  - colorrules::ThematicVectorTable
  - colorrules::BufferedWindow
 
-(C) 2008, 2010-2012 by the GRASS Development Team
+(C) 2008-2015 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.
@@ -599,9 +599,18 @@ class ColorTable(wx.Frame):
     def OnSaveRulesFile(self, event):
         """Save color table to file"""
         path = event.GetString()
-        if not os.path.exists(path):
+        if not path:
             return
         
+        if os.path.exists(path):
+            dlgOw = wx.MessageDialog(parent,
+                                     message = _("File <%s> already already exists. "
+                                                 "Do you want to overwrite it?") % path,
+                                     caption = _("Overwrite?"),
+                                     style = wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
+            if dlgOw.ShowModal() != wx.ID_YES:
+                return
+        
         rulestxt = ''   
         for rule in self.rulesPanel.ruleslines.itervalues():
             if 'value' not in rule: