[GRASS-SVN] r39588 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Oct 19 19:24:45 EDT 2009
Author: martinl
Date: 2009-10-19 19:24:44 -0400 (Mon, 19 Oct 2009)
New Revision: 39588
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI/dbm: fix extract selected features
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py 2009-10-19 22:40:00 UTC (rev 39587)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py 2009-10-19 23:24:44 UTC (rev 39588)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py 2009-10-19 22:40:00 UTC (rev 39587)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py 2009-10-19 23:24:44 UTC (rev 39588)
@@ -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