PDA

View Full Version : Porting a python app and already out of my depth :-)


cferrism
2010-08-09, 12:36
Guys,

I have decided to jump in at the deep end and look at development for the n900. Im not much of a programmer though apart from dabbling in vb when needed at work so its probably going to be a slow ride. ive never been much for the hello world method of learning, preferring to get my hands on a more complex piece of code and just figure out how its working as i go. so heres where i am at the moment and any help or abuse that ive bitten off more than i can chew would be appreciated:

i have decided to start in python as im getting the general opinion that its easy to pick up and to my benefit the application im looking to port (xbox friend list) is available as python open source which i have messed about with and got running on ubuntu with minimal fuss. The problem now is it uses gtk.glade. I was under the impression that this was supported and that apps like gpodder used it but if i try to run the code on the n900 i get a module gtk.glade not found error.

From searching about i see reference to gtkbuilder as an alternative but while i understand the majority of the code im not entirely sure which bits reference the glade and so what would need to be changed.

Am i on to a lost cause trying to port a python app? any advise or help would be appreciated

Marcus
2010-08-09, 13:33
Have you installed PyMaemo on your N900? I think that might solve it, give it a shot.

epage
2010-08-09, 13:38
Guys,

I have decided to jump in at the deep end and look at development for the n900. Im not much of a programmer though apart from dabbling in vb when needed at work so its probably going to be a slow ride. ive never been much for the hello world method of learning, preferring to get my hands on a more complex piece of code and just figure out how its working as i go. so heres where i am at the moment and any help or abuse that ive bitten off more than i can chew would be appreciated:

i have decided to start in python as im getting the general opinion that its easy to pick up and to my benefit the application im looking to port (xbox friend list) is available as python open source which i have messed about with and got running on ubuntu with minimal fuss. The problem now is it uses gtk.glade. I was under the impression that this was supported and that apps like gpodder used it but if i try to run the code on the n900 i get a module gtk.glade not found error.

From searching about i see reference to gtkbuilder as an alternative but while i understand the majority of the code im not entirely sure which bits reference the glade and so what would need to be changed.

Am i on to a lost cause trying to port a python app? any advise or help would be appreciated

Making sure you have all the needed dependencies is an important thing. Also if you don't want to fork the app but keep it working on desktop and Maemo, I would recommend a module I use to hide away hildon specific code
https://garage.maemo.org/plugins/ggit/browse.php/?p=gc-dialer;a=blob;f=src/hildonize.py;h=339eb2a6f11bea01ae804497ab6c921ab0e 6dc9c;hb=9555abf234c0141c05a17c5f7e5009d3146bb474

cferrism
2010-08-09, 14:01
Cheers folks! Ill have a look and report back :)

cferrism
2010-08-09, 17:33
Nope :( Instaled the Maemo-Python-Device development enviroment finally (after a dependency nightmare caused by another app), which I assume gives me pymaemo as it was the only one I could find and still complaining about the GTK.Glade statement. Seems to be the only part so far that it doesnt like which suprised me as if I comment it out it gets down to the xml glade statement before it falls over again. Pasted the first part of the code here in case anyone can tell me what I am missing (epage, cheers for the link to your source. defo useful)

#!/usr/bin/python


import ConfigParser
from ConfigParser import NoOptionError
import os
import os.path
import re
import threading
import time
import urllib2

import pygtk
pygtk.require("2.0")
import gtk
# import gtk.glade
import gnome
import gobject

fatalsaint
2010-08-09, 17:51
Make sure you have python-glade2 installed..

epage
2010-08-09, 17:56
Nope :( Instaled the Maemo-Python-Device development enviroment finally (after a dependency nightmare caused by another app), which I assume gives me pymaemo as it was the only one I could find and still complaining about the GTK.Glade statement. Seems to be the only part so far that it doesnt like which suprised me as if I comment it out it gets down to the xml glade statement before it falls over again. Pasted the first part of the code here in case anyone can tell me what I am missing (epage, cheers for the link to your source. defo useful)

#!/usr/bin/python


import ConfigParser
from ConfigParser import NoOptionError
import os
import os.path
import re
import threading
import time
import urllib2

import pygtk
pygtk.require("2.0")
import gtk
# import gtk.glade
import gnome
import gobject

I know an easy way to get the deps taken care of, install all of the apps in my signature ;)

Well, Dialcentral should do the trick.

cferrism
2010-08-09, 18:28
doh! i was so busy checking the repository i never even thought to do an apt-get for the glade plugin (and just assumed it would be included as part of python like it was in ubuntu) Cheers fatalsaint that sorted it....well im now getting a segmentation error but im further than i was so more playing for me :o) You guys have been a great help as i had been googling that for days.

cferrism
2010-08-09, 18:48
awesomeness! got that issue sorted and the app is now loading and i can type in my username and password and connect to xbox live!! not showing anything once its connected and no notifications but once i have figured that out i will have a fully functional xbox friends app. this is why i love the n900....to be continued!!

cferrism
2010-08-09, 22:51
Woohoo!

I have successfully ported my first app and I have to say Im pretty damn proud of myself, and feel I have contributed in some small way :p. Will work on making it a bit more maemo friendly later but coming to repository near you....once I figure out that side of things :D