My Life Is A House

My daily life with all things Libre and Open

Monday, July 11, 2011

GSoC 2011 Jokosher porting to Gtk+3/PyGI - status quo


Yeah, this year again I'm working on Jokosher during Google Summer Of Code. Last summer I tried to implement Telepathy calls, thus creating nice podcast tool. While I partly succeeded and anyone willing to test it can do it using this Jokosher branch of mine on Launchpad, it . I'm planning to return to it after my porting job this summer because I want to see that feature in master branch and official release.
This summer I have different, but yet still very interesting task - porting PyGTK stuff over PyGI. GI comes here as GObject Introspection. To get full details about GI read here, but in nutshell it is method to create mostly automated bindings, using special API scanners and creating Python counterparts of C methods and variable types. Therefore PyGI API follows very closely C API. This gives two very obvious advantages - there is no need of complex support of bindings, and they are always mostly up to date.
For Jokosher it means that I have to replace most of PyGTK syntax which differs from Gtk+3 C API syntax. Thankfully, pygobject hackers and other coders with their porting tasks have created nice bash script called pygi-convert.sh which will replace lot of the obvious stuff automatically (like 'import gtk' to 'from gi.repository import Gtk'). While it helps porting considerably, you must take into account that it is quite "dumb" and can create some nasty side effects, especially on such large app as Jokosher. So, I started with pygi-convert.sh and then ran Jokosher in Gtk+3 enviroment to get errors, fix them and repeat these steps as much as needed. Mostly it was when script had done something wrong, like inserted replacement strings nested twice, but mostly it went surprisingly smooth.
After that I had usual "trial and error" sessions. List of bugs I encountered doing this I have put online here - and actual code can be found here, in my project's Bazaar branch on Launchpad. Taking into account rather nasty exams I had this year I'm quite happy with what I have achieved so far. My little but effective knowledge about Gtk+ internals is helping me considerably - and again big thanks goes out to hackers at #gnome-hackers and #python channel at GimpNet. Biggest problem so far I faced with is waveform drawing. Jokosher doesn't issue an error or traceback, but it doesn't draw a thing neither. So it doesn't let me try out event manipulation either, so I could have to check out considerable size of Gtk code after fixing waveform.
So for second part of this project my major aim will be to fix this waveform drawing. I also have bunch of small errors (like Unicode problems) I have yet to figure out how to fix - or they just side nuances of using jhbuild enviroment. After this I want to try out moving to PyGI for Gstreamer. This probably will be very difficult but also fun, because no one have actually tried that at home yet.