Я создаю приложение Python GTK и использовал Glade для определения интерфейса. (с помощью Glade Interface Designer).
На Glade все выглядит хорошо, но когда я пытаюсь создать GUI из моей программы на Python, он выдает ошибку при загрузке представлений, связанных с Webkit:
Glade - недопустимый тип объекта 'WebKitWebView'
Он отлично работает в Glade Designer, а также, если я создаю виджеты вручную, но Builder это не нравится.
Я создаю пользовательский интерфейс так:
GtkBuilder = Gtk.Builder.new_from_file("glade/main.glade")
GtkBuilder.connect_signals(self)
Мой файл .glade:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="webkit2gtk" version="4.0"/>
<object class="GtkPopover" id="popover1">
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<object class="WebKitSettings" id="wv_settings">
<property name="enable_developer_extras">True</property>
<property name="enable_dns_prefetching">True</property>
<property name="enable_webaudio">True</property>
<property name="enable_webgl">True</property>
<property name="user_agent">Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15</property>
<property name="enable_smooth_scrolling">True</property>
<property name="enable_accelerated_2d_canvas">True</property>
<property name="enable_media_stream">True</property>
<property name="enable_mediasource">True</property>
<property name="enable_encrypted_media">True</property>
</object>
<object class="GtkApplicationWindow" id="MainWindow">
<property name="can_focus">False</property>
<property name="window_position">center</property>
<property name="default_width">440</property>
<property name="default_height">250</property>
<property name="deletable">False</property>
<child>
<object class="WebKitWebView" id="webview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="settings">wv_settings</property>
<property name="is_ephemeral">True</property>
<signal name="decide-policy" handler="on_webview_decide_policy" swapped="no"/>
<signal name="load-changed" handler="on_webview_load_changed" swapped="no"/>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="btn_back">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_back_btn_clicked" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-go-back</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="btn_forward">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_btn_forward_clicked" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-go-forward</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_refresh">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_btn_refresh_clicked" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-refresh</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="title">
<object class="GtkEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">30</property>
<property name="caps_lock_warning">False</property>
<property name="input_purpose">url</property>
<signal name="activate" handler="on_search_input" swapped="no"/>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_close">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_btn_close_clicked" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-close</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_settings">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_btn_settings_clicked" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-preferences</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="menu">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">popover1</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-index</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
Есть идеи, что я делаю не так?
Спасибо.