User: Password:
Subscribe / Log in / New account

Clasen: Introducing GtkInspector

Clasen: Introducing GtkInspector

Posted May 19, 2014 8:54 UTC (Mon) by jospoortvliet (subscriber, #33164)
In reply to: Clasen: Introducing GtkInspector by tetromino
Parent article: Clasen: Introducing GtkInspector

This has been in Qt forever, from what I understand. See google:

And of course, the SMOKE bindings allow writing a GTK hello world app in Qt:


(Log in to post comments)

Clasen: Introducing GtkInspector

Posted May 19, 2014 13:19 UTC (Mon) by kigurai (subscriber, #85475) [Link]

But is there anything in place so that this information can actually be used in an automated fashion?

Currently I can start a Python shell and do

>>> from gi.repository import GtkSource

and now I can natively make calls to the GtkSourceView library using a Pythonic interface.
And the same would go for JS, or any language for which a GObject introspection functionality exists.

When I've looked at programming with Qt, I've gotten the impression that all the Python interfaces are "handcrafted" in some sense. But maybe I'm wrong on this.

Still GIR is a really nice concept that I wish was more common.

Clasen: Introducing GtkInspector

Posted May 19, 2014 13:27 UTC (Mon) by sandsmark (subscriber, #62172) [Link]

Language bindings for KDE libraries (and some other libraries, though it was made by KDE and is therefore most popular there) are made by SMOKE/smokegen automatically. It has been around for a while now. It doesn't require you to do anything at runtime though, as it seems like the GObject introspections does?

Clasen: Introducing GtkInspector

Posted May 19, 2014 13:59 UTC (Mon) by kigurai (subscriber, #85475) [Link]

Hmm, I could not really make sense of the documentation of that page.
But, to met still seemed like you
1) Have to write a lot of SMOKE specific code, and
2) have to do this for every language binding?

But, as I said, the documentation was not really clear to me.

With GIR, the introspection file is created once for each library, and the GIR mechanism is created once per runtime (Python, JS, ...).
And yes, it means doing things at runtime, but I have not noticed any overhead when using the Python GIR module.
For compiled languages I am guessing you would simply call into the C-library anyway?

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds