[GRASS-SVN] r29812 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jan 23 13:53:28 EST 2008
Author: martinl
Date: 2008-01-23 13:53:28 -0500 (Wed, 23 Jan 2008)
New Revision: 29812
Modified:
grass/trunk/gui/wxpython/gui_modules/dbm.py
Log:
wxGUI/Attribute Table Manager: fix add column for multi-layer vector maps.
Fix error dialogs.
Header doxygenized.
Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py 2008-01-23 16:10:51 UTC (rev 29811)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py 2008-01-23 18:53:28 UTC (rev 29812)
@@ -1,34 +1,35 @@
"""
-MODULE: dbm.py
+ at package dbm.py
-CLASSES:
- * Log
- * VirtualAttributeList
- * AttributeManager
- * DisplayAttributesDialog
- * VectorDBInfo
- * ModifyTableRecord
- * NewVectorDialog
+ at brief GRASS attribute table manager
-PURPOSE: GRASS attribute table manager
+This program is based on FileHunter, published in 'The wxPython Linux
+Tutorial' on wxPython WIKI pages.
- This program is based on FileHunter, published in 'The wxPython Linux
- Tutorial' on wxPython WIKI pages.
+It also uses some functions at
+http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/426407
- It also uses some functions at
- http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/426407
+ at code
+dbm.py vector at mapset
+ at endcode
- dbm.py vector at mapset
+List of classes:
+ - Log
+ - VirtualAttributeList
+ - AttributeManager
+ - DisplayAttributesDialog
+ - VectorDBInfo
+ - ModifyTableRecord
+ - NewVectorDialog
-AUTHOR(S): GRASS Development Team
- Original author: Jachym Cepicky <jachym.cepicky gmail.com>
- Various updates: Martin Landa <landa.martin gmail.com>
+(C) 2007 by the GRASS Development Team
-COPYRIGHT: (C) 2007 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.
- This program is free software under the GNU General Public
- License (>=v2). Read the file COPYING that comes with GRASS
- for details.
+ at author Jachym Cepicky <jachym.cepicky gmail.com>
+Martin Landa <landa.martin gmail.com>
"""
import sys
@@ -382,8 +383,10 @@
if len(self.mapDBInfo.layers.keys()) == 0:
wx.MessageBox(parent=self.parent,
- message=_("Database connection for map <%s> "
- "is not defined in DB file.") % self.vectmap,
+ message=_("Database connection for vector map <%s> "
+ "is not defined in DB file. "
+ "You can define new connection in "
+ "'Manage layers'.") % self.vectmap,
caption=_("Attribute Table Manager"),
style=wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
@@ -702,7 +705,7 @@
flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
border=3)
- btnAddCol = wx.Button(parent=panel, id=wx.ID_ADD)
+ btnAddCol = wx.Button(parent=panel, id=wx.ID_ANY, label=_('&Add'))
btnAddCol.Bind(wx.EVT_BUTTON, self.OnTableItemAdd)
btnAddCol.Enable(False)
self.layerPage[layer]['addColButton'] = btnAddCol.GetId()
@@ -1261,7 +1264,7 @@
nameTo = self.FindWindowById(self.layerPage[self.layer]['renameColTo']).GetValue()
if not name or not nameTo:
- wx.MessageBox(self=self.parent,
+ wx.MessageBox(self=self,
message=_("Unable to rename column. "
"No column name defined."),
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
@@ -1269,10 +1272,10 @@
item = list.FindItem(start=-1, str=name)
if item > -1:
if list.FindItem(start=-1, str=nameTo) > -1:
- wx.MessageBox(parent=self.parent,
- message=_("Unable to rename column. "
- "Column <%s> already exists in the table.") % \
- nameTo,
+ wx.MessageBox(parent=self,
+ message=_("Unable to rename column <%s>. "
+ "Column <%s> already exists in the table <%s>.") % \
+ (name, nameTo, self.mapDBInfo.layers[self.layer]["table"]),
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
else:
list.SetItemText(item, nameTo)
@@ -1282,9 +1285,10 @@
'layer=%d' % self.layer,
'column=%s,%s' % (name, nameTo)])
else:
- wx.MessageBox(parent=self.parent,
+ wx.MessageBox(parent=self,
message=_("Unable to rename column. "
- "Column <%s> doesn't exist in the table.") % name,
+ "Column <%s> doesn't exist in the table <%s>.") % \
+ (name, self.mapDBInfo.layers[self.layer]["table"]),
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
event.Skip()
@@ -1348,7 +1352,7 @@
name = self.FindWindowById(self.layerPage[self.layer]['addColName']).GetValue()
if not name:
- wx.MessageBox(parent=self.parent,
+ wx.MessageBox(parent=self,
message=_("Unable to add column to the table. "
"No column name defined."),
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
@@ -1367,9 +1371,9 @@
list = self.FindWindowById(self.layerPage[self.layer]['tableData'])
# check for duplicate items
if list.FindItem(start=-1, str=name) > -1:
- wx.MessageBox(parent=self.parent,
- message=_("Unable to add column <%s> to the table. "
- "Column already exists.") % name,
+ wx.MessageBox(parent=self,
+ message=_("Column <%s> already exists in table <%s>.") % \
+ (name, self.mapDBInfo.layers[self.layer]["table"]),
caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
return
index = list.InsertStringItem(sys.maxint, str(name))
@@ -2449,11 +2453,11 @@
key = self.tableWidgets['key'][1].GetValue()
if not table or not key:
- wx.MessageBox(parent=self.parent,
+ wx.MessageBox(parent=self,
message=_("Unable to create new table.%s"
"Table name or key column name is missing.") % \
(os.linesep),
- caption=_("Error"), flag=wx.OK | wx.ICON_ERROR | wx.CENTRE)
+ caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
return
# create table
@@ -2487,7 +2491,7 @@
key = self.addLayerWidgets['key'][1].GetStringSelection()
if layer in self.mapDBInfo.layers.keys():
- wx.MessageBox(parent=self.parent,
+ wx.MessageBox(parent=self,
message=_("Unable to add new layer to vector map <%s>.%s"
"Layer %d already exists.") % \
(self.mapDBInfo.map, os.linesep, layer),
More information about the grass-commit
mailing list