It is currently Thu Apr 25, 2024 6:08 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 5:01 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Hi to everybody who writes plug-ins (in python) or has to do with gimp loader.
I like to explain to you what IMHO is a behavioural error in gimp loader when loading python plug-ins:
- if you have a python plug-in already tested and running and you close gimp, edit the plug-in changing the menu path (neither the file name nor the plug-in name, just the menu path), gimp does not recognize the change and your plug-in still appears under the old menu path (even if you check help/plug-in browser you find it detailed as before the change); if you want your change taking effect you have to close gimp, edit the file .gimp-2.8/pluginrc, remove the lines related to your plug-in and restart gimp: now the plug-in is shown under the new menu path.
My environment is : win 7 32-bits, gimp 2.8.4.
Please try it! Thanks

_________________
"Where am I ?"


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 5:31 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Can you post the code you are changing please - just the registration block is all that's needed as I want to be sure which method you are using to register the menu path.

Kevin


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 5:39 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
OK Paynekj, here it is:
.... "<Image>/Additional/Diego/My First Python-Fu", ....
this is the new;
the old was:
.... "<Image>/Additional/MyPyFu/My First Python-Fu", ....
Thanks

_________________
"Where am I ?"


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 6:27 am  (#4) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
In your register() call, try changing

"<Image>/Additional/Diego/My First Python-Fu"

to

"My First Python-Fu"

and then adding the argument

menu= "<Image>/Additional/MyPyFu/"

at the end.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 8:31 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
to SaulGoode
tried your suggestion, but:
1 - first of all to make the plug-in be accepted I had to add two initial parameters
(PF_IMAGE, "image", "Input image", None),
(PF_DRAWABLE, "drawable", "Input drawable", None),
which normally are not in because defaulted by the interface
(before adding those two additional parameter the call returned an error saying that four parameters where defined but only two registered)
2 - nothing changed with respect to the menu entry, i.e. I still had to clear .gimp-2.8/pluginrc lines related to the plug-in when trying to change MyPyFu to Diego or viceversa
Sorry, but thanks again for the suggestion
(BTW did your suggestion come from the fact that you did try the same and it works by you? in general I'd like to hear from python plug-in writers about such a trial...)

_________________
"Where am I ?"


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 8:46 am  (#6) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
dinasset wrote:
to SaulGoode
tried your suggestion, but:
1 - first of all to make the plug-in be accepted I had to add two initial parameters
(PF_IMAGE, "image", "Input image", None),
(PF_DRAWABLE, "drawable", "Input drawable", None),
which normally are not in because defaulted by the interface
(before adding those two additional parameter the call returned an error saying that four parameters where defined but only two registered)
2 - nothing changed with respect to the menu entry, i.e. I still had to clear .gimp-2.8/pluginrc lines related to the plug-in when trying to change MyPyFu to Diego or viceversa
Sorry, but thanks again for the suggestion
(BTW did your suggestion come from the fact that you did try the same and it works by you? in general I'd like to hear from python plug-in writers about such a trial...)

1) You have to declare all the parameters that your plug-in expects... the interface then decides which are implicitly available (active image/layer/drawable/path...), and which warrant an entry in a parameter input dialog. When called non-interactively by another plugin, all parameters should be specified.

2) As far as I can tell, the pluginrc file has a timestamp for each plugin, and if at startup the timestamp of the plugin executable file isn't the same as one in pluginrc, the plugin is run to execute its registration code.

_________________
Image


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 9:16 am  (#7) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
I've just tried it on Windows 7 (64) using GIMP 2.8.2 and it works perfectly. Every time I change the "menu=" entry, GIMP re-starts using the new location.

In view of what Ofnuts points out about the timestamp, you haven't got a setting on your text editor that allows you to keep the last modified time of the file?

Kevin


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 1:22 pm  (#8) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
to Ofnuts and Paynekj
thanks for your support
1 - about the list of parameters in the registration I understand it's better to define always also image and layer; I didn't do it so far because of many suggestions read here and there though various python - gimp documents which are saying those two are implicitly defined by the interface; OK well
2 - about date modified I do not know about preference set-up in my editor to choose it or not; if the fact that I see in the list of .py files of my folder that there is a column with date and time always updated is a proof that the info is available to gimp, fine, it's there; if that info is translated into a single number in pluginrc like for instance the number at the end of "(plug-in-def "C:\\Users\\User\\.gimp-2.8\\plug-ins in prova\\example2u.py" 1360942972", OK, it changes every time
3 - if you tried and in your system everything works, OK, there must be something in my system; because changing the path is not so frequent (normally only during tests up to the "release" of the plug-in, I can survive with that problem.
So, many thanks again to all of you

_________________
"Where am I ?"


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 4:10 pm  (#9) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
The number 1360942972 is a UNIX timestamp

Using http://www.onlineconversion.com/unix_time.htm I can see the time/date is Fri, 15 Feb 2013 15:42:52 GMT


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Tue Feb 19, 2013 7:37 pm  (#10) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
paynekj wrote:
The number 1360942972 is a UNIX timestamp

Using http://www.onlineconversion.com/unix_time.htm I can see the time/date is Fri, 15 Feb 2013 15:42:52 GMT


Actually the number of seconds since Jan 1st, 1970, 00:00:00 UTC. In a unix shell prompt:
>date -d @1360942972
Fri Feb 15 16:42:52 CET 2013

_________________
Image


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Wed Feb 20, 2013 12:27 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Well, based on your info I supposed my text editor does something wrong in saving, because the translated date shown is not Feb 19 ...
So I decided to try with a different editor: downloaded and installed Cream (Wim), changed the menu path again and saved; unfortunately when launching gimp I didn't see the change in menu path and looking into gimprc the unix timestamp is still the previous (1360942972); there must be some other reason on my system for this behaviour...
Thanks for your support

_________________
"Where am I ?"


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Wed Feb 20, 2013 1:50 am  (#12) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Let's clarify a couple of things.

Can you be explicit about the order in which you do things. i.e. do you stop GIMP before editing the pluginrc file (GIMP tends to re-save the ...rc files when it exits)

As you're on Windows 7 I start to wonder if you've got a Windows Virtual Store problem, so what is the full path of your pluginrc file?

Kevin


Top
 Post subject: Re: error in gimp loader for python plug-ins ?
PostPosted: Wed Feb 20, 2013 3:53 am  (#13) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
My sequence is as follows when I want to change the menu path:
1-close gimp, if open
2-change the menu path in the plug-in
3-restart gimp
4-because gimp doesn't reflect the menu change...
5-close gimp
6-edit pluginrc, deleting lines related to the plug-in
7-restart gimp and the change is there!
About the second question, the path of pluginrc (as well as of others ..rc)is the following:
C:/Users/User/.gimp-2.8 (User is the name of myself, with administrator rights)
Thanks for your support Kevin

_________________
"Where am I ?"


Top
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts use in python of plug-in lighting

4

No new posts Load As Layers Wire Initialization Error With Python

6

No new posts Attachment(s) GIMP Python-Fu Plug-in template

4

No new posts GIMP 2.10 doesn't install my python plug-ins

1

No new posts Curve Bend tool called from python giving error not very consistent.

0



* Login  



Powered by phpBB3 © phpBB Group