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

Problem with python save handler

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.

9 of 9 messages available
Toggle history

Please log in to manage your subscriptions.

Problem with python save handler Rob Antonishen 08 Sep 15:31
  Problem with python save handler Chris Mohler 08 Sep 16:09
   Problem with python save handler Rob Antonishen 08 Sep 16:48
    Problem with python save handler Rob Antonishen 09 Sep 15:00
     Problem with python save handler Chris Mohler 09 Sep 18:33
      Problem with python save handler Rob Antonishen 09 Sep 20:09
       Problem with python save handler Chris Mohler 10 Sep 00:33
       Problem with python save handler Joao S. O. Bueno 10 Sep 15:12
        Problem with python save handler Rob Antonishen 10 Sep 16:20
Rob Antonishen
2012-09-08 15:31:44 UTC (over 12 years ago)

Problem with python save handler

I've put together a simple python save handler for OpenSCAD surface files.

It was working, but after making some changes it is no longer popping up a dialog and is failing to save. I can, however call it via the python console like pdb.file_openscad_save

The code is here: http://pastebin.com/EmpxmFVb

I am a python newb, so I suspect it might have something to do with bad syntax, but I get no errors when gimp starts up....

Can anyone suggest what dumb mistake I've made?

Thanks,

-Rob A>

Chris Mohler
2012-09-08 16:09:37 UTC (over 12 years ago)

Problem with python save handler

On Sat, Sep 8, 2012 at 10:31 AM, Rob Antonishen wrote:

Can anyone suggest what dumb mistake I've made?

Dunno if it's related but "min" and "max" are built-in functions, so you shouldn't use them for var names.

Chris

Rob Antonishen
2012-09-08 16:48:31 UTC (over 12 years ago)

Problem with python save handler

Dunno if it's related but "min" and "max" are built-in functions, so you shouldn't use them for var names.

Chris

Thanks I caught that and changed it, but still no luck http://pastebin.com/MKUEshcx

-Rob A>

Rob Antonishen
2012-09-09 15:00:53 UTC (over 12 years ago)

Problem with python save handler

It seems the issue is related to adding extra parameters to the save handler....

Is it not possible to have dialog parameters with a python save handler?

-Rob A>

On Sat, Sep 8, 2012 at 12:48 PM, Rob Antonishen wrote:

Dunno if it's related but "min" and "max" are built-in functions, so you shouldn't use them for var names.

Chris

Thanks I caught that and changed it, but still no luck http://pastebin.com/MKUEshcx

-Rob A>

Chris Mohler
2012-09-09 18:33:50 UTC (over 12 years ago)

Problem with python save handler

On Sun, Sep 9, 2012 at 10:00 AM, Rob Antonishen wrote:

It seems the issue is related to adding extra parameters to the save handler....

Is it not possible to have dialog parameters with a python save handler?

Seems not, no. Setting the menu="" and/or setting the on_query causes your extra float parameters to always be set to "0.0", and there's no dialog. I can't tell if that's a bug, or by design.

This is a quick and dirty hack, but seems to work: http://pastebin.com/g1kriiqf

It ends up at the bottom of the File menu, instead of being properly registered as a save handler.

Chris

Rob Antonishen
2012-09-09 20:09:50 UTC (over 12 years ago)

Problem with python save handler

It seems the issue is related to adding extra parameters to the save handler....

Is it not possible to have dialog parameters with a python save handler?

Seems not, no. Setting the menu="" and/or setting the on_query causes your extra float parameters to always be set to "0.0", and there's no dialog. I can't tell if that's a bug, or by design.

This is a quick and dirty hack, but seems to work: http://pastebin.com/g1kriiqf

It ends up at the bottom of the File menu, instead of being properly registered as a save handler.

Thanks Chris-

I'll just set the scaling to be 0-100 and let users deal with the scaling in the receiving application.

The odd thing is that I did manage to get a dialog showing up on the first save, then not on subsequent, the it stopped working completely, so I'm guessing there is a bug in there somewhere.

-Rob A>

Chris Mohler
2012-09-10 00:33:14 UTC (over 12 years ago)

Problem with python save handler

Another workaround might be to pop up your own gtk window. There's a plug-in in the registry called "unseparate PNGS" that opens its own gtk dialog.

Chris
On Sep 9, 2012 3:10 PM, "Rob Antonishen" wrote:

It seems the issue is related to adding extra parameters to the save

handler....

Is it not possible to have dialog parameters with a python save handler?

Seems not, no. Setting the menu="" and/or setting the on_query causes your extra float parameters to always be set to "0.0", and there's no dialog. I can't tell if that's a bug, or by design.

This is a quick and dirty hack, but seems to work: http://pastebin.com/g1kriiqf

It ends up at the bottom of the File menu, instead of being properly registered as a save handler.

Thanks Chris-

I'll just set the scaling to be 0-100 and let users deal with the scaling in the receiving application.

The odd thing is that I did manage to get a dialog showing up on the first save, then not on subsequent, the it stopped working completely, so I'm guessing there is a bug in there somewhere.

-Rob A>

Joao S. O. Bueno
2012-09-10 15:12:52 UTC (over 12 years ago)

Problem with python save handler

On 9 September 2012 17:09, Rob Antonishen wrote:

It seems the issue is related to adding extra parameters to the save handler....

Is it not possible to have dialog parameters with a python save handler?

Seems not, no. Setting the menu="" and/or setting the on_query causes your extra float parameters to always be set to "0.0", and there's no dialog. I can't tell if that's a bug, or by design.

This is a quick and dirty hack, but seems to work: http://pastebin.com/g1kriiqf

It ends up at the bottom of the File menu, instead of being properly registered as a save handler.

The openraster import/export plug-in ships with GIMP and should be used as an example to take off any doubts.

Check the code at: http://git.gnome.org/browse/gimp/tree/plug-ins/pygimp/plug-ins/file-openraster.py

(If, on the other hand, openraster import/export itself is not working, than something is broken, and we will have to fix it)

js ->

Thanks Chris-

I'll just set the scaling to be 0-100 and let users deal with the scaling in the receiving application.

The odd thing is that I did manage to get a dialog showing up on the first save, then not on subsequent, the it stopped working completely, so I'm guessing there is a bug in there somewhere.

-Rob A> _______________________________________________ gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list

Rob Antonishen
2012-09-10 16:20:38 UTC (over 12 years ago)

Problem with python save handler

On Mon, Sep 10, 2012 at 11:12 AM, Joao S. O. Bueno wrote:

On 9 September 2012 17:09, Rob Antonishen wrote:

It seems the issue is related to adding extra parameters to the save handler....

Is it not possible to have dialog parameters with a python save handler?

Seems not, no. Setting the menu="" and/or setting the on_query causes your extra float parameters to always be set to "0.0", and there's no dialog. I can't tell if that's a bug, or by design.

The openraster import/export plug-in ships with GIMP and should be used as an example to take off any doubts.

Thanks Joao-

I had looked at the ora handler as an example, but it does not use any additional parameters on the save.

-Rob A>