Jelajahi Sumber

wxGUI/animation: fix https://trac.osgeo.org/grass/ticket/3894 and https://trac.osgeo.org/grass/ticket/3895

Anna Petrasova 5 tahun lalu
induk
melakukan
4e2049a917

+ 2 - 2
gui/wxpython/animation/dialogs.py

@@ -43,7 +43,7 @@ from core.settings import UserSettings
 from gui_core.gselect import Select
 from gui_core.widgets import FloatValidator
 from gui_core.wrap import SpinCtrl, CheckBox, TextCtrl, Button, \
-    BitmapButton, StaticText, StaticBox, Choice, RadioButton
+    BitmapButton, StaticText, StaticBox, Choice, RadioButton, EmptyImage
 
 from animation.utils import TemporalMode, getRegisteredMaps, getNameAndLayer, getCpuCount
 from animation.data import AnimationData, AnimLayer
@@ -1085,7 +1085,7 @@ class ExportDialog(wx.Dialog):
 
         # image
         self.imageBox = wx.BoxSizer(wx.HORIZONTAL)
-        filetype, ltype = GetImageHandlers(wx.EmptyImage(10, 10))
+        filetype, ltype = GetImageHandlers(EmptyImage(10, 10))
         self.browse = filebrowse.FileBrowseButton(
             parent=panel, id=wx.ID_ANY, fileMask=filetype,
             labelText=_("Image file:"),

+ 3 - 3
gui/wxpython/animation/provider.py

@@ -32,7 +32,7 @@ from core.debug import Debug
 from core.utils import autoCropImageFromFile
 
 from animation.utils import HashCmd, HashCmds, GetFileFromCmd, GetFileFromCmds
-from gui_core.wrap import EmptyBitmap
+from gui_core.wrap import EmptyBitmap, BitmapFromImage
 
 import grass.script.core as gcore
 from grass.script.task import cmdlist_to_tuple
@@ -308,7 +308,7 @@ class BitmapProvider:
             cmdTuple[0], **cmdTuple[1])
 
         if returncode == 0:
-            return wx.BitmapFromImage(autoCropImageFromFile(filename))
+            return BitmapFromImage(autoCropImageFromFile(filename))
         else:
             os.remove(filename)
             raise GException(messages)
@@ -519,7 +519,7 @@ class BitmapComposer:
                         self._bitmapPool[
                             HashCmds(
                                 cmd_lists[i][0],
-                                cmd_lists[i][1])] = wx.BitmapFromImage(
+                                cmd_lists[i][1])] = BitmapFromImage(
                             wx.Image(filename))
                         os.remove(filename)
                 proc_count = 0

+ 2 - 7
gui/wxpython/animation/utils.py

@@ -265,13 +265,8 @@ def RenderText(text, font, bgcolor, fgcolor):
 def WxImageToPil(image):
     """Converts wx.Image to PIL image"""
     pilImage = Image.new('RGB', (image.GetWidth(), image.GetHeight()))
-    getattr(
-        pilImage,
-        "frombytes",
-        getattr(
-            pilImage,
-            "fromstring"))(
-        image.GetData())
+    getattr(pilImage, "frombytes", getattr(pilImage, "fromstring"))(
+        bytes(image.GetData()))
     return pilImage