快速 ubuntu-应用程序 + 指示器模板不起作用

快速 ubuntu-应用程序 + 指示器模板不起作用

我已经开始使用 quick 和 python(因为我想进行一些 GTk3 集成并创建 appindicator),因此我像这样创建了 projecto:

quickly create ubuntu-application ualarm
cd ualarm
quickly run

然后应用程序就启动了。但后来我尝试像这样添加 appindicator:

quickly add indicator

从那时起,应用程序不再启动,并出现此错误:

aliasbody@BodyUbuntu-PC:~/Projectos/ualarm$ quickly run

(ualarm:8515): Gtk-WARNING **: Theme parsing error: gnome-panel.css:28:11: Not using units is deprecated. Assuming 'px'.
/usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py:391: Warning: g_object_set_property: construct property "type" for object `Window' can't be set after construction
Gtk.Window.__init__(self, type=type, **kwds)
Traceback (most recent call last):
File "bin/ualarm", line 33, in <module>
ualarm.main()
File "/home/aliasbody/Projectos/ualarm/ualarm/__init__.py", line 33, in main
window = UalarmWindow.UalarmWindow()
File "/home/aliasbody/Projectos/ualarm/ualarm_lib/Window.py", line 35, in __new__
new_object.finish_initializing(builder)
File "/home/aliasbody/Projectos/ualarm/ualarm/UalarmWindow.py", line 24, in finish_initializing
super(UalarmWindow, self).finish_initializing(builder)
File "/home/aliasbody/Projectos/ualarm/ualarm_lib/Window.py", line 75, in finish_initializing
self.indicator = indicator.new_application_indicator(self)
File "/home/aliasbody/Projectos/ualarm/ualarm/indicator.py", line 52, in new_application_indicator
ind = Indicator(window)
File "/home/aliasbody/Projectos/ualarm/ualarm/indicator.py", line 20, in __init__
self.indicator = AppIndicator3.Indicator('ualarm', '',      AppIndicator3.IndicatorCategory.APPLICATION_STATUS)
TypeError: GObject.__init__() takes exactly 0 arguments (3 given)

我怎么解决这个问题 ?

答案1

该命令quickly add indicator创建一个文件项目名称/indicator.py指标的创建位置。

self.indicator = AppIndicator3.Indicator('projectname', '', AppIndicator3.IndicatorCategory.APPLICATION_STATUS)

将此行更改为:

self.indicator = AppIndicator3.Indicator.new('projectname', '', AppIndicator3.IndicatorCategory.APPLICATION_STATUS)

并且它会起作用。

相关内容