[GRASS-SVN] r42326 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 21 04:11:08 EDT 2010


Author: martinl
Date: 2010-05-21 04:11:07 -0400 (Fri, 21 May 2010)
New Revision: 42326

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
Log:
bugfix #1072
(merge r42325 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2010-05-21 08:07:20 UTC (rev 42325)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2010-05-21 08:11:07 UTC (rev 42326)
@@ -1658,8 +1658,19 @@
     def OnTableItemDelete(self, event):
         """!Delete selected item(s) from the list"""
         list = self.FindWindowById(self.layerPage[self.layer]['tableData'])
-
+        
         item = list.GetFirstSelected()
+        
+        if UserSettings.Get(group='atm', key='askOnDeleteRec', subkey='enabled'):
+            deleteDialog = wx.MessageBox(parent=self,
+                                         message=_("Selected column '%s' will PERMANENTLY removed "
+                                                   "from table. Do you want to drop the column?") % \
+                                             (list.GetItemText(item)),
+                                         caption=_("Drop column(s)"),
+                                         style=wx.YES_NO | wx.CENTRE)
+            if deleteDialog != wx.YES:
+                return False
+        
         while item != -1:
             self.listOfCommands.append(('v.db.dropcol',
                                         { 'map' : self.vectorName,
@@ -1668,21 +1679,35 @@
                                         ))
             list.DeleteItem(item)
             item = list.GetFirstSelected()
-
+        
         # apply changes
         self.ApplyCommands()
-
+        
         # update widgets
         table = self.mapDBInfo.layers[self.layer]['table']
         self.FindWindowById(self.layerPage[self.layer]['renameCol']).SetItems(self.mapDBInfo.GetColumns(table))
         self.FindWindowById(self.layerPage[self.layer]['renameCol']).SetSelection(0)
-
+        
         event.Skip()
 
     def OnTableItemDeleteAll(self, event):
         """!Delete all items from the list"""
-        table = self.mapDBInfo.layers[self.layer]['table']
-        cols = self.mapDBInfo.GetColumns(table)
+        table     = self.mapDBInfo.layers[self.layer]['table']
+        cols      = self.mapDBInfo.GetColumns(table)
+        keyColumn = self.mapDBInfo.layers[self.layer]['key']
+        if keyColumn in cols:
+            cols.remove(keyColumn)
+        
+        if UserSettings.Get(group='atm', key='askOnDeleteRec', subkey='enabled'):
+            deleteDialog = wx.MessageBox(parent=self,
+                                         message=_("Selected columns\n%s\nwill PERMANENTLY removed "
+                                                   "from table. Do you want to drop the columns?") % \
+                                             ('\n'.join(cols)),
+                                         caption=_("Drop column(s)"),
+                                         style=wx.YES_NO | wx.CENTRE)
+            if deleteDialog != wx.YES:
+                return False
+        
         for col in cols:
             self.listOfCommands.append(('v.db.dropcol',
                                         { 'map' : self.vectorName,



More information about the grass-commit mailing list