Can't add WebKit.WebView to a Gtk.Window

Bug #796131 reported by Stuart Langridge
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pygobject (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

$ python -c "from gi.repository import Gtk,WebKit; w=Gtk.Window(); v=WebKit.WebView(); w.add(v)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 44, in function
    return info.invoke(*args)
TypeError: argument 1: Must be Gtk.Widget, not WebView

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: python-gobject 2.28.3-1ubuntu1.1
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic-pae 2.6.38.2
Uname: Linux 2.6.38-8-generic-pae i686
Architecture: i386
Date: Sun Jun 12 08:12:37 2011
ProcEnviron:
 LANGUAGE=en_GB:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 LC_MESSAGES=en_GB.utf8
 SHELL=/bin/bash
SourcePackage: pygobject
UpgradeStatus: Upgraded to natty on 2011-01-18 (144 days ago)

Revision history for this message
Stuart Langridge (sil) wrote :
Revision history for this message
Jason Gerard DeRose (jderose) wrote :

I battled the same thing in dmedia for quite a while, and I think the issue was having a mix of Gtk2 and Gtk3 installed, needing to explicitly require the correct versions before importing from gi.repository. Here's an example:

import gi
gi.require_version('Gtk', '2.0')
gi.require_version('WebKit', '1.0')
from gi.repository import Gtk, WebKit

I attached the dummy-client script I use in dmedia to automatically run JavaScript unit tests in embedded webkit, so you have a full working example (or at least it's working for me right now).

Revision history for this message
Stuart Langridge (sil) wrote :

Sadly, that doesn't seem to work for me; Jason's dummy-client gives the same error:

$ python dummy-client.py
Traceback (most recent call last):
  File "dummy-client.py", line 54, in <module>
    scroll.add(view)
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 44, in function
    return info.invoke(*args)
TypeError: argument 1: Must be Gtk.Widget, not WebView

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

I've been trying to reproduce this, haven't been able to. My hunch is something different in the packages we have installed might be the problem.

But obviously this affects dmedia too... if Stuart is having this problem, others probably are too, or will in the future.

Stuart, can you try this on a fresh install in a VM or something? I can too, although I'm off for a bike ride right now.

Changed in pygobject (Ubuntu):
importance: Undecided → Low
Revision history for this message
Martin Pitt (pitti) wrote :

I tested this on current oneiric, and it works fine. So I'm closing this for oneiric. Do you need this working on natty for an SRU? If it's important, we can presumably find an SRU to fix it.

Changed in pygobject (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers