[GRASS-SVN] r34547 - in grass/branches/develbranch_6: display/d.vect gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 27 15:53:39 EST 2008


Author: martinl
Date: 2008-11-27 15:53:39 -0500 (Thu, 27 Nov 2008)
New Revision: 34547

Modified:
   grass/branches/develbranch_6/display/d.vect/main.c
   grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
Log:
wxGUI: fix layer > 1
       vdigit: fix category dialog (change category)
       dbm: delete multiple records fixed


Modified: grass/branches/develbranch_6/display/d.vect/main.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect/main.c	2008-11-27 20:52:35 UTC (rev 34546)
+++ grass/branches/develbranch_6/display/d.vect/main.c	2008-11-27 20:53:39 UTC (rev 34547)
@@ -144,8 +144,9 @@
     type_opt->guisection = _("Query");
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
-    field_opt->description =
-	_("Layer number. If -1, all layers are displayed.");
+    field_opt->label =
+	_("Layer number (if -1, all layers are displayed)");
+    field_opt->gisprompt = "old_layer,layer,layer_all";
     field_opt->guisection = _("Query");
 
     cat_opt = G_define_standard_option(G_OPT_V_CATS);

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2008-11-27 20:52:35 UTC (rev 34546)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2008-11-27 20:53:39 UTC (rev 34547)
@@ -1646,9 +1646,9 @@
                         os.environ.has_key('GRASS_DB_ENCODING'):
                     enc = os.environ['GRASS_DB_ENCODING']
                 if enc:
-                    sqlFile.file.write(sql.encode(enc))
+                    sqlFile.file.write(sql.encode(enc) + ';')
                 else:
-                    sqlFile.file.write(sql)
+                    sqlFile.file.write(sql + ';')
                 sqlFile.file.write(os.linesep)
                 sqlFile.file.flush()
 

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2008-11-27 20:52:35 UTC (rev 34546)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2008-11-27 20:53:39 UTC (rev 34547)
@@ -50,9 +50,8 @@
 import string
 import textwrap
 import os
-from os import system
 import time
-start = time.time()
+import copy
 
 ### i18N
 import gettext
@@ -1317,7 +1316,7 @@
             if p.get('gisprompt', False) == False:
                 continue
             
-            prompt = p.get('prompt', '')
+            prompt = p.get('element', '')
             
             if prompt == 'vector':
                 name = p.get('name', '')
@@ -1335,7 +1334,7 @@
                 pTable = p
         
         if pMap:
-            pMap['wxId-bind'] = pColumn
+            pMap['wxId-bind'] = copy.copy(pColumn)
             if pLayer:
                 pMap['wxId-bind'].append(pLayer['wxId'])
         
@@ -1350,7 +1349,7 @@
 
         if pTable and pColumn:
             pTable['wxId-bind'] = pColumn
-        
+                
 	#
 	# determine panel size
 	#
@@ -1497,8 +1496,21 @@
     def OnUpdateSelection(self, event):
         """Update list of available layers, tables, columns for
         vector map layer"""
-        id = event.GetId()
-
+        if not event:
+            id = None
+            for p in self.task.params:
+                if p.get('gisprompt', False) == False:
+                    continue
+                prompt = p.get('element', '')
+                if prompt == 'vector':
+                    name = p.get('name', '')
+                    if name in ('map', 'input'):
+                        id = p['wxId']
+            if id is None:
+                return
+        else:
+            id = event.GetId()
+        
         p = self.task.get_param(id, element='wxId', raiseError=False)
         if not p or \
                 not p.has_key('wxId-bind'):
@@ -1511,12 +1523,9 @@
         pMap = self.task.get_param('map', raiseError=False)
         if not pMap:
             pMap = self.task.get_param('input', raiseError=False)
-
-        if p == pMap:
-            map = event.GetString()
-        elif pMap:
-            map = pMap.get('value', '')
         
+        map = pMap.get('value', '')
+        
         for uid in p['wxId-bind']:
             win = self.FindWindowById(uid)
             name = win.GetName()
@@ -1534,9 +1543,8 @@
                 win.InsertTables(driver, db)
             
             elif name == 'ColumnSelect':
-                pLayer = self.task.get_param('layer', element='prompt', raiseError=False)
-                if pLayer and \
-                        pLayer.get('prompt', '') == 'layer':
+                pLayer = self.task.get_param('layer', element='element', raiseError=False)
+                if pLayer:
                     if pLayer.get('value', '') != '':
                         layer = int(pLayer.get('value', 1))
                     else:
@@ -1546,7 +1554,8 @@
                 
                 win.InsertColumns(map, layer)
         
-        event.Skip()
+        if event:
+            event.Skip()
         
     def createCmd( self, ignoreErrors = False ):
         """
@@ -1614,7 +1623,7 @@
         self.mf.CentreOnScreen()
         self.mf.Show(True)
         self.SetTopWindow(self.mf)
-        # print >> sys.stderr, time.time() - start
+        
         return True
 
 class GUI:
@@ -1700,6 +1709,8 @@
             # update only propwin reference
             get_dcmd(dcmd=None, layer=layer, params=None,
                      propwin=self.mf)
+
+        self.mf.notebookpanel.OnUpdateSelection(None)
         
         if show:
             if self.parent:
@@ -1709,7 +1720,6 @@
         else:
             self.mf.OnApply(None)
         
-        # print >> sys.stderr, time.time() - start
         return cmd
 
     def GetCommandInputMapParamKey(self, cmd):

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2008-11-27 20:52:35 UTC (rev 34546)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2008-11-27 20:53:39 UTC (rev 34547)
@@ -1877,12 +1877,12 @@
         else:
             layerNew = layerOld
             catNew = int(event.GetLabel())
-
+        
         try:
             if layerNew not in self.cats[self.fid].keys():
-                self.cats[layerNew] = []
-            self.cats[layerNew].append(catNew)
-            self.cats[layerOld].remove(catOld)
+                self.cats[self.fid][layerNew] = []
+            self.cats[self.fid][layerNew].append(catNew)
+            self.cats[self.fid][layerOld].remove(catOld)
         except:
             event.Veto()
             self.list.SetStringItem(itemIndex, 0, str(layerNew))



More information about the grass-commit mailing list