首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python-fu脚本没有显示在Gimp菜单中

Python-fu脚本没有显示在Gimp菜单中
EN

Stack Overflow用户
提问于 2016-06-25 16:41:41
回答 1查看 2.2K关注 0票数 1

我去过Gimp: python脚本没有显示在菜单中,但这对我没什么帮助。这是我试过的,一步一步地:

1.GIMP2.8.16在MacOSX10.9.5命令行上运行,文件包括gimp

代码语言:javascript
复制
alias gimp='/Applications/GIMP.app/Contents/MacOS/GIMP --verbose --console-messages '

我查看终端输出,我看到了很多消息,但是没有什么问题(您想在这里转储吗?)我从一开始就看到了,Enabling internal Python...,所以这应该是好的。

2.过滤器>Python>控制台打开控制台

代码语言:javascript
复制
GIMP 2.8.16 Python Console
Python 2.7.8 (default, Dec  5 2015, 09:38:54) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
>>> 

-so,再一次,python似乎正在工作。

3.由于这里的小费,我尝试运行这里的小费脚本。我打开一个图像并运行过滤器>呈现>云>雾。它的工作原理就像一个魔咒- in,当窗口亮起时,我确实会收到一些类型转换警告:

代码语言:javascript
复制
** (foggify.py:30312): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'
** (foggify.py:30312): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'
** (foggify.py:30312): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'

我搜索了我的计算机,foggify.py实际上是在/Applications/GIMP.app/Contents/Resources/lib/gimp/2.0/plug-ins/foggify.py中,所以这证明了Python是有效的,但并不是它正在加载脚本。我有点困惑,因为foggify.py只有77行,而不是30312行。

4. GIMP >>>文件夹>脚本显示GIMP应该为脚本加载以下目录:

代码语言:javascript
复制
/Users/julio/Library/Application Support/GIMP/2.8/scripts
/Applications/GIMP.app/Contents/Resources/share/gimp/2.0/scripts

我不使用/Applications/GIMP.app/Contents/Resources/share/gimp/2.0/scripts,但是它有很多*.scm文件(所以,很可能都在Scheme中)。我自己也没在这里加任何东西。

5. i只有一个脚本:ls -l "/Users/julio/Library/Application Support/Gimp/2.8/scripts"生成

代码语言:javascript
复制
total 8
-rwxr-xr-x  1 julio  staff  654 25 Jun 16:25 minimal.py

(仅此而已)

6.,这是我的minimal.py

代码语言:javascript
复制
#!/usr/bin/env python

from gimpfu import *

def minimal():
    pass

register(
    "python_fu_minimal",                                    # plugin name
    "Minimal plug-in example",                              # blurb (short description)
    "Show the smallest possible Python plug-in example",    # help (long description)
    "Michael Schumacher",                                   # author
    "Michael Schumacher",                                   # copyright info
    "2007",                                                 # date
    "<Image>/Tools/Minimal",                                # menu position and label
    None,                                                   # image types accepted
    [],                                                     # input parameters
    [],                                                     # output (results)
    minimal                                                 # method to call
    )

main()

7. --我已经在上面提到的scripts目录中使用minimal.py运行gimp,并且在“Tools”菜单中看不到任何“最小”项。

我还尝试了下面的变体,这也不起作用:

代码语言:javascript
复制
#!/usr/bin/env python

from gimpfu import *

def minimal():
    pass

register(
    "python_fu_minimal",                                    # plugin name
    "Minimal plug-in example",                              # blurb (short description)
    "Show the smallest possible Python plug-in example",    # help (long description)
    "Michael Schumacher",                                   # author
    "Michael Schumacher",                                   # copyright info
    "2007",                                                 # date
    "Minimal",                                              # menu position and label
    None,                                                   # image types accepted
    [],                                                     # input parameters
    [],                                                     # output (results)
    minimal,                                                # method to call
    menu="<Image>/Tools"
    )

main()
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-26 11:22:53

Python“脚本”在技术上是“插件”,因此应该位于“插件”子目录(/Users/julio/Library/Application Support/GIMP/2.8/插件)。

更新2.10: gimp2.10仍然支持2.8方式,.py文件放在plug-ins目录中,但它也支持新的样式,其中.py (实际上是主要插件可执行文件)位于同名plug-ins的子目录中,还有它可能需要的其他文件(如果有的话)。AFAIK,这将是未来Gimp版本中唯一被接受的方式。

代码语言:javascript
复制
{Your Gimp profile}
└── plug-ins
    ├── some_2.08_plugin.py
    ├── another_2.08_plugin.py
    ├── some_plugin_for_2.10_and_beyond
    │   ├── some_plugin_for_2.10_and_beyond.py
    │   └── some_python_module.py
    └── another_plugin_for_2.10_and_beyond
        ├── another_plugin_for_2.10_and_beyond.py
        └── another_auxiliary_file.dat
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38030656

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档