Generate python code from Glade XML files


The One-Laptop-Per-Child’s XO laptop has Tepache to generate code from Glade XML.

http://wiki.laptop.org/go/PyGTK/Hello_World_with_Glade_and_Sweettepache

But they’ve added some extras to it to make it play nicely in the sugar desktop environment and perhaps updated versions of glade 3. I guess it works for them, but i’m not developing on or for the XO right now.

Why can’t I find a code generator that works?

train_wreck_st_malo_france_aug_1944

Tepache?

Tepache is a code sketcher for python that uses pygtk and glade.

It’s supposed to create pure python modules so they call it a sketcher rather than a generator. But the Tepache homepage is broken and it looks like it hasn’t been updated since July 2005 anyway. Following a link to anything useful will result in the incarnation of an ugly oops page.

An error has been encountered in accessing this page.
1. Server: kefir.sourceforge.net
2. URL path: /tepache/tepache
3. Error notes: NONE
4. Error type: 404

trainwreck_1

Gladex?

Gladex was broken out of the box. It wouldn’t load any plugins. The entries just show up in the dialog with place holders, so it won’t actually generate anything at all.

trainwreck_3

autoglade?

Autoglade doesn’t seem to be that old, but it’s not working on my apps and the documentation is, well… limited. There’s a README.txt but it’s empty. And a CHANGES.txt, but that’s empty too.
./autoglade.py id.glade

===Oh well.===
====I’m probably just doing it wrong.====
Time to just carve it out by hand.



2 thoughts on “Generate python code from Glade XML files

  1. Try: http://wiki.laptop.org/go/Tepache

    I also found “Writing PyGTK applications in a visual way” {http://kefir.sourceforge.net/tepache/}
    and “Glade to Python conversion” {http://python-forum.com/pythonforum/viewtopic.php?f=4&t=6687}

  2. I ended up saving the glade xml in guibuilder format and writing the code by hand. I know it’s not nearly as manly as writing all the gtk stuff from scratch, but I really like having the gui separated from the code like this.