M7S / dockbarx

286 stars 40 forks source link

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #180

Open tiamed opened 1 year ago

tiamed commented 1 year ago

DockbarX 1.0-beta2 DockbarX init

(dockx:20478): Wnck-CRITICAL **: 01:02:40.076: wnck_set_client_type: changing the client type is not supported.

DockbarX reload Traceback (most recent call last): File "/usr/bin/dockx", line 1578, in do_activate self.window = DockX(application=self, monitor=self.monitor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/bin/dockx", line 524, in init self.dockbar.load() File "/usr/lib/python3.11/site-packages/dockbarx/dockbar.py", line 576, in load self.reload(tell_parent=False) File "/usr/lib/python3.11/site-packages/dockbarx/dockbar.py", line 644, in reload self.add_launcher(identifier, path) File "/usr/lib/python3.11/site-packages/dockbarx/dockbar.py", line 1555, in __add_launcher self.make_groupbutton(identifier=identifier, \ File "/usr/lib/python3.11/site-packages/dockbarx/dockbar.py", line 1006, in make_groupbutton group.button.update_state() File "/usr/lib/python3.11/site-packages/dockbarx/groupbutton.py", line 1516, in update_state surface = self.icon_factory.surface_update(state_type, force_update=force_update) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/dockbarx/iconfactory.py", line 168, in surface_update surface = self.__do_commands(surface, commands) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/dockbarx/iconfactory.py", line 188, in do_commands surface = f(surface, args) ^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/dockbarx/iconfactory.py", line 421, in command_if surface = self.__do_commands(surface, content) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/dockbarx/iconfactory.py", line 188, in do_commands surface = f(surface, args) ^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/dockbarx/iconfactory.py", line 775, in __command_composite background = self.resize_surface(self.theme.get_surface(bg), w, h) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/dockbarx/iconfactory.py", line 1020, in resize_surface im = im.resize((w, h), Image.ANTIALIAS) ^^^^^^^^^^^^^^^ AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

hashn0n commented 1 year ago

Most likely in your system python library pillow was/is updated to version 10.0.0 or up, in this version of pillow attribute ANTIALIAS was removed as it was in deprecated status for some time already.

I made a patch to fix this however this patch have no logic to detect old version of pillow. `commit 9fde54a204f00b160b9ac59833ecbaa1e519370b Author: hashn0n> Date: Tue Oct 17 01:20:44 2023 +0300

Fix deprecation of attribute Image.ANTIALIAS in Pillow version 10.0.0 to Image.Resampling.LANCZOS

diff --git a/dockbarx/iconfactory.py b/dockbarx/iconfactory.py index f796819..98e2dc0 100644 --- a/dockbarx/iconfactory.py +++ b/dockbarx/iconfactory.py @@ -1017,7 +1017,7 @@ class IconFactory():

 def __resize_surface(self, surface, w, h):
     im = self.__surface2pil(surface)