You are here

Gimp IDE

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

Simple GIMP IDE.

In fact, Gimp IDE is a simple text editor with syntax highlighting, with the ability to run the script.
Simple dialog allow you to create plug-in based on you script.

Perhaps fills a gap between conventional designer who can copy-paste from the web page, but can not edit and save script as plug-in.

In feature i plan create mini plug-in repository in internet with simple lifecycle as:

1) Select plug-in from menu (content menu is list of plug-ins on server).
2) Plug-in automaticaly download from server and run

Also this mini IDE is suitable for games with GIMP and study its internal structure.

--

Installing instructions for windows:

1) Install Gimp 2.6 (if not installed) into c:\bin\gimp\
2) Install Python 2.5 (if not installed (check in Gimp)) into c:\bin\gimp\python
3) Install PyGTK
http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.4/pycairo-1.4.12...
http://ftp.gnome.org/pub/GNOME/binaries/win32/pygobject/2.14/pygobject-2...
http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.12/pygtk-2.12.1-3....
4) Install GTK Binaries or add c:\bin\gimp\bin\ into PATH environment variable (check you path! path must be, a ptah to Gimp bin directory)
5) unpack dll.zip into c:\bin\gimp\bin\ (check you path).
this archive contents: libglade-2.0-0.dll libgtksourceview-2.0-0.dll
6) unpack python.zip into c:\bin\gimp\python\lib\site-packages\ (check you path)
this archive contents: gimpcolor.pyd _gimpenums.pyd gimpfu.pyc gimpplugin.pyc
gimpshelf.py gimpthumb.pyd _gimpui.pyd gtksourceview2.la gimpenums.py
gimpenums.pyo gimpfu.pyo gimpplugin.pyo gimpshelf.pyc gimpui.py gimpui.pyo
gtksourceview2.pyd gimpenums.pyc gimpfu.py gimpplugin.py gimp.pyd gimpshelf.pyo
gimpui.pyc gtksourceview2.dll.a pygimp-logo.png

If you Gimp distribution setup with enabled python supprt, you only need: gtksourceview2.dll.a
gtksourceview2.pyd and gtksourceview2.la files

7) Unpack gimpide in some place and check set-up:
set PATH=%PATH%;C:\bin\GIMP\bin
C:\bin\GIMP\Python\python.exe gimpplug.py
(check you path)
if you see errors - let me know

8) If you Gimp distribution setup with enabled python supprt, skip this item.
Unpack pygimp.interp.zip into c:\bin\GIMP\lib\gimp\2.0\interpreters
this file contain path to python interpreter. Edit him in notepad if you need (check paths).

9) If you Gimp distribution setup with enabled python supprt, skip this item.
Unpack plug-ins.zip into c:\bin\gimp\lib\gimp\2.0\plug-ins\

10) Unpack gimpide.zip into c:\bin\gimp\lib\gimp\2.0\plug-ins\

THE END :-)

--

Example script (simple paset it into GIMP IDE editor and run):

# -*- coding: utf8 -*-
#Create border with bg and fg color
#based on http://blogpost.am9.ru/?cat=14

import gimp
from gimpfu import pdb
from gimpfu import *

#BORDER WIDTH
width = 20
#Edit this ^^^^^^^

images = gimp.image_list()
image = images[0]
image.undo_group_start()

old_background_color = pdb.gimp_context_get_background()
old_foreground_color = pdb.gimp_context_get_foreground()

image_width = pdb.gimp_image_width(image)
image_height = pdb.gimp_image_height(image)
# get a copy of background
background_copy = pdb.gimp_image_get_active_layer (image)
border = pdb.gimp_layer_copy(background_copy,0)
pdb.gimp_image_add_layer(image, border, -1)
#select and make stroke
pdb.gimp_rect_select(image, width, width, image_width - 2*width , image_height - 2*width , CHANNEL_OP_REPLACE, 0, 0.0)

drawable = pdb.gimp_image_active_drawable (image)
# TODO somehow set the width for the stroke
pdb.gimp_edit_stroke(drawable)
# fill by foreground color
pdb.gimp_selection_invert(image)

pdb.gimp_context_set_foreground(old_background_color)

drawable = pdb.gimp_image_active_drawable (image)
pdb.gimp_bucket_fill(drawable,FG_BUCKET_FILL,NORMAL_MODE,100,0,0,width/2,width/2)
pdb.gimp_layer_set_opacity(border,50)
pdb.gimp_selection_none (image)
# megre visible layers
pdb.gimp_image_merge_visible_layers(image,EXPAND_AS_NECESSARY)

pdb.gimp_context_set_foreground(old_foreground_color)
pdb.gimp_context_set_background(old_background_color)

image.undo_group_end()
gimp.displays_flush()

--

Known issues:
* Under Windows syntax highlight not work. (May be mime detection broken)
* The strange игп is lost when the contents of global dict:

if you write

import aaa
def a(test):
print aaa.somefunction(test)
a("foo")

Python will swear that the aaa module is not loaded

workaround:
import aaa
def a(test):
import aaa
print aaa.somefunction(test)
a("foo")

--
Changes:
31.09.2009 - Russian translation added

AttachmentSize
gimpide.zip18.64 KB
dlls.zip444.02 KB
python.zip281.68 KB
plug-ins.zip21.56 KB
pygimp.interp.zip216 bytes
gimpide.zip25.29 KB
GIMP Version: 
Code License: 

Comments

In the near future I will try to make a correction

Again, thanks for sharing.

These are suggestions for improvements:

Register under "/Filters/Python-Fu/_IDE".
Discussion: it should be beside "Python-Fu/Console. IDE should be capitalized. Gimp is an extra word, not needed.

Don't register twice, once as an extension.
Discussion: I don't think it is necessary. If you want to have two menu items, use gimp_plugin_menu_register() to add a second menu item.

Enable the menu item even if no image is open.
Discussion: the console is enabled even if no image is open. I don't know how to do that. An empty menu item parameter to register() doesn't work.

Change the name of the file gimpplug.py.
Discussion: A more conventional name would be python-foo-IDE.py or plugin-python-IDE.py.

Use white background in editing window.
Discussion: Black text on white background is best for a GUI.

I can help with the English throughout the program, but that should be offline.

It seems to me that the IDE is a candidate for a new open source project, maybe under Launchpad. Maybe this should be discussed on the gimp developer mailing list. Pessimistically, I think most people would say that the IDE is not necessary since the population of users is small: Gimp plugin programmers using Python. But I think you could improve it so that it also could be used by ordinary GIMP users to create extremely simple scripts: those that are just lists of actions without any parameters or variables or control statements (for, if, etc.) For example, there was a recent post that "Convert selection to path" followed by "Path to selection" was a useful script (it rounds the selection). It would be nice if a user could automate that and put it in their menus.

plashless, off banks of noon

In Python, to enable a gimp plugin menu item whether or not an image is open:

In the call to register:
1) 'params' param empty (omitting image and drawable etc.)
2)'menupath' param just the menu item, not the path
3) 'imagetypes' param empty
4) use keyword arg 'menu=path'

In the plugin function, omit the image and drawable parameters.

I am not sure why, but this gets around the gimpfu module wrapping that automatically handles the image and drawable parameters. If you don't get around that wrapping, then you can have the menu item always enabled, but a dialog pops up asking the user to choose an image and drawable.

Example snippets for installing a new PDB Browser alongside the Python console:

def browse(): # no image or drawable parameters
app = TutorialApp()
gtk.main()

# enabled even if no image open
register(
"python_fu_pdb_browser",
"Browse the Plugin Database",
"TBD",
"author",
"Copyright holder",
"2009",
"New _Browse PDB", # just the menu item
"", # all image types
[], # no parameters
[],
browse,
menu="/Filters/Languages/Python-Fu")
# domain=("gimp20-python", gimp.locale_directory))

plashless, off banks of noon

Dmitry: Great idea.

Follows a discussion about Gimp IDE installation that may help others.

The installation instructions are for Windows. Most of the installation instructions are for packages (software) that the plugin depends on (and can be ignored by most people).

Most recent Linux distributions already have installed the packages which the Gimp IDE plugin depends on. (I can't say for Windows installations.)

The GIMP IDE plugin itself is installed in the "normal place". However, unlike many plugins, it is not a single file, but comprises the plugin itself (file gimpplug.py) and a module it depends on (imports), which is in the folder named gimpide, which can be installed alongside the plugin itself.

In my case, I downloaded and extracted just the gimpide.zip file to ~/.gimp-2.6/plug-ins and it seems to work. I am running Ubuntu 9.04 Jaunty. (But I also do Gimp plugin development and might have previously downloaded packages that the Gimp IDE plugin depends on.)

Note that there are two files named gimpide.zip. I believe the second one includes a Russian language translation (in file gimpide/locale/ru/LC_MESSAGES. I downloaded the first one and it seems to be in English (except for the IDE's menu bar? which might be a mistake.) (I am not too familiar with Internationalization.)

See also another post named "Gimp IDE suggestions."

(For programmers:
The GIMP IDE plugin depends on:
Python support in Gimp
GTK (GUI) support in Python
libglade (separate, XML GUI resources) support in Python
Sourceview (text editor) support in GTK for Python
The Gimp IDE plugin uses libglade, which is a way of building the GUI using a GUI designer application (in this case Glade which produced the XML gimpide.glade file?) That software architecture is fairly state-of-the-art and has been around for several years (at least in the Linux world.) But the Python language and the world around it does change.

plashless, off banks of noon

How do you install it, and where is it registered? I put it (including sub folders) in my personal .gim2.6\plugins folder (windows XP) but I don't see any thing under Python-Fu, and searching in the plugin browser doesn't locate it. I am using windows XP with working python support. -Rob A>

See a description

What version Python you use? (in python console 3 top lines) Gimp IDE use gtk and gtksourceview2 for interface. If you not have this libraries, you not able to use him (sorry, my english bad). But i tell link to install this libraries for you python You can run plug-in standalone entered [path to python.exe]\python.exe gimpplig.py paste error messages in this forum. PS: Magic dance :-) I planned create installer for Gimp IDE if it need...

I've used software called InstallJammer to make windows .exe and .msi installers - it's pretty easy to use... Chris
Subscribe to Comments for "Gimp IDE"