Browse Source

r.proj/v.proj: wxGUI interactivity improved (select input map from location)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@44184 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 years ago
parent
commit
d78f8e6d14
4 changed files with 239 additions and 56 deletions
  1. 82 6
      gui/wxpython/gui_modules/gselect.py
  2. 105 34
      gui/wxpython/gui_modules/menuform.py
  3. 28 11
      raster/r.proj/main.c
  4. 24 5
      vector/v.proj/main.c

+ 82 - 6
gui/wxpython/gui_modules/gselect.py

@@ -13,11 +13,13 @@ Classes:
  - DriverSelect
  - DriverSelect
  - DatabaseSelect
  - DatabaseSelect
  - ColumnSelect
  - ColumnSelect
+ - DbaseSelect
  - LocationSelect
  - LocationSelect
  - MapsetSelect
  - MapsetSelect
  - SubGroupSelect
  - SubGroupSelect
  - FormatSelect
  - FormatSelect
  - GdalSelect
  - GdalSelect
+ - ProjSelect
  
  
 (C) 2007-2010 by the GRASS Development Team This program is free
 (C) 2007-2010 by the GRASS Development Team This program is free
 software under the GNU General Public License (>=v2). Read the file
 software under the GNU General Public License (>=v2). Read the file
@@ -93,7 +95,7 @@ class VectorSelect(Select):
         """!Custom to create a ComboBox with a tree control to display and
         """!Custom to create a ComboBox with a tree control to display and
         select vector maps. Control allows to filter vector maps. If you
         select vector maps. Control allows to filter vector maps. If you
         don't need this feature use Select class instead
         don't need this feature use Select class instead
-
+        
         @ftype filter vector maps based on feature type
         @ftype filter vector maps based on feature type
         """
         """
         Select.__init__(self, parent = parent, id = wx.ID_ANY,
         Select.__init__(self, parent = parent, id = wx.ID_ANY,
@@ -763,6 +765,16 @@ class ColumnSelect(wx.ComboBox):
         
         
         if self.param:
         if self.param:
             self.param['value'] = ''
             self.param['value'] = ''
+
+class DbaseSelect(wx.lib.filebrowsebutton.DirBrowseButton):
+    """!Widget for selecting GRASS Database"""
+    def __init__(self, parent, **kwargs):
+        super(DbaseSelect, self).__init__(parent, id = wx.ID_ANY,
+                                          size = globalvar.DIALOG_GSELECT_SIZE, labelText = '',
+                                          dialogTitle = _('Choose GIS Data Directory'),
+                                          buttonText = _('Browse'),
+                                          startDirectory = grass.gisenv()['GISDBASE'],
+                                          **kwargs)
         
         
 class LocationSelect(wx.ComboBox):
 class LocationSelect(wx.ComboBox):
     """!Widget for selecting GRASS location"""
     """!Widget for selecting GRASS location"""
@@ -770,16 +782,26 @@ class LocationSelect(wx.ComboBox):
                  gisdbase = None, **kwargs):
                  gisdbase = None, **kwargs):
         super(LocationSelect, self).__init__(parent, id, size = size, 
         super(LocationSelect, self).__init__(parent, id, size = size, 
                                              style = wx.CB_READONLY, **kwargs)
                                              style = wx.CB_READONLY, **kwargs)
-
         self.SetName("LocationSelect")
         self.SetName("LocationSelect")
         
         
         if not gisdbase:
         if not gisdbase:
             self.gisdbase = grass.gisenv()['GISDBASE']
             self.gisdbase = grass.gisenv()['GISDBASE']
         else:
         else:
             self.gisdbase = gisdbase
             self.gisdbase = gisdbase
-
+        
         self.SetItems(utils.GetListOfLocations(self.gisdbase))
         self.SetItems(utils.GetListOfLocations(self.gisdbase))
 
 
+    def UpdateItems(self, dbase):
+        """!Update list of locations
+
+        @param dbase path to GIS database
+        """
+        self.gisdbase = dbase
+        if dbase:
+            self.SetItems(utils.GetListOfLocations(self.gisdbase))
+        else:
+            self.SetItems([])
+        
 class MapsetSelect(wx.ComboBox):
 class MapsetSelect(wx.ComboBox):
     """!Widget for selecting GRASS mapset"""
     """!Widget for selecting GRASS mapset"""
     def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_COMBOBOX_SIZE, 
     def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_COMBOBOX_SIZE, 
@@ -788,7 +810,6 @@ class MapsetSelect(wx.ComboBox):
                                            style = wx.CB_READONLY, **kwargs)
                                            style = wx.CB_READONLY, **kwargs)
         
         
         self.SetName("MapsetSelect")
         self.SetName("MapsetSelect")
-        
         if not gisdbase:
         if not gisdbase:
             self.gisdbase = grass.gisenv()['GISDBASE']
             self.gisdbase = grass.gisenv()['GISDBASE']
         else:
         else:
@@ -802,6 +823,20 @@ class MapsetSelect(wx.ComboBox):
         if setItems:
         if setItems:
             self.SetItems(utils.GetListOfMapsets(self.gisdbase, self.location, selectable = True)) # selectable
             self.SetItems(utils.GetListOfMapsets(self.gisdbase, self.location, selectable = True)) # selectable
 
 
+    def UpdateItems(self, location, dbase = None):
+        """!Update list of mapsets for given location
+
+        @param dbase path to GIS database (None to use currently selected)
+        @param location name of location
+        """
+        if dbase:
+            self.gisdbase = dbase
+        self.location = location
+        if location:
+            self.SetItems(utils.GetListOfMapsets(self.gisdbase, self.location, selectable = True))
+        else:
+            self.SetItems([])
+        
 class SubGroupSelect(wx.ComboBox):
 class SubGroupSelect(wx.ComboBox):
     """!Widget for selecting subgroups"""
     """!Widget for selecting subgroups"""
     def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE, 
     def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE, 
@@ -978,7 +1013,7 @@ class GdalSelect(wx.Panel):
             filemask = 'ESRI Shapefile (*.shp)|*.shp'
             filemask = 'ESRI Shapefile (*.shp)|*.shp'
         
         
         dsnFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY, 
         dsnFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY, 
-                                              size=globalvar.DIALOG_GSELECT_SIZE, labelText='',
+                                              size=globalvar.DIALOG_GSELECT_SIZE, labelText = '',
                                               dialogTitle=_('Choose input file'),
                                               dialogTitle=_('Choose input file'),
                                               buttonText=_('Browse'),
                                               buttonText=_('Browse'),
                                               startDirectory=os.getcwd(),
                                               startDirectory=os.getcwd(),
@@ -997,7 +1032,7 @@ class GdalSelect(wx.Panel):
         
         
         dsnDbFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY, 
         dsnDbFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY, 
                                                 size=globalvar.DIALOG_GSELECT_SIZE, labelText='',
                                                 size=globalvar.DIALOG_GSELECT_SIZE, labelText='',
-                                                  dialogTitle=_('Choose file'),
+                                                dialogTitle=_('Choose file'),
                                                 buttonText=_('Browse'),
                                                 buttonText=_('Browse'),
                                                 startDirectory=os.getcwd(),
                                                 startDirectory=os.getcwd(),
                                                 changeCallback=self.OnSetDsn)
                                                 changeCallback=self.OnSetDsn)
@@ -1302,3 +1337,44 @@ class GdalSelect(wx.Panel):
         """!Get format extension"""
         """!Get format extension"""
         return self.format.GetExtension(self.format.GetStringSelection())
         return self.format.GetExtension(self.format.GetStringSelection())
     
     
+class ProjSelect(wx.ComboBox):
+    """!Widget for selecting input raster/vector map used by
+    r.proj/v.proj modules."""
+    def __init__(self, parent, isRaster, id = wx.ID_ANY, size = globalvar.DIALOG_COMBOBOX_SIZE,
+                 **kwargs):
+        super(ProjSelect, self).__init__(parent, id, size = size, 
+                                         style = wx.CB_READONLY, **kwargs)
+        self.SetName("ProjSelect")
+        self.isRaster = isRaster
+        
+    def UpdateItems(self, dbase, location, mapset):
+        """!Update list of maps
+        
+        """
+        if not dbase:
+            dbase = grass.gisenv()['GISDBASE']
+        if not mapset:
+            mapset = grass.gisenv()['MAPSET']
+        if self.isRaster:
+            ret = gcmd.RunCommand('r.proj',
+                                  quiet = True,
+                                  read = True,
+                                  flags = 'l',
+                                  dbase = dbase,
+                                  location = location,
+                                  mapset = mapset)
+        else:
+            ret = gcmd.RunCommand('v.proj',
+                                  quiet = True,
+                                  read = True,
+                                  flags = 'l',
+                                  dbase = dbase,
+                                  location = location,
+                                  mapset = mapset)
+        listMaps = list()
+        if ret:
+            for line in ret.splitlines():
+                listMaps.append(line.strip())
+        
+        self.SetItems(listMaps)
+        self.SetValue('')

+ 105 - 34
gui/wxpython/gui_modules/menuform.py

@@ -313,6 +313,27 @@ class UpdateThread(Thread):
                 if pGroup:
                 if pGroup:
                     self.data[win.Insert] = { 'group' : pGroup.get('value', '')}
                     self.data[win.Insert] = { 'group' : pGroup.get('value', '')}
             
             
+            elif name == 'LocationSelect':
+                pDbase = self.task.get_param('dbase', element='element', raiseError=False)
+                if pDbase:
+                    self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', '')}
+
+            elif name == 'MapsetSelect':
+                pDbase = self.task.get_param('dbase', element='element', raiseError=False)
+                pLocation = self.task.get_param('location', element='element', raiseError=False)
+                if pDbase and pLocation:
+                    self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', ''),
+                                                   'location' : pLocation.get('value', '')}
+
+            elif name == 'ProjSelect':
+                pDbase = self.task.get_param('dbase', element='element', raiseError=False)
+                pLocation = self.task.get_param('location', element='element', raiseError=False)
+                pMapset = self.task.get_param('mapset', element='element', raiseError=False)
+                if pDbase and pLocation and pMapset:
+                    self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', ''),
+                                                   'location' : pLocation.get('value', ''),
+                                                   'mapset' : pMapset.get('value', '')}
+            
 def UpdateDialog(parent, event, eventId, task):
 def UpdateDialog(parent, event, eventId, task):
     return UpdateThread(parent, event, eventId, task)
     return UpdateThread(parent, event, eventId, task)
 
 
@@ -1378,7 +1399,10 @@ class cmdPanel(wx.Panel):
                                               'dbtable',
                                               'dbtable',
                                               'dbcolumn',
                                               'dbcolumn',
                                               'layer',
                                               'layer',
-                                              'layer_all') and \
+                                              'layer_all',
+                                              'location',
+                                              'mapset',
+                                              'dbase') and \
                        p.get('element', '') != 'file':
                        p.get('element', '') != 'file':
                     if p.get('multiple', 'no') == 'yes':
                     if p.get('multiple', 'no') == 'yes':
                         multiple = True
                         multiple = True
@@ -1388,21 +1412,36 @@ class cmdPanel(wx.Panel):
                         mapsets = [grass.gisenv()['MAPSET'],]
                         mapsets = [grass.gisenv()['MAPSET'],]
                     else:
                     else:
                         mapsets = None
                         mapsets = None
-                    selection = gselect.Select(parent=which_panel, id=wx.ID_ANY,
-                                               size=globalvar.DIALOG_GSELECT_SIZE,
-                                               type=p.get('element', ''),
-                                               multiple=multiple, mapsets=mapsets)
+                    if self.task.name in ('r.proj', 'v.proj') \
+                            and p.get('name', '') == 'input':
+                        if self.task.name == 'r.proj':
+                            isRaster = True
+                        else:
+                            isRaster = False
+                        selection = gselect.ProjSelect(parent=which_panel,
+                                                       isRaster = isRaster)
+                        p['wxId'] = [ selection.GetId(), ]
+                        selection.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
+                        formatSelector = False
+                        selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
+                    else:
+                        selection = gselect.Select(parent=which_panel, id=wx.ID_ANY,
+                                                   size=globalvar.DIALOG_GSELECT_SIZE,
+                                                   type=p.get('element', ''),
+                                                   multiple=multiple, mapsets=mapsets)
+                        formatSelector = True
+                        # A select.Select is a combobox with two children: a textctl and a popupwindow;
+                        # we target the textctl here
+                        p['wxId'] = [selection.GetChildren()[0].GetId(), ]
+                        selection.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetValue)
+                    
                     if p.get('value','') != '':
                     if p.get('value','') != '':
                         selection.SetValue(p['value']) # parameter previously set
                         selection.SetValue(p['value']) # parameter previously set
                     
                     
-                    # A select.Select is a combobox with two children: a textctl and a popupwindow;
-                    # we target the textctl here
-                    p['wxId'] = [selection.GetChildren()[0].GetId(), ]
-                    selection.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetValue)
                     if p.get('prompt', '') == 'vector':
                     if p.get('prompt', '') == 'vector':
                         selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                         selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                         
                         
-                        if p.get('age', '') == 'old':
+                        if formatSelector and p.get('age', '') == 'old':
                             # OGR supported (read-only)
                             # OGR supported (read-only)
                             self.hsizer = wx.BoxSizer(wx.HORIZONTAL)
                             self.hsizer = wx.BoxSizer(wx.HORIZONTAL)
                             
                             
@@ -1468,12 +1507,19 @@ class cmdPanel(wx.Panel):
                                              'dbtable',
                                              'dbtable',
                                              'dbcolumn',
                                              'dbcolumn',
                                              'layer',
                                              'layer',
-                                             'layer_all'):
+                                             'layer_all',
+                                             'location',
+                                             'mapset',
+                                             'dbase'):
                     if p.get('multiple', 'no') == 'yes':
                     if p.get('multiple', 'no') == 'yes':
                         win = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
                         win = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
                                           size=globalvar.DIALOG_TEXTCTRL_SIZE)
                                           size=globalvar.DIALOG_TEXTCTRL_SIZE)
                         win.Bind(wx.EVT_TEXT, self.OnSetValue)
                         win.Bind(wx.EVT_TEXT, self.OnSetValue)
                     else:
                     else:
+                        value = p.get('value', '')
+                        if not value:
+                            value = p.get('default', '')
+                        
                         if p.get('prompt', '') in ('layer',
                         if p.get('prompt', '') in ('layer',
                                                    'layer_all'):
                                                    'layer_all'):
                             if p.get('prompt', '') == 'layer_all':
                             if p.get('prompt', '') == 'layer_all':
@@ -1504,18 +1550,12 @@ class cmdPanel(wx.Panel):
                                     border = 5)
                                     border = 5)
 
 
                         elif p.get('prompt', '') == 'dbdriver':
                         elif p.get('prompt', '') == 'dbdriver':
-                            value = p.get('value', '')
-                            if not value:
-                                value = p.get('default', '')
                             win = gselect.DriverSelect(parent = which_panel,
                             win = gselect.DriverSelect(parent = which_panel,
                                                        choices = p.get('values', []),
                                                        choices = p.get('values', []),
                                                        value = value)
                                                        value = value)
                             win.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
                             win.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
                             win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                             win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                         elif p.get('prompt', '') == 'dbname':
                         elif p.get('prompt', '') == 'dbname':
-                            value = p.get('value', '')
-                            if not value:
-                                value = p.get('default', '')
                             win = gselect.DatabaseSelect(parent = which_panel,
                             win = gselect.DatabaseSelect(parent = which_panel,
                                                          value = value)
                                                          value = value)
                             win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                             win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
@@ -1530,19 +1570,35 @@ class cmdPanel(wx.Panel):
                                                   size=globalvar.DIALOG_TEXTCTRL_SIZE)
                                                   size=globalvar.DIALOG_TEXTCTRL_SIZE)
                                 win.Bind(wx.EVT_TEXT, self.OnSetValue)
                                 win.Bind(wx.EVT_TEXT, self.OnSetValue)
                         elif p.get('prompt', '') == 'dbcolumn':
                         elif p.get('prompt', '') == 'dbcolumn':
-                            value = p.get('value', '')
-                            if not value:
-                                value = p.get('default', '')
                             win = gselect.ColumnSelect(parent = which_panel,
                             win = gselect.ColumnSelect(parent = which_panel,
                                                        value = value,
                                                        value = value,
                                                        param = p)
                                                        param = p)
                             win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                             win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                             win.Bind(wx.EVT_TEXT,     self.OnSetValue)
                             win.Bind(wx.EVT_TEXT,     self.OnSetValue)
 
 
-                    try:
-                        p['wxId'] = [ win.GetId(), ]
-                    except AttributeError:
-                        pass
+                        elif p.get('prompt', '') == 'location':
+                            win = gselect.LocationSelect(parent = which_panel,
+                                                         value = value)
+                            win.Bind(wx.EVT_COMBOBOX,     self.OnUpdateSelection)
+                            win.Bind(wx.EVT_COMBOBOX,     self.OnSetValue)
+                        
+                        elif p.get('prompt', '') == 'mapset':
+                            win = gselect.MapsetSelect(parent = which_panel,
+                                                       value = value)
+                            win.Bind(wx.EVT_COMBOBOX,     self.OnUpdateSelection)
+                            win.Bind(wx.EVT_COMBOBOX,     self.OnSetValue)
+                            
+                        elif p.get('prompt', '') == 'dbase':
+                            win = gselect.DbaseSelect(parent = which_panel,
+                                                      changeCallback=self.OnSetValue)
+                            win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
+                            p['wxId'] = [ win.GetChildren()[1].GetId() ]
+                            
+                    if not p.has_key('wxId'):
+                        try:
+                            p['wxId'] = [ win.GetId(), ]
+                        except AttributeError:
+                            pass
                     
                     
                     which_sizer.Add(item=win, proportion=0,
                     which_sizer.Add(item=win, proportion=0,
                                     flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT, border=5)
                                     flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT, border=5)
@@ -1661,6 +1717,9 @@ class cmdPanel(wx.Panel):
         pColumn = []
         pColumn = []
         pGroup = None
         pGroup = None
         pSubGroup = None
         pSubGroup = None
+        pDbase = None
+        pLocation = None
+        pMapset = None
         for p in self.task.params:
         for p in self.task.params:
             if p.get('gisprompt', False) == False:
             if p.get('gisprompt', False) == False:
                 continue
                 continue
@@ -1679,7 +1738,7 @@ class cmdPanel(wx.Panel):
                 continue
                 continue
             
             
             prompt = p.get('element', '')
             prompt = p.get('element', '')
-            if prompt == 'vector':
+            if prompt in ('cell', 'vector'):
                 name = p.get('name', '')
                 name = p.get('name', '')
                 if name in ('map', 'input'):
                 if name in ('map', 'input'):
                     pMap = p
                     pMap = p
@@ -1697,6 +1756,12 @@ class cmdPanel(wx.Panel):
                 pGroup = p
                 pGroup = p
             elif prompt == 'subgroup':
             elif prompt == 'subgroup':
                 pSubGroup = p
                 pSubGroup = p
+            elif prompt == 'dbase':
+                pDbase = p
+            elif prompt == 'location':
+                pLocation = p
+            elif prompt == 'mapset':
+                pMapset = p
         
         
         # collect ids
         # collect ids
         pColumnIds = []
         pColumnIds = []
@@ -1726,14 +1791,22 @@ class cmdPanel(wx.Panel):
         
         
         if pGroup and pSubGroup:
         if pGroup and pSubGroup:
             pGroup['wxId-bind'] = pSubGroup['wxId']
             pGroup['wxId-bind'] = pSubGroup['wxId']
+
+        if pDbase and pLocation:
+            pDbase['wxId-bind'] = pLocation['wxId']
+
+        if pLocation and pMapset:
+            pLocation['wxId-bind'] = pMapset['wxId']
+        
+        if pLocation and pMapset and pMap:
+            pLocation['wxId-bind'] = pMap['wxId']
+            pMapset['wxId-bind'] = pMap['wxId']
         
         
 	#
 	#
 	# determine panel size
 	# determine panel size
 	#
 	#
         maxsizes = (0,0)
         maxsizes = (0,0)
         for section in sections:
         for section in sections:
-            # tabsizer[section].SetSizeHints( tab[section] )
-            #tab[section].SetAutoLayout(True)
             tab[section].SetSizer( tabsizer[section] )
             tab[section].SetSizer( tabsizer[section] )
             tabsizer[section].Fit( tab[section] )
             tabsizer[section].Fit( tab[section] )
             tab[section].Layout()
             tab[section].Layout()
@@ -1745,16 +1818,13 @@ class cmdPanel(wx.Panel):
         self.constrained_size = (min(600, maxsizes[0]) + 25, min(400, maxsizes[1]) + 25)
         self.constrained_size = (min(600, maxsizes[0]) + 25, min(400, maxsizes[1]) + 25)
         for section in sections:
         for section in sections:
             tab[section].SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
             tab[section].SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
-            # tab[section].SetMinSize( constrained_size )
-
+        
         if self.manual_tab.IsLoaded():
         if self.manual_tab.IsLoaded():
             self.manual_tab.SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
             self.manual_tab.SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
         
         
         self.SetSizer( panelsizer )
         self.SetSizer( panelsizer )
         panelsizer.Fit(self.notebook)
         panelsizer.Fit(self.notebook)
-
-        self.hasMain = tab.has_key( _('Required') ) # publish, to enclosing Frame for instance
-
+        
         self.Bind(EVT_DIALOG_UPDATE, self.OnUpdateDialog)
         self.Bind(EVT_DIALOG_UPDATE, self.OnUpdateDialog)
         
         
     def OnFileText(self, event):
     def OnFileText(self, event):
@@ -1957,7 +2027,8 @@ class cmdPanel(wx.Panel):
                     break
                     break
             
             
             if found:
             if found:
-                if name in ('LayerSelect', 'DriverSelect', 'TableSelect'):
+                if name in ('LayerSelect', 'DriverSelect', 'TableSelect',
+                            'LocationSelect', 'MapsetSelect'):
                     porf['value'] = me.GetStringSelection()
                     porf['value'] = me.GetStringSelection()
                 elif name == 'GdalSelect':
                 elif name == 'GdalSelect':
                     porf['value'] = event.dsn
                     porf['value'] = event.dsn
@@ -1965,7 +2036,7 @@ class cmdPanel(wx.Panel):
                     porf['parameterized'] = me.IsChecked()
                     porf['parameterized'] = me.IsChecked()
                 else:
                 else:
                     porf['value'] = me.GetValue()
                     porf['value'] = me.GetValue()
-                
+        
         self.OnUpdateValues(event)
         self.OnUpdateValues(event)
         
         
         event.Skip()
         event.Skip()

+ 28 - 11
raster/r.proj/main.c

@@ -144,34 +144,45 @@ int main(int argc, char **argv)
     module = G_define_module();
     module = G_define_module();
     G_add_keyword(_("raster"));
     G_add_keyword(_("raster"));
     G_add_keyword(_("projection"));
     G_add_keyword(_("projection"));
+    G_add_keyword(_("transformation"));
     module->description =
     module->description =
 	_("Re-projects a raster map from one location to the current location.");
 	_("Re-projects a raster map from one location to the current location.");
 
 
     inmap = G_define_standard_option(G_OPT_R_INPUT);
     inmap = G_define_standard_option(G_OPT_R_INPUT);
     inmap->description = _("Name of input raster map to re-project");
     inmap->description = _("Name of input raster map to re-project");
     inmap->required = NO;
     inmap->required = NO;
+    inmap->guisection = _("Input");
 
 
     inlocation = G_define_option();
     inlocation = G_define_option();
     inlocation->key = "location";
     inlocation->key = "location";
     inlocation->type = TYPE_STRING;
     inlocation->type = TYPE_STRING;
     inlocation->required = YES;
     inlocation->required = YES;
-    inlocation->description = _("Location of input raster map");
+    inlocation->description = _("Location containing input raster map");
+    inlocation->gisprompt = "old,location,location";
+    inlocation->key_desc = "name";
 
 
     imapset = G_define_option();
     imapset = G_define_option();
     imapset->key = "mapset";
     imapset->key = "mapset";
     imapset->type = TYPE_STRING;
     imapset->type = TYPE_STRING;
     imapset->required = NO;
     imapset->required = NO;
-    imapset->description = _("Mapset of input raster map");
+    imapset->description = _("Mapset containing input raster map");
+    imapset->gisprompt = "old,mapset,mapset";
+    imapset->key_desc = "name";
+    imapset->guisection = _("Input");
 
 
     indbase = G_define_option();
     indbase = G_define_option();
     indbase->key = "dbase";
     indbase->key = "dbase";
     indbase->type = TYPE_STRING;
     indbase->type = TYPE_STRING;
     indbase->required = NO;
     indbase->required = NO;
     indbase->description = _("Path to GRASS database of input location");
     indbase->description = _("Path to GRASS database of input location");
+    indbase->gisprompt = "old,dbase,dbase";
+    indbase->key_desc = "path";
+    indbase->guisection = _("Input");
 
 
     outmap = G_define_standard_option(G_OPT_R_OUTPUT);
     outmap = G_define_standard_option(G_OPT_R_OUTPUT);
     outmap->required = NO;
     outmap->required = NO;
     outmap->description = _("Name for output raster map (default: input)");
     outmap->description = _("Name for output raster map (default: input)");
+    outmap->guisection = _("Output");
 
 
     ipolname = make_ipol_list();
     ipolname = make_ipol_list();
 
 
@@ -276,11 +287,17 @@ int main(int argc, char **argv)
 
 
     /* if requested, list the raster maps in source location - MN 5/2001 */
     /* if requested, list the raster maps in source location - MN 5/2001 */
     if (list->answer) {
     if (list->answer) {
-	if (isatty(0))		/* check if on command line */
-	    G_message(_("Checking location <%s>, mapset <%s>..."),
-		      inlocation->answer, setname);
-	G_list_element("cell", "raster", setname, 0);
-	exit(EXIT_SUCCESS);	/* leave r.proj after listing */
+	int i;
+	char **list;
+	G_verbose_message(_("Checking location <%s> mapset <%s>"),
+			  inlocation->answer, imapset->answer);
+	list = G_list(G_ELEMENT_RASTER, G__getenv("GISDBASE"),
+		      G__getenv("LOCATION_NAME"), imapset->answer);
+	for (i = 0; list[i]; i++) {
+	    fprintf(stdout, "%s\n", list[i]);
+	}
+	fflush(stdout);
+	exit(EXIT_SUCCESS);	/* leave v.proj after listing */
     }
     }
 
 
     if (!inmap->answer)
     if (!inmap->answer)
@@ -422,7 +439,7 @@ int main(int argc, char **argv)
     G_adjust_Cell_head(&outcellhd, 0, 0);
     G_adjust_Cell_head(&outcellhd, 0, 0);
     Rast_set_output_window(&outcellhd);
     Rast_set_output_window(&outcellhd);
 
 
-    G_message("");
+    G_message(" ");
     G_message(_("Input:"));
     G_message(_("Input:"));
     G_message(_("Cols: %d (%d)"), incellhd.cols, icols);
     G_message(_("Cols: %d (%d)"), incellhd.cols, icols);
     G_message(_("Rows: %d (%d)"), incellhd.rows, irows);
     G_message(_("Rows: %d (%d)"), incellhd.rows, irows);
@@ -432,7 +449,7 @@ int main(int argc, char **argv)
     G_message(_("East: %f (%f)"), incellhd.east, ieast);
     G_message(_("East: %f (%f)"), incellhd.east, ieast);
     G_message(_("EW-res: %f"), incellhd.ew_res);
     G_message(_("EW-res: %f"), incellhd.ew_res);
     G_message(_("NS-res: %f"), incellhd.ns_res);
     G_message(_("NS-res: %f"), incellhd.ns_res);
-    G_message("");
+    G_message(" ");
 
 
     G_message(_("Output:"));
     G_message(_("Output:"));
     G_message(_("Cols: %d (%d)"), outcellhd.cols, ocols);
     G_message(_("Cols: %d (%d)"), outcellhd.cols, ocols);
@@ -443,7 +460,7 @@ int main(int argc, char **argv)
     G_message(_("East: %f (%f)"), outcellhd.east, oeast);
     G_message(_("East: %f (%f)"), outcellhd.east, oeast);
     G_message(_("EW-res: %f"), outcellhd.ew_res);
     G_message(_("EW-res: %f"), outcellhd.ew_res);
     G_message(_("NS-res: %f"), outcellhd.ns_res);
     G_message(_("NS-res: %f"), outcellhd.ns_res);
-    G_message("");
+    G_message(" ");
 
 
     /* open and read the relevant parts of the input map and close it */
     /* open and read the relevant parts of the input map and close it */
     G__switch_env();
     G__switch_env();
@@ -516,7 +533,7 @@ int main(int argc, char **argv)
     Rast_command_history(&history);
     Rast_command_history(&history);
     Rast_write_history(mapname, &history);
     Rast_write_history(mapname, &history);
 
 
-    G_done_msg("");
+    G_done_msg(" ");
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);
 }
 }
 
 

+ 24 - 5
vector/v.proj/main.c

@@ -62,34 +62,45 @@ int main(int argc, char *argv[])
     module = G_define_module();
     module = G_define_module();
     G_add_keyword(_("vector"));
     G_add_keyword(_("vector"));
     G_add_keyword(_("projection"));
     G_add_keyword(_("projection"));
-    module->description = _("Allows projection conversion of vector maps.");
+    G_add_keyword(_("transformation"));
+    module->description = _("Re-projects a vector map from one location to the current location.");
 
 
     /* set up the options and flags for the command line parser */
     /* set up the options and flags for the command line parser */
 
 
     mapopt = G_define_standard_option(G_OPT_V_INPUT);
     mapopt = G_define_standard_option(G_OPT_V_INPUT);
-    mapopt->gisprompt = NULL;
     mapopt->required = NO;
     mapopt->required = NO;
-
+    mapopt->guisection = _("Input");
+    
     ilocopt = G_define_option();
     ilocopt = G_define_option();
     ilocopt->key = "location";
     ilocopt->key = "location";
     ilocopt->type = TYPE_STRING;
     ilocopt->type = TYPE_STRING;
     ilocopt->required = YES;
     ilocopt->required = YES;
     ilocopt->description = _("Location containing input vector map");
     ilocopt->description = _("Location containing input vector map");
-
+    ilocopt->gisprompt = "old,location,location";
+    ilocopt->key_desc = "name";
+    
     isetopt = G_define_option();
     isetopt = G_define_option();
     isetopt->key = "mapset";
     isetopt->key = "mapset";
     isetopt->type = TYPE_STRING;
     isetopt->type = TYPE_STRING;
     isetopt->required = NO;
     isetopt->required = NO;
     isetopt->description = _("Mapset containing input vector map");
     isetopt->description = _("Mapset containing input vector map");
+    isetopt->gisprompt = "old,mapset,mapset";
+    isetopt->key_desc = "name";
+    isetopt->guisection = _("Input");
 
 
     ibaseopt = G_define_option();
     ibaseopt = G_define_option();
     ibaseopt->key = "dbase";
     ibaseopt->key = "dbase";
     ibaseopt->type = TYPE_STRING;
     ibaseopt->type = TYPE_STRING;
     ibaseopt->required = NO;
     ibaseopt->required = NO;
     ibaseopt->description = _("Path to GRASS database of input location");
     ibaseopt->description = _("Path to GRASS database of input location");
+    ibaseopt->gisprompt = "old,dbase,dbase";
+    ibaseopt->key_desc = "path";
+    ibaseopt->guisection = _("Input");
 
 
     omapopt = G_define_standard_option(G_OPT_V_OUTPUT);
     omapopt = G_define_standard_option(G_OPT_V_OUTPUT);
     omapopt->required = NO;
     omapopt->required = NO;
+    omapopt->description = _("Name for output vector map (default: input)");
+    omapopt->guisection = _("Output");
 
 
     flag.list = G_define_flag();
     flag.list = G_define_flag();
     flag.list->key = 'l';
     flag.list->key = 'l';
@@ -101,6 +112,7 @@ int main(int argc, char *argv[])
     flag.transformz->label =
     flag.transformz->label =
 	_("Assume z co-ordinate is ellipsoidal height and "
 	_("Assume z co-ordinate is ellipsoidal height and "
 	  "transform if possible");
 	  "transform if possible");
+    flag.transformz->guisection = _("Output");
 
 
     /* The parser checks if the map already exists in current mapset,
     /* The parser checks if the map already exists in current mapset,
        we switch out the check and do it
        we switch out the check and do it
@@ -154,9 +166,16 @@ int main(int argc, char *argv[])
     if (stat >= 0) {		/* yes, we can access the mapset */
     if (stat >= 0) {		/* yes, we can access the mapset */
 	/* if requested, list the vector maps in source location - MN 5/2001 */
 	/* if requested, list the vector maps in source location - MN 5/2001 */
 	if (flag.list->answer) {
 	if (flag.list->answer) {
+	    int i;
+	    char **list;
 	    G_verbose_message(_("Checking location <%s> mapset <%s>"),
 	    G_verbose_message(_("Checking location <%s> mapset <%s>"),
 			      iloc_name, iset_name);
 			      iloc_name, iset_name);
-	    G_list_element("vector", "vector", iset_name, 0);
+	    list = G_list(G_ELEMENT_VECTOR, G__getenv("GISDBASE"),
+			  G__getenv("LOCATION_NAME"), iset_name);
+	    for (i = 0; list[i]; i++) {
+		fprintf(stdout, "%s\n", list[i]);
+	    }
+	    fflush(stdout);
 	    exit(EXIT_SUCCESS);	/* leave v.proj after listing */
 	    exit(EXIT_SUCCESS);	/* leave v.proj after listing */
 	}
 	}