GIMP Chat
http://gimpchat.com/

default parameters
http://gimpchat.com/viewtopic.php?f=9&t=19639
Page 1 of 1

Author:  ecs1749 [ Mon Oct 04, 2021 1:01 pm ]
Post subject:  default parameters

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).

Author:  ofnuts [ Mon Oct 04, 2021 6:57 pm ]
Post subject:  Re: default parameters

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).

Author:  ecs1749 [ Mon Oct 04, 2021 7:56 pm ]
Post subject:  Re: default parameters

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)

Author:  ofnuts [ Tue Oct 05, 2021 2:16 am ]
Post subject:  Re: default parameters

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.

Author:  ecs1749 [ Tue Oct 05, 2021 2:47 pm ]
Post subject:  Re: default parameters

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.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/