GNOME Bugzilla – Bug 621207
'Rectangle' has no attribute '__info__'
Last modified: 2010-06-10 17:59:16 UTC
deb pkg on Maverik updated . i am trying to port an italian erp to pygi: is this the place to report or launchpad?
+ Trace 222340
from gi.repository import Gtk
overrides_modules = __import__('gi.overrides', fromlist=[namespace])
from gi.repository import Gdk
Rectangle = override(Rectangle)
g_type = type_.__info__.get_g_type()
AttributeError: type object 'Rectangle' has no attribute '__info__' F.
sorry, i had an import gtk before that i don't sow wich is the right place to fill a bug?
(In reply to comment #1) > sorry, i had an import gtk before that i don't sow > > wich is the right place to fill a bug? If you know it's something not related to your distro, here is fine. In case of doubt, filing a bug in Launchpad would be best.
thanks, the problem is that i don't know the devel status. My app is a complex pygtk program and with some, small change now is running with pygi, i have errors in parts like "event.type == gtk.gdk.KEY_PRESS " or actionGroup = gtk.ActionGroup("Actions") but is running fast almost perfectly. i imported Gtk as gtk for now great works. i ll post a video later for pg2-pi on vimeo F.
This is not a bug i guess, i think you know about that so i ll wait:
+ Trace 222341
if event.type == gtk.gdk.KEY_PRESS:
attribute = getattr(self._dynamic_module, name)
self.__class__.__name__, name))
AttributeError: 'DynamicModule' object has no attribute 'gdk'
from gi.repository import Gdk if event.type == Gdk.EventType.KEY_PRESS:
it doesn't work
+ Trace 222342
if event.type == Gdk.EventType.GDK_KEY_PRESS:
AttributeError: type object 'EventType' has no attribute 'GDK_KEY_PRESS'
That is because it is KEY_PRESS not GDK_KEY_PRESS. Try to familiarize yourself with the gir files in /usr/share/gir-1.0/. If you can't find a particular keyword simply search for its C equivalent. For example - GDK_KEY_PRESS: <enumeration name="EventType" glib:type-name="GdkEventType" glib:get-type="gdk_event_type_get_type" c:type="GdkEventType"> . . . <member name="button_press" value="4" c:identifier="GDK_BUTTON_PRESS" glib:nick="button-press"/> . . . Since this comes from the GDK gir that would tell you you want to look at Gsk.EventType and use the member BUTTON_PRESS. For enum members the name is always in caps.
+ Trace 222346
if event.type == Gdk.EventType.KEY_PRESS:
AttributeError: type object 'EventType' has no attribute 'KEY_PRESS' it was the same :) maybe i start to understand how to read the doc i passed the problem with that code if event.type == Gdk.EventType(8): if event.state & Gdk.ModifierType(1 << 2): but i can't solve this part was : if event.type == gtk.gdk.KEY_PRESS: if event.state & gtk.gdk.CONTROL_MASK: key = str(gtk.gdk.keyval_name(event.keyval)) if key.upper() == "L": ...... now : if event.type == Gdk.EventType(8): if event.state & Gdk.ModifierType(1 << 2): key = str(Gdk.EventKey().keyval) <------ ??????? if key.upper() == "L":
You must have an old gobject-introspection if KEY_PRESS isn't available: >>> Gdk.EventType.KEY_PRESS <enum GDK_KEY_PRESS of type GdkEventType> For your second issue event.key.keyval should work but as a warning, that isn't a stable interface. We are trying to fix the issues around GdkEvent. we are not sure when we will get around to it. It really should be event.keyval