Missing self. reference. Fixes #115714.

2003-06-26  Manish Singh  <yosh@gimp.org>

        * plug-ins/pygimp/gimpui.py: Missing self. reference. Fixes #115714.

        * plug-ins/pygimp/gimpui.py: Move item.show() in Selector so that all
        items are shown. Fixes bug #115715. Thanks to Dave Corrie for catching
        both these.

        * plug-ins/pygimp/gimpfu.py: Always register as type PLUGIN, to
        reflect the recent changes in semantics.

        * plug-ins/pygimp/plug-ins/gimpcons.py
        * plug-ins/pygimp/plug-ins/pdbbrowse.py: s/extension/plug_in/ to
        reflect above, for consistency.

        * plug-ins/pygimp/gimpfu.py: Add a fail method which uses
        gimp.message and then raises an error.

        * plug-ins/pygimp/gimpmodule.c: remove declarations for
        gimp_extension_ack and gimp_extension_process, they are in gimp.h.

        * plug-ins/pygimp/gimpfu.py
        * plug-ins/pygimp/gimpui.py
        * plug-ins/pygimp/plug-ins/gimpcons.py
        * plug-ins/pygimp/plug-ins/pdbbrowse.py: Added pygtk.require('2.0').
        Fixes bug #115545.
This commit is contained in:
Manish Singh
2003-06-28 00:06:58 +00:00
committed by Manish Singh
parent 377d184946
commit c1e165d32d
6 changed files with 89 additions and 15 deletions

View File

@ -1,3 +1,30 @@
2003-06-26 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/gimpui.py: Missing self. reference. Fixes #115714.
* plug-ins/pygimp/gimpui.py: Move item.show() in Selector so that all
items are shown. Fixes bug #115715. Thanks to Dave Corrie for catching
both these.
* plug-ins/pygimp/gimpfu.py: Always register as type PLUGIN, to
reflect the recent changes in semantics.
* plug-ins/pygimp/plug-ins/gimpcons.py
* plug-ins/pygimp/plug-ins/pdbbrowse.py: s/extension/plug_in/ to
reflect above, for consistency.
* plug-ins/pygimp/gimpfu.py: Add a fail method which uses
gimp.message and then raises an error.
* plug-ins/pygimp/gimpmodule.c: remove declarations for
gimp_extension_ack and gimp_extension_process, they are in gimp.h.
* plug-ins/pygimp/gimpfu.py
* plug-ins/pygimp/gimpui.py
* plug-ins/pygimp/plug-ins/gimpcons.py
* plug-ins/pygimp/plug-ins/pdbbrowse.py: Added pygtk.require('2.0').
Fixes bug #115545.
2003-06-28 Henrik Brix Andersen <brix@gimp.org>
* app/gui/grid-dialog.c (cancel_callback): removed unneeded

View File

@ -135,7 +135,7 @@ def register(func_name, blurb, help, author, copyright, date, menupath,
else:
return 1
if not letterCheck(func_name):
raise error, "function name contains ileagal characters"
raise error, "function name contains illegal characters"
for ent in params:
if len(ent) < 4:
raise error, "sequence not long enough for "+ent[0]
@ -152,12 +152,11 @@ def register(func_name, blurb, help, author, copyright, date, menupath,
raise error,"result name contains ilegal characters"
if menupath[:8] == '<Image>/' or \
menupath[:7] == '<Load>/' or \
menupath[:7] == '<Save>/':
menupath[:7] == '<Save>/' or \
menupath[:10] == '<Toolbox>/':
plugin_type = PLUGIN
elif menupath[:10] == '<Toolbox>/':
plugin_type = EXTENSION
else:
raise error, "menu path must start with <Image> or <Toolbox>"
raise error, "Invalid menu path"
if not func_name[:7] == 'python_' and \
not func_name[:10] == 'extension_' and \
@ -188,7 +187,7 @@ def _query():
if plugin_type == PLUGIN:
if menupath[:7] == '<Load>/':
params[1:1] = file_params
else:
elif menupath[:10] != '<Toolbox>/':
params.insert(1, (PDB_IMAGE, "image",
"The image to work on"))
params.insert(2, (PDB_DRAWABLE, "drawable",
@ -233,6 +232,9 @@ def _interact(func_name):
# short circuit for no parameters ...
if len(params) == 0: return []
import pygtk
pygtk.require('2.0')
import gtk
import gimpui
@ -242,6 +244,9 @@ def _interact(func_name):
# define a mapping of param types to edit objects ...
class StringEntry(gtk.Entry):
def __init__(self, default=''):
import pygtk
pygtk.require('2.0')
import gtk
gtk.Entry.__init__(self)
self.set_text(str(default))
@ -261,6 +266,8 @@ def _interact(func_name):
class SliderEntry(gtk.HScale):
# bounds is (upper, lower, step)
def __init__(self, default=0, bounds=(0, 100, 5)):
import pygtk
pygtk.require('2.0')
import gtk
self.adj = gtk.Adjustment(default, bounds[0],
bounds[1], bounds[2],
@ -271,6 +278,8 @@ def _interact(func_name):
class SpinnerEntry(gtk.SpinButton):
# bounds is (upper, lower, step)
def __init__(self, default=0, bounds=(0, 100, 5)):
import pygtk
pygtk.require('2.0')
import gtk
self.adj = gtk.Adjustment(default, bounds[0],
bounds[1], bounds[2],
@ -280,6 +289,8 @@ def _interact(func_name):
return int(self.adj.value)
class ToggleEntry(gtk.ToggleButton):
def __init__(self, default=0):
import pygtk
pygtk.require('2.0')
import gtk
gtk.ToggleButton.__init__(self)
self.label = gtk.Label("No")
@ -296,6 +307,8 @@ def _interact(func_name):
return self.get_active()
class RadioEntry(gtk.Frame):
def __init__(self, default=0, items=(("Yes", 1), ("No", 0))):
import pygtk
pygtk.require('2.0')
import gtk
gtk.Frame.__init__(self)
box = gtk.HBox(gtk.FALSE, 5)
@ -441,6 +454,11 @@ def main():
'''This should be called after registering the plugin.'''
gimp.main(None, None, _query, _run)
def fail(msg):
'''Display and error message and quit'''
gimp.message(msg)
raise error, msg
_python_image = [
"64 64 7 1",
" c #000000",
@ -517,6 +535,8 @@ _python_image = [
]
def _get_logo(colormap):
import pygtk
pygtk.require('2.0')
import gtk
pix, mask = gtk.gdk.pixmap_colormap_create_from_xpm_d(None, colormap,
None, _python_image)

View File

@ -669,9 +669,6 @@ pygimp_tile_height(PyObject *self)
return PyInt_FromLong(gimp_tile_height());
}
void gimp_extension_ack (void);
void gimp_extension_process (guint timeout);
static PyObject *
pygimp_extension_ack(PyObject *self)
{

View File

@ -11,6 +11,9 @@ various gimp data types. Each of these selectors takes default as an argument
to the constructor, and has a get_value() method for retrieving the result.
'''
import pygtk
pygtk.require('2.0')
import gtk, gimp
def _callbackWrapper(menu_item, callback, data):
@ -188,7 +191,7 @@ class _Selector(gtk.HBox):
swin = gtk.ScrolledWindow()
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
dialog.vbox.pack_start(swin)
self.dialog.vbox.pack_start(swin)
swin.show()
items = map(None, self.get_list())

View File

@ -19,13 +19,19 @@
from gimpfu import *
def extension_python_fu_console():
def plug_in_python_fu_console():
import pygtk
pygtk.require('2.0')
import gtk, gimpenums, gimpshelf
gtk.rc_parse(gimp.gtkrc())
namespace = {'__builtins__': __builtins__,
'__name__': '__main__', '__doc__': None,
'gimp': gimp, 'pdb': gimp.pdb,
'shelf': gimpshelf.shelf}
for s in gimpenums.__dict__.keys():
if s[0] != '_':
namespace[s] = getattr(gimpenums, s)
@ -38,15 +44,21 @@ def extension_python_fu_console():
cons = gtkcons.Console(namespace=namespace, quit_cb=gtk.mainquit)
def browse(button, cons):
import pygtk
pygtk.require('2.0')
import gtk, pdbbrowse
def ok_clicked(button, browse, cons=cons):
cons.line.set_text(browse.cmd)
browse.destroy()
win = pdbbrowse.BrowseWin(ok_button=ok_clicked)
win.connect("destroy", gtk.mainquit)
win.set_modal(TRUE)
win.show()
gtk.mainloop()
button = gtk.Button("Browse")
button.connect("clicked", browse, cons)
cons.inputbox.pack_end(button, expand=FALSE)
@ -56,10 +68,12 @@ def extension_python_fu_console():
win.set_default_size(475, 300)
win.show()
cons.init()
# flush the displays every half second
def timeout():
gimp.displays_flush()
return TRUE
gtk.timeout_add(500, timeout)
gtk.mainloop()
@ -74,6 +88,6 @@ register(
"*",
[],
[],
extension_python_fu_console)
plug_in_python_fu_console)
main()

View File

@ -30,6 +30,9 @@ for i in pars:
del pars, i
def define_browse_win():
import pygtk
pygtk.require('2.0')
import gtk
global BrowseWin
@ -288,14 +291,22 @@ def define_browse_win():
map(lambda x: x[1], params), ', ') + ")"
if __name__ == '__main__':
def extension_pdb_browse():
def plug_in_pdb_browse():
import pygtk
pygtk.require('2.0')
import gtk
gtk.rc_parse(gimp.gtkrc())
define_browse_win()
win = BrowseWin()
win.connect("destroy", gtk.mainquit)
win.show()
gtk.mainloop()
register(
"python_fu_pdb_browse",
"Browse the Procedural Database",
@ -307,7 +318,9 @@ if __name__ == '__main__':
"*",
[],
[],
extension_pdb_browse)
plug_in_pdb_browse)
main()
else:
define_browse_win()