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 621207 - 'Rectangle' has no attribute '__info__'
'Rectangle' has no attribute '__info__'
Status: RESOLVED NOTABUG
Product: pygi
Classification: Deprecated
Component: general
unspecified
Other Linux
: Normal normal
: 0.6
Assigned To: pygi-maint
pygi-maint
Depends on:
Blocks:
 
 
Reported: 2010-06-10 14:38 UTC by Francesco Meloni
Modified: 2010-06-10 17:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Francesco Meloni 2010-06-10 14:38:40 UTC
deb pkg on  Maverik updated .

i am trying to port an italian erp to pygi:

is this the place to report or launchpad? 

  • File "/home/vete1010/pg2-gi/core/promogest/ui/SimpleGladeWrapper.py", line 31 in <module>
    from gi.repository import Gtk
  • File "/usr/lib/pymodules/python2.6/gtk-2.0/gi/importer.py", line 71 in load_module
    overrides_modules = __import__('gi.overrides', fromlist=[namespace])
  • File "/usr/lib/pymodules/python2.6/gtk-2.0/gi/overrides/Gtk.py", line 23 in <module>
    from gi.repository import Gdk
  • File "/usr/lib/pymodules/python2.6/gtk-2.0/gi/importer.py", line 71 in load_module
    overrides_modules = __import__('gi.overrides', fromlist=[namespace])
  • File "/usr/lib/pymodules/python2.6/gtk-2.0/gi/overrides/Gdk.py", line 44 in <module>
    Rectangle = override(Rectangle)
  • File "/usr/lib/pymodules/python2.6/gtk-2.0/gi/types.py", line 163 in override
    g_type = type_.__info__.get_g_type()

  AttributeError: type object 'Rectangle' has no attribute '__info__'

F.
Comment 1 Francesco Meloni 2010-06-10 15:24:26 UTC
sorry, i had an import gtk before that i don't  sow

wich is the right place to fill a bug?
Comment 2 Tomeu Vizoso 2010-06-10 15:31:16 UTC
(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.
Comment 3 Francesco Meloni 2010-06-10 15:41:22 UTC
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.
Comment 4 Francesco Meloni 2010-06-10 15:43:18 UTC
This is not a bug i guess, i think you know about that so i ll wait:

  • File "/home/vete1010/pg2-gi/core/promogest/ui/Login.py", line 407 in on_login_window_key_press_event
    if event.type == gtk.gdk.KEY_PRESS:
  • File "/usr/lib/pymodules/python2.6/gtk-2.0/gi/module.py", line 211 in __getattr__
    attribute = getattr(self._dynamic_module, name)
  • File "/usr/lib/pymodules/python2.6/gtk-2.0/gi/module.py", line 87 in __getattr__
    self.__class__.__name__, name))

  AttributeError: 'DynamicModule' object has no attribute 'gdk'
Comment 5 johnp 2010-06-10 15:55:53 UTC
from gi.repository import Gdk

if event.type == Gdk.EventType.KEY_PRESS:
Comment 6 Francesco Meloni 2010-06-10 16:30:32 UTC
it doesn't work

  • File "/home/vete1010/pg2-gi/core/promogest/ui/Login.py", line 409 in on_login_window_key_press_event
    if event.type == Gdk.EventType.GDK_KEY_PRESS:

  AttributeError: type object 'EventType' has no attribute 'GDK_KEY_PRESS'
Comment 7 johnp 2010-06-10 17:41:59 UTC
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.
Comment 8 Francesco Meloni 2010-06-10 17:50:51 UTC


  • File "/home/vete1010/pg2-gi/core/promogest/ui/Login.py", line 409 in on_login_window_key_press_event
    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":
Comment 9 johnp 2010-06-10 17:59:16 UTC
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