[GRASS-SVN] r39589 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Oct 19 19:27:31 EDT 2009
Author: martinl
Date: 2009-10-19 19:27:31 -0400 (Mon, 19 Oct 2009)
New Revision: 39589
Modified:
grass/trunk/gui/wxpython/gui_modules/dbm.py
grass/trunk/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI/dbm: fix extract selected features
(merge r39588 from devbr6)
Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py 2009-10-19 23:24:44 UTC (rev 39588)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py 2009-10-19 23:27:31 UTC (rev 39589)
@@ -1931,7 +1931,7 @@
event.Skip()
def OnExtractSelected(self, event):
- """
+ """!
Extract vector objects selected in attribute browse window
to new vector map
"""
@@ -1945,12 +1945,21 @@
return
else:
# dialog to get file name
- gdialogs.CreateNewVector(parent = self, title = _('Extract selected features'),
- log = self.cmdLog,
- cmd = (('v.extract',
- { 'input' : self.vectorName,
- 'list' : utils.ListOfCatsToRange(cats) },
- 'output')))
+ name, add = gdialogs.CreateNewVector(parent = self, title = _('Extract selected features'),
+ log = self.cmdLog,
+ cmd = (('v.extract',
+ { 'input' : self.vectorName,
+ 'list' : utils.ListOfCatsToRange(cats) },
+ 'output')),
+ disableTable = True)
+ if name and add:
+ # add layer to map layer tree
+ self.parent.curr_page.maptree.AddLayer(ltype='vector',
+ lname=name,
+ lchecked=True,
+ lopacity=1.0,
+ lcmd=['d.vect', 'map=%s' % name])
+
def OnDeleteSelected(self, event):
"""
Delete vector objects selected in attribute browse window
Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2009-10-19 23:24:44 UTC (rev 39588)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2009-10-19 23:27:31 UTC (rev 39589)
@@ -183,7 +183,7 @@
class NewVectorDialog(ElementDialog):
"""!Dialog for creating new vector map"""
- def __init__(self, parent, id, title, disableAdd=False,
+ def __init__(self, parent, id, title, disableAdd=False, disableTable=False,
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
ElementDialog.__init__(self, parent, title, label = _("Name for new vector map:"))
@@ -194,6 +194,8 @@
self.table = wx.CheckBox(parent = self.panel, id = wx.ID_ANY,
label = _("Create attribute table"))
self.table.SetValue(True)
+ if disableTable:
+ self.table.Enable(False)
self.addbox = wx.CheckBox(parent = self.panel,
label = _('Add created map into layer tree'), style = wx.NO_BORDER)
@@ -233,7 +235,7 @@
return self.GetElement().split('@', 1)[0]
def CreateNewVector(parent, cmd, title=_('Create new vector map'),
- exceptMap=None, log=None, disableAdd=False):
+ exceptMap=None, log=None, disableAdd=False, disableTable=False):
"""!Create new vector map layer
@cmd cmd (prog, **kwargs)
@@ -242,7 +244,7 @@
@return None of failure
"""
dlg = NewVectorDialog(parent, wx.ID_ANY, title,
- disableAdd)
+ disableAdd, disableTable)
if dlg.ShowModal() == wx.ID_OK:
outmap = dlg.GetName()
if outmap == exceptMap:
@@ -290,7 +292,7 @@
#
# create attribute table
#
- if dlg.table.IsChecked():
+ if dlg.table.IsEnabled() and dlg.table.IsChecked():
key = UserSettings.Get(group='atm', key='keycolumn', subkey='value')
sql = 'CREATE TABLE %s (%s INTEGER)' % (outmap, key)
More information about the grass-commit
mailing list