Commit 62749bb9 authored by Manish Singh's avatar Manish Singh Committed by Manish Singh
Browse files

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.
parent 052d95c9
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> 2005-06-05 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* plug-ins/common/screenshot.c: make " no decorations" option * plug-ins/common/screenshot.c: make " no decorations" option
......
...@@ -26,8 +26,6 @@ from _gimpenums import * ...@@ -26,8 +26,6 @@ from _gimpenums import *
# This is from pygtk/gtk/__init__.py # This is from pygtk/gtk/__init__.py
# Copyright (C) 1998-2003 James Henstridge # Copyright (C) 1998-2003 James Henstridge
from warnings import warn as _warn
class _DeprecatedConstant: class _DeprecatedConstant:
def __init__(self, value, name, suggestion): def __init__(self, value, name, suggestion):
self._v = value self._v = value
...@@ -35,9 +33,10 @@ class _DeprecatedConstant: ...@@ -35,9 +33,10 @@ class _DeprecatedConstant:
self._suggestion = suggestion self._suggestion = suggestion
def _deprecated(self, value): def _deprecated(self, value):
import warnings
message = '%s is deprecated, use %s instead' % (self._name, message = '%s is deprecated, use %s instead' % (self._name,
self._suggestion) self._suggestion)
_warn(message, DeprecationWarning, 3) warnings.warn(message, DeprecationWarning, 3)
return value return value
__nonzero__ = lambda self: self._deprecated(self._v == True) __nonzero__ = lambda self: self._deprecated(self._v == True)
...@@ -50,14 +49,3 @@ TRUE = _DeprecatedConstant(True, 'gimpenums.TRUE', 'True') ...@@ -50,14 +49,3 @@ TRUE = _DeprecatedConstant(True, 'gimpenums.TRUE', 'True')
FALSE = _DeprecatedConstant(False, 'gimpenums.FALSE', 'False') FALSE = _DeprecatedConstant(False, 'gimpenums.FALSE', 'False')
del _DeprecatedConstant 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) ...@@ -84,11 +84,11 @@ add_registered_enums(PyObject *m)
names = gimp_enums_get_type_names(&num_names); names = gimp_enums_get_type_names(&num_names);
pyg_enum_add(m, "CheckSize", "GIMP_", GIMP_TYPE_CHECK_SIZE); pyg_enum_add_constants(m, GIMP_TYPE_CHECK_SIZE, "GIMP_");
pyg_enum_add(m, "CheckType", "GIMP_", GIMP_TYPE_CHECK_TYPE); pyg_enum_add_constants(m, GIMP_TYPE_CHECK_TYPE, "GIMP_");
for (i = 0; i < num_names; i++) 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), ...@@ -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.''' which defines the limits for the slider or spinner.'''
import string as _string import string as _string
import gimp, gimpenums import gimp
from gimpenums import * from gimpenums import *
pdb = gimp.pdb pdb = gimp.pdb
...@@ -166,9 +166,8 @@ def register(func_name, blurb, help, author, copyright, date, menupath, ...@@ -166,9 +166,8 @@ def register(func_name, blurb, help, author, copyright, date, menupath,
raise error, ("parameter definition must contain at least 4 " raise error, ("parameter definition must contain at least 4 "
"elements (%s given: %s)" % (len(ent), ent)) "elements (%s given: %s)" % (len(ent), ent))
if type(ent[0]) != gimpenums.PDBArgType and \ if type(ent[0] != int:
type(ent[0]) != int: raise error, "parameter types must be integers"
raise error, "parameter types must be PDB argument types"
if not letterCheck(ent[1]): if not letterCheck(ent[1]):
raise error, "parameter name contains illegal characters" raise error, "parameter name contains illegal characters"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment