[GRASS-SVN] r42325 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri May 21 04:07:25 EDT 2010
Author: martinl
Date: 2010-05-21 04:07:20 -0400 (Fri, 21 May 2010)
New Revision: 42325
Modified:
grass/trunk/gui/wxpython/gui_modules/dbm.py
Log:
bugfix #1072
Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py 2010-05-21 07:08:11 UTC (rev 42324)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py 2010-05-21 08:07:20 UTC (rev 42325)
@@ -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.dropcolumn',
{ '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.dropcolumn',
{ 'map' : self.vectorName,
More information about the grass-commit
mailing list