[GRASS-SVN] r69179 - grass/trunk/gui/wxpython/core
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 21 07:15:17 PDT 2016
Author: annakrat
Date: 2016-08-21 07:15:17 -0700 (Sun, 21 Aug 2016)
New Revision: 69179
Modified:
grass/trunk/gui/wxpython/core/render.py
Log:
wxGUI/vector legend: update legend in case of any change
Modified: grass/trunk/gui/wxpython/core/render.py
===================================================================
--- grass/trunk/gui/wxpython/core/render.py 2016-08-21 14:07:21 UTC (rev 69178)
+++ grass/trunk/gui/wxpython/core/render.py 2016-08-21 14:15:17 UTC (rev 69179)
@@ -466,6 +466,7 @@
self._init()
self._rendering = False
+ self._old_legend = []
def _init(self, env=None):
"""Init render manager
@@ -585,6 +586,8 @@
masks = list()
opacities = list()
+ # TODO: g.pnmcomp is now called every time
+ # even when only overlays are rendered
for layer in self.layers:
if layer.GetType() == 'overlay':
continue
@@ -621,6 +624,7 @@
(stop - self._startTime, stop - startCompTime))
# Update legfile
+ new_legend = []
with open(self.Map.legfile, "w") as outfile:
for layer in reversed(self.layers):
if layer.GetType() == 'overlay':
@@ -629,13 +633,23 @@
if os.path.isfile(layer.legrow) and layer.legrow[-1].isdigit() \
and layer.hidden is False:
with open(layer.legrow) as infile:
- outfile.write(infile.read())
+ line = infile.read()
+ outfile.write(line)
+ new_legend.append(line)
self._rendering = False
if wx.IsBusy():
wx.EndBusyCursor()
- self.updateMap.emit()
+ # if legend file changed, rerender vector legend
+ if new_legend != self._old_legend:
+ self._old_legend = new_legend
+ for layer in self.layers:
+ if layer.GetType() == 'overlay' and layer.GetName() == 'vectleg':
+ layer.forceRender = True
+ self.Render()
+ else:
+ self.updateMap.emit()
def Abort(self):
"""Abort all rendering processes"""
More information about the grass-commit
mailing list