GNOME Bugzilla – Bug 625096
WebKit class wrapped incorrectly
Last modified: 2010-07-30 13:00:09 UTC
>>> from gi.repository import Gtk, WebKit >>> Gtk.Window() <Window object at 0x7fb3a6093960 (GtkWindow at 0x1efd400)> >>> WebKit.WebView() <WebView object at 0x7fb3a609a280 (WebKitWebView at 0x1f95000)> >>> WebKit.WebView().get_back_forward_list() <__main__.WebKitWebBackForwardList object at 0x7fb3a609a6e0 (WebKitWebBackForwardList at 0x1fa4100)> >>> WebKit.WebView().get_back_forward_list().get_back_length() Traceback (most recent call last):
+ Trace 222967
>>> WebKit.WebBackFowardList Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/lucian/pygi-0.6.0/gi/module.py", line 87, in __getattr__ self.__class__.__name__, name)) AttributeError: 'DynamicModule' object has no attribute 'WebBackFowardList' As you can see, that class is missing from the WebKit module and the object returned by get_back_forward_list is not backed by it (hence no methods).
Forgot to add, i'm using PyGI 0.6.0.
Typo. >>> WebKit.WebBackForwardList <class 'gi.types.__main__.WebKitWebBackForwardList'> But the object returned by get_back_forward_list still has no methods.
(In reply to comment #2) > Typo. > > >>> WebKit.WebBackForwardList > <class 'gi.types.__main__.WebKitWebBackForwardList'> > > But the object returned by get_back_forward_list still has no methods. Do the methods appear in the .gir file? There's a big chance the problem is in gobject-introspection and not pygobject.
I've built pygobject and webkit in jhbuild. Now WebBackForwardList does have methods, but it's missing a few, most notably get_back_list_with_limit and get_forward_list_with_limit. Checking the .gir file, the WebBackForwardList has all the methods listed in the API reference, including get_back_list_with_limit and get_forward_list_with_limit.
Created attachment 166657 [details] Snipped from WebKit's .gir file Contains the relevant WebBackForwardList class and its methods.
Here's a list of methods from the python object >>> h = WebKit.WebBackForwardList() >>> h <WebBackForwardList object at 0x8800cd4 (WebKitWebBackForwardList at 0x880d590)> >>> dir(h) ['__class__', '__cmp__', '__copy__', '__deepcopy__', '__delattr__', '__dict__', '__doc__', '__format__', '__gdoc__', '__getattribute__', '__gobject_init__', '__grefcount__', '__gtype__', '__hash__', '__info__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'add_item', 'chain', 'clear', 'connect', 'connect_after', 'connect_object', 'connect_object_after', 'contains_item', 'disconnect', 'disconnect_by_func', 'emit', 'emit_stop_by_name', 'freeze_notify', 'get_back_item', 'get_back_length', 'get_current_item', 'get_data', 'get_forward_item', 'get_forward_length', 'get_limit', 'get_nth_item', 'get_properties', 'get_property', 'go_back', 'go_forward', 'go_to_item', 'handler_block', 'handler_block_by_func', 'handler_disconnect', 'handler_is_connected', 'handler_unblock', 'handler_unblock_by_func', 'new_with_web_view', 'notify', 'parent_instance', 'priv', 'props', 'set_data', 'set_limit', 'set_properties', 'set_property', 'stop_emission', 'thaw_notify', 'weak_ref'] No methods other than get_back_list_with_limit and get_forward_list_with_limit seem to be missing. It seems that the issue is indeed with WebKit, the two methods have the attributes introspectable="0".
(In reply to comment #6) > > It seems that the issue is indeed with WebKit, the two methods have the > attributes introspectable="0". In this case this ticket should be closed (and reopened later if the bug turns out to be in gobject-introspection).