[GRASS-SVN] r73133 - in grass/branches/releasebranch_7_4: gui/wxpython/gui_core vector/v.vect.stats

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 21 13:24:34 PDT 2018


Author: martinl
Date: 2018-08-21 13:24:34 -0700 (Tue, 21 Aug 2018)
New Revision: 73133

Modified:
   grass/branches/releasebranch_7_4/gui/wxpython/gui_core/forms.py
   grass/branches/releasebranch_7_4/gui/wxpython/gui_core/gselect.py
   grass/branches/releasebranch_7_4/vector/v.vect.stats/main.c
Log:
G_OPT_DB_WHERE - non-functional 'table' icon in gui, closes #3619
	(merge r73114, r73118-73119 from trunk)


Modified: grass/branches/releasebranch_7_4/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/gui_core/forms.py	2018-08-21 19:41:15 UTC (rev 73132)
+++ grass/branches/releasebranch_7_4/gui/wxpython/gui_core/forms.py	2018-08-21 20:24:34 UTC (rev 73133)
@@ -270,7 +270,11 @@
                     pMapL = self.task.get_param(
                         p['wxId'][0], element='wxId-bind', raiseError=False)
                     if pMapL:
-                        map = pMapL.get('value', '')
+                        gui_deps = pMapL.get('guidependency', None)
+                        if gui_deps:
+                            gui_deps = gui_deps.split(',')
+                        if not gui_deps or (gui_deps and p.get('name', '') in gui_deps):
+                            map = pMapL.get('value', '')
 
             if name == 'TableSelect' or \
                     (name == 'ColumnSelect' and not map):
@@ -292,12 +296,13 @@
                 # determine format
                 native = True
 
-                for id in pMap['wxId']:
-                    winVec = self.parent.FindWindowById(id)
-                    if winVec.GetName() == 'VectorFormat' and \
-                            winVec.GetSelection() != 0:
-                        native = False
-                        break
+                if pMap:
+                    for id in pMap['wxId']:
+                        winVec = self.parent.FindWindowById(id)
+                        if winVec.GetName() == 'VectorFormat' and \
+                                winVec.GetSelection() != 0:
+                            native = False
+                            break
                 # TODO: update only if needed
                 if native:
                     if map:

Modified: grass/branches/releasebranch_7_4/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/gui_core/gselect.py	2018-08-21 19:41:15 UTC (rev 73132)
+++ grass/branches/releasebranch_7_4/gui/wxpython/gui_core/gselect.py	2018-08-21 20:24:34 UTC (rev 73133)
@@ -2708,6 +2708,7 @@
         """
         super(SqlWhereSelect, self).__init__(parent=parent, id=wx.ID_ANY)
         self.parent = parent
+        self.vector_map = None
 
         self.sqlField = wx.TextCtrl(parent=self, id=wx.ID_ANY,
                                     size=globalvar.DIALOG_TEXTCTRL_SIZE)
@@ -2738,6 +2739,8 @@
     def _onClick(self, event):
         from dbmgr.sqlbuilder import SQLBuilderWhere
         try:
+            if not self.vector_map:
+                raise GException(_('No vector map selected'))
             win = SQLBuilderWhere(parent=self,
                                   vectmap=self.vector_map,
                                   layer=self.vector_layer)

Modified: grass/branches/releasebranch_7_4/vector/v.vect.stats/main.c
===================================================================
--- grass/branches/releasebranch_7_4/vector/v.vect.stats/main.c	2018-08-21 19:41:15 UTC (rev 73132)
+++ grass/branches/releasebranch_7_4/vector/v.vect.stats/main.c	2018-08-21 20:24:34 UTC (rev 73133)
@@ -138,7 +138,7 @@
     point_opt->key = "points";
     point_opt->label = _("Name of existing vector map with points");
     /* point_opt->guisection = _("Required"); */
-
+      
     area_opt = G_define_standard_option(G_OPT_V_INPUT);
     area_opt->key = "areas";
     area_opt->label = _("Name of existing vector map with areas");
@@ -226,7 +226,18 @@
 	_("Print output to stdout, do not update attribute table");
     print_flag->description = _("First column is always area category");
     print_flag->guisection = _("Print");
- 
+
+    /* GUI dependencies */
+    G_asprintf((char **) &(point_opt->guidependency), "%s,%s,%s",
+               point_field_opt->key, point_where_opt->key, point_column_opt->key);
+    G_asprintf((char **) &(point_field_opt->guidependency), "%s,%s",
+               point_where_opt->key, point_column_opt->key);
+    G_asprintf((char **) &(area_opt->guidependency), "%s,%s,%s,%s",
+               area_field_opt->key, area_where_opt->key,
+               count_column_opt->key, stats_column_opt->key);
+    G_asprintf((char **) &(area_field_opt->guidependency), "%s,%s,%s",
+               area_where_opt->key, count_column_opt->key, stats_column_opt->key);
+    
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 



More information about the grass-commit mailing list