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


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Python Scripts not Registering in Gimp 2.8
PostPosted: Thu Nov 08, 2012 8:03 am  (#1) 
Offline
GimpChat Member

Joined: Nov 06, 2012
Posts: 11
I am using Gimp 2.8.2 on Windows 7. I have some python scripts that I wrote when I was using Gimp 2.6 (on same Window 7 laptop). They worked with Gimp 2.6, and when I upgraded to Gimp 2.8, the scripts were copied (I assume during the installation process) to the appropriate plug-in directory for GIMP 2.8, as copies of the scripts are located in both the GIMP 2.8 plug-in directory and the Gimp 2.6 plug-in directory. When I start Gimp 2.8, the plug-ins show in the appropriate menu. Further, I recently (since upgrading to Gimp 2.8) downloaded a script written by someone else and copied it to the appropriate Gimp 2.8 plug-in directory and it shows in the appropriate menu.

My question/issue is this, I created a new script and saved it to the appropriate Gimp 2.8 plug-in directory. When I start Gimp, I see a reference to the new script in the Gimp start-up flash screen 9along with all the other scripts). However, it is not showing in the menu?

The following is a copy of my code (note, the script does not do anything fancy, just trying to learn how this all works):

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from gimpfu import *
from gimpenums import *

# create an output function that redirects to gimp's Error Console
def gprint( text ):
   pdb.gimp_message(text)
   return

# our script
def my_print_script():

    g = gimp.pdb
    the_image = gimp.image_list()
    the_layers = the_image[0].layers
    for l in the_layers:
        if g.gimp_item_get_visible(l) == 0:
            gprint ("Layer is already invisible!")
        else:
            g.gimp_item_set_visible(l, 0)
    g.gimp_item_set_visible(the_layers[0], 1)
   

    return
   
# This is the plugin registration function
register(
    "Print 4x6",   
    "A procedure to crop an image to a 4x6 aspect and save a print version.",   
    "A simple Python Script that can crop an image to a 4x6 aspect and save a print version.",
    "rph",
    "rph",
    "November 8, 2012",
    "<Image>/MyScripts/Print 4x6",
    "*",
    [], 
    [],
    my_print_script)

main()


Is there an issue with Gimp 2.8 that I am missing, or am I making some silly coding error that I am missing?

Any help would be appreciated. Thanks.


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: Python Scripts not Registering in Gimp 2.8
PostPosted: Thu Nov 08, 2012 6:33 pm  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
Traceback (most recent call last):
  File "/home/ofn/.gimp-2.6/plug-ins/test-registration.py", line 40, in <module>
    my_print_script)
  File "/home/ofn/.gimp-2.6/plug-ins/gimpfu.py", line 223, in register
    raise error, "procedure name contains illegal characters"
gimpfu.error: procedure name contains illegal characters


I think it's complaining about the space in "Print 4x6", with "Print-4x6" I don't get the registration error and see the menu item.

_________________
Image


Top
 Post subject: Re: Python Scripts not Registering in Gimp 2.8
PostPosted: Fri Nov 09, 2012 6:35 am  (#3) 
Offline
GimpChat Member

Joined: Nov 06, 2012
Posts: 11
ofnuts wrote:
I think it's complaining about the space in "Print 4x6", with "Print-4x6" I don't get the registration error and see the menu item.


Yep, me too. Knew it had to be some silly coding error... :oops:

Thank you!


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Can someone please convert these two python scripts for Gimp 2.99.19

10

No new posts Convert GIMP plugin from Python 2 to Python 3

4

No new posts Difference between "Python-Fu" and "Python" plugin

6

No new posts Attachment(s) very old scripts

11

No new posts SCRIPTS CONPATIBLE OR NOT

1


cron

* Login  



Powered by phpBB3 © phpBB Group