Re: [Gimp-developer] A question about python gimpfu - home folder
On Fri, Oct 10, 2008 at 12:24 AM, Chris Mohler [EMAIL PROTECTED] wrote: Hi list, I've been mucking around with a GIMP plugin a la python, and I have a question: Is there a method to discover the GIMP version and/or ~/.gimp folder that works across platform (from python)? And (in the interest of being a pest) a follow-up: Can I attach a plug-in to the Palettes sub-menu? Thanks, Chris ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
Hi, On Fri, Oct 10, 2008 at 4:42 PM, Chris Mohler [EMAIL PROTECTED] wrote: On Fri, Oct 10, 2008 at 12:24 AM, Chris Mohler [EMAIL PROTECTED] wrote: Hi list, I've been mucking around with a GIMP plugin a la python, and I have a question: Is there a method to discover the GIMP version and/or ~/.gimp folder that works across platform (from python)? gimp.directory And (in the interest of being a pest) a follow-up: Can I attach a plug-in to the Palettes sub-menu? Other python plugins, like the 'Sort palette' plugin, certainly do. HTH, David -- Everything has reasons. Nothing has justification. Ĉio havas kialojn; Neniaĵo havas pravigeron. ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
Hi, Is there a method to discover the GIMP version and/or ~/.gimp folder that works across platform (from python)? gimp.directory On a Mac running gimp2.4.5 print gimp.directory = %s % gimp.directory prints gimp.directory = /Users/paultaney/Library/Application Support/Gimp ...but my plugin fails to run from there. It does not appear in the menus. Nor will it run from ~/.gimp-2.4/plug-ins or ~/.gimp-2.4/scripts I have only managed to make it run from one location: % cat push.sh cp stroke_to_vector.py /Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/plug-ins/ chmod +x /Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/plug-ins/stroke_to_vector.py ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
On Fri, Oct 10, 2008 at 10:11 AM, paul taney [EMAIL PROTECTED] wrote: Hi, Is there a method to discover the GIMP version and/or ~/.gimp folder that works across platform (from python)? gimp.directory On a Mac running gimp2.4.5 print gimp.directory = %s % gimp.directory prints gimp.directory = /Users/paultaney/Library/Application Support/Gimp ...but my plugin fails to run from there. It does not appear in the menus. Nor will it run from ~/.gimp-2.4/plug-ins or ~/.gimp-2.4/scripts I have only managed to make it run from one location: % cat push.sh cp stroke_to_vector.py /Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/plug-ins/ chmod +x /Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/plug-ins/stroke_to_vector.py That's interesting. if you create a custom palette on a Mac, does it end up in ~/.gimp or /Applications/Gimp.app//Contents/somewhere ? Thanks, Chris ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
--- On Fri, 10/10/08, Chris Mohler [EMAIL PROTECTED] wrote: From: Chris Mohler [EMAIL PROTECTED] Subject: Re: [Gimp-developer] A question about python gimpfu - home folder To: [EMAIL PROTECTED] Cc: gimp Gimp-developer@lists.xcf.berkeley.edu Date: Friday, October 10, 2008, 12:08 PM On Fri, Oct 10, 2008 at 10:11 AM, paul taney [EMAIL PROTECTED] wrote: Hi, Is there a method to discover the GIMP version and/or ~/.gimp folder that works across platform (from python)? gimp.directory On a Mac running gimp2.4.5 print gimp.directory = %s % gimp.directory prints gimp.directory = /Users/paultaney/Library/Application Support/Gimp ...but my plugin fails to run from there. It does not appear in the menus. Nor will it run from ~/.gimp-2.4/plug-ins or ~/.gimp-2.4/scripts I have only managed to make it run from one location: % cat push.sh cp stroke_to_vector.py /Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/plug-ins/ chmod +x /Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/plug-ins/stroke_to_vector.py That's interesting. if you create a custom palette on a Mac, does it end up in ~/.gimp or /Applications/Gimp.app//Contents/somewhere ? Not knowing what file to look for I cant be sure, but I did create a new tmp file and then ran Gimp and custom pallette. % find ~ -newer tmp ...didnt get any hits in the ~/.gimp-2.4 dir but made about ten files in ~/Library/Application Support/Gimp Tell me the name of the expected file and I can do a better test. paul Ready find ~ -newer tmp /Users/paultaney /Users/paultaney/.recently-used.xbel /Users/paultaney/Library/Application Support/Gimp /Users/paultaney/Library/Application Support/Gimp/colorrc /Users/paultaney/Library/Application Support/Gimp/controllerrc /Users/paultaney/Library/Application Support/Gimp/documents /Users/paultaney/Library/Application Support/Gimp/menurc /Users/paultaney/Library/Application Support/Gimp/parasiterc /Users/paultaney/Library/Application Support/Gimp/sessionrc /Users/paultaney/Library/Application Support/Gimp/templaterc /Users/paultaney/Library/Application Support/Gimp/themerc /Users/paultaney/Library/Application Support/Gimp/toolrc /Users/paultaney/Library/Application Support/Gimp/unitrc ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
On Fri, Oct 10, 2008 at 2:28 AM, David Gowers [EMAIL PROTECTED] wrote: [...] And (in the interest of being a pest) a follow-up: Can I attach a plug-in to the Palettes sub-menu? Other python plugins, like the 'Sort palette' plugin, certainly do. Hmm - I can't seem to figure this out. When I register a plug-in on the Palettes menu, the 'PF_FILE' parameter seems to be ignored. Can someone please take a look at the attached test script? Instead of getting a GUI file chooser, the main plug-in function is executed, and the the name of the currently selected palette is passed instead of this_file Attaching to another menu (Toolbox/Xtns/, for example) works as expected. Thanks, Chris #!/usr/bin/env python from gimpfu import * gettext.install(gimp20-python, gimp.locale_directory, unicode=True) def test_attach(this_file): print Test file: + this_file register( python-fu-test-attach-menu, Test of PF_FILE from palettes menu, Test of PF_FILE from palettes menu, Chris Mohler, Chris Mohler, 2008, Palettes/TEST..., , [ (PF_FILE, this_file, _(File), ), ], [], test_attach, domain=(gimp20-python, gimp.locale_directory) ) main() ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
On Fri, Oct 10, 2008 at 11:57 AM, paul taney [EMAIL PROTECTED] wrote: --- On Fri, 10/10/08, Chris Mohler [EMAIL PROTECTED] wrote: From: Chris Mohler [EMAIL PROTECTED] Subject: Re: [Gimp-developer] A question about python gimpfu - home folder To: [EMAIL PROTECTED] Cc: gimp Gimp-developer@lists.xcf.berkeley.edu Date: Friday, October 10, 2008, 12:08 PM On Fri, Oct 10, 2008 at 10:11 AM, paul taney [EMAIL PROTECTED] wrote: Hi, Is there a method to discover the GIMP version and/or ~/.gimp folder that works across platform (from python)? gimp.directory On a Mac running gimp2.4.5 print gimp.directory = %s % gimp.directory prints gimp.directory = /Users/paultaney/Library/Application Support/Gimp ...but my plugin fails to run from there. It does not appear in the menus. Nor will it run from ~/.gimp-2.4/plug-ins or ~/.gimp-2.4/scripts I have only managed to make it run from one location: % cat push.sh cp stroke_to_vector.py /Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/plug-ins/ chmod +x /Applications/Gimp.app//Contents/Resources/lib/gimp/2.0/plug-ins/stroke_to_vector.py That's interesting. if you create a custom palette on a Mac, does it end up in ~/.gimp or /Applications/Gimp.app//Contents/somewhere ? Not knowing what file to look for I cant be sure, but I did create a new tmp file and then ran Gimp and custom pallette. % find ~ -newer tmp ...didnt get any hits in the ~/.gimp-2.4 dir but made about ten files in ~/Library/Application Support/Gimp Tell me the name of the expected file and I can do a better test. It's no big deal - I was just wondering if you created a new palette (not image) if it's stored in your home gimp folder. The more I think about it, I doubt that it *could* be saved anywhere else - so don't worry about it. Thanks anyway :) Chris ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
Instead of getting a GUI file chooser, the main plug-in function is executed, and the the name of the currently selected palette is passed instead of this_file Attaching to another menu (Toolbox/Xtns/, for example) works as expected. I didnt find it (where is this menu?)... Maybe a pallette or something is passed by default and you have to have a placeholder for it -- as with (image, drawable) when it lives at Image. def test_attach(p, this_file): print Test type(p): + type(p) print Test file: + this_file BTW, I have noticed that this fails trying to convert to Unicode. (PF_FILENAME, filename, Output file:, \ os.path.expanduser(~/tmp.svg)), # fails ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
On Fri, Oct 10, 2008 at 2:56 PM, paul taney [EMAIL PROTECTED] wrote: Instead of getting a GUI file chooser, the main plug-in function is executed, and the the name of the currently selected palette is passed instead of this_file Attaching to another menu (Toolbox/Xtns/, for example) works as expected. I didnt find it (where is this menu?)... Maybe a pallette or something is passed by default and you have to have a placeholder for it -- as with (image, drawable) when it lives at Image. def test_attach(p, this_file): print Test type(p): + type(p) print Test file: + this_file D'oh! - you are correct. I had to add a parameter when registering: [ (PF_PALETTE, palette, _(Palette), ), (PF_FILE, this_file, _(File), ), ] That seems odd to me - is this behavior documented somewhere? BTW, I have noticed that this fails trying to convert to Unicode. (PF_FILENAME, filename, Output file:, \ os.path.expanduser(~/tmp.svg)), # fails Not sure about that - would something like this work (does on linux): print os.path.join((os.getenv('HOME')), 'tmp') Chris ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
--- On Fri, 10/10/08, Chris Mohler [EMAIL PROTECTED] wrote: From: Chris Mohler [EMAIL PROTECTED] Subject: Re: [Gimp-developer] A question about python gimpfu - home folder To: [EMAIL PROTECTED] Cc: gimp gimp-developer@lists.xcf.berkeley.edu Date: Friday, October 10, 2008, 4:09 PM On Fri, Oct 10, 2008 at 2:56 PM, paul taney [EMAIL PROTECTED] wrote: Instead of getting a GUI file chooser, the main plug-in function is executed, and the the name of the currently selected palette is passed instead of this_file Attaching to another menu (Toolbox/Xtns/, for example) works as expected. I didnt find it (where is this menu?)... Maybe a pallette or something is passed by default and you have to have a placeholder for it -- as with (image, drawable) when it lives at Image. def test_attach(p, this_file): print Test type(p): + type(p) print Test file: + this_file D'oh! - you are correct. I had to add a parameter when registering: [ (PF_PALETTE, palette, _(Palette), ), (PF_FILE, this_file, _(File), ), ] That seems odd to me - is this behavior documented somewhere? I guessed :-) Not on http://www.gimp.org/docs/python/index.html Use the Aussie spelling to look for palette. 2 occurances. Is there other gimpfu documentation? This is dated July 1999. paul BTW, I have noticed that this fails trying to convert to Unicode. (PF_FILENAME, filename, Output file:, \ os.path.expanduser(~/tmp.svg)), # fails Not sure about that - would something like this work (does on linux): print os.path.join((os.getenv('HOME')), 'tmp') Chris ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] A question about python gimpfu - home folder
On Fri, Oct 10, 2008 at 3:31 PM, paul taney [EMAIL PROTECTED] wrote: Maybe a pallette or something is passed by default and you have to have a placeholder for it -- as with (image, drawable) when it lives at Image. def test_attach(p, this_file): print Test type(p): + type(p) print Test file: + this_file D'oh! - you are correct. I had to add a parameter when registering: [ (PF_PALETTE, palette, _(Palette), ), (PF_FILE, this_file, _(File), ), ] That seems odd to me - is this behavior documented somewhere? I guessed :-) Not on http://www.gimp.org/docs/python/index.html Use the Aussie spelling to look for palette. 2 occurances. Is there other gimpfu documentation? This is dated July 1999. That's what I've been using. The procedure browser and python-fu console are also very handy. Chris ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] A question about python gimpfu - home folder
Hi list, I've been mucking around with a GIMP plugin a la python, and I have a question: Is there a method to discover the GIMP version and/or ~/.gimp folder that works across platform (from python)? Thanks, Chris ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer