[GRASS-SVN] r41948 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 21 08:19:28 EDT 2010


Author: martinl
Date: 2010-04-21 08:19:27 -0400 (Wed, 21 Apr 2010)
New Revision: 41948

Modified:
   grass/trunk/gui/wxpython/gui_modules/gselect.py
   grass/trunk/gui/wxpython/gui_modules/layertree.py
   grass/trunk/gui/wxpython/gui_modules/menuform.py
   grass/trunk/gui/wxpython/gui_modules/utils.py
Log:
wxGUI: d.vect OGR fixes


Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py	2010-04-21 11:37:05 UTC (rev 41947)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py	2010-04-21 12:19:27 UTC (rev 41948)
@@ -578,7 +578,6 @@
         @param dsn    OGR data source name
         """
         layers = list()
-        self.SetValue('')
         if vector:
             # TODO
             pass
@@ -592,6 +591,7 @@
                 layers = ret.splitlines()
         
         self.SetItems(layers)
+        self.SetSelection(0)
         
 class DriverSelect(wx.ComboBox):
     """!Creates combo box for selecting database driver.

Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py	2010-04-21 11:37:05 UTC (rev 41947)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py	2010-04-21 12:19:27 UTC (rev 41948)
@@ -836,7 +836,7 @@
                 
         Debug.msg (3, "LayerTree.PropertiesDialog(): ltype=%s" % \
                    ltype)
-
+        
         if self.GetPyData(layer)[0]['cmd']:
             module = menuform.GUI()
             module.ParseCommand(self.GetPyData(layer)[0]['cmd'],

Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-04-21 11:37:05 UTC (rev 41947)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-04-21 12:19:27 UTC (rev 41948)
@@ -1402,6 +1402,8 @@
                                                label = " %s " % _("Format"),
                                                style = wx.RA_SPECIFY_ROWS,
                                                choices = [_("Native / Linked OGR"), _("Direct OGR")])
+                            if p.get('value', '').lower().rfind('@ogr') > -1:
+                                rbox.SetSelection(1)
                             rbox.SetName('VectorFormat')
                             rbox.Bind(wx.EVT_RADIOBOX, self.OnVectorFormat)
                             
@@ -1465,6 +1467,10 @@
                                                   min=1, max=100, initial=int(p['default']))
                                 win1.Bind(wx.EVT_SPINCTRL, self.OnSetValue)
                             win2 = gselect.LayerNameSelect(parent = which_panel)
+                            if p.get('value','') != '':
+                                win2.SetItems([p['value']])
+                                win2.SetSelection(0)
+                            
                             win2.Bind(wx.EVT_TEXT, self.OnSetValue)
                             p['wxId'] = [ win1.GetId(), win2.GetId() ]
                             win.Add(item = win1, proportion = 0)
@@ -1993,7 +1999,7 @@
             layer = completed[1]
             if completed[2]:
                 dcmd_params.update(completed[2])
-
+        
         self.parent = parentframe
 
         # parse the interface decription
@@ -2029,8 +2035,11 @@
 
                     if self.grass_task.get_param(key)['element'] in ['cell', 'vector']:
                         # mapname -> mapname at mapset
-                        if '@' not in value:
+                        try:
+                            name, mapset = value.split('@')
+                        except ValueError:
                             value = value + '@' + grass.gisenv()['MAPSET']
+                    
                     self.grass_task.set_param(key, value)
                     cmd_validated.append(key + '=' + value)
                     i = i + 1

Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py	2010-04-21 11:37:05 UTC (rev 41947)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py	2010-04-21 12:19:27 UTC (rev 41948)
@@ -82,7 +82,7 @@
     @return '' if no map name found in command
     """
     mapname = ''
-
+    
     if len(dcmd) < 1:
         return mapname
     
@@ -106,7 +106,7 @@
                 params = [(idx, p, v)]
                 break
             
-            if p in ('map', 'input',
+            if p in ('map', 'input', 'layer',
                      'red', 'blue', 'green',
                      'h_map', 's_map', 'i_map',
                      'reliefmap'):
@@ -136,10 +136,17 @@
             
             # update dcmd
             for i, p, v in params:
+                if p == 'layer':
+                    continue
                 dcmd[i] = p + '=' + v + '@' + mapset
     
         maps = list()
+        ogr = False
         for i, p, v in params:
+            if v.lower().rfind('@ogr') > -1:
+                ogr = True
+            if p == 'layer' and not ogr:
+                continue
             maps.append(dcmd[i].split('=')[1])
         mapname = '\n'.join(maps)
     



More information about the grass-commit mailing list