[GRASS-SVN] r37915 -
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jun 16 16:16:52 EDT 2009
Author: martinl
Date: 2009-06-16 16:16:52 -0400 (Tue, 16 Jun 2009)
New Revision: 37915
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py
Log:
No warning when querying grid layer (trac #650)
(merge from trunk, r37913)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py 2009-06-16 20:11:16 UTC (rev 37914)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py 2009-06-16 20:16:52 UTC (rev 37915)
@@ -3477,31 +3477,39 @@
self.MapWindow.SetCursor(self.cursors["cross"])
def QueryMap(self, x, y):
- """
- Query map layer features
+ """!Query map layer features
- Currently only raster and vector map layers are supported
+ Currently only raster and vector map layers are supported.
+
+ @param x,y coordinates
"""
#set query snap distance for v.what at mapunit equivalent of 10 pixels
qdist = 10.0 * ((self.Map.region['e'] - self.Map.region['w']) / self.Map.width)
east, north = self.MapWindow.Pixel2Cell((x, y))
- if not self.tree.layer_selected:
+ num = 0
+ for layer in self.tree.GetSelections():
+ type = self.tree.GetPyData(layer)[0]['maplayer'].GetType()
+ if type in ('raster', 'rgb', 'his',
+ 'vector', 'thememap', 'themechart'):
+ num += 1
+
+ if num < 1:
dlg = wx.MessageDialog(parent=self,
- message=_('No map layer selected for querying.'),
- caption=_('Message'),
- style=wx.OK | wx.ICON_INFORMATION)
+ message=_('No raster or vector map layer selected for querying.'),
+ caption=_('No map layer selected'),
+ style=wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
dlg.ShowModal()
dlg.Destroy()
return
-
+
mapname = None
raststr = ''
vectstr = ''
rcmd = []
vcmd = []
for layer in self.tree.GetSelections():
- type = self.tree.GetPyData(layer)[0]['maplayer'].type
+ type = self.tree.GetPyData(layer)[0]['maplayer'].GetType()
dcmd = self.tree.GetPyData(layer)[0]['cmd']
name = utils.GetLayerNameFromCmd(dcmd)
if name == '':
@@ -3651,6 +3659,15 @@
kind=wx.ITEM_CHECK)
toolsmenu.AppendItem(display)
self.Bind(wx.EVT_MENU, self.OnQueryDisplay, display)
+ numLayers = 0
+ for layer in self.tree.GetSelections():
+ type = self.tree.GetPyData(layer)[0]['maplayer'].GetType()
+ if type in ('raster', 'rgb', 'his',
+ 'vector', 'thememap', 'themechart'):
+ numLayers += 1
+ if numLayers < 1:
+ display.Enable(False)
+
if action == "displayAttrb":
display.Check(True)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py 2009-06-16 20:11:16 UTC (rev 37914)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py 2009-06-16 20:16:52 UTC (rev 37915)
@@ -263,16 +263,17 @@
# map layer items
if ltype != "group" and \
- ltype != "command": # properties
+ ltype != "command":
self.popupMenu.AppendSeparator()
self.popupMenu.Append(self.popupID8, text=_("Change opacity level"))
self.Bind(wx.EVT_MENU, self.OnPopupOpacityLevel, id=self.popupID8)
self.popupMenu.Append(self.popupID3, text=_("Properties"))
self.Bind(wx.EVT_MENU, self.OnPopupProperties, id=self.popupID3)
- self.popupMenu.Append(self.popupID9, text=_("Zoom to selected map(s)"))
- self.Bind(wx.EVT_MENU, self.mapdisplay.MapWindow.OnZoomToMap, id=self.popupID9)
- self.popupMenu.Append(self.popupID10, text=_("Set computational region from selected map(s)"))
- self.Bind(wx.EVT_MENU, self.OnSetCompRegFromMap, id=self.popupID10)
+ if ltype in ('raster', 'vector'):
+ self.popupMenu.Append(self.popupID9, text=_("Zoom to selected map(s)"))
+ self.Bind(wx.EVT_MENU, self.mapdisplay.MapWindow.OnZoomToMap, id=self.popupID9)
+ self.popupMenu.Append(self.popupID10, text=_("Set computational region from selected map(s)"))
+ self.Bind(wx.EVT_MENU, self.OnSetCompRegFromMap, id=self.popupID10)
if numSelected > 1:
self.popupMenu.Enable(self.popupID8, False)
self.popupMenu.Enable(self.popupID3, False)
More information about the grass-commit
mailing list