using a parasite in a python import/export script

View: New views
3 Messages — Rating Filter:   Alert me  

using a parasite in a python import/export script

by Bugzilla from pompei2@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

If this is the wrong list for my question, please tell me the right place for it.

I wrote an exporter script (to a new file format) in python. This script requires the user to choose the location of some other file, amongst other settings before saving the image
so in the call to the register function, there is the following:
        (PF_BOOL,  "compression", _("Use _compression (LZO, not yet implemented)"), True),
        (PF_FILE,  "ftsarc", _("The ftsarc binary"), "/some/path/to/some/file")

Once the user selected that file, I would like to keep that setting in mind to avoid him the need to re-select it, as it is very likely to never change. I could do this by saving it into a well-defined file, like ~/.something, but that sucks (I don't like to pollute the filesystem).

I found that the png exporter plugin uses "parasites" for this, that sounds interesting. Now, trying to read my parasite is a problem, I need to read it before the call to register but at that time, the GIMP system doesn't seem to be ready yet. Just doing:
        print gimp.parasite_list()
in the script will print out the error:
        LibGimpBase-ERROR **: gimp_wire_write_msg: the wire protocol has not been initialized
        aborting...
        (gimp:17350): LibGimpBase-WARNING **: gimp: gimp_wire_read(): error
to the console.

Is there any other way to achieve what I want? (Without saving it to a well-defined file in the user's home)

--
Regards, Lucas
http://arkana-fts.sourceforge.net

_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: using a parasite in a python import/export script

by RobA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I found that the png exporter plugin uses "parasites" for this, that sounds
> interesting. Now, trying to read my parasite is a problem, I need to read it
> before the call to register but at that time, the GIMP system doesn't seem
> to be ready yet. Just doing:
>         print gimp.parasite_list()
> in the script will print out the error:
>         LibGimpBase-ERROR **: gimp_wire_write_msg: the wire protocol has not
> been initialized
>         aborting...
>         (gimp:17350): LibGimpBase-WARNING **: gimp: gimp_wire_read(): error
> to the console.
>
> Is there any other way to achieve what I want? (Without saving it to a
> well-defined file in the user's home)
>


Works for me.  Here is a capture from my python console:

GIMP 2.6.4 Python Console
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]
>>> print gimp.parasite_list()
('exif-orientation-rotate', 'testing', 'jpeg-save-defaults')
>>>
_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: using a parasite in a python import/export script

by Bugzilla from pompei2@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Works for me.  Here is a capture from my python console:

GIMP 2.6.4 Python Console
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]
>>> print gimp.parasite_list()
('exif-orientation-rotate', 'testing', 'jpeg-save-defaults')
>>>

Yes, in the python-console it works like a charm, I tested it there.

The problem is with the python scripts that get loaded during GIMP startup (i.e. scripts in ~/.gimp-2.4/plug-ins), it seems they are loaded even before some GIMP core.

Oh, if it may help, here are my versions:
Gimp 2.4.5 Python Console
Python 2.5.2 (r252:60911, Dec  1 2008, 18:10:01)
[GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]]

--
Regards, Lucas
http://arkana-fts.sourceforge.net

_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer