[GRASS-SVN] r39590 -
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Oct 19 19:39:24 EDT 2009
Author: martinl
Date: 2009-10-19 19:39:24 -0400 (Mon, 19 Oct 2009)
New Revision: 39590
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI/dbm: fix extract selected features
(merge r39588 from devbr6)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py 2009-10-19 23:27:31 UTC (rev 39589)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py 2009-10-19 23:39:24 UTC (rev 39590)
@@ -1914,7 +1914,7 @@
event.Skip()
def OnExtractSelected(self, event):
- """
+ """!
Extract vector objects selected in attribute browse window
to new vector map
"""
@@ -1928,12 +1928,21 @@
return
else:
# dialog to get file name
- gdialogs.CreateNewVector(parent=self, title=_('Extract selected features'),
- log=self.cmdLog,
- cmdDef=(["v.extract",
- "input=%s" % self.vectmap,
- "list=%s" % utils.ListOfCatsToRange(cats)],
- "output"))
+ name, add = gdialogs.CreateNewVector(parent=self, title=_('Extract selected features'),
+ log=self.cmdLog,
+ cmdDef=(["v.extract",
+ "input=%s" % self.vectmap,
+ "list=%s" % 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/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py 2009-10-19 23:27:31 UTC (rev 39589)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py 2009-10-19 23:39:24 UTC (rev 39590)
@@ -43,7 +43,7 @@
class NewVectorDialog(wx.Dialog):
"""Create new vector map layer"""
- 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):
wx.Dialog.__init__(self, parent, id, title, style=style)
@@ -64,7 +64,9 @@
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)
if disableAdd:
@@ -126,7 +128,7 @@
return mapName
def CreateNewVector(parent, cmdDef, title=_('Create new vector map'),
- exceptMap=None, log=None, disableAdd=False):
+ exceptMap=None, log=None, disableAdd=False, disableTable=False):
"""Create new vector map layer
@cmdList tuple/list (cmd list, output paramater)
@@ -136,7 +138,7 @@
"""
cmd = cmdDef[0]
dlg = NewVectorDialog(parent, wx.ID_ANY, title,
- disableAdd)
+ disableAdd, disableTable)
if dlg.ShowModal() == wx.ID_OK:
outmap = dlg.GetName()
if outmap == exceptMap:
@@ -181,7 +183,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