无法显示偏好设置对话框

无法显示偏好设置对话框

我又在使用 Python 时遇到了一些麻烦。我使用 Quickly 创建了一个项目,它为我创建了一个首选项对话框。我现在正尝试构建首选项对话框,但我总是得到一些错误,指向 Quickly 自己生成的一段代码。

robin@RobinJ:~/Ubuntu One/Python/gtkreddit$ quickly run
/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)
WARNING:gtkreddit_lib: connect_signals() 'expected handler 'btnRefresh_clicked' in /home/robin/Ubuntu One/Python/gtkreddit/gtkreddit/GtkredditWindow.pyc'
Traceback (most recent call last):
  File "bin/gtkreddit", line 33, in <module>
    gtkreddit.main()
  File "/home/robin/Ubuntu One/Python/gtkreddit/gtkreddit/__init__.py", line 33, in main
    window = GtkredditWindow.GtkredditWindow()
  File "/home/robin/Ubuntu One/Python/gtkreddit/gtkreddit_lib/Window.py", line 35, in __new__
    new_object.finish_initializing(builder)
  File "/home/robin/Ubuntu One/Python/gtkreddit/gtkreddit/GtkredditWindow.py", line 50, in finish_initializing
    dlgPreferences = PreferencesDialog ()
  File "/home/robin/Ubuntu One/Python/gtkreddit/gtkreddit_lib/PreferencesDialog.py", line 26, in __new__
    new_object.finish_initializing(builder)
AttributeError: 'NoneType' object has no attribute 'finish_initializing'

这是它所抱怨的部分;

def finish_initializing(self, builder): # pylint: disable=E1002
    """Set up the preferences dialog"""
    super(PreferencesGtkredditDialog, self).finish_initializing(builder)

完整代码可以在这里找到这里

请帮忙。我对 Python 还很陌生。

答案1

基类偏好设置对话框正在寻找名为的对象preferences_gtkreddit_dialog,您需要将对话框重命名为该对象。

此外,你的首选项GtkredditDialog Glade 文件已被改为认为它是 的一个实例GtkDialog,而它应该是 的一个实例PreferencesGtkredditDialog

相关内容