[GRASS-SVN] r68121 - grass/trunk/gui/wxpython/tplot
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Mar 23 07:06:48 PDT 2016
Author: lucadelu
Date: 2016-03-23 07:06:48 -0700 (Wed, 23 Mar 2016)
New Revision: 68121
Modified:
grass/trunk/gui/wxpython/tplot/frame.py
Log:
g.gui.tplot: improved tool with stvds
Modified: grass/trunk/gui/wxpython/tplot/frame.py
===================================================================
--- grass/trunk/gui/wxpython/tplot/frame.py 2016-03-23 09:14:19 UTC (rev 68120)
+++ grass/trunk/gui/wxpython/tplot/frame.py 2016-03-23 14:06:48 UTC (rev 68121)
@@ -51,6 +51,7 @@
from core import globalvar
from grass.pygrass.vector.geometry import Point
from grass.pygrass.raster import RasterRow
+from grass.pygrass.gis.region import Region
from collections import OrderedDict
from subprocess import PIPE
try:
@@ -107,6 +108,7 @@
self.dbif = tgis.SQLDatabaseInterfaceConnection()
self.dbif.connect()
self.Bind(wx.EVT_CLOSE, self.onClose)
+ self.region = Region()
def init(self):
self.timeDataR = OrderedDict()
@@ -214,12 +216,19 @@
self.datasetSelectLabelV = wx.StaticText(parent=self.controlPanelVector,
id=wx.ID_ANY,
label=_('Vector temporal '
- 'dataset (strds)'))
+ 'dataset (strds)\n'
+ 'Please press enter if'
+ ' you digit the name'
+ ' instead select with'
+ ' combobox'))
self.datasetSelectV = gselect.Select(parent=self.controlPanelVector,
id=wx.ID_ANY,
size=globalvar.DIALOG_GSELECT_SIZE,
- type='stvds', multiple=True)
- self.datasetSelectV.Bind(wx.EVT_TEXT, self.OnVectorSelected)
+ type='stvds', multiple=True,
+ style=wx.TE_PROCESS_ENTER)
+ self.datasetSelectV.Bind(wx.EVT_TEXT_ENTER, self.OnVectorSelected)
+ self.datasetSelectV.Bind(wx.EVT_COMBOBOX_CLOSEUP,
+ self.OnVectorSelected)
self.attribute = gselect.ColumnSelect(parent=self.controlPanelVector)
self.attributeLabel = wx.StaticText(parent=self.controlPanelVector,
@@ -281,6 +290,10 @@
"""Load data and read properties
:param list timeseries: a list of timeseries
"""
+ if not self.poi:
+ GError(parent=self, message=_("Invalid input coordinates"),
+ showTraceback=False)
+ return
mode = None
unit = None
columns = ','.join(['name', 'start_time', 'end_time'])
@@ -683,6 +696,12 @@
GError(parent=self, message=_("Invalid input coordinates"),
showTraceback=False)
return
+ bbox = self.region.get_bbox()
+ if not bbox.contains(self.poi):
+ GError(parent=self, message=_("Seed point outside the "
+ "current region"),
+ showTraceback=False)
+ return
# check raster dataset
if datasetsR:
datasetsR = datasetsR.split(',')
@@ -838,11 +857,20 @@
def OnVectorSelected(self, event):
"""Update the controlbox related to stvds"""
dataset = self.datasetSelectV.GetValue().strip()
- vect_list = grass.read_command('t.vect.list', flags='s', input=dataset,
- col='name')
- vect_list = list(set(sorted(vect_list.split())))
- for vec in vect_list:
- self.attribute.InsertColumns(vec, 1)
+ if dataset:
+ try:
+ vect_list = grass.read_command('t.vect.list', flags='s',
+ input=dataset, column='name')
+ except Exception:
+ self.attribute.Clear()
+ GError(parent=self, message=_("Invalid input temporal dataset"),
+ showTraceback=False)
+ return
+ vect_list = list(set(sorted(vect_list.split())))
+ for vec in vect_list:
+ self.attribute.InsertColumns(vec, 1)
+ else:
+ return
class LookUp:
More information about the grass-commit
mailing list