<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Webninja &#187; 770</title>
	<atom:link href="http://www.webninja.com/category/geek/770/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webninja.com</link>
	<description>Like you care...</description>
	<pubDate>Thu, 11 Dec 2008 20:47:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
			<item>
		<title>Nokia 770, Development, and How Cool is Python?</title>
		<link>http://www.webninja.com/2006/02/04/nokia-770-development-and-how-cool-is-python/</link>
		<comments>http://www.webninja.com/2006/02/04/nokia-770-development-and-how-cool-is-python/#comments</comments>
		<pubDate>Sat, 04 Feb 2006 06:19:01 +0000</pubDate>
		<dc:creator>Caleb Shay</dc:creator>
		
		<category><![CDATA[770]]></category>

		<category><![CDATA[Geek]]></category>

		<category><![CDATA[gtk]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[maemo]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.webninja.com/2006/02/04/nokia-770-development-and-how-cool-is-python/</guid>
		<description><![CDATA[As I mentioned earlier, I got a Nokia 770.

I decided I would try my hand at doing some development on this thing, ostensibly as a potential solution for a client.  The question was, what was I going to use as a programming language?  The 770&#8217;s OS is Linux, which certainly doesn&#8217;t lack in [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image22" style="float: left" src="http://www.webninja.com/wp-content/uploads/2006/02/770_support_main.thumbnail.jpg" alt="Nokia 770" width="96" height="96" />As I mentioned <a href="http://www.webninja.com/2006/01/27/new-toy/">earlier</a>, I got a <a href="http://www.nokia.com/770" target="_blank">Nokia 770</a>.</p>

<p>I decided I would try my hand at doing some development on this thing, ostensibly as a potential solution for a client.  The question was, what was I going to use as a programming language?  The 770&#8217;s OS is Linux, which certainly doesn&#8217;t lack in language options.  They even provide a full SDK and development environment for the 770 at <a href="http://www.maemo.org/" target="_blank">maemo.org</a>.  A quick browse through the documentation showed me that the UI for the 770 is basically <a href="http://www.gtk.org/" target="_blank">Gtk+</a> and parts of <a href="http://www.gnome.org/" target="_blank">Gnome</a> plus a Nokia created extension to Gtk called <a href="http://www.maemo.org/platform/docs/tutorials/Maemo_tutorial.html#Hildon-UI" target="_blank">Hildon</a>.  Well, the language of choice for gtk and gnome is C, but I don&#8217;t really like writing C unless I really need the performance.  Fortunately there are a ton of language bindings for gtk, somebody was bound to have ported one for a language I like to the 770.  Sure enough, the <a href="http://web.indt.org/" target="_blank">Nokia Institute of Technology</a> in Brazil not only ported <a href="http://www.python.org/" target="_blank">Python</a> to the 770, they even ported the gtk modules and created bindings for the Hildon extensions.  They call the whole package <a href="http://pymaemo.sourceforge.net/" target="_blank">PyMaemo</a>.</p>

<p>I really like python.  I&#8217;ve actually been using it quite a bit lately for some projects for clients.  I&#8217;m not a great python programmer yet, I still have to look things up fairly often.  Not like <a href="http://www.php.net/" target="_blank">PHP</a>, where I could probably name every function and its arguments from memory. Anyways, I installed PyMaemo onto my 770 and did your basic &#8220;Does HelloWorld work?&#8221; kind of testing on it and then got down to business.</p>

<p>First, I created a simple pygtk app along the lines of:</p>

<pre>import gtk
app = gtk.Window(gtk.WINDOW_TOPLEVEL)
app.set_title("My App")
app.add(gtk.Label("Testing..."))
app.show_all()
gtk.main()
</pre>

<p>That seemed to work fine, though the app looked a little funny.  It didn&#8217;t seem to fit the screen quite right.</p>

<p>So, I figured I would head back to the PyMaemo site and check the docs on the Hildon bindings.  There aren&#8217;t any.  None.  They didn&#8217;t document it at all.  So, I checked out the maemo.org site for Hildon docs.  They have docs, but only for C.  I could figure out what most of the python methods were called based on the function names in the C API, but not all of them.  Thank goodness for python&#8217;s self-documenting nature. Even when a class/method doesn&#8217;t have a <strong>doc</strong> string, you can still at least get the method names using dir().  If you haven&#8217;t seen this it&#8217;s pretty cool.  The theory goes like this:  Everything in python is an object, and obviously an object must know what properties and methods it has, so if I create an instance of an object, I should be able to find out what properties and methods that instance has.  So, when I couldn&#8217;t figure out why I didn&#8217;t have a hildon.app_new like it said in the C api, I simply did:
<pre>
import hildon
dir(hildon)
</pre></p>

<p>&#8230;and looked through the output for a likely looking method (it turned out I just needed hildon.App()).</p>

<p>So, after going through some docs, and digging through some dir() output, I converted my app to Hildon like so:</p>

<pre>import gtk
import hildon
app = hildon.App()
app.set_title("Hildon App")
app.set_two_part_title(True)
view = hildon.AppView("Main")
view.add(gtk.Label("Testing..."))
app.set_appview(view)
app.show_all()
gtk.main()
</pre>

<p>The concept here is that the 770 doesn&#8217;t really have room for multiple windows in a single app, so instead you create an app and multiple views that can be switched between.  It&#8217;s actually a very comfortable concept to work inside.  I create different views for every type of display I need in my application and then just swap them out as needed.</p>

<p>So, this time the app looked just like any other native app on the 770&#8230;except for the lack of an application icon.  I&#8217;m not sure how to deal with that yet, but I&#8217;m sure enough digging through dir() output will turn up what I&#8217;m looking for.</p>

<p>I wish I&#8217;d seen <a href="http://www.teemuharju.net/2006/01/26/coding-for-nokia-770-using-python-part-1/" target="_blank">this blog</a> before I started fighting with this, would have saved me hours of work.</p>

<p><strong>Edit:</strong></p>

<p>Hooray for Teemu&#8217;s blog.   Now I know <a href="http://www.teemuharju.net/2006/02/14/coding-for-nokia-770-using-python-misc-notes/">how to make the application icon show up</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webninja.com/2006/02/04/nokia-770-development-and-how-cool-is-python/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Toy!</title>
		<link>http://www.webninja.com/2006/01/27/new-toy/</link>
		<comments>http://www.webninja.com/2006/01/27/new-toy/#comments</comments>
		<pubDate>Sat, 28 Jan 2006 00:50:32 +0000</pubDate>
		<dc:creator>Caleb Shay</dc:creator>
		
		<category><![CDATA[770]]></category>

		<category><![CDATA[Geek]]></category>

		<guid isPermaLink="false">http://www.webninja.com/2006/01/27/new-toy/</guid>
		<description><![CDATA[I got a Nokia 770.  This thing is awesome.  That&#8217;s it.  That&#8217;s all I have to say.  I&#8217;ve started doing some development on it, and I really like it.  I&#8217;ll post more when I have more to say.
]]></description>
			<content:encoded><![CDATA[<p>I got a <a target="_blank" href="http://www.nokia.com/770">Nokia 770</a>.  This thing is awesome.  That&#8217;s it.  That&#8217;s all I have to say.  I&#8217;ve started doing some development on it, and I really like it.  I&#8217;ll post more when I have more to say.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webninja.com/2006/01/27/new-toy/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
