Re: [Gimp-developer] [At GIMP 3 era, The Python Script writing style]



Hi!

On Tue, Aug 3, 2021 at 5:49 AM ShiroYuki Mot <shiroyuki mot mail gmail com>
wrote:

Dear Jehan Pagès, Thanks for your reply even though you are busy.

We, the beginners of Python writer feel it is so difficult.
I didn't know the devel-docs/GIMP3-plug-in-porting-guide/ folder.
(Windows users got only executables...)
Reasons for feeling difficult are that gi module firstly needed and
plug-ins dialog/registration definitions changed.
I said this situation is a "new stage".
There doesn't exist the explanation of a 'new' generation of using GObject.
So many beginner level users (like me) will be confused.
Many GIMP Python/script-fu users are writing code by
imitating/copying-pasting, not at the developer level...
And there are not many samples...

The new API itself is not so difficult, I think so. This is because the
documents are carefully supported. ;)

Also as said, porting is actually very quick. Some people already started
(there are a bunch of plug-ins with a GIMP 2.99.x version; even G'MIC can
work on 2.99.x). The base logics of our plug-in stayed quite similar. So
it's nothing too hard.


Sure! ;)

 And one more Question.
foggify.py is stored in the same named sub directory.
If we write a private script, is it better to be stored in a named sub
diretory at users 'plug-ins' directory?


In GIMP 3, it is mandatory to have all plug-ins in an identically named
folder as the main script. This is to avoid making a mess in the root
plug-ins/ directory, and mixing files between plug-ins (which results in
DLL hell on Windows especially, for instance).

Jehan




2021年8月3日(火) 2:29 Jehan Pagès <jehan marmottard gmail com>:

Hi!

On Mon, Aug 2, 2021 at 3:15 PM ShiroYuki Mot <
shiroyuki mot mail gmail com> wrote:

Dear Jehan Pagès, Thanks for reply.

Mostly yes. There will probably be some more changes so you will have to
change more from time to time until GIMP 3 release (when it will be
finalized).


 Basically, the current scripting style is on a new stage, isn't it?


I don't really understand what you mean by "new stage". 🙂

We can learn the basic writing from this.

Not really. This is on my TODO list to write proper docs. We have some
starts in the devel-docs/GIMP3-plug-in-porting-guide/ folder in the
repository, but nothing yet which you can really call a proper
"documentation".


 Maybe, because of the difference from GIMP 2.10 scripting, many people
will need the guide to write/rewrite.
I think that the porting will be not so easy...


Most plug-ins can be actually ported in less than 30 min (let's say 2 or
3 hours for someone who does this for the first time by just following a
tutorial; nothing insurmountable). I say it by experience from having
ported a huge portion of core plug-ins.


I feel that the hurdle is higher than before when it was possible to
replace api name/enumeration name.
Even now, there is a lot of talk that old plug-ins don't work


Our API has been stable for a long long time. Actually the cases of
broken plug-ins which we can see here and there are plug-ins which have
been basically abandoned/unmaintained for years and years. In such case,
first there were deprecation warning triggering popups then much later,
functions were removed. So we are talking plug-ins which have not been
updated for like 10 or 15 years!


, but with GIMP 3, many more/most will be wiped out.


Sure. We did a choice of going with a cleaner API. Sometimes I wonder if
that was not a mistake and we should have tried compatibility as much as
possible. On the other hand, we would have lost so much. In any case, it's
too late now. We are not going to redo everything.

Also as said, porting is actually very quick. Some people already started
(there are a bunch of plug-ins with a GIMP 2.99.x version; even G'MIC can
work on 2.99.x). The base logics of our plug-in stayed quite similar. So
it's nothing too hard.

And once again, same as the v2 API has been around for more than 15
years, I expect the v3 API to stay for quite some time. We are not planning
to break API all the time. 😛



It's never premature to write docs. Sure there will be changes, and
sure it means some of the docs will be wrong and need to be changed before
release. But better start early and fix as we go than write dozens of pages
of documentation at the last minute.

This is actually a good way to contribute to GIMP with other than code.
The few random files we have in devel-docs/GIMP3-plug-in-porting-guide/
were written by several people already. If you port your own plug-ins and
want to write documentation, do not hesitate. Right now it's a mess because
everyone wrote a bit of what they wanted, but with time and more people
giving time into it, the documentation will organize itself. 🙂


 Let's port! Thanks.

Cool! 👍

Jehan


PS;
I tried writing template from GIMP 2.99.6 Foggify.py. So, attached.
(Maybe, including many wrong points. UTF-8 CrLf)


2021年8月2日(月) 19:08 Jehan Pagès <jehan marmottard gmail com>:

Hi!

On Mon, Aug 2, 2021 at 9:38 AM ShiroYuki Mot via gimp-developer-list <
gimp-developer-list gnome org> wrote:

It is the Question (same as
https://gitlab.gnome.org/GNOME/gimp/-/issues/7114)
Please teach me.

At the next coming 2.99.8, the Python script will avoid the crash. (See
#7106 (closed))
(https://gitlab.gnome.org/GNOME/gimp/-/issues/7106)
So, One question I have. It is not the issue!.

Can I rewrite my own Python scripts by referring to the foggify.py
(official one) writing style bundled with GIMP 2.99.8?


Mostly yes. There will probably be some more changes so you will have
to change more from time to time until GIMP 3 release (when it will be
finalized).

Because of I think that the scripting is so far from GIMP 2.10 era...
(Too
high hardles / So difficult)


It's actually simpler in many ways, but yeah it changed (though bases
concepts still are the same). That's a fact. Also the Python binding used
to have some of the new features already (like dialog generation) which
makes the improvements less visible for people who were already making
Python plug-ins.

Are there any points to be aware of?
Or does the documentation exist for GIMP 3 scripting?


Not really. This is on my TODO list to write proper docs. We have some
starts in the devel-docs/GIMP3-plug-in-porting-guide/ folder in the
repository, but nothing yet which you can really call a proper
"documentation".

Is it premature? (Is it better to wait for a while? Will some change
come?)


It's never premature to write docs. Sure there will be changes, and
sure it means some of the docs will be wrong and need to be changed before
release. But better start early and fix as we go than write dozens of pages
of documentation at the last minute.

This is actually a good way to contribute to GIMP with other than code.
The few random files we have in devel-docs/GIMP3-plug-in-porting-guide/
were written by several people already. If you port your own plug-ins and
want to write documentation, do not hesitate. Right now it's a mess because
everyone wrote a bit of what they wanted, but with time and more people
giving time into it, the documentation will organize itself. 🙂

Jehan

_______________________________________________
gimp-developer-list mailing list
List address:    gimp-developer-list gnome org
List membership:
https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list



--
ZeMarmot open animation film
http://film.zemarmot.net
Liberapay: https://liberapay.com/ZeMarmot/
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot



--
ZeMarmot open animation film
http://film.zemarmot.net
Liberapay: https://liberapay.com/ZeMarmot/
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot



-- 
ZeMarmot open animation film
http://film.zemarmot.net
Liberapay: https://liberapay.com/ZeMarmot/
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]