[GRASS-SVN] r54016 - in grass/trunk: gui/wxpython/lmgr vector/v.distance
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Nov 24 14:18:17 PST 2012
Author: wenzeslaus
Date: 2012-11-24 14:18:17 -0800 (Sat, 24 Nov 2012)
New Revision: 54016
Modified:
grass/trunk/gui/wxpython/lmgr/layertree.py
grass/trunk/vector/v.distance/main.c
Log:
wxGUI/layertree: layer info: deleting unused code and using the old way when necessary (fixing r54014)
Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py 2012-11-24 22:12:36 UTC (rev 54015)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py 2012-11-24 22:18:17 UTC (rev 54016)
@@ -1165,22 +1165,12 @@
# update progress bar range (mapwindow statusbar)
self.mapdisplay.GetProgressBar().SetRange(len(self.Map.GetListOfLayers(l_active = True)))
- #
- # nviz
- #
- if self.lmgr.IsPaneShown('toolbarNviz') and \
- self.GetLayerInfo(item) is not None and not self.rerender:
- # nviz - load/unload data layer
- mapLayer = self.GetLayerInfo(item, key = 'maplayer')
- self.mapdisplay.SetStatusText(_("Please wait, updating data..."), 0)
- if mapLayer.type == 'raster':
- self.mapdisplay.MapWindow.UnloadRaster(item)
- elif mapLayer.type == '3d-raster':
- self.mapdisplay.MapWindow.UnloadRaster3d(item)
- elif mapLayer.type == 'vector':
- self.mapdisplay.MapWindow.UnloadVector(item)
- self.mapdisplay.SetStatusText("", 0)
-
+ # here was some dead code related to layer and nviz
+ # however, in condition was rerender = False
+ # but rerender is alway True
+ # (here no change and also in UpdateListOfLayers and GetListOfLayers)
+ # You can safely remove this comment after some testing.
+
event.Skip()
def OnLayerChecking(self, event):
@@ -1227,7 +1217,7 @@
# nviz
if self.lmgr.IsPaneShown('toolbarNviz') and \
- self.GetLayerInfo(item) is not None:
+ self.GetPyData(item) is not None:
# nviz - load/unload data layer
mapLayer = self.GetLayerInfo(item, key = 'maplayer')
@@ -1300,7 +1290,12 @@
event.Veto()
def OnChangeSel(self, event):
- """!Selection changed"""
+ """!Selection changed
+
+ Preconditions:
+ event.GetItem() is a valid layer;
+ self.layer_selected is a valid layer
+ """
layer = event.GetItem()
digitToolbar = self.mapdisplay.GetToolbar('vdigit')
if digitToolbar:
@@ -1337,13 +1332,13 @@
pass
# update statusbar -> show command string
- if self.GetLayerInfo(layer) and self.GetLayerInfo(layer, key = 'maplayer'):
+ if self.GetLayerInfo(layer, key = 'maplayer'):
cmd = self.GetLayerInfo(layer, key = 'maplayer').GetCmd(string = True)
if len(cmd) > 0:
self.lmgr.SetStatusText(cmd)
# set region if auto-zooming is enabled
- if self.GetLayerInfo(layer) and self.GetLayerInfo(layer, key = 'cmd') and \
+ if self.GetLayerInfo(layer, key = 'cmd') and \
UserSettings.Get(group = 'display', key = 'autoZooming', subkey = 'enabled'):
mapLayer = self.GetLayerInfo(layer, key = 'maplayer')
if mapLayer.GetType() in ('raster', 'vector'):
@@ -1352,8 +1347,7 @@
render = render)
# update nviz tools
- if self.lmgr.IsPaneShown('toolbarNviz') and \
- self.GetLayerInfo(self.layer_selected) is not None:
+ if self.lmgr.IsPaneShown('toolbarNviz'):
if self.layer_selected.IsChecked():
# update Nviz tool window
type = self.GetLayerInfo(self.layer_selected, key = 'maplayer').type
@@ -1445,7 +1439,7 @@
newctrl = buttons.GenBitmapButton(self, id = wx.ID_ANY, bitmap = btnbmp, size = (24, 24))
newctrl.SetToolTipString(_("Click to edit layer settings"))
self.Bind(wx.EVT_BUTTON, self.OnLayerContextMenu, newctrl)
- data = self.GetLayerInfo(dragItem)
+ data = self.GetPyData(dragItem)
elif self.GetLayerInfo(dragItem, key = 'type') == 'command':
# recreate command layer
@@ -1459,7 +1453,7 @@
pass
newctrl.Bind(wx.EVT_TEXT_ENTER, self.OnCmdChanged)
newctrl.Bind(wx.EVT_TEXT, self.OnCmdChanged)
- data = self.GetLayerInfo(dragItem)
+ data = self.GetPyData(dragItem)
elif self.GetLayerInfo(dragItem, key = 'type') == 'group':
# recreate group
@@ -1608,7 +1602,7 @@
vislayer = self.GetFirstVisibleItem()
- if not vislayer or self.GetLayerInfo(vislayer) is None:
+ if not vislayer or self.GetPyData(vislayer) is None:
return
itemList = ""
@@ -1647,7 +1641,7 @@
chk = self.IsItemChecked(item)
hidden = not self.IsVisible(item)
elif type != 'group':
- if self.GetLayerInfo(item) is not None:
+ if self.GetPyData(item) is not None:
cmdlist = self.GetLayerInfo(item, key = 'cmd')
opac = self.GetLayerInfo(item, key = 'maplayer').GetOpacity(float = True)
chk = self.IsItemChecked(item)
Modified: grass/trunk/vector/v.distance/main.c
===================================================================
--- grass/trunk/vector/v.distance/main.c 2012-11-24 22:12:36 UTC (rev 54015)
+++ grass/trunk/vector/v.distance/main.c 2012-11-24 22:18:17 UTC (rev 54016)
@@ -93,7 +93,7 @@
opt.from = G_define_standard_option(G_OPT_V_INPUT);
opt.from->key = "from";
- opt.from->description = _("Name of existing vector map (from)");
+ opt.from->label = _("Name of existing vector map (from)");
opt.from->guisection = _("From");
opt.from_field = G_define_standard_option(G_OPT_V_FIELD);
@@ -110,7 +110,7 @@
opt.to = G_define_standard_option(G_OPT_V_INPUT);
opt.to->key = "to";
- opt.to->description = _("Name of existing vector map (to)");
+ opt.to->label = _("Name of existing vector map (to)");
opt.to->guisection = _("To");
opt.to_field = G_define_standard_option(G_OPT_V_FIELD);
More information about the grass-commit
mailing list