Skip to content

Commit

Permalink
wxGUI/animation: fix deprecation warnings (https://trac.osgeo.org/gra…
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa committed Oct 4, 2019
1 parent 37c996a commit a5453ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gui/wxpython/animation/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from core.gcmd import GException, GError, GMessage
from grass.imaging import writeAvi, writeGif, writeIms, writeSwf
from core.settings import UserSettings
from gui_core.wrap import EmptyImage, ImageFromBitmap

from animation.temporal_manager import TemporalManager
from animation.dialogs import InputDialog, EditDialog, ExportDialog
Expand Down Expand Up @@ -551,7 +552,7 @@ def _export(self, exportInfo, decorations):
key='font',
subkey='bgcolor')
for frameIndex in range(frameCount):
image = wx.EmptyImage(*size)
image = EmptyImage(*size)
image.Replace(0, 0, 0, 255, 255, 255)
# collect bitmaps of all windows and paste them into the one
for i in animWinIndex:
Expand All @@ -568,14 +569,14 @@ def _export(self, exportInfo, decorations):
bitmap = self.bitmapProvider.GetBitmap(frameId)
lastBitmaps[i] = bitmap

im = wx.ImageFromBitmap(lastBitmaps[i])
im = ImageFromBitmap(lastBitmaps[i])

# add legend if used
legend = legends[i]
if legend:
legendBitmap = self.bitmapProvider.LoadOverlay(legend)
x, y = self.mapwindows[i].GetOverlayPos()
legImage = wx.ImageFromBitmap(legendBitmap)
legImage = ImageFromBitmap(legendBitmap)
# not so nice result, can we handle the transparency
# otherwise?
legImage.ConvertAlphaToMask()
Expand Down
5 changes: 5 additions & 0 deletions gui/wxpython/gui_core/wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def BitmapFromImage(image, depth=-1):
else:
return wx.BitmapFromImage(image, depth=depth)

def ImageFromBitmap(bitmap):
if wxPythonPhoenix:
return bitmap.ConvertToImage()
else:
return wx.ImageFromBitmap(bitmap)

def EmptyBitmap(width, height, depth=-1):
if wxPythonPhoenix:
Expand Down

0 comments on commit a5453ab

Please sign in to comment.