It is currently Tue Jul 02, 2024 8:33 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: default parameters
PostPosted: Mon Oct 04, 2021 1:01 pm  (#1) 
Offline
GimpChat Member

Joined: Oct 10, 2014
Posts: 36
It seems the GIMP Python functions do not accept default parameters. I try to invoke a number of the methods and it insists I pass down all the parameters.

If that's true, it would be unfortunate. I would have to look up the default parameters because a lot of them isn't obvious what their default values should be (the Browser is not very clear in many of the cases and the UI is often out of sync with the browser).


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: default parameters
PostPosted: Mon Oct 04, 2021 6:57 pm  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
There are no default parameters (actually, there is one for the runmode, as a keyword parameter, as done in python for parameters with default values, but you never use it). So, yes, you have to look up parameters (in the Python console, hit the "Browse..." button and all the doc is there).

There is neither a one-to-one relationship between UI actions and API calls. Many UI actions require several API calls (the oppoiste is sometimes true, too).

_________________
Image


Top
 Post subject: Re: default parameters
PostPosted: Mon Oct 04, 2021 7:56 pm  (#3) 
Offline
GimpChat Member

Joined: Oct 10, 2014
Posts: 36
ofnuts wrote:
There are no default parameters (actually, there is one for the runmode, as a keyword parameter, as done in python for parameters with default values, but you never use it). So, yes, you have to look up parameters (in the Python console, hit the "Browse..." button and all the doc is there).

There is neither a one-to-one relationship between UI actions and API calls. Many UI actions require several API calls (the oppoiste is sometimes true, too).


That makes it unnecessarily hard. I am building my own wrapper and as time go on, I will end up with my own set of "easy" wrappers.

amount=1.0
radius=0.5
myWaveletSharpen(image, drawable, amount, radius)

saturation=10
myHueSaturation(drawable,saturation)


Top
 Post subject: Re: default parameters
PostPosted: Tue Oct 05, 2021 2:16 am  (#4) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
ecs1749 wrote:
ofnuts wrote:
There are no default parameters (actually, there is one for the runmode, as a keyword parameter, as done in python for parameters with default values, but you never use it). So, yes, you have to look up parameters (in the Python console, hit the "Browse..." button and all the doc is there).

There is neither a one-to-one relationship between UI actions and API calls. Many UI actions require several API calls (the oppoiste is sometimes true, too).


That makes it unnecessarily hard. I am building my own wrapper and as time go on, I will end up with my own set of "easy" wrappers.

amount=1.0
radius=0.5
myWaveletSharpen(image, drawable, amount, radius)

saturation=10
myHueSaturation(drawable,saturation)


It doesn't try to be hard but to be general. Your default values are not necessarily mine. Writing "helper" functions or defining constants for things you use often is a fairly basic concept.

_________________
Image


Top
 Post subject: Re: default parameters
PostPosted: Tue Oct 05, 2021 2:47 pm  (#5) 
Offline
GimpChat Member

Joined: Oct 10, 2014
Posts: 36
ofnuts wrote:
ecs1749 wrote:
ofnuts wrote:
There are no default parameters (actually, there is one for the runmode, as a keyword parameter, as done in python for parameters with default values, but you never use it). So, yes, you have to look up parameters (in the Python console, hit the "Browse..." button and all the doc is there).

There is neither a one-to-one relationship between UI actions and API calls. Many UI actions require several API calls (the oppoiste is sometimes true, too).


That makes it unnecessarily hard. I am building my own wrapper and as time go on, I will end up with my own set of "easy" wrappers.

amount=1.0
radius=0.5
myWaveletSharpen(image, drawable, amount, radius)

saturation=10
myHueSaturation(drawable,saturation)


It doesn't try to be hard but to be general. Your default values are not necessarily mine. Writing "helper" functions or defining constants for things you use often is a fairly basic concept.


Obviously. That's why we define parameters with a default value but can be overwritten with whatever value you wish to use. There are plenty of GIMP parameters I have no clue what they do (and most likely don't care). Most of them do come with a default value recommended by the plugin author. I don't ever change them anyway. So, why not just

def myHueSaturation(drawable,saturation,hue_range=0,hue_offset=0,lightness=0):
pdb.gimp_hue_saturation(drawable, hue_range, hue_offset, lightness, saturation)
return

so I can simply do:

myHueSaturation(drawable,saturation=10)

There are literally hundreds and thousands of GIMP functions and God know how many parameters. I am sure it's too late now to do anything about it.


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) GMIC no longer puts parameters used into layer name

4

No new posts Attachment(s) Default to inches instead of pixels

3

No new posts Attachment(s) GIMP's Default Patterns put to use

11

No new posts Scripts default to New Window

4

No new posts Are gimp default patterns can be use in anycommercial using ?!

1



* Login  



Powered by phpBB3 © phpBB Group