[GRASS-SVN] r57827 - grass/trunk/gui/wxpython/animation
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Sep 24 18:02:36 PDT 2013
Author: annakrat
Date: 2013-09-24 18:02:36 -0700 (Tue, 24 Sep 2013)
New Revision: 57827
Modified:
grass/trunk/gui/wxpython/animation/controller.py
grass/trunk/gui/wxpython/animation/dialogs.py
grass/trunk/gui/wxpython/animation/mapwindow.py
Log:
wxGUI/animation: fix legend hiding
Modified: grass/trunk/gui/wxpython/animation/controller.py
===================================================================
--- grass/trunk/gui/wxpython/animation/controller.py 2013-09-24 23:50:47 UTC (rev 57826)
+++ grass/trunk/gui/wxpython/animation/controller.py 2013-09-25 01:02:36 UTC (rev 57827)
@@ -409,6 +409,8 @@
self.mapwindows[animationData.windowIndex].SetOverlay(bitmap, x, y)
except GException:
GError(message=_("Failed to display legend."))
+ else:
+ self.mapwindows[animationData.windowIndex].ClearOverlay()
def EvaluateInput(self, animationData):
stds = 0
@@ -486,6 +488,7 @@
animWinSize = []
animWinPos = []
animWinIndex = []
+ legends = [anim.legendCmd for anim in self.animationData]
# determine position and sizes of bitmaps
for i, (win, anim) in enumerate(zip(self.mapwindows, self.animations)):
if anim.IsActive():
@@ -501,16 +504,16 @@
image = wx.EmptyImage(*size)
image.Replace(0, 0, 0, 255, 255, 255)
# collect bitmaps of all windows and paste them into the one
- for i in range(len(animWinSize)):
- frameId = self.animations[animWinIndex[i]].GetFrame(frameIndex)
- bitmap = self.bitmapProviders[animWinIndex[i]].GetBitmap(frameId)
+ for i in animWinIndex:
+ frameId = self.animations[i].GetFrame(frameIndex)
+ bitmap = self.bitmapProviders[i].GetBitmap(frameId)
im = wx.ImageFromBitmap(bitmap)
# add legend if used
- legend = self.animationData[animWinIndex[i]].legendCmd
+ legend = legends[i]
if legend:
- legendBitmap = self.bitmapProviders[animWinIndex[i]].LoadOverlay(legend)
- x, y = self.mapwindows[animWinIndex[i]].GetOverlayPos()
+ legendBitmap = self.bitmapProviders[i].LoadOverlay(legend)
+ x, y = self.mapwindows[i].GetOverlayPos()
legImage = wx.ImageFromBitmap(legendBitmap)
# not so nice result, can we handle the transparency otherwise?
legImage.ConvertAlphaToMask()
Modified: grass/trunk/gui/wxpython/animation/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/animation/dialogs.py 2013-09-24 23:50:47 UTC (rev 57826)
+++ grass/trunk/gui/wxpython/animation/dialogs.py 2013-09-25 01:02:36 UTC (rev 57827)
@@ -530,6 +530,7 @@
self.animationData.inputData = self.dataSelect.GetValue()
sel = self.nDChoice.GetSelection()
self.animationData.viewMode = self.nDChoice.GetClientData(sel)
+ self.animationData.legendCmd = None
if self._tmpLegendCmd:
if self.legend.IsChecked():
self.animationData.legendCmd = self._tmpLegendCmd
Modified: grass/trunk/gui/wxpython/animation/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/animation/mapwindow.py 2013-09-24 23:50:47 UTC (rev 57826)
+++ grass/trunk/gui/wxpython/animation/mapwindow.py 2013-09-25 01:02:36 UTC (rev 57827)
@@ -179,6 +179,13 @@
self._pdc.RemoveAll()
self.UpdateDrawing()
+ def ClearOverlay(self):
+ """!Clear overlay (legend) """
+ Debug.msg(3, "AnimationWindow.ClearOverlay()")
+ self._overlay = None
+ self._pdc.RemoveAll()
+ self.UpdateDrawing()
+
def OnPaint(self, event):
Debug.msg(5, "AnimationWindow.OnPaint()")
# All that is needed here is to draw the buffer to screen
More information about the grass-commit
mailing list