home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 May / maximum-cd-2009-05.iso / DiscContents / gimp-2.6.5-i686-setup.exe / {app} / lib / gimp / 2.0 / python / gimpenums,1.py < prev    next >
Encoding:
Python Source  |  2009-02-15  |  2.0 KB  |  52 lines

  1. #   Gimp-Python - allows the writing of Gimp plugins in Python.
  2. #   Copyright (C) 2005  Manish Singh  <yosh@gimp.org>
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17.  
  18. # gimpenums.py -- constants for use with the gimp module
  19. #
  20. # this file pulls in constants that are useful for use in
  21. # gimp plugins.  Just add 'from gimpenums import *' to the top
  22. # of the script
  23.  
  24. from _gimpenums import *
  25.  
  26. # This is from pygtk/gtk/__init__.py
  27. # Copyright (C) 1998-2003  James Henstridge
  28.  
  29. class _DeprecatedConstant:
  30.     def __init__(self, value, name, suggestion):
  31.         self._v = value
  32.         self._name = name
  33.         self._suggestion = suggestion
  34.  
  35.     def _deprecated(self, value):
  36.         import warnings
  37.         message = '%s is deprecated, use %s instead' % (self._name,
  38.                                                         self._suggestion)
  39.         warnings.warn(message, DeprecationWarning, 3)
  40.         return value
  41.  
  42.     __nonzero__ = lambda self: self._deprecated(self._v == True)
  43.     __int__     = lambda self: self._deprecated(int(self._v))
  44.     __str__     = lambda self: self._deprecated(str(self._v))
  45.     __repr__    = lambda self: self._deprecated(repr(self._v))
  46.     __cmp__     = lambda self, other: self._deprecated(cmp(self._v, other))
  47.  
  48. TRUE = _DeprecatedConstant(True, 'gimpenums.TRUE', 'True')
  49. FALSE = _DeprecatedConstant(False, 'gimpenums.FALSE', 'False')
  50.  
  51. del _DeprecatedConstant
  52.