[GRASS-SVN] r35475 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jan 17 16:56:06 EST 2009
Author: martinl
Date: 2009-01-17 16:56:06 -0500 (Sat, 17 Jan 2009)
New Revision: 35475
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: avoid getting list of columns more then once
(merge from trunk, r35474)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2009-01-17 21:54:03 UTC (rev 35474)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2009-01-17 21:56:06 UTC (rev 35475)
@@ -1517,8 +1517,10 @@
event.Skip()
def OnUpdateSelection(self, event):
- """Update list of available layers, tables, columns for
- vector map layer"""
+ """
+ Update dialog (layers, tables, columns, etc.)
+ """
+ # get widget id
if not event:
id = None
for p in self.task.params:
@@ -1538,11 +1540,13 @@
if not p or \
not p.has_key('wxId-bind'):
return
-
+
+ # get widget prompt
pType = p.get('prompt', '')
if not pType:
return
+ # check for map/input parameter
pMap = self.task.get_param('map', raiseError=False)
if not pMap:
pMap = self.task.get_param('input', raiseError=False)
@@ -1552,6 +1556,10 @@
else:
map = None
+ # avoid multiple updating
+ columns = []
+
+ # update reference widgets
for uid in p['wxId-bind']:
win = self.FindWindowById(uid)
name = win.GetName()
@@ -1571,30 +1579,34 @@
win.InsertTables(driver, db)
elif name == 'ColumnSelect':
- pLayer = self.task.get_param('layer', element='element', raiseError=False)
- if pLayer:
- if pLayer.get('value', '') != '':
- layer = int(pLayer.get('value', 1))
+ if not columns:
+ print 'c'
+ pLayer = self.task.get_param('layer', element='element', raiseError=False)
+ if pLayer:
+ if pLayer.get('value', '') != '':
+ layer = int(pLayer.get('value', 1))
+ else:
+ layer = int(pLayer.get('default', 1))
else:
- layer = int(pLayer.get('default', 1))
+ layer = 1
+
+ if map:
+ win.InsertColumns(map, layer)
+ columns = win.GetItems()
+ else: # table
+ pDriver = self.task.get_param('dbdriver', element='prompt', raiseError=False)
+ if pDriver:
+ driver = pDriver.get('value', None)
+ pDb = self.task.get_param('dbname', element='prompt', raiseError=False)
+ if pDb:
+ db = pDb.get('value', None)
+ pTable = self.task.get_param('dbtable', element='element', raiseError=False)
+ if pTable and \
+ pTable.get('value', '') != '':
+ win.InsertTableColumns(pTable.get('value'), driver, db)
+ columns = win.GetItems()
else:
- layer = 1
- if map:
- win.InsertColumns(map, layer)
- else: # table
- pDriver = self.task.get_param('dbdriver', element='prompt', raiseError=False)
- if pDriver:
- driver = pDriver.get('value', None)
- pDb = self.task.get_param('dbname', element='prompt', raiseError=False)
- if pDb:
- db = pDb.get('value', None)
- pTable = self.task.get_param('dbtable', element='element', raiseError=False)
- if pTable and \
- pTable.get('value', '') != '':
- win.InsertTableColumns(pTable.get('value'), driver, db)
-
- if event:
- event.Skip()
+ win.SetItems(columns)
def createCmd( self, ignoreErrors = False ):
"""
More information about the grass-commit
mailing list