[Python-apps-team] Bug#823796: phatch: impossible to use phatch there is just the logo that is displayed

Steve Cotton steve at s.cotton.clara.co.uk
Fri May 26 23:57:01 UTC 2017


On Sun, May 07, 2017 at 02:39:07PM +0200, Marc Dequènes wrote:
> Quack,

>   File "/usr/share/phatch/phatch/lib/pyWx/treeEdit.py", line 120, in
> _AddFormToImageList
>     wx_image = pil_wxImage(wxImage_pil(wx_image).resize(icon_size,\
>   File "/usr/share/phatch/phatch/lib/pyWx/wxPil.py", line 45, in wxImage_pil
>     image = Image.new('RGB', size)
>   File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2051, in new
>     _check_size(size)
>   File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2027, in
> _check_size
>     raise ValueError("Size must be a tuple")
> ValueError: Size must be a tuple
> 
> \_o<

This is a caused by a change in the PIL library, but it can be worked
round with a one-line change to Phatch, which seems the best option
before the Stretch release.

Steve


From: Steve Cotton <steve at octalot.co.uk>
Date: Sat, 27 May 2017 01:32:21 +0200
Subject: [PATCH] Convert images' wx.Size object to a tuple for the PIL library

The wxPython library wraps image sizes in a wx.Size object, a class
which provides the __len__ and accessor methods expected for a tuple.
There's been a breaking change to the PIL library, which now
explicitly checks the type of the size passed to it, and rejects
anything which is not a tuple or a list.

This patch adds a call to wx.Size.Get(), which returns the size as a
tuple.

Bug-Debian: https://bugs.debian.org/823796

PIL library change: https://github.com/python-pillow/Pillow/commit/445451c0b9347b50e0f603db33f196e207de470d
---
 phatch/lib/pyWx/wxPil.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/phatch/lib/pyWx/wxPil.py b/phatch/lib/pyWx/wxPil.py
index cf8c940..be73074 100644
--- a/phatch/lib/pyWx/wxPil.py
+++ b/phatch/lib/pyWx/wxPil.py
@@ -41,7 +41,7 @@ def pil_wxBitmap(image):
 
 
 def wxImage_pil(wx_image):
-    size = wx_image.GetSize()
+    size = wx_image.GetSize().Get()
     image = Image.new('RGB', size)
     image.frombytes(wx_image.GetData())
     if wx_image.HasAlpha():



More information about the Python-apps-team mailing list