Python plugin registration: choosing between a "closed" set of strings

ForumsFor GIMP developers (read-only) ► Python plugin registration: choosing between a "closed" set of strings

Sent: 2010-09-07 16:53:51 UTC (over 1 year ago)

From: Ofnuts

Python plugin registration: choosing between a "closed" set of strings

I'd like the user to select a "variant" of a plugin (among 3 to 5
ones). I would normally do so with a R/O drop-down box displaying the
names. Is there a way to do so using the right type of parameter type in
the registration (couldn't find it)?

Otherwise what would be the recommended way to do it? Define separate
plugins for each variant?

Btw, can I define several plugins (ie, register() calls) in one single
Python file? Or what is the best way (ie, easier to install for the
end-user) to share code between Python plugins?

--
Ofnuts

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2010-09-07 20:52:20 UTC (over 1 year ago)

From: Sven Neumann

Python plugin registration: choosing between a "closed" set of strings

On Tue, 2010-09-07 at 16:53 +0200, Ofnuts wrote:
> I'd like the user to select a "variant" of a plugin (among 3 to 5
> ones). I would normally do so with a R/O drop-down box displaying the
> names. Is there a way to do so using the right type of parameter type in
> the registration (couldn't find it)?

You should consider to avoid gimpfu for this and write a real GIMP
plug-in in Python using a user interface built in PyGTK. The
auto-generated UI of gimpfu is really just suited for very simple
scripts. And there is a lot of awkwardness in gimpfu. It tries to make
things easy for you, but then it gets into your way and you end up
spending time to find workarounds for that.

Sven

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2010-09-07 20:52:51 UTC (over 1 year ago)

From: Jerry Baker

Python plugin registration: choosing between a "closed" set of strings

If your 'variants' are similar you could just use PF_OPTION and change
your variables/options with an if/else...

Or you can define different functions and register them separately in
the same file. The 'palette-to-gradient.py' file in the source does
this...
http://git.gnome.org/browse/gimp/tree/plug-ins/pygimp/plug-ins/palette-to-gradient.py

On 09/07/2010 10:53 AM, Ofnuts wrote:
> I'd like the user to select a "variant" of a plugin (among 3 to 5
> ones). I would normally do so with a R/O drop-down box displaying the
> names. Is there a way to do so using the right type of parameter type in
> the registration (couldn't find it)?
>
> Otherwise what would be the recommended way to do it? Define separate
> plugins for each variant?
>
> Btw, can I define several plugins (ie, register() calls) in one single
> Python file? Or what is the best way (ie, easier to install for the
> end-user) to share code between Python plugins?
>
> --
> Ofnuts
>
>

_______________________________________________
> Gimp-developer mailing list
> Gimp-developer@lists.XCF.Berkeley.EDU
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2010-09-07 21:10:01 UTC (over 1 year ago)

From: Ofnuts

Python plugin registration: choosing between a "closed" set of strings

On 07/09/2010 20:52, Sven Neumann wrote:
>
> On Tue, 2010-09-07 at 16:53 +0200, Ofnuts wrote:
>> I'd like the user to select a "variant" of a plugin (among 3 to 5
>> ones). I would normally do so with a R/O drop-down box displaying the
>> names. Is there a way to do so using the right type of parameter type in
>> the registration (couldn't find it)?
>
> You should consider to avoid gimpfu for this and write a real GIMP
> plug-in in Python using a user interface built in PyGTK. The
> auto-generated UI of gimpfu is really just suited for very simple
> scripts. And there is a lot of awkwardness in gimpfu. It tries to make
> things easy for you, but then it gets into your way and you end up
> spending time to find workarounds for that.

Still a rather simple script so far, parameter-wise, so python-fu is
sufficient, especially given Jerry's answers... but I'll keep your
suggestion in mind for when I get more proficient with all this.

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2010-09-07 21:14:07 UTC (over 1 year ago)

From: Ofnuts

Python plugin registration: choosing between a "closed" set of strings

On 07/09/2010 20:55, Jerry Baker wrote:

PF_OPTION is what I had in mind, without finding it described. I googled
it after you netioned itn and found a nice python-fu sample with all
parameters types... I wish I had found it earlier...

Thanks for confirming my guess that multiple registration could work. It
is therefore a serious option, especially since some variants require
less parameters.

> If your 'variants' are similar you could just use PF_OPTION and change
> your variables/options with an if/else...
>
> Or you can define different functions and register them separately in
> the same file. The 'palette-to-gradient.py' file in the source does
> this...
> http://git.gnome.org/browse/gimp/tree/plug-ins/pygimp/plug-ins/palette-to-gradient.py
>
> On 09/07/2010 10:53 AM, Ofnuts wrote:
>> I'd like the user to select a "variant" of a plugin (among 3 to 5
>> ones). I would normally do so with a R/O drop-down box displaying the
>> names. Is there a way to do so using the right type of parameter type in
>> the registration (couldn't find it)?
>>
>> Otherwise what would be the recommended way to do it? Define separate
>> plugins for each variant?
>>
>> Btw, can I define several plugins (ie, register() calls) in one single
>> Python file? Or what is the best way (ie, easier to install for the
>> end-user) to share code between Python plugins?
>>
>> --
>> Ofnuts
>>
>>

_______________________________________________
>> Gimp-developer mailing list
>> Gimp-developer@lists.XCF.Berkeley.EDU
>> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
>

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Welcome!


Lost password?

Not a member? Sign up!

Random tutorials | Latest tutorials

  1. Cool glowing text Cool glowing text 40
  2. Creating 3D icons Creating 3D icons 35
  3. Create an amazing electricity effect on any object! Create an amazing electricity effect on any object! 6
  4. Create the Dragan effect Create the Dragan effect 2

Latest comments

But I just have 1 more prob (bear with me) I am really having troub... (2 days ago in [AVATAR] Become a real Na'Vi using GIMP!)

I got it to work :) I had to close the image and restart it. I thin... (2 days ago in Create cool rifts with translucent lights!)

there was a second and 3rd release of 2.6.12. we included the lates... (2 days ago in Last stable 2.6 release: 2.6.12 has arrived)

Poll

Is GIMP an adequate application for you to create printed graphics like flyers, advertisments etc?

Latest forum activities

Your Ad Here

facts & numbers

gimpusers.com RSS feed

48 identi.ca followers
750 Twitter followers

powered by bitfire it services