#1015901 ocrfeeder-cli is completely broken: AttributeError: type object 'IconSize' has no attribute 'SMALL_TOOLBAR'

#1015901#5
Date:
2022-07-23 14:30:32 UTC
From:
To:
ocrfeeder-cli doesn't work at all:
$ ocrfeeder-cli -h
/usr/lib/python3/dist-packages/ocrfeeder/util/lib.py:25: PyGIWarning:
Gtk was imported without specifying a version first. Use
gi.require_version('Gtk', '4.0') before import to ensure that the right
version gets loaded.
  from gi.repository import Gtk
Traceback (most recent call last):
  File "/usr/bin/ocrfeeder-cli", line 33, in <module>
    from ocrfeeder.util.graphics import getImageResolution,
convertMultiImagesInList
  File "/usr/lib/python3/dist-packages/ocrfeeder/util/graphics.py", line
20, in <module>
    from .lib import getNonExistingFileName
  File "/usr/lib/python3/dist-packages/ocrfeeder/util/lib.py", line 35,
in <module>
    def getIconOrLabel(icon_name, label_text, icon_size =
Gtk.IconSize.SMALL_TOOLBAR):
AttributeError: type object 'IconSize' has no attribute 'SMALL_TOOLBAR'

#1015901#10
Date:
2024-07-10 16:43:20 UTC
From:
To:
Hello,

Changing the line to

def getIconOrLabel(icon_name, label_text, icon_size =
Gtk.IconSize.NORMAL):

fixes the breaking error. It seems that gtk4 no longer has the
'SMALL_TOOLBAR' constant. Being a cli tool the icon_size does not seem
to matter anyhow.

Have a nice day!