[wingide-users] GTK3 gi.repository completion
Wingware Support
support at wingware.com
Thu Nov 15 11:03:09 EST 2012
> If I try to complete code in debug mode.
> The completion is under Gtk._introspection_module instead of Gtk.
Hi,
I haven't had time to work on a fix yet but I think we'll need to do two
things:
1) Our introspection engine will need to look for _introspection_module
in some form (see below for possible work-around)
2) For static analysis, it will be necessary to generate *.pi files w/ a
script that imports the modules and looks through _introspection_module
then writes the *.pi files to a place where Wing will look for it. This
part is something you could do on your own. It is documented at the end
of this page: http://www.wingware.com/doc/edit/helping-wing-analyze-code
There is a script that did this for older pygtk in
src/wingutils/pygtk_to_pi.py in your Wing installation and, in the same
directory, a generic one generate_pi.py that is used for extracting
information from extension modules. It probably wouldn't be hard to
tweak one of these to look in _introspection_module instead of the top
level of the modules.
If you try (2) then please don't hesitate to ask questions.
I tried to come up with a work-around for (1) the runtime introspection
case and it seems that the following works and doesn't break the binding:
>>> for key in Gtk._introspection_module.__dict__.keys():
... setattr(Gtk, key, Gtk._introspection_module.__dict__[key])
>>> Gtk.AboutDialog
<class 'gi.repository.Gtk.AboutDialog'>
>>> dlg=Gtk.AboutDialog()
>>> dlg
<AboutDialog object at 0x21ef500 (GtkAboutDialog at 0x2686110)>
>>> dlg.show() # It shows a window!
If this is the case I can't understand why this isn't done to begin
with. Maybe there's supposed to be a way to load the bindings like
this, but I couldn't find any docs on that. It would certainly be
possible to write a simple module that you import as Gtk that does
this. I'd be interested in hearing whether this works if you try it.
I hope this helps...
Thanks,
--
Stephan Deibel
Wingware | Python IDE
Advancing Software Development
www.wingware.com
More information about the wingide-users
mailing list