It is currently Fri Sep 25, 2026 7:20 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: deleting a gradient created inside a script
PostPosted: Wed May 20, 2015 3:13 pm  (#21) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
dinasset wrote:
edit: I inserted the "disable" stmt immediately after the creation and the "enable" immediately before the disply-new

hope it's correct

'Tis.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: deleting a gradient created (SOLVED! thanks to JT+SG)
PostPosted: Wed May 20, 2015 4:25 pm  (#22) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
Glad you got your script to work Diego, but I think we've still got a nasty bug here somewhere.
It doesn't matter what a script or plugin does, it should not cause the Gimp app to crash.

If I start Gimp from the task bar as normal and run the script, when it crashes Gimp locks up completely - the Gimp window greys-out and about 30 seconds later the laptop's fan kicks-in, indicating that the processor is working very, very hard doing nothing useful.
But if I start Gimp from a terminal window, when it crashes the Gimp window aborts and I get:
(palette-to-gradient.py:13095): LibGimpBase-WARNING **: palette-to-gradient.py: gimp_wire_read(): error

(script-fu:13030): LibGimpBase-WARNING **: script-fu: gimp_wire_read(): error
Segmentation fault (core dumped)
ie. something has provoked the Gimp app to segfault (which of course it should not do).

I also notice that when it doesn't crash, I often get one of these 2 messages on the console at about the time the script starts the python-fu-wrap-map-bucket:
either: invalid unclassed pointer in cast to 'GimpTaggedInterface'
or: invalid uninstantiatable type '(null)' in cast to 'GimpTaggedInterface'


Top
 Post subject: Re: deleting a gradient created (SOLVED! thanks to JT+SG)
PostPosted: Wed May 20, 2015 11:40 pm  (#23) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
Hi, Jonathan, I didn't reply to your comment because for me it was time for sleeping, but this morning I opened Gimp-chat just because I wanted to ask you and all gurus around whether that behaviour was in any case "acceptable" (i.e. the push/pop influences the behaviour of a script the second time is called? even if there is no use at all of the starting active gradient?).
So, I'm happy you underlined the possible presence of a nasty bug, somewhere.
Curious to see whether you succeed in finding where.
BTW I now put a qm in the title (solved?).

_________________
"Where am I ?"


Top
 Post subject: Re: deleting a gradient created (SOLVED?) (thanks to JT+SG)
PostPosted: Wed May 20, 2015 11:48 pm  (#24) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
BTW Jonathan, what is your opinion on the other aspect I called "inconsistency" about the functionality of the the "border select"?
I think that either the API should provide the same parameters as the online or -at least!- the default behaviour should be the same (online it creates a selection, via API it does not when called after a "selection all").
You have certainly noticed that in my scrtipt I was obliged NOT to use the same command used online, but to replace it with the "shrink + invert" sequence of statements.
Don't you think that a "fix" of the API could be requested?

_________________
"Where am I ?"


Top
 Post subject: Re: deleting a gradient created (SOLVED?) (thanks to JT+SG)
PostPosted: Thu May 21, 2015 1:40 pm  (#25) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
I notice you are passing a 'dimension' argument to plug-in-smooth-palette whereas the plug-in is expecting a 'ntries' argument. This parameter appears to specify something along the lines of Newton-Raphson iterations and should the argument be very a large value, could result in extremely long delays (the default value is "50").

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: deleting a gradient created (SOLVED?) (thanks to JT+SG)
PostPosted: Thu May 21, 2015 2:08 pm  (#26) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
thanks Saul,
the "dimension" is normally a value around 100 (dimension of the source square for the colours, [W+H)/25], not huge, but certainly bigger than 50.
What do you suggest? To put a fixed value of 50?

_________________
"Where am I ?"


Top
 Post subject: Re: deleting a gradient created (SOLVED?) (thanks to JT+SG)
PostPosted: Fri May 22, 2015 1:08 pm  (#27) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
dinasset wrote:
I think that either the API should provide the same parameters as the online or -at least!- the default behaviour should be the same (online it creates a selection, via API it does not when called after a "selection all").
You have certainly noticed that in my scrtipt I was obliged NOT to use the same command used online, but to replace it with the "shrink + invert" sequence of statements.
Don't you think that a "fix" of the API could be requested?

In general it is not necessary for the PDB API to match the interface dialogs. There are several instances where the user interface offers options not directly accessible in the PDB API.

Sometimes the "inconsistency" is caused by the nature of the option being interactive. For example, "Show preview" doesn't affect what the filter does, only what is shown in the dialog. There are also interface elements that are conveniences provided for the user. For example, the "x/2, y/2" options in the layer offset dialog. Or the "Lock thresholds" option in the Color Exchange filter. Such options have an effect on what the filter does, but are easily accomplished by simple calculations of the relevant existing parameters. If these options were available in the API, the API would have more arguments, be more complicated, and need to handle more error conditions.

Once one accepts that excluding such "convenience" options from the API is sensible, it is not that much of step to consider how prudent it is to simplify the API by restricting options that are easily accomplished as a separate operation within the plug-in. For example, the Add Layer Mask dialog has an "Invert Mask" option while 'gimp-layer-create-mask' does not -- yet it would be trivial for a plug-in to achieve the same result by performing a 'gimp-invert' after creating the mask. Similarly for the selection border operation, it is pretty trivial for a script to perform a 'gimp-threshold' on the selection after the bordering has been performed to obtain the same result as unchecking the "Feather border" box in the dialog.

Equally important as keeping the API simple is the issue of backwards compatibility. Modifying the API of a PDB function necessitates revising all existing scripts/plug-ins that used that interface so they will work with the updated API. This is far from desirable and there is a firm policy* against it. It is acceptable to add a new PDB procedure that uses the revised API (e.g., gimp-layer-scale-full, gimp-drawable-mask-intersect) but then the original procedure is still retained, with the same name and arguments, so that existing scripts/plug-ins will continue to behave properly.

Note that there is no policy against modifying a plug-in's dialog interface, only its PDB API. While drastic changes in the user interface are typically discouraged, users can readily adapt to new or changed options. Over the years it has not been uncommon for dialogs to be enhanced with additional options ("center", "monochrome", "keep luminance", "feather border", etc). These enhancements did not affect the PDB API of existing functions and new functions were rarely deemed necessary.

From a scripting standpoint, there is no actual reason to even have a border selection PDB procedure as the operation can be readily accomplished with just a few existing functions (selection grow/shrink, combine masks, etc). The only reason to have the procedure in the PDB is to support the menu command. Given this, it is highly unlikely that a new procedure would be accepted just so that its API matches the user interface dialog.


* GNU policy is that API changes will remain backwards compatible within a major version. If it were deemed that the API should change in an incompatible manner, such a change could only be implemented when GIMP 3.0 comes out -- GIMP 2.10 is expected to run all previously written 2.x plug-ins (otherwise it is considered a bug). Unfortunately, the GIMP project has not been in 100% compliance with this policy.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: deleting a gradient created (SOLVED?) (thanks to JT+SG)
PostPosted: Fri May 22, 2015 2:03 pm  (#28) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
...hence some incorrigible optimist -like me- can only expect in a future the release of an API called "gimp-selection-border-full" which: has all the parameters the interactive plug-in has and is set to operate in default mode having the identical behaviour of the interactive plug-in....
(dreamland? who knows...)

_________________
"Where am I ?"


Top
 Post subject: Re: deleting a gradient created (SOLVED?) (thanks to JT+SG)
PostPosted: Sat May 23, 2015 3:34 pm  (#29) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
Going back to the original bug, the basic problem is simply deleting the currently-selected gradient.
If you do it manually from the <Gradients> dialog, it works okay, but if you do it from a Script-Fu Gimp gets a little bit confused. And if you open/create an image between each iteration, Gimp will eventually crash.

The problem can be avoided simply by selecting a different gradient (or popping the caller's context) before deleting the gradient.

Reported as a bug:
https://bugzilla.gnome.org/show_bug.cgi?id=749777


Top
 Post subject: Re: deleting a gradient created (SOLVED?) (thanks to JT+SG)
PostPosted: Sat May 23, 2015 11:47 pm  (#30) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
thanks Jonathan!
I didn't read your position on border selection (I got Saul's position -to which I replied with a "hope"-, but not yours)

_________________
"Where am I ?"


Top
 Post subject: Re: deleting a gradient created (SOLVED?) (thanks to JT+SG)
PostPosted: Mon May 25, 2015 3:29 pm  (#31) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
dinasset wrote:
...hence some incorrigible optimist -like me- can only expect in a future the release of an API called "gimp-selection-border-full" which: has all the parameters the interactive plug-in has and is set to operate in default mode having the identical behaviour of the interactive plug-in....
(dreamland? who knows...)


Write it and submit it... bit IMHO it is pointless. The basic idea of an API is to make it possible to achieve all the functionality, as efficiently as possible. But APIs with few simple and focused functions that don't require a whole raft of parameters are more efficient than those with plethoric functions, if only because programmers can memorize them. The effort is saves *you* to write your little bit of code is offset by the effort for all other programmers to figure out the added complexity you wanted when they write their code.

_________________
Image


Top
 Post subject: Re: deleting a gradient created (SOLVED?) (thanks to JT+SG)
PostPosted: Sat May 30, 2015 7:08 pm  (#32) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
Bug fixed in master, thanks to mitch.

https://bugzilla.gnome.org/show_bug.cgi?id=749777


Top
 Post subject: Re: deleting a gradient created (SOLVED) (thanks to JT+SG)
PostPosted: Sun May 31, 2015 9:48 am  (#33) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
Many thanks Jonathan (for submitting the detailed request) and Mitch (for solving the issue).
Thread SOLVED

_________________
"Where am I ?"


Top
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group