[GRASS-SVN] r65763 - in grass/trunk/gui/wxpython: lmgr tplot

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 21 11:09:35 PDT 2015


Author: lucadelu
Date: 2015-07-21 11:09:35 -0700 (Tue, 21 Jul 2015)
New Revision: 65763

Modified:
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/tplot/frame.py
Log:
g.gui.tplot: fixed bugs; fixed start up from GUI

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2015-07-21 18:01:41 UTC (rev 65762)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2015-07-21 18:09:35 UTC (rev 65763)
@@ -1636,7 +1636,7 @@
         except ImportError:
             GError(parent=self, message=_("Unable to start Temporal Plot Tool."))
             return
-        frame = TplotFrame(None)
+        frame = TplotFrame(parent=self, giface=self._giface)
         frame.Show()
           
     def OnHistogram(self, event):

Modified: grass/trunk/gui/wxpython/tplot/frame.py
===================================================================
--- grass/trunk/gui/wxpython/tplot/frame.py	2015-07-21 18:01:41 UTC (rev 65762)
+++ grass/trunk/gui/wxpython/tplot/frame.py	2015-07-21 18:09:35 UTC (rev 65763)
@@ -344,7 +344,7 @@
         for line in vdb.splitlines():
             lsplit = line.split('|')
             layer = lsplit[0].split('/')[0]
-            if layer == layerInp:
+            if str(layer) == str(layerInp):
                 return lsplit[2]
         return None
 
@@ -435,12 +435,14 @@
                 totcat = len(cats)
                 ncat = 1
                 for cat in cats:
-                    if ncat == 1:
-                        wherequery += 'cat={c} or'.format(c=cat)
+                    if ncat == 1 and totcat != 1:
+                        wherequery += '{k}={c} or'.format(c=cat, k="{key}")
+                    elif ncat == 1 and totcat == 1:
+                        wherequery += '{k}={c}'.format(c=cat, k="{key}")
                     elif ncat == totcat:
-                        wherequery += ' cat={c}'.format(c=cat)
+                        wherequery += ' {k}={c}'.format(c=cat, k="{key}")
                     else:
-                        wherequery += ' cat={c} or'.format(c=cat)
+                        wherequery += ' {k}={c} or'.format(c=cat, k="{key}")
                     catn = "cat{num}".format(num=cat)
                     self.plotNameListV.append("{na}+{cat}".format(na=name,
                                                                   cat=catn))
@@ -448,8 +450,15 @@
                     ncat += 1
                 for row in rows:
                     lay = int(row['layer'])
+                    catkey = self.parseVDbConn(row['name'], lay)
+                    if not catkey:
+                        GError(parent=self, showTraceback=False,
+                           message=_("No connection between vector map {vmap} "
+                                     "and layer {la}".format(vmap=row['name'],
+                                                              la=lay)))
+                        return
                     vals = grass.vector_db_select(map=row['name'], layer=lay,
-                                                  where=wherequery,
+                                                  where=wherequery.format(key=catkey),
                                                   columns=attribute)
                     layn = "lay{num}".format(num=lay)
                     for cat in cats:



More information about the grass-commit mailing list