It is currently Sat Jul 06, 2024 9:28 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Cannot get a Python plug-in to show up in GIMP
PostPosted: Sat Mar 16, 2013 1:28 pm  (#21) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Now I've learned something,

you can get round the requirement for having the image and drawable parameters by using the "menu=" parameter in the register statement instead of using the complete menu path earlier:

register(
   "test_image",
   "This is a test",
   "This is a test",
   "Name Test",
   "Name Test",
   "Date Test",
   "Test Image",
   "",
   [
#      (PF_VALUE, "size", "Size", 100),
      (PF_INT, "size", "Size", 100),
      (PF_COLOR, "color", "Image", (255, 127, 0)),
   ],
   [],
   test_image,
   menu="<Image>/MyScripts/"
   )

I found this by comparing your code with the working code and experimenting.

Note the use of PF_INT, this is just to get round another of your problems and isn't related.


Top
 Post subject: Re: Cannot get a Python plug-in to show up in GIMP
PostPosted: Sat Mar 16, 2013 1:41 pm  (#22) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Fine!
Also, to get the script running, Grafx, modify two lines:
1 - gimp.set_background(color)
2 - pdb.gimp_edit_fill(layer, BACKGROUND_FILL)
good luck!

_________________
"Where am I ?"


Top
 Post subject: Re: Cannot get a Python plug-in to show up in GIMP
PostPosted: Sat Mar 16, 2013 4:05 pm  (#23) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
In my opinion, the problem is not owing to GIMP's pluginrc, but to Microsoft's handling of modification time stamps on files. I am not aware of anybody using other operating systems experiencing this problem, and it would seem to be rather uncommon even amongst Windows users.

My speculation is that, for the problem to be exhibited, your Windows filesystem has to be configured for file creation "tunneling"; and when you edit your Python code, your text editor works on a temporary copy, renaming that copy to replace the original file when you have finished. The net effect of this would be the "last modified time stamp" of the edited Python file being identical to that of the original file. GIMP sees this and assumes that the file has not changed since it was last installed, so it forgoes re-installing it.

If this is the case -- again I am just speculating -- then the solution is to disable Microsoft's file system tunneling (it is an archaic, braindead concept anyway).

Also, it is perfectly acceptable to delete GIMP's pluginrc file, it will be re-generated after a forced re-install of all plugins. dinasset's advice to rename the file works fine, but there is no reason to keep the old pluginrc.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Now nothing works, regenerating pluginrc doesn't work
PostPosted: Sat Mar 16, 2013 6:04 pm  (#24) 
Offline
GimpChat Member

Joined: Mar 15, 2013
Posts: 36
I've tried all the recommended changes and now nothing seems to work.

My plug-in no longer shows up in any of the menus and I can't seem to restore the old menu. Regenerating the pluginrc doesn't help either. Here is plug-in as it stands right now. Am I missing something else?

from gimpfu import *

def test_image(size, color) :
    # gimp.context_push()
   img = gimp.Image(size, size, RGB)
   layer = gimp.Layer(img, "Uni Layer", size, size,
        RGB_IMAGE, 100, NORMAL_MODE)
   img.disable_undo()
   img.add_layer(img, layer, 0)
   gimp.set_background(color)
   pdb.gimp_edit_fill(layer, BACKGROUND_FILL)
   pdb.gimp_display_new(img)
   pdb.gimp_image_undo_enable(img)
    # disp = gimp.Display(img)
    # gimp.context_pop()

register(
   "test_image",
   "This is a test",
   "This is a test",
   "Name Test",
   "Name Test",
   "Date Test",
   "Test Image",
   "",
   [
      (PF_INT, "size", "Size", 100),
      (PF_COLOR, "color", "Image", (255, 127, 0)),
   ],
   [],
   test_image,
   menu="<image>/MyScripts"
   )

main()


Notice I removed a slash here, menu="<image>/MyScripts", thinking that was the problem, it wasn't. Here is the entry in pluginrc,

(plug-in-def "C:\\Documents and Settings\\Merlin\\.gimp-2.8\\plug-ins\\uni_img_py.py" 1363384740
    (proc-def "python-fu-test_image" 1
         "This is a test"
         "This is a test"
         "Name Test"
         "Name Test"
         "Date Test"
         "Test Image"
         0
        (icon stock-id -1 "")
         ""
         3 0
        (proc-arg 0 "run-mode" "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }")
        (proc-arg 0 "size" "Size")
        (proc-arg 10 "color" "Image")))


There is no menu entry.


Top
 Post subject: Re: Cannot get a Python plug-in to show up in GIMP
PostPosted: Sat Mar 16, 2013 6:56 pm  (#25) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Make sure that your menu location uses the proper (upper/lower) case:
menu="<Image>/MyScripts"

Also, you should not specify the image when using the add_layer() method:
    img.add_layer(layer, 0)

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Cannot get a Python plug-in to show up in GIMP
PostPosted: Sat Mar 16, 2013 7:01 pm  (#26) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
You can check the more blatant syntax errors by just running the script in a command prompt outside of Gimp. Just issue "python the_script.py". If it complains about a missing gimpfu, then everything is fine.

Erasing pluginrc means the next startup will be slower because Gimp will rescan all plugins...

In the pluginrc file the lines with "plugin-def" end with a big number which is the plugin file date in "system" format (seconds since 1970-01-01 00:00:00 UTC). You can put that date in the past (86400 seconds/day) to make Gimp reconsider your file.

_________________
Image


Top
 Post subject: Re: Cannot get a Python plug-in to show up in GIMP
PostPosted: Sat Mar 16, 2013 8:21 pm  (#27) 
Hi.
I think you need to remove the "," from the end of the PF_COLOR line.
fluffybunny


Top
 Post subject: Re: Cannot get a Python plug-in to show up in GIMP
PostPosted: Sat Mar 16, 2013 11:36 pm  (#28) 
Offline
GimpChat Member

Joined: Mar 15, 2013
Posts: 36
saulgoode, I removed the "img" from img.add_layer.

ofnuts, I tried changing the date on pluginrc to 136310000.

fluffybunny, I removed the apostrophe from the end of the PF_COLOR line.

I rebooted GIMP and it was in the right place in the menu and the plug-in works.

Break out the ginger ale, problem solved!

Thanks all for showing up and your hard work. I think I'm finally on my way.

When I'm finally finished with this project, I'll report back. I have successfully generated a series of ebook volumes using a MySQL database and now I would like to generate some covers for them using this MySQL database that is the back end for the website that the series is based on.

http://www.ictytranscripts.org


Top
 Post subject: Re: [SOLVED] Cannot get a Python plug-in to show up in GIMP
PostPosted: Thu Apr 04, 2013 2:54 pm  (#29) 
Offline
GimpChat Member

Joined: Mar 15, 2013
Posts: 36
I've posted a plug-in as a result of the work I did here,

http://registry.gimp.org/node/28013


Top
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Unable to get simple python plugin to show up

8

No new posts use in python of plug-in lighting

4

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 Plug-in crashes after OS upgrade: python version mismatch? maybe?

4


cron

* Login  



Powered by phpBB3 © phpBB Group