After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639173 - AttributeError: 'gi.repository.Gdk' object has no attribute 'Drawable'
AttributeError: 'gi.repository.Gdk' object has no attribute 'Drawable'
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-10 20:55 UTC by Evan Dandrea
Modified: 2011-01-11 15:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Evan Dandrea 2011-01-10 20:55:36 UTC
>>> from gi.repository import Gdk
>>> Gdk.threads_enter()
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
  • File "/usr/lib/pymodules/python2.7/gtk-2.0/gi/module.py", line 234 in __getattr__
    self._import()
  • File "/usr/lib/pymodules/python2.7/gtk-2.0/gi/module.py", line 228 in _import
    overrides_modules = __import__('gi.overrides', fromlist=[self._namespace])
  • File "/usr/lib/pymodules/python2.7/gtk-2.0/gi/overrides/Gdk.py", line 65 in <module>
    class Drawable(Gdk.Drawable):
  • File "/usr/lib/pymodules/python2.7/gtk-2.0/gi/module.py", line 98 in __getattr__
    self.__name__, name))
AttributeError: 'gi.repository.Gdk' object has no attribute 'Drawable'

Using gir1.2-gtk-2.0 version 2.23.90-0ubuntu2 on Ubuntu Natty.
Comment 1 Martin Pitt 2011-01-10 20:57:15 UTC
I confirm this on current upstream git head of gtk-2-24.
Comment 2 Tomeu Vizoso 2011-01-11 08:40:12 UTC
If GdkDrawable isn't in the .gir any more, there's nothing that PyGObject can do.

Please check if GdkDrawable is present in the .gir and if it isn't and it should be, move this bug to either the gtk+ module or gobject-introspection.
Comment 3 Tomeu Vizoso 2011-01-11 08:43:49 UTC
Also, note that currently we are not aiming to support gtk+ 2.x in pygobject, only gtk+ 3. So I'm closing this bug accordingly.

If people want to use gtk+ 2 with pygobject and introspection, we'll need help maintaining that combination.
Comment 4 Martin Pitt 2011-01-11 13:47:44 UTC
It is in the .gir:

    <class name="Drawable"
           c:symbol-prefix="drawable"
           c:type="GdkDrawable"
           parent="GObject.Object"
           abstract="1"
           glib:type-name="GdkDrawable"
           glib:get-type="gdk_drawable_get_type"
           glib:type-struct="DrawableClass">

I recently did some commits to gtk-2-24 to improve usage with GI, and it actually works pretty well now. I'll have a look at this RSN.
Comment 5 Martin Pitt 2011-01-11 14:06:46 UTC
Funnily enough this _does_ work with current Gtk 2-24 head, but not with Gtk 2.93.7. /usr/share/gir-1.0/Gdk-3.0.gir doesn't contain Drawable at all, i. e. not just introspectable="0".

Evan, try

>>> from gi.repository import Gdk
>>> Gdk.require_version('2.0')
>>> Gdk.threads_enter()
Comment 6 Evan Dandrea 2011-01-11 14:52:16 UTC
Indeed, that works.
Comment 7 Tomeu Vizoso 2011-01-11 14:57:46 UTC
(In reply to comment #5)
> Funnily enough this _does_ work with current Gtk 2-24 head, but not with Gtk
> 2.93.7. /usr/share/gir-1.0/Gdk-3.0.gir doesn't contain Drawable at all, i. e.
> not just introspectable="0".

Yes, GdkDrawable has been removed from gtk+ 3.
Comment 8 Martin Pitt 2011-01-11 15:25:00 UTC
This got fixed in git head:

http://git.gnome.org/browse/pygobject/commit/?id=4d097eea94258eda0c328711491fd456cbd6741b

Evan, I'll update our pygobject to a recent git snapshot.

Thanks!