mirror of https://github.com/GNOME/gimp.git
plug-ins/pygimp/gimpfu.py plug-ins/pygimp/gimpenums.py use old pygtk enum
2005-06-05 Manish Singh <yosh@gimp.org> * plug-ins/pygimp/gimpfu.py * plug-ins/pygimp/gimpenums.py * plug-ins/pygimp/gimpenumsmodule.c: use old pygtk enum API so we still work with older pygtk versions.
This commit is contained in:
parent
052d95c906
commit
62749bb931
|
@ -1,3 +1,10 @@
|
|||
2005-06-05 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* plug-ins/pygimp/gimpfu.py
|
||||
* plug-ins/pygimp/gimpenums.py
|
||||
* plug-ins/pygimp/gimpenumsmodule.c: use old pygtk enum API so we
|
||||
still work with older pygtk versions.
|
||||
|
||||
2005-06-05 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
* plug-ins/common/screenshot.c: make " no decorations" option
|
||||
|
|
|
@ -26,8 +26,6 @@ from _gimpenums import *
|
|||
# This is from pygtk/gtk/__init__.py
|
||||
# Copyright (C) 1998-2003 James Henstridge
|
||||
|
||||
from warnings import warn as _warn
|
||||
|
||||
class _DeprecatedConstant:
|
||||
def __init__(self, value, name, suggestion):
|
||||
self._v = value
|
||||
|
@ -35,9 +33,10 @@ class _DeprecatedConstant:
|
|||
self._suggestion = suggestion
|
||||
|
||||
def _deprecated(self, value):
|
||||
import warnings
|
||||
message = '%s is deprecated, use %s instead' % (self._name,
|
||||
self._suggestion)
|
||||
_warn(message, DeprecationWarning, 3)
|
||||
warnings.warn(message, DeprecationWarning, 3)
|
||||
return value
|
||||
|
||||
__nonzero__ = lambda self: self._deprecated(self._v == True)
|
||||
|
@ -50,14 +49,3 @@ TRUE = _DeprecatedConstant(True, 'gimpenums.TRUE', 'True')
|
|||
FALSE = _DeprecatedConstant(False, 'gimpenums.FALSE', 'False')
|
||||
|
||||
del _DeprecatedConstant
|
||||
|
||||
def exported_constants():
|
||||
import gobject, _gimpenums
|
||||
constants = ['TRUE', 'FALSE']
|
||||
for name in dir(_gimpenums):
|
||||
if isinstance(getattr(_gimpenums, name), gobject.GEnum):
|
||||
constants.append(name)
|
||||
return constants
|
||||
|
||||
__all__ = exported_constants()
|
||||
del exported_constants
|
||||
|
|
|
@ -84,11 +84,11 @@ add_registered_enums(PyObject *m)
|
|||
|
||||
names = gimp_enums_get_type_names(&num_names);
|
||||
|
||||
pyg_enum_add(m, "CheckSize", "GIMP_", GIMP_TYPE_CHECK_SIZE);
|
||||
pyg_enum_add(m, "CheckType", "GIMP_", GIMP_TYPE_CHECK_TYPE);
|
||||
pyg_enum_add_constants(m, GIMP_TYPE_CHECK_SIZE, "GIMP_");
|
||||
pyg_enum_add_constants(m, GIMP_TYPE_CHECK_TYPE, "GIMP_");
|
||||
|
||||
for (i = 0; i < num_names; i++)
|
||||
pyg_enum_add(m, names[i] + 4, "GIMP_", g_type_from_name(names[i]));
|
||||
pyg_enum_add_constants(m, g_type_from_name(names[i]), "GIMP_");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ element in their description tuple -- a 3-tuple of the form (lower,upper,step),
|
|||
which defines the limits for the slider or spinner.'''
|
||||
|
||||
import string as _string
|
||||
import gimp, gimpenums
|
||||
import gimp
|
||||
from gimpenums import *
|
||||
pdb = gimp.pdb
|
||||
|
||||
|
@ -166,9 +166,8 @@ def register(func_name, blurb, help, author, copyright, date, menupath,
|
|||
raise error, ("parameter definition must contain at least 4 "
|
||||
"elements (%s given: %s)" % (len(ent), ent))
|
||||
|
||||
if type(ent[0]) != gimpenums.PDBArgType and \
|
||||
type(ent[0]) != int:
|
||||
raise error, "parameter types must be PDB argument types"
|
||||
if type(ent[0] != int:
|
||||
raise error, "parameter types must be integers"
|
||||
|
||||
if not letterCheck(ent[1]):
|
||||
raise error, "parameter name contains illegal characters"
|
||||
|
|
Loading…
Reference in New Issue