Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tiamed opened this issue Jul 27, 2023 · 1 comment
Open

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

tiamed opened this issue Jul 27, 2023 · 1 comment

Comments

@tiamed
Copy link

tiamed commented Jul 27, 2023

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
Copy link

hashn0n commented Oct 16, 2023

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)
  •    im = im.resize((w, h), Image.ANTIALIAS)
    
  •    im = im.resize((w, h), Image.Resampling.LANCZOS)
       return self.__pil2surface(im)
    

    def __command_print_size(self, surface):
    diff --git a/dockbarx/theme.py b/dockbarx/theme.py
    index fb087b3..3758d8a 100644
    --- a/dockbarx/theme.py
    +++ b/dockbarx/theme.py
    @@ -840,5 +840,5 @@ class DockTheme(GObject.GObject):

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

  •    im = im.resize((w, h), Image.ANTIALIAS)
    
  •    im = im.resize((w, h), Image.Resampling.LANCZOS)
       return self.__pil2surface(im)
    

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants