[GRASS-SVN] r53522 - in grass/trunk: gui/wxpython/gui_core temporal/t.info temporal/t.register temporal/t.remove temporal/t.support temporal/t.topology temporal/t.unregister

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 22 01:24:21 PDT 2012


Author: annakrat
Date: 2012-10-22 01:24:21 -0700 (Mon, 22 Oct 2012)
New Revision: 53522

Modified:
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/temporal/t.info/t.info.py
   grass/trunk/temporal/t.register/t.register.py
   grass/trunk/temporal/t.remove/t.remove.py
   grass/trunk/temporal/t.support/t.support.py
   grass/trunk/temporal/t.topology/t.topology.py
   grass/trunk/temporal/t.unregister/t.unregister.py
Log:
wxGUI: improve gui forms for t. modules - change element of selection widget dynamically + related changes in t. modules headers

Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2012-10-22 07:19:33 UTC (rev 53521)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2012-10-22 08:24:21 UTC (rev 53522)
@@ -149,11 +149,12 @@
         p = self.task.get_param(self.eventId, element = 'wxId', raiseError = False)
         if not p or 'wxId-bind' not in p:
             return
-        
+
+        # is this check necessary?
         # get widget prompt
-        pType = p.get('prompt', '')
-        if not pType:
-            return
+        # pType = p.get('prompt', '')
+        # if not pType:
+        #     return
         
         # check for map/input parameter
         pMap = self.task.get_param('map', raiseError = False)
@@ -182,6 +183,17 @@
             if pBind:
                 pBind['value'] = ''
             
+            # set appropriate types in t.* modules element selections
+            if name == 'Select':
+                type_param = self.task.get_param('type', element = 'name', raiseError = False)
+                maps_param = self.task.get_param('maps', element = 'name', raiseError = False)
+                self.data[win.GetParent().SetType] = {'etype': type_param.get('value')}
+                # t.(un)register has one type for 'input', 'maps'
+                if maps_param is not None:
+                    if maps_param['wxId'][0] != uid:
+                        element_dict = {'rast': 'strds', 'vect': 'stvds', 'rast3d': 'str3ds'}
+                        self.data[win.GetParent().SetType] = {'etype': element_dict[type_param.get('value')]}
+
             map = layer = None
             driver = db = table = None
             if name in ('LayerSelect', 'ColumnSelect'):
@@ -293,7 +305,7 @@
                     self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', ''),
                                                    'location' : pLocation.get('value', ''),
                                                    'mapset' : pMapset.get('value', '')}
-            
+
 def UpdateDialog(parent, event, eventId, task):
     return UpdateThread(parent, event, eventId, task)
 
@@ -1030,6 +1042,8 @@
                             p['wxId'] = [cb.GetId(),]
                             cb.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                             cb.Bind(wx.EVT_TEXT, self.OnSetValue)
+                            if p.get('guidependency', ''):
+                                cb.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
             
             # text entry
             if (p.get('type','string') in ('string','integer','float')
@@ -1117,12 +1131,25 @@
                         formatSelector = False
                         selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                     else:
+                        elem = p.get('element', None)
+                        # hack for t.* modules
+                        if elem in ('stds', 'map'):
+                            orig_elem = elem
+                            type_param = self.task.get_param('type', element = 'name', raiseError = False)
+                            if type_param:
+                                elem = type_param.get('default', None)
+                                # for t.(un)register:
+                                maps_param = self.task.get_param('maps', element = 'name', raiseError = False)
+                                if maps_param and orig_elem == 'stds':
+                                    element_dict = {'rast': 'strds', 'vect': 'stvds', 'rast3d': 'str3ds'}
+                                    elem = element_dict[type_param.get('default')]
+                        
+
                         selection = gselect.Select(parent = which_panel, id = wx.ID_ANY,
                                                    size = globalvar.DIALOG_GSELECT_SIZE,
-                                                   type = p.get('element', ''),
+                                                   type = elem,
                                                    multiple = multiple, nmaps = len(p.get('key_desc', [])),
                                                    mapsets = mapsets, fullyQualified = p.get('age', 'old') == 'old')
-                        
                         value = self._getValue(p)
                         if value:
                             selection.SetValue(value)
@@ -1480,9 +1507,6 @@
         pLocation = None
         pMapset = None
         for p in self.task.params:
-            if p.get('gisprompt', False) == False:
-                continue
-            
             guidep = p.get('guidependency', '')
             
             if guidep:
@@ -1495,6 +1519,8 @@
                             p['wxId-bind'] = list()
                         p['wxId-bind'] +=  pOpt['wxId']
                 continue
+            if p.get('gisprompt', False) == False:
+                continue
             
             prompt = p.get('element', '')
             if prompt in ('cell', 'vector'):

Modified: grass/trunk/temporal/t.info/t.info.py
===================================================================
--- grass/trunk/temporal/t.info/t.info.py	2012-10-22 07:19:33 UTC (rev 53521)
+++ grass/trunk/temporal/t.info/t.info.py	2012-10-22 08:24:21 UTC (rev 53522)
@@ -20,12 +20,8 @@
 #% keywords: metadata
 #%end
 
-#%option
-#% key: input
-#% type: string
+#%option G_OPT_STDS_INPUT
 #% description: Name of an existing space time dataset or map
-#% required: no
-#% multiple: no
 #%end
 
 #%option
@@ -33,6 +29,8 @@
 #% type: string
 #% description: Type of the dataset, default is strds (space time raster dataset)
 #% required: no
+#% guidependency: input
+#% guisection: Required
 #% options: strds, str3ds, stvds, rast, rast3d, vect
 #% answer: strds
 #%end
@@ -45,6 +43,7 @@
 #%flag
 #% key: s
 #% description: Print information about the temporal DBMI interface and exit
+#% suppress_required: yes
 #%end
 
 

Modified: grass/trunk/temporal/t.register/t.register.py
===================================================================
--- grass/trunk/temporal/t.register/t.register.py	2012-10-22 07:19:33 UTC (rev 53521)
+++ grass/trunk/temporal/t.register/t.register.py	2012-10-22 08:24:21 UTC (rev 53522)
@@ -30,6 +30,7 @@
 #%end
 
 #%option G_OPT_MAP_TYPE
+#% guidependency: input,maps
 #%end
 
 #%option G_OPT_FILE_INPUT

Modified: grass/trunk/temporal/t.remove/t.remove.py
===================================================================
--- grass/trunk/temporal/t.remove/t.remove.py	2012-10-22 07:19:33 UTC (rev 53521)
+++ grass/trunk/temporal/t.remove/t.remove.py	2012-10-22 08:24:21 UTC (rev 53522)
@@ -21,27 +21,27 @@
 #% keywords: remove
 #%end
 
-#%option G_OPT_STDS_INPUT
+#%option G_OPT_STDS_INPUTS
 #% required: no
 #%end
 
 #%option
-#% key: file
-#% type: string
-#% description: Input file with dataset names, one per line
-#% required: no
-#% multiple: no
-#%end
-
-#%option
 #% key: type
 #% type: string
 #% description: Type of the space time dataset, default is strds
+#% guidependency: inputs
 #% required: no
 #% options: strds, str3ds, stvds
 #% answer: strds
 #%end
 
+#%option G_OPT_F_INPUT
+#% key: file
+#% description: Input file with dataset names, one per line
+#% required: no
+#%end
+
+
 import grass.script as grass
 import grass.temporal as tgis
 
@@ -51,12 +51,12 @@
 def main():
 
     # Get the options
-    datasets = options["input"]
+    datasets = options["inputs"]
     file = options["file"]
     type = options["type"]
 
     if datasets and file:
-        core.fata(_("%s= and %s= are mutually exclusive") % ("input", "file"))
+        core.fatal(_("%s= and %s= are mutually exclusive") % ("input", "file"))
 
     # Make sure the temporal database exists
     tgis.init()

Modified: grass/trunk/temporal/t.support/t.support.py
===================================================================
--- grass/trunk/temporal/t.support/t.support.py	2012-10-22 07:19:33 UTC (rev 53521)
+++ grass/trunk/temporal/t.support/t.support.py	2012-10-22 08:24:21 UTC (rev 53522)
@@ -34,6 +34,8 @@
 #%end
 
 #%option G_OPT_STDS_TYPE
+#% guidependency: input
+#% guisection: Required
 #%end
 
 #%option

Modified: grass/trunk/temporal/t.topology/t.topology.py
===================================================================
--- grass/trunk/temporal/t.topology/t.topology.py	2012-10-22 07:19:33 UTC (rev 53521)
+++ grass/trunk/temporal/t.topology/t.topology.py	2012-10-22 08:24:21 UTC (rev 53522)
@@ -24,6 +24,8 @@
 #%end
 
 #%option G_OPT_STDS_TYPE
+#% guidependency: input
+#% guisection: Required
 #%end
 
 #%option G_OPT_T_WHERE

Modified: grass/trunk/temporal/t.unregister/t.unregister.py
===================================================================
--- grass/trunk/temporal/t.unregister/t.unregister.py	2012-10-22 07:19:33 UTC (rev 53521)
+++ grass/trunk/temporal/t.unregister/t.unregister.py	2012-10-22 08:24:21 UTC (rev 53522)
@@ -32,6 +32,7 @@
 #%end
 
 #%option G_OPT_MAP_TYPE
+#% guidependency: input,maps
 #%end
 
 



More information about the grass-commit mailing list