RSS/Atom feed Twitter
Site is read-only, email is disabled

A question about python gimpfu - "home folder"

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

12 of 12 messages available
Toggle history

Please log in to manage your subscriptions.

A question about python gimpfu - "home folder" Chris Mohler 10 Oct 07:24
  A question about python gimpfu - "home folder" Chris Mohler 10 Oct 08:12
   A question about python gimpfu - "home folder" David Gowers 10 Oct 09:28
    A question about python gimpfu - "home folder" Chris Mohler 10 Oct 21:13
     A question about python gimpfu - "home folder" paul taney 10 Oct 21:56
      A question about python gimpfu - "home folder" Chris Mohler 10 Oct 22:09
       A question about python gimpfu - "home folder" paul taney 10 Oct 22:31
        A question about python gimpfu - "home folder" Chris Mohler 10 Oct 22:39
A question about python gimpfu - "home folder" paul taney 10 Oct 17:11
  A question about python gimpfu - "home folder" Chris Mohler 10 Oct 18:08
   A question about python gimpfu - "home folder" paul taney 10 Oct 18:57
    A question about python gimpfu - "home folder" Chris Mohler 10 Oct 21:19
Chris Mohler
2008-10-10 07:24:58 UTC (over 16 years ago)

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

Chris Mohler
2008-10-10 08:12:54 UTC (over 16 years ago)

A question about python gimpfu - "home folder"

On Fri, Oct 10, 2008 at 12:24 AM, Chris Mohler 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

David Gowers
2008-10-10 09:28:01 UTC (over 16 years ago)

A question about python gimpfu - "home folder"

Hi,

On Fri, Oct 10, 2008 at 4:42 PM, Chris Mohler wrote:

On Fri, Oct 10, 2008 at 12:24 AM, Chris Mohler 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

paul taney
2008-10-10 17:11:33 UTC (over 16 years ago)

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

Chris Mohler
2008-10-10 18:08:26 UTC (over 16 years ago)

A question about python gimpfu - "home folder"

On Fri, Oct 10, 2008 at 10:11 AM, paul taney 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/ ?

Thanks, Chris

paul taney
2008-10-10 18:57:41 UTC (over 16 years ago)

A question about python gimpfu - "home folder"

--- On Fri, 10/10/08, Chris Mohler wrote:

From: Chris Mohler
Subject: Re: [Gimp-developer] A question about python gimpfu - "home folder" To: paultaney@yahoo.com
Cc: "gimp"
Date: Friday, October 10, 2008, 12:08 PM On Fri, Oct 10, 2008 at 10:11 AM, paul taney 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/ ?

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

Chris Mohler
2008-10-10 21:13:16 UTC (over 16 years ago)

A question about python gimpfu - "home folder"

On Fri, Oct 10, 2008 at 2:28 AM, David Gowers 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 (/Xtns/, for example) works as expected.

Thanks, Chris

Chris Mohler
2008-10-10 21:19:04 UTC (over 16 years ago)

A question about python gimpfu - "home folder"

On Fri, Oct 10, 2008 at 11:57 AM, paul taney wrote:

--- On Fri, 10/10/08, Chris Mohler wrote:

From: Chris Mohler
Subject: Re: [Gimp-developer] A question about python gimpfu - "home folder" To: paultaney@yahoo.com
Cc: "gimp"
Date: Friday, October 10, 2008, 12:08 PM On Fri, Oct 10, 2008 at 10:11 AM, paul taney 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/ ?

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

paul taney
2008-10-10 21:56:47 UTC (over 16 years ago)

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 (/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 .

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

Chris Mohler
2008-10-10 22:09:11 UTC (over 16 years ago)

A question about python gimpfu - "home folder"

On Fri, Oct 10, 2008 at 2:56 PM, paul taney 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 (/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 .

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

paul taney
2008-10-10 22:31:20 UTC (over 16 years ago)

A question about python gimpfu - "home folder"

--- On Fri, 10/10/08, Chris Mohler wrote:

From: Chris Mohler
Subject: Re: [Gimp-developer] A question about python gimpfu - "home folder" To: paultaney@yahoo.com
Cc: "gimp"
Date: Friday, October 10, 2008, 4:09 PM On Fri, Oct 10, 2008 at 2:56 PM, paul taney 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 (/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 .

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

Chris Mohler
2008-10-10 22:39:05 UTC (over 16 years ago)

A question about python gimpfu - "home folder"

On Fri, Oct 10, 2008 at 3:31 PM, paul taney 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 .

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