gimp r25854 - in branches/soc-2008-python: . plug-ins/pygimp



Author: larsc
Date: Thu May 29 12:07:32 2008
New Revision: 25854
URL: http://svn.gnome.org/viewvc/gimp?rev=25854&view=rev

Log:
2008-05-29  Lars-Peter Clausen  <lars metafoo de>
    Move gimpenums, gimpshelf, gimpui, gimpcolor to the gimp package and remove
    the leading gimp. So they are now accessed as gimp.enums.
    The old modules import everything from the new ones.

    * plug-ins/pygimp/gimpcolor.py
    * plug-ins/pygimp/gimpshelf.py
    * plug-ins/pygimp/gimpui.py
    * plug-ins/pygimp/gimpenums.py
    * plug-ins/pygimp/gimpthumb.py
    * plug-ins/pygimp/enums.py
    * plug-ins/pygimp/ui.py
    * plug-ins/pygimp/shelf.py
    * plug-ins/pygimp/gimpfu.py
    * plug-ins/pygimp/gimpthumbmodule.c
    * plug-ins/pygimp/gimpenumsmodule.c
    * plug-ins/pygimp/pygimpcolor-api.h
    * plug-ins/pygimp/gimpuimodule.c
    * plug-ins/pygimp/gimpcolormodule.c
    * plug-ins/pygimp/pygimp-pdb.c
    * plug-ins/pygimp/Makefile.am


Added:
   branches/soc-2008-python/plug-ins/pygimp/enums.py
      - copied, changed from r25832, /branches/soc-2008-python/plug-ins/pygimp/gimpenums.py
   branches/soc-2008-python/plug-ins/pygimp/gimpcolor.py
   branches/soc-2008-python/plug-ins/pygimp/gimpenums.py
   branches/soc-2008-python/plug-ins/pygimp/gimpshelf.py
   branches/soc-2008-python/plug-ins/pygimp/gimpui.py
   branches/soc-2008-python/plug-ins/pygimp/shelf.py
      - copied, changed from r25832, /branches/soc-2008-python/plug-ins/pygimp/gimpshelf.py
   branches/soc-2008-python/plug-ins/pygimp/ui.py
      - copied, changed from r25832, /branches/soc-2008-python/plug-ins/pygimp/gimpui.py
Modified:
   branches/soc-2008-python/ChangeLog
   branches/soc-2008-python/plug-ins/pygimp/Makefile.am
   branches/soc-2008-python/plug-ins/pygimp/gimpcolormodule.c
   branches/soc-2008-python/plug-ins/pygimp/gimpenumsmodule.c
   branches/soc-2008-python/plug-ins/pygimp/gimpfu.py
   branches/soc-2008-python/plug-ins/pygimp/gimpthumbmodule.c
   branches/soc-2008-python/plug-ins/pygimp/gimpuimodule.c
   branches/soc-2008-python/plug-ins/pygimp/pygimp-pdb.c
   branches/soc-2008-python/plug-ins/pygimp/pygimpcolor-api.h

Modified: branches/soc-2008-python/plug-ins/pygimp/Makefile.am
==============================================================================
--- branches/soc-2008-python/plug-ins/pygimp/Makefile.am	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/Makefile.am	Thu May 29 12:07:32 2008
@@ -27,10 +27,8 @@
 pygimpdir = $(gimpplugindir)/$(pygimpbase)
 pygimpmoduledir = $(pygimpdir)/gimp
 
-pygimp_LTLIBRARIES = _gimpenums.la gimpcolor.la _gimpui.la \
-	gimpthumb.la
 
-pygimpmodule_LTLIBRARIES = _gimp.la
+pygimpmodule_LTLIBRARIES = _gimp.la color.la thumb.la _ui.la _enums.la
 
 _gimp_la_SOURCES = \
 	gimpmodule.c		\
@@ -57,13 +55,13 @@
 	$(PYLINK_LIBS)		\
 	$(RT_LIBS)
 
-_gimpenums_la_SOURCES = \
+_enums_la_SOURCES = \
 	gimpenumsmodule.c
 
-_gimpenums_la_LDFLAGS = -module -avoid-version $(no_undefined) \
-	-export-symbols-regex init_gimpenums
+_enums_la_LDFLAGS = -module -avoid-version $(no_undefined) \
+	-export-symbols-regex init_enums
 
-_gimpenums_la_LIBADD = \
+_enums_la_LIBADD = \
 	$(libgimp)		\
 	$(libgimpcolor)		\
 	$(libgimpbase)		\
@@ -71,28 +69,28 @@
 	$(PYLINK_LIBS)		\
 	$(RT_LIBS)
 
-gimpcolor_la_SOURCES = \
+color_la_SOURCES = \
 	gimpcolormodule.c	\
 	pygimp-colors.c		\
 	pygimpcolor.h		\
 	pygimpcolor-api.h
 
-gimpcolor_la_LDFLAGS = -module -avoid-version $(no_undefined) \
-	-export-symbols-regex initgimpcolor
+color_la_LDFLAGS = -module -avoid-version $(no_undefined) \
+	-export-symbols-regex initcolor
 
-gimpcolor_la_LIBADD = \
+color_la_LIBADD = \
 	$(libgimpcolor)		\
 	$(GLIB_LIBS)		\
 	$(PYLINK_LIBS)
 
-_gimpui_la_SOURCES = \
+_ui_la_SOURCES = \
 	gimpuimodule.c		\
 	gimpui.c
 
-_gimpui_la_LDFLAGS = -module -avoid-version $(no_undefined) \
-	-export-symbols-regex init_gimpui
+_ui_la_LDFLAGS = -module -avoid-version $(no_undefined) \
+	-export-symbols-regex init_ui
 
-_gimpui_la_LIBADD = \
+_ui_la_LIBADD = \
 	$(libgimpui)		\
 	$(libgimpwidgets)	\
 	$(libgimpconfig)	\
@@ -105,14 +103,14 @@
 	$(RT_LIBS)		\
 	$(INTLLIBS)
 
-gimpthumb_la_SOURCES = \
+thumb_la_SOURCES = \
 	gimpthumbmodule.c \
 	gimpthumb.c
 
-gimpthumb_la_LDFLAGS = -module -avoid-version $(no_undefined) \
-	-export-symbols-regex initgimpthumb
+thumb_la_LDFLAGS = -module -avoid-version $(no_undefined) \
+	-export-symbols-regex initthumb
 
-gimpthumb_la_LIBADD = \
+thumb_la_LIBADD = \
 	$(libgimpthumb)		\
 	$(GDK_PIXBUF_LIBS)	\
 	$(PYLINK_LIBS)
@@ -122,12 +120,18 @@
 	gimpfu.py	\
 	gimpplugin.py	\
 	gimpshelf.py	\
-	gimpui.py
+	gimpui.py	\
+	gimpthumb.py	\
+	gimpcolor.py
 
 pygimp_DATA = pygimp-logo.png
 
 pygimpmodule_PYTHON = \
-	__init__.py 
+	__init__.py \
+	context.py	\
+	ui.py	\
+	shelf.py	\
+	enums.py
 
 codegen_files = \
 	gimpcolor-types.defs	\

Copied: branches/soc-2008-python/plug-ins/pygimp/enums.py (from r25832, /branches/soc-2008-python/plug-ins/pygimp/gimpenums.py)
==============================================================================
--- /branches/soc-2008-python/plug-ins/pygimp/gimpenums.py	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/enums.py	Thu May 29 12:07:32 2008
@@ -15,13 +15,13 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-# gimpenums.py -- constants for use with the gimp module
+# enums.py -- constants for use with the gimp module
 #
 # this file pulls in constants that are useful for use in
 # gimp plugins.  Just add 'from gimpenums import *' to the top
 # of the script
 
-from _gimpenums import *
+from _enums import *
 
 # This is from pygtk/gtk/__init__.py
 # Copyright (C) 1998-2003  James Henstridge
@@ -45,7 +45,7 @@
     __repr__    = lambda self: self._deprecated(repr(self._v))
     __cmp__     = lambda self, other: self._deprecated(cmp(self._v, other))
 
-TRUE = _DeprecatedConstant(True, 'gimpenums.TRUE', 'True')
-FALSE = _DeprecatedConstant(False, 'gimpenums.FALSE', 'False')
+TRUE = _DeprecatedConstant(True, 'enums.TRUE', 'True')
+FALSE = _DeprecatedConstant(False, 'enums.FALSE', 'False')
 
 del _DeprecatedConstant

Added: branches/soc-2008-python/plug-ins/pygimp/gimpcolor.py
==============================================================================
--- (empty file)
+++ branches/soc-2008-python/plug-ins/pygimp/gimpcolor.py	Thu May 29 12:07:32 2008
@@ -0,0 +1,2 @@
+from gimp.color import *
+from gimp.color import _PyGimpColor_API

Modified: branches/soc-2008-python/plug-ins/pygimp/gimpcolormodule.c
==============================================================================
--- branches/soc-2008-python/plug-ins/pygimp/gimpcolormodule.c	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/gimpcolormodule.c	Thu May 29 12:07:32 2008
@@ -392,17 +392,17 @@
 "This module provides interfaces to allow you to write gimp plugins"
 ;
 
-void initgimpcolor(void);
+void initcolor(void);
 
 PyMODINIT_FUNC
-initgimpcolor(void)
+initcolor(void)
 {
     PyObject *m, *d;
 
     pygimp_init_pygobject();
 
     /* Create the module and add the functions */
-    m = Py_InitModule3("gimpcolor", gimpcolor_methods, gimpcolor_doc);
+    m = Py_InitModule3("color", gimpcolor_methods, gimpcolor_doc);
 
     d = PyModule_GetDict(m);
 

Added: branches/soc-2008-python/plug-ins/pygimp/gimpenums.py
==============================================================================
--- (empty file)
+++ branches/soc-2008-python/plug-ins/pygimp/gimpenums.py	Thu May 29 12:07:32 2008
@@ -0,0 +1 @@
+from gimp.enums import *

Modified: branches/soc-2008-python/plug-ins/pygimp/gimpenumsmodule.c
==============================================================================
--- branches/soc-2008-python/plug-ins/pygimp/gimpenumsmodule.c	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/gimpenumsmodule.c	Thu May 29 12:07:32 2008
@@ -110,10 +110,10 @@
 "This module provides interfaces to allow you to write gimp plugins"
 ;
 
-void init_gimpenums(void);
+void init_enums(void);
 
 PyMODINIT_FUNC
-init_gimpenums(void)
+init_enums(void)
 {
     PyObject *m;
 
@@ -124,7 +124,7 @@
     gimp_enums_init();
 
     /* Create the module and add the functions */
-    m = Py_InitModule3("_gimpenums", NULL, gimpenums_doc);
+    m = Py_InitModule3("_enums", NULL, gimpenums_doc);
 
     add_misc_enums(m);
     add_registered_enums(m);

Modified: branches/soc-2008-python/plug-ins/pygimp/gimpfu.py
==============================================================================
--- branches/soc-2008-python/plug-ins/pygimp/gimpfu.py	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/gimpfu.py	Thu May 29 12:07:32 2008
@@ -72,8 +72,7 @@
 
 import string as _string
 import gimp
-import gimpcolor
-from gimpenums import *
+from gimp.enums import *
 pdb = gimp.pdb
 
 import gettext
@@ -176,7 +175,7 @@
     #PF_INT32ARRAY  : list,
     #PF_FLOATARRAY  : list,
     #PF_STRINGARRAY : list,
-    PF_COLOR       : gimpcolor.RGB,
+    PF_COLOR       : gimp.color.RGB,
     PF_REGION      : int,
     PF_DISPLAY     : gimp.Display,
     PF_IMAGE       : gimp.Image,
@@ -320,7 +319,6 @@
             on_query()
 
 def _get_defaults(proc_name):
-    import gimpshelf
     (blurb, help, author, copyright, date,
      label, imagetypes, plugin_type,
      params, results, function, menu, domain,
@@ -328,17 +326,16 @@
 
     key = "python-fu-save--" + proc_name
 
-    if gimpshelf.shelf.has_key(key):
-        return gimpshelf.shelf[key]
+    if gimp.shelf.shelf.has_key(key):
+        return gimp.shelf.shelf[key]
     else:
         # return the default values
         return [x[3] for x in params]
 
 def _set_defaults(proc_name, defaults):
-    import gimpshelf
 
     key = "python-fu-save--" + proc_name
-    gimpshelf.shelf[key] = defaults
+    gimp.shelf.shelf[key] = defaults
 
 def _interact(proc_name, start_params):
     (blurb, help, author, copyright, date,
@@ -360,7 +357,6 @@
     import pygtk
     pygtk.require('2.0')
 
-    import gimpui
     import gtk
 #    import pango
 
@@ -607,13 +603,13 @@
             #PF_INT32ARRAY  : ArrayEntry,
             #PF_FLOATARRAY  : ArrayEntry,
             #PF_STRINGARRAY : ArrayEntry,
-            PF_COLOR       : gimpui.ColorSelector,
+            PF_COLOR       : gimp.ui.ColorSelector,
             PF_REGION      : IntEntry,  # should handle differently ...
-            PF_IMAGE       : gimpui.ImageSelector,
-            PF_LAYER       : gimpui.LayerSelector,
-            PF_CHANNEL     : gimpui.ChannelSelector,
-            PF_DRAWABLE    : gimpui.DrawableSelector,
-            PF_VECTORS     : gimpui.VectorsSelector,
+            PF_IMAGE       : gimp.ui.ImageSelector,
+            PF_LAYER       : gimp.ui.LayerSelector,
+            PF_CHANNEL     : gimp.ui.ChannelSelector,
+            PF_DRAWABLE    : gimp.ui.DrawableSelector,
+            PF_VECTORS     : gimp.ui.VectorsSelector,
 
             PF_TOGGLE      : ToggleEntry,
             PF_SLIDER      : SliderEntry,
@@ -621,14 +617,14 @@
             PF_RADIO       : RadioEntry,
             PF_OPTION      : ComboEntry,
 
-            PF_FONT        : gimpui.FontSelector,
+            PF_FONT        : gimp.ui.FontSelector,
             PF_FILE        : FileSelector,
             PF_FILENAME    : FilenameSelector,
             PF_DIRNAME     : DirnameSelector,
-            PF_BRUSH       : gimpui.BrushSelector,
-            PF_PATTERN     : gimpui.PatternSelector,
-            PF_GRADIENT    : gimpui.GradientSelector,
-            PF_PALETTE     : gimpui.PaletteSelector,
+            PF_BRUSH       : gimp.ui.BrushSelector,
+            PF_PATTERN     : gimp.ui.PatternSelector,
+            PF_GRADIENT    : gimp.ui.GradientSelector,
+            PF_PALETTE     : gimp.ui.PaletteSelector,
             PF_TEXT        : TextEntry
     }
 
@@ -637,7 +633,7 @@
 
     tooltips = gtk.Tooltips()
 
-    dialog = gimpui.Dialog(proc_name, 'python-fu', None, 0, None, proc_name,
+    dialog = gimp.ui.Dialog(proc_name, 'python-fu', None, 0, None, proc_name,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                             gtk.STOCK_OK, gtk.RESPONSE_OK))
 
@@ -658,7 +654,7 @@
             except ValueError:
                 trans = gettext.translation(domain, fallback=True)
             blurb = trans.ugettext(blurb)
-        box = gimpui.HintBox(blurb)
+        box = gimp.ui.HintBox(blurb)
         vbox.pack_start(box, expand=False)
         box.show()
 
@@ -728,7 +724,7 @@
     vbox.pack_end(progress_vbox, expand=False)
     progress_vbox.show()
 
-    progress = gimpui.ProgressBar()
+    progress = gimp.ui.ProgressBar()
     progress_vbox.pack_start(progress)
     progress.show()
 

Added: branches/soc-2008-python/plug-ins/pygimp/gimpshelf.py
==============================================================================
--- (empty file)
+++ branches/soc-2008-python/plug-ins/pygimp/gimpshelf.py	Thu May 29 12:07:32 2008
@@ -0,0 +1 @@
+from gimp.shelf import *

Modified: branches/soc-2008-python/plug-ins/pygimp/gimpthumbmodule.c
==============================================================================
--- branches/soc-2008-python/plug-ins/pygimp/gimpthumbmodule.c	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/gimpthumbmodule.c	Thu May 29 12:07:32 2008
@@ -42,16 +42,16 @@
 "This module provides interfaces to allow you to write gimp plugins"
 ;
 
-void initgimpthumb(void);
+void initthumb(void);
 
 PyMODINIT_FUNC
-initgimpthumb(void)
+initthumb(void)
 {
     PyObject *m, *d;
     
     pygimp_init_pygobject();
 
-    m = Py_InitModule3("gimpthumb", gimpthumb_functions, gimpthumb_doc);
+    m = Py_InitModule3("thumb", gimpthumb_functions, gimpthumb_doc);
     d = PyModule_GetDict(m);
 
     gimpthumb_register_classes(d);

Added: branches/soc-2008-python/plug-ins/pygimp/gimpui.py
==============================================================================
--- (empty file)
+++ branches/soc-2008-python/plug-ins/pygimp/gimpui.py	Thu May 29 12:07:32 2008
@@ -0,0 +1,2 @@
+from gimp.ui import *
+from gimp.ui import _, _callbackWrapper, _createMenu

Modified: branches/soc-2008-python/plug-ins/pygimp/gimpuimodule.c
==============================================================================
--- branches/soc-2008-python/plug-ins/pygimp/gimpuimodule.c	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/gimpuimodule.c	Thu May 29 12:07:32 2008
@@ -44,10 +44,10 @@
 "This module provides interfaces to allow you to write gimp plugins"
 ;
 
-void init_gimpui(void);
+void init_ui(void);
 
 PyMODINIT_FUNC
-init_gimpui(void)
+init_ui(void)
 {
     PyObject *m, *d;
     PyObject *av;
@@ -71,7 +71,7 @@
     init_pygimpcolor();
     init_pygimp();
 
-    m = Py_InitModule3("_gimpui", gimpui_functions, gimpui_doc);
+    m = Py_InitModule3("_ui", gimpui_functions, gimpui_doc);
     d = PyModule_GetDict(m);
 
     gimpui_register_classes(d);

Modified: branches/soc-2008-python/plug-ins/pygimp/pygimp-pdb.c
==============================================================================
--- branches/soc-2008-python/plug-ins/pygimp/pygimp-pdb.c	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/pygimp-pdb.c	Thu May 29 12:07:32 2008
@@ -331,7 +331,7 @@
     }
 
     if (PyTuple_Size(tuple) != nparams) {
-	PyErr_SetString(PyExc_TypeError, "wrong number of parameters");
+	PyErr_SetString(PyExc_TypeError, "takes exactly %d arguments (%d given)");
         Py_DECREF(tuple);
 	return NULL;
     }
@@ -1035,7 +1035,7 @@
 
     result = PyTuple_New(n_params);
     
-    gimpenums = PyImport_ImportModule("gimpenums");
+    gimpenums = PyImport_ImportModule("gimp.enums");
 
     if(gimpenums == NULL ||
        (pdb_arg_type = PyObject_GetAttrString(gimpenums, "GimpPDBArgType")) == NULL) {

Modified: branches/soc-2008-python/plug-ins/pygimp/pygimpcolor-api.h
==============================================================================
--- branches/soc-2008-python/plug-ins/pygimp/pygimpcolor-api.h	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/pygimpcolor-api.h	Thu May 29 12:07:32 2008
@@ -63,7 +63,7 @@
 #define pygimp_rgb_from_pyobject (_PyGimpColor_API->rgb_from_pyobject)
 
 #define init_pygimpcolor() G_STMT_START { \
-    PyObject *gimpcolormodule = PyImport_ImportModule("gimpcolor"); \
+    PyObject *gimpcolormodule = PyImport_ImportModule("gimp.color"); \
     if (gimpcolormodule != NULL) { \
 	PyObject *mdict = PyModule_GetDict(gimpcolormodule); \
 	PyObject *cobject = PyDict_GetItemString(mdict, "_PyGimpColor_API"); \

Copied: branches/soc-2008-python/plug-ins/pygimp/shelf.py (from r25832, /branches/soc-2008-python/plug-ins/pygimp/gimpshelf.py)
==============================================================================
--- /branches/soc-2008-python/plug-ins/pygimp/gimpshelf.py	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/shelf.py	Thu May 29 12:07:32 2008
@@ -15,7 +15,7 @@
 #   along with this program; if not, write to the Free Software
 #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-# gimpshelf.py -- a simple module to help gimp modules written in Python
+# shelf.py -- a simple module to help gimp modules written in Python
 #                 store persistent data.
 #
 # Copyright (C) 1997, James Henstridge

Copied: branches/soc-2008-python/plug-ins/pygimp/ui.py (from r25832, /branches/soc-2008-python/plug-ins/pygimp/gimpui.py)
==============================================================================
--- /branches/soc-2008-python/plug-ins/pygimp/gimpui.py	(original)
+++ branches/soc-2008-python/plug-ins/pygimp/ui.py	Thu May 29 12:07:32 2008
@@ -31,9 +31,9 @@
 import pygtk
 pygtk.require('2.0')
 
-import gtk, gobject, gimp, gimpcolor
+import gtk, gobject, gimp
 
-from _gimpui import *
+from _ui import *
 
 import gettext
 t = gettext.translation('gimp20-python', gimp.locale_directory, fallback=True)
@@ -167,13 +167,13 @@
         return self.get_active_vectors()
 
 class ColorSelector(ColorButton):
-    def __init__(self, default=gimpcolor.RGB(1.0, 0, 0)):
-        if isinstance(default, gimpcolor.RGB):
+    def __init__(self, default=gimp.color.RGB(1.0, 0, 0)):
+        if isinstance(default, gimp.color.RGB):
             color = default
         elif isinstance(default, tuple):
-            color = apply(gimpcolor.RGB, default)
+            color = apply(gimp.color.RGB, default)
         elif isinstance(default, str):
-            color = gimpcolor.rgb_parse_css(default)
+            color = gimp.color.rgb_parse_css(default)
         ColorButton.__init__(self, _("Python-Fu Color Selection"), 100, 20,
                              color, COLOR_AREA_FLAT)
     def get_value(self):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]