Gedit 插件可以绑定到 OnSave 事件吗?
我正在编写一个 gedit 3 插件,类似于 phsilva 的 PyLint 插件,它调用外部 lint 程序并突出显示当前文档中的代码行。我的问题是,如果我的插件有 run_lint
操作,是否可以将其绑定到 gedit 中的 OnSave
事件?我上面链接的文档中的可用信号列表仍然有一个 FIXME
通知,我正在努力找出在 API 文档汤中的哪里可以找到完整的列表。
I'm writing a gedit 3 plugin, something similar to phsilva's PyLint plugin, which calls out to an external lint program and highlights lines of code in the current document. My question is, if my plugin has a run_lint
action is it possible to bind that to the OnSave
event in gedit? The list of available signals in the documentation I've linked above still has a FIXME
notice against it and I'm struggling to figure out where in the soup of API documentation the full list can be found.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,没有人回答这个问题,但我最终明白了。当在包含文档的窗口中创建新选项卡时,需要执行两个步骤。该文档具有可连接到操作的
loaded
和saved
信号。重要的是要记住,每个选项卡都有一个单独的文档,每个文档都需要自己的一组信号和处理程序。这是一个概要解决方案,以防对其他人有用:
Well, no-one answered this, but I figured it out eventually. There are two steps to this, when a new tab is created in the window that tab contains a document. The document has
loaded
andsaved
signals that can be connected to actions. It's important to remember that each tab has a separate document, each of which needs its own set of signals and handlers.Here's an outline solution, in case it's useful to others: