From 8b5b80a37524dd58ca1c0fce40ed27a3334cfca0 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Fri, 18 Aug 2006 08:53:17 +0000 Subject: [PATCH] derive the menu from the label before adding to _registered_plugins_. 2006-08-18 Sven Neumann * plug-ins/pygimp/gimpfu.py (register): derive the menu from the label before adding to _registered_plugins_. * plug-ins/pygimp/Makefile.am: moved clothify.py to test-scripts, it doubles the functionality of script-fu-clothify. --- ChangeLog | 8 ++++++++ plug-ins/pygimp/gimpfu.py | 26 ++++++++++++++------------ plug-ins/pygimp/plug-ins/Makefile.am | 4 ++-- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index a79c5c8137..a251cd7b95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-08-18 Sven Neumann + + * plug-ins/pygimp/gimpfu.py (register): derive the menu from the + label before adding to _registered_plugins_. + + * plug-ins/pygimp/Makefile.am: moved clothify.py to test-scripts, + it doubles the functionality of script-fu-clothify. + 2006-08-17 Sven Neumann * libgimp/gimppixbuf.[ch]: added a convenience function to create diff --git a/plug-ins/pygimp/gimpfu.py b/plug-ins/pygimp/gimpfu.py index eaa8197802..59b68df8b3 100644 --- a/plug-ins/pygimp/gimpfu.py +++ b/plug-ins/pygimp/gimpfu.py @@ -199,6 +199,13 @@ def register(proc_name, blurb, help, author, copyright, date, label, not proc_name[:5] == 'file_': proc_name = 'python-fu-' + proc_name + # if menu is not given, derive it from label + if menu is None and label: + fields = _string.split(label, '/') + if fields: + label = fields.pop() + menu = _string.join(fields, '/') + _registered_plugins_[proc_name] = (blurb, help, author, copyright, date, label, imagetypes, plugin_type, params, results, @@ -219,25 +226,20 @@ def _query(): params = make_params(params) # add the run mode argument ... - params.insert(0, (PDB_INT32, "run_mode", + params.insert(0, (PDB_INT32, "run-mode", "Interactive, Non-Interactive")) - if menu is None and not label is None: - fields = _string.split(label, '/') - label = fields.pop() - menu = _string.join(fields, '/') - if plugin_type == PLUGIN: if menu is None: pass - elif menu[:7] == '/': + elif menu[:6] == '': params[1:1] = file_params - elif menu[:10] != '/': + elif menu[:9] != '': params.insert(1, (PDB_IMAGE, "image", "The image to work on")) params.insert(2, (PDB_DRAWABLE, "drawable", "The drawable to work on")) - if menu[:7] == '/': + if menu[:6] == '': params[3:3] = file_params results = make_params(results) @@ -609,10 +611,10 @@ def _run(proc_name, params): run_mode = params[0] plugin_type = _registered_plugins_[proc_name][7] func = _registered_plugins_[proc_name][10] - menupath = _registered_plugins_[proc_name][11] + menu = _registered_plugins_[proc_name][11] - if plugin_type == PLUGIN and menupath and menupath[:10] != '/': - if menupath[:7] == '/': + if plugin_type == PLUGIN and menu and menu[:9] != '': + if menu[:6] == '': end = 5 else: end = 3 diff --git a/plug-ins/pygimp/plug-ins/Makefile.am b/plug-ins/pygimp/plug-ins/Makefile.am index 6b12212b96..bed07f10b2 100644 --- a/plug-ins/pygimp/plug-ins/Makefile.am +++ b/plug-ins/pygimp/plug-ins/Makefile.am @@ -2,7 +2,6 @@ pluginexecdir = $(gimpplugindir)/plug-ins scripts = \ colorxhtml.py \ - clothify.py \ foggify.py \ gimpcons.py \ happy-valley-relief.py \ @@ -15,7 +14,8 @@ scripts = \ test_scripts = \ benchmark-foreground-extract.py \ - sphere.py \ + clothify.py \ + sphere.py \ whirlpinch.py if GIMP_UNSTABLE