[英]Simple Pantheon panel applet on eOS?
I would like to make a simple applet for the Pantheon Panel on eOS Luna with Python. 我想为使用Python在eOS Luna上的Pantheon Panel创建一个简单的applet。 I can't find any documentation on any API.
我找不到任何API的任何文档。 It's been suggested on some forum I should use the same procedure as Gnome or Unity.
有人在某些论坛上建议我应该使用与Gnome或Unity相同的过程。 The applets I have tried, however (like the one on this answer ), simply didn't work.
但是,我尝试过的小程序(就像该答案中的小程序一样)根本没有用。
Could you guide me a little towards what I should be doing to have a simple applet icon + menu showing on the Pantheon panel? 您能否指导我一些了解在万神殿面板上显示一个简单小程序图标+菜单的方法?
It seems one has to use the App Indicator module as per Ubuntu documentation. 似乎必须根据Ubuntu文档使用App Indicator模块。 The
appindicator
package of PyGtk didn't work out, but the PyGi AppIndicator3
does work fine as far as I can tell. appindicator
包无法正常运行,但据我所知,PyGi AppIndicator3
确实可以正常工作。
A simple example is: 一个简单的例子是:
#!/usr/env/bin/ python
from gi.repository import Gtk
from gi.repository import AppIndicator3 as appindicator
def menuitem_response(w, buf):
print buf
if __name__ == "__main__":
ind = appindicator.Indicator.new (
"example-simple-client",
"indicator-messages",
appindicator.IndicatorCategory.APPLICATION_STATUS)
ind.set_status (appindicator.IndicatorStatus.ACTIVE)
ind.set_attention_icon ("indicator-messages-new")
menu = Gtk.Menu()
for i in range(3):
buf = "Test-undermenu - %d" % i
menu_items = Gtk.MenuItem(buf)
menu.append(menu_items)
menu_items.show()
ind.set_menu(menu)
Gtk.main()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.