View Single Post
Posts: 25 | Thanked: 8 times | Joined on Feb 2008
#5
Yay! With the new official desktop bindings, I have written my first task navigator panel in Python. It's just a simple shortcut to launch X Terminal.

/usr/share/applications/hildon-navigator/xterm-launch.desktop
Code:
[Desktop Entry]
Name=X Terminal Launcher
Type=python
X-Path=xterm-launch
Icon=terminal
/usr/lib/hildon-desktop/xterm-launch.py
Code:
import gtk
import hildondesktop
import os

class XTermLaunch(hildondesktop.TaskNavigatorItem):

	def clicked(self, widget, Data = None):
		os.spawnlp(os.P_NOWAIT, "maemo-invoker", "maemo-invoker", "osso-xterm.launch")

	def __init__(self):

		hildondesktop.TaskNavigatorItem.__init__(self)

		image = gtk.image_new_from_file("/usr/share/icons/hicolor/64x64/apps/terminal.png")

		button = gtk.Button()
		button.set_image(image)
		button.connect("clicked", self.clicked, None)
		button.show()

		self.add(button)


def hd_plugin_get_objects():
	plugin = XTermLaunch()
	return [plugin]
Make sure you have the required libraries installed:
hildon-desktop-python-loader_0.0.2-1_armel.deb
python2.5-hildondesktop_0.0.2-1_armel.deb
(For some reason those wouldn't install for me just by clicking. I had to download them locally and install with dpgk -i.)

I love my N810.
 

The Following 6 Users Say Thank You to SpiritGeek For This Useful Post: