Adding icon to procedure

So, poring over the docs, I found something that could add some swag to my scripts, adding an icon. But it doesn’t seem to work:

    def do_create_procedure(self, name):
        print(f'** do_create_procedure({name=!r}) **')
        Gegl.init(None)

        procedure = Gimp.ImageProcedure.new(self, name,
                                            Gimp.PDBProcType.PLUGIN,
                                            procedures[name].execute, None)
        procedure.set_attribution("Ofn","Ofn","2024")
        # create the file
        iconfile=Gio.File.new_build_filenamev(['/tmp/sample.png'])
        # check tha the file exists for Glib: 
        print(f'{iconfile}, exists: {iconfile.query_exists()}')
        procedure.set_icon_file(iconfile)

In Gimp’s console:

<__gi__.GLocalFile object at 0x7959e917b3c0 (GLocalFile at 0x1b670a0)>, exists: True
GIMP-Error: Execution error for procedure 'gimp-pdb-set-proc-icon':
Failed to open file “file:///tmp/sample.png”: No such file or directory

Of course, /tmp/sample.png exists and is readable:

>ll /tmp/sample.png 
-rw-rw-r-- 1 bd bd 9138 Nov  7 18:29 /tmp/sample.png

Any ideas?

There was a bug in code. We don’t even set icons for any of the core plug-ins.

Anyway I fixed this in latest master code. Right now it seems like it is only shown in menus. Here is for instance what it looks like (after my fix), I set it to a random core plug-in (blinds) with Wilber icon:

I’ve created a report so that we can look in the future for better using of this icon. At the very least, it should be visible in the “action search” widget. And maybe in a desktop/OS where the plug-in window would be considered a separate window, it could use the icon as window/process icon:
More use of the plug-in procedure icon (#12311) · Issues · GNOME / GIMP · GitLab

Nice, although shouldn’t the icon go in the space left for it to the left of the text, so tthat the word Blinds aligns exactly with the other menu items?

Wondered about this too. I think I’d need to look at the code to know if this space on the left is where the icons are supposed to be (or is just padding in the theme).

We had an environment variable (GIMP_ICONS_LIKE_A_BOSS) which was overriding the new GTK logic of not showing icons in menus anymore, and I was hoping to test with it, but it doesn’t seem to work anymore. It may be related to my GimpAction port which also included some custom GimpMenu code. :person_shrugging:

Then once the code is checked and if we confirm if it’s a bug or not, then if it’s a bug, it can be fixed. If confirmed it’s not a bug, we can go on a second stage, UX discussions, to decide how things should work regarding icons.

Anyway… some more stuff to look at, discuss and so on…

Thanks, will pull the code and check.

OK, appears fixed.

image

But I agree with Liam, this should probably be in the space on the left.

Hmm. Looks like the “wrong” icon is replaced. In the shortcut editor the plugin has the regular icon, and on other entries the icons are exactly what I would expect to show in the space Liam mentioned:

Hence the report I wrote.

If you mean that these icons should be shown in menus, then we are back at the old discussion about “should we just follow GTK or override their decision?”. The fact is that GTK has decided (that’s a pretty old decision, from 2013 and that included most of 2.8 series time frame and all of 2.10) to drop icons in menus. We have never tried to override this decision (we had an environment variable for override, but nothing really people-facing, more for testing/development), mostly because I don’t think we had a clear opinion about this.

Eventually we could get back from this decision if we have a proper UX discussion with data to back it on. I.e. not just a “I think icons are better for usability because I like pretty images”. It’s even more an interesting discussion to have as it looks like GTK is slowly getting away from menus, while we clearly are not. With GIMP 3, I already had to implement our own menu subclass and generation code in order not to lose tooltips (as GTK devs came to consider tooltips are not a good idea in menus unfortunately, which is a decision I have a very hard time to understand). And apparently when we’ll move on to GTK4, we’ll have to write even more custom code as they seem to have removed most menu widgets (apparently now the “hamburger menu” is all the rage, but certainly not for us, at least not for the main menu). So since menus may get more and more fully GIMP-only code, making more decisions on our own may be the way to go, and much easier than it used to be.

So yeah I wouldn’t mind having a discussion and proper usability testing because it’s important to do this kind of decisions right. And maybe we’ll bring back icons.

But for the time being, we should stick to no icons by default as has been the norm for the last 10 years, and in this world, it makes sense to only show icons of third-party plug-ins which decided to explicitly set one for themselves.
Because not much is as bad, UX-wise, than constantly changing a UX decision from one version to another because we aren’t sure what we want.

1 Like

If you mean that these icons should be shown in menus,

No, I means this is where I would expect the icons to show, if some stylistic decision or configuration is made to display them. In understand that my swag could be someone else’s clutter (however in 2.10 these icons where quite useful to distinguish GEGL (G icon) from legacy things (gears icon), but these show elsewhere (for instance in the dialog header)).

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.