Closed major-mayer closed 3 years ago
Can't you just specify the version on the command line eg -m Gtk-3.0
or -m Gtk-4.0
? That's what I've been doing, and it seems to work,
Really? Specifying those arguments do work for you? For me it doesn't and I don't see where in the code this logic would come from...
~/Checkouts/fakegir >>> ./fakegir.py -m Gtk-3.0
Parsing /usr/share/gir-1.0/Gom-1.0.gir
...
Parsing /usr/share/gir-1.0/Gtk-3.0.gir
Parsing /usr/share/gir-1.0/LangTag-0.6.gir
Parsing /usr/share/gir-1.0/Gcr-3.gir
...
Parsing /usr/share/gir-1.0/Gtk-4.0.gir
Parsing /usr/share/gir-1.0/cairo-1.0.gir
...
Perhaps it only works for me because I'm using Gtk-4.0 anyway. I'm using my own fork, but I don't think I changed anything relevant to this issue.
I guess this must be the reason then. At least for me the Gtk-4.gir files get converted later, so they overwrite all Gtk-3 files that were created previously.
BTW: I would like to also use Gtk4 but can't find any good Python tutorials on it. Any suggestions?
Not really, I just relied on my experience with GTK3 and looking at the migration guide and C API docs for each widget.
Oh wait, python. I had this confused with another project for Typescript! You might actually find that helpful too, because one of the problems I had with python was that it could be hard to work out the parameters etc for functions in libraries that didn't have any docs for the python version of their API. The .d.ts
files ts-for-gjs outputs provide a really handy reference, and I think the binding rules for python and gjs are very similar.
The patch looks simple enough, thanks for bringing support for Gtk 2 as well :D
Thanks for the quick merge :) Maybe you should update the readme at some point
Now that GTK4 is released the assumption that there is only one GTK version to generate stubs for doesn't work anymore. I experienced this myself the hard way, because the GTK 3 stub files always got overwritten by the GTK 4 ones which are completely different and don't make sense when you want to use GTK3.
To solve this, I introduced another environment variable that let's the user select the GTK version he wants. If no environment variable is set, the script generates stubfiles for GTK3 by default, because i think that's the most used right now.