@John:
I don't really see any reason why this shouldn't be done in Python!
I've had a look at your Color Grading script and, as far as I can see, all you want to do is to update your existing "in-situ" preview (in the image stack) whenever the user makes any changes to the settings in the "Color Wheels" tab or loads a new profile. And that just means connecting the appropriate "signals".
So as a quick test I've hacked your script thus:
self.shlev_spinner = self.make_slider_and_spinner(0, -100, 100, 1, 1, 0)
self.midlev_spinner = self.make_slider_and_spinner(0, -100, 100, 1, 1, 0)
self.highlev_spinner = self.make_slider_and_spinner(0, -100, 100, 1, 1, 0)
self.satlev_spinner = self.make_slider_and_spinner(0, -100, 100, 1, 1, 0)
self.shlev_spinner['spinner'].connect("value-changed", self.preview) #***JT***
self.midlev_spinner['spinner'].connect("value-changed", self.preview) #***JT***
self.highlev_spinner['spinner'].connect("value-changed", self.preview) #***JT***
self.satlev_spinner['spinner'].connect("value-changed", self.preview) #***JT***
This just connects signals from the slider/spinners to invoke your preview display routine each time a value is changed.
And it works!
At the moment, of course, the preview routine works on a toggle basis, alternately removing the current preview (if there is one) and creating a new preview. So, connecting signals as above, the preview is only displayed on alternate clicks, but with a little re-arrangement I think you can get the immediacy of a "live-updated" preview that you wanted.
The net result is basically the same as I was going to provide as a C template and works at very much the same speed (which is determined by the Gimp operations).
If you want to try this approach, a few other thoughts:
- You'll have to connect signals for the Color Wheels and "Load Config" button as well;
- I think you should include an "update preview live" checkbutton so that the updating can be disabled by the user, especially on large images;
- I think you may have to do something a bit different with the undo history (though I haven't looked at this in any great detail yet) ..at the moment it's generating two undo items for every preview change ..that could amount to an awful lot if the user keeps playing around with the settings!
Cheers.