I already saw all those calls, I think I see how to modify my design to make it work. Thanks for the help! I am going to do some hacking and get another commit together. Thanks, wt On Sat, Sep 7, 2013 at 5:07 AM, Joao S. O. Bueno <gwidion@xxxxxxxxxx> wrote: > On 7 September 2013 03:20, Warren Turkal <wt@xxxxxxxxxxxxxxxx> wrote: > > On Fri, Sep 6, 2013 at 11:20 AM, Joao S. O. Bueno <gwidion@xxxxxxxxxx> > > wrote: > >> > > From the above comment, I assume that what I want to do will be hard. Any > > pointers on what would need to change to make it more useful? I'd be > happy > > to try to do some of the work if it ends in making possible what I want > to > > do. > > Let me say it again: > The "string" IS the Pallete as far as any code relating to GIMP via PDB is > concerned. It works more like an ID than as a name. And the PDB is > quite complete in what relates to Palette > manipulation. > > > Check this Python-fu Session - it creates a new palette and adds entries > to it, > just as you want: > > > GIMP 2.9.1 Python Console > Python 2.7.3 (default, Jul 24 2012, 11:41:40) > [GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] > >>> > >>> pal_id = "warren palette" > >>> > >>> pal_id = pdb.gimp_palette_new(pal_id) > >>> print pal_id > warren palette > >>> pdb.gimp_palette_add_color(pal_id, "black", (0,0,0)) > Traceback (most recent call last): > File "<input>", line 1, in <module> > error: procedure not found > >>> pdb.gimp_palette_add_entry(pal_id, "black", (0,0,0)) > 0 > >>> pdb.gimp_palette_add_entry(pal_id, "golden yellow", (255,230,0)) > 1 > >>> pdb.gimp_palette_add_entry(pal_id, "pinkish", (255,200,150)) > 2 > >>> > > And voilá- when I look in the Palette's dialog, in GIMP, the new > Palette _is there_, > with all three colors, fully featured as any other GIMP's palette > and with all the export options enabled for it. > > Just take care with the line that goes: > >>> pal_id = pdb.gimp_palette_new(pal_id) > > It is important to store the ID as the return value of the call to > gimp_palette_new, > because it the palette name you attempt to create already exists, GIMP will > automatically modify the name with a numbering scheme - and the modified > name > will be the ID for that pallete. > > In practice, a Python Script manipulating Palletes never needs to do > anything with the > value passed around as a PF_PALETTE - (if it is a plug-in to > manipulate them in place, that is) - > it is just passed into the plug-in, and it is iused as an ID for all > Palette related calls. > > BTW, it just occurred me that you might not yet be aware of the > procedure-browser functionality: > in GIMP, just open help->procedure browser - now type "palette" in the > search box - > there you are, all palette related calls available for your plug-in. > > > > > > > >> > >> But having the string passed around between plug-ins works as nicely > >> as it can be - I had written some palette creating/exporting a few > >> years ago. > > > > > > Passing around a string doesn't really suit the use case I want to > > implement. I basically want the plugin to be able to return a palette > that > > the core code registers if the running of the plugin is successful. > > > > Are there any pointers for doing this kind of thing that I should be > looking > > at? > > > > Thanks, > > wt > _______________________________________________ gimp-developer-list mailing list List address: gimp-developer-list@xxxxxxxxx List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list