gpt4 book ai didi

Python-fu 脚本未显示在 Gimp 菜单中

转载 作者:行者123 更新时间:2023-12-01 03:52:21 46 4
gpt4 key购买 nike

我去过Gimp: python script not showing in menu这对我没有帮助。这是我一步一步尝试的:

1. 我在 Mac OS X 10.9.5 上从命令行运行 Gimp 2.8.16,并将 gimp 作为我的 .bashrc 文件包含

alias gimp='/Applications/GIMP.app/Contents/MacOS/GIMP --verbose --console-messages '

我查看终端输出,看到很多消息,但没有出现任何问题(您想要在此处转储吗?)。我从一开始就看到启用内部Python...,所以这应该很好。

2. Filters > Python-Fu > Console 调出控制台,带有

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)]
>>>

——所以,Python 似乎再次发挥作用了。

3.因为this tip here我尝试运行 Python 脚本。我打开一个图像并运行“滤镜”>“渲染”>“云”>“雾”。工作起来就像一个魅力 - 在控制台中,当窗口启动时,我确实收到了一些类型转换警告:

** (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 应加载以下脚本目录:

/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 文件(所以,可能全部都在计划中)。我自己从未在这里添加过任何内容。

5. 我只有一个脚本:ls -l "/Users/julio/Library/Application Support/Gimp/2.8/scripts" 产量

total 8
-rwxr-xr-x 1 julio staff 654 25 Jun 16:25 minimal.py

(没有别的)

6.这是我的minimal.py:

#!/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 already> 上面指出的目录,我在“工具”菜单中看不到任何“最小”项目。

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

#!/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()

最佳答案

Python“脚本”从技术上讲是“插件”,因此应位于“插件”子目录中 (/Users/julio/Library/Application Support/GIMP/2.8/plug-ins)。

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

{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

关于Python-fu 脚本未显示在 Gimp 菜单中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38030656/

46 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com