[GRASS-SVN] r66563 - grass/branches/releasebranch_7_0/gui/wxpython/vnet

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 21 13:24:17 PDT 2015


Author: turek
Date: 2015-10-21 13:24:17 -0700 (Wed, 21 Oct 2015)
New Revision: 66563

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/vnet/vnet_data.py
Log:
wx.vnet points list fixes (merge r66429 from trunk)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/vnet/vnet_data.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/vnet/vnet_data.py	2015-10-21 20:19:16 UTC (rev 66562)
+++ grass/branches/releasebranch_7_0/gui/wxpython/vnet/vnet_data.py	2015-10-21 20:24:17 UTC (rev 66563)
@@ -307,6 +307,11 @@
             idx = self.cols["name"].index(col)
             self.data[pt_id][idx] = v
 
+
+        # if type is changed checked columns must be recalculated by _usePoint
+        if data.has_key('type') and not data.has_key('use'):
+            data["use"] = self.GetPointData(pt_id)['use']
+
         if data.has_key('use'):
             if self._usePoint(pt_id, data["use"]) == -1:
                 data["use"] =  False
@@ -373,6 +378,9 @@
         if "analysis" in kwargs["changed_params"].keys():
             self._updateTypeCol()
 
+            if self.an_params.GetParam("analysis")[0] == "v.net.path":
+                self._vnetPathUpdateUsePoints(None)
+
     def _updateTypeCol(self):
         """Rename category values when module is changed. Expample: Start point -> Sink point"""
         colValues = [""]
@@ -414,21 +422,29 @@
         if len(cats) <= 1:
             return 0
 
-        type_idx = self.cols["name"].index("type")
         use_idx = self.cols["name"].index("use")
         checkedVal = self.data[pt_id][1]
 
+        # point without given type cannot be selected
         if checkedVal == 0:
             self.data[pt_id][use_idx] = False
             self.pointsChanged.emit(method = "SetPointData", kwargs = {"pt_id" : pt_id, "data" : {"use" : False}})
             return -1
 
         if analysis == "v.net.path" and use:
+            self._vnetPathUpdateUsePoints(pt_id)
+
+    def _vnetPathUpdateUsePoints(self, checked_pt_id):
+
             alreadyChecked = []
 
-            if pt_id:
-                checkedKey = pt_id
-                alreadyChecked.append(self.data[pt_id][type_idx])
+
+            type_idx = self.cols["name"].index("type")
+            use_idx = self.cols["name"].index("use")
+
+            if checked_pt_id is not None:
+                checkedKey = checked_pt_id
+                alreadyChecked.append(self.data[checked_pt_id][type_idx])
             else:
                 checkedKey = -1
 



More information about the grass-commit mailing list