Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 2:20 am

PythonFu Plugin-writers
How to solve downward compatibility 2.9 (or higher) to 2.8?

Reasons:
1. Name Changes example:
Code:
         pdb.gimp_edit_fill(fill_layer,PATTERN_FILL)    #GIMP 2.8
         #pdb.gimp_edit_fill(fill_layer,FILL_PATTERN)     #GIMP 2.9

Thanks to MQ.

If one (WE!) use this way of notifying needed changes, one could eventually give a notice of how to change a file to a version one needs.
From 2.8 to 2.9:
E.g. in Emacs: Search for #GIMP 2.8, go to beginning of line, insert a # (suitable place), goto start of next line, remove the next first #

Make it a macro and execute as often as needed.

This could naturally wrapped into a Python action file. Emacs commands 'translated' to Python commands.

2. New features in >2.8
Not solvable???

3. ????

Re: plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 5:47 am

Plenty of the most used plugins, in theory should be re-written even for Gimp 2.8

example heal-selection

run Gimp with compatibility off

Code:
gimp --pdb-compat-mode=off


and you get an error even in Gimp 2.8. Development 2.9 versions certainly.

deprecated.jpg
deprecated.jpg (54.87 KiB) Viewed 2929 times


I suspect that even Gimp 2.10 when it arrives will come with compatibility=on.

Re: plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 6:31 am

I do not ask for lower than 2.8 (18), that would probably too much work for a normal Gimp user with some knowledge about plugins :(

Re: plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 7:58 am

I think you might be a bit premature writing code to support 2.9 yet, as it's still fundamentally very changeable.
For example from this week:
https://git.gnome.org/browse/gimp/commit/?id=3307c719663dd3aefb5722ad5cdb7faf03bcfdaf
Where the ranges into the new histogram/threshold tools will change from 0->255 into 0.0->1.0

Kevin

Re: plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 8:01 am

Test the gimp.version variable and set a PATTERN_FILL variable to FILL_PATTERN if >= (2,9,0)

Re: plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 8:06 am

ofnuts wrote:Test the gimp.version variable and set a PATTERN_FILL variable to FILL_PATTERN if >= (2,9,0)


But then what to do for other changes that happen at some indeterminate point in 2.9.5 at commit xxxxx given that the commit identifiers aren't sequentially incrementing values? (and are they accessible from the scheme/Python APIs?)

Re: plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 9:03 am

paynekj, why so pessimistic???

If someone has a plugin wanting to use in 2.9 version but it does not work, does work in 2.8, and if it is ONLY a small change to get it working, see ofnuts comment ...
THAT is reason to start something special for those problems here .

Re: plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 11:32 am

Hi Ofnuts.

Can you put the code on how to properly use "Test the gimp.version" for example, Your plugin:
path-grid-0.1.py
https://sourceforge.net/projects/gimp-path-tools/files/scripts/


In GIMP 2.9.5:
called deprecated procedure 'gimp-image-add-vectors'.It should call 'gimp-image-insert-vectors' instead!

In line 64 and 100 changed
from:
Code:
pdb.gimp_image_add_vectors(self.image, self.path, 0)

to:
Code:
pdb.gimp_image_insert_vectors(self.image, self.path, None, 0)

Re: plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 12:13 pm

Hi MareroQ

I think PKHG missed the point of the post about compatibility.

Yes, Gimp 2.9.5 will fail on many scripts and plugins due to changes in the python syntax

but

Run (or compile) gimp 2.9 with compatibility mode ON "--pdb-compat-mode=on"

gimp29.jpg
gimp29.jpg (176.46 KiB) Viewed 2863 times


Should they be re-writtten if possible, of course they should. In the meantime Gimp 2.9.5 is a great tool and really fun to use.

Re: plugin compatibility Gimp 2.9: downward compatible?

Fri Nov 04, 2016 1:27 pm

MareroQ wrote:Hi Ofnuts.

Can you put the code on how to properly use "Test the gimp.version" for example, Your plugin:
path-grid-0.1.py
https://sourceforge.net/projects/gimp-path-tools/files/scripts/


In GIMP 2.9.5:
called deprecated procedure 'gimp-image-add-vectors'.It should call 'gimp-image-insert-vectors' instead!

In line 64 and 100 changed
from:
Code:
pdb.gimp_image_add_vectors(self.image, self.path, 0)

to:
Code:
pdb.gimp_image_insert_vectors(self.image, self.path, None, 0)


In python you can compare tuples:
Code:
if gimp.version >= (2,9,0):


Calling a deprecated procedure is not an error. The odd-numbered versions emit a warning but do not stop, just use a console dialog to not get stopped by the messages. I won't change my distributed code until 2.10 is out, since there are still 2.6 users around (because the deprecated thing above is deprecated is 2.8 too, you had the same messages in 2.7...).

If you change my code and redistribute it, make it clear that it is your code and that you assume the maintenance of the fork.
Post a reply