Reply
Thread Tools
Posts: 25 | Thanked: 8 times | Joined on Feb 2008
#1
At one point in time (circa '06), it was apparently possible to write task navigator panels in Python. However, search as I may, that one file is the only reference to the practice that I can find anywhere.

1) Does anyone know if it's still possible to do this in OS 2008?

2) If so, does anyone know where to find more documentation?

Thanks!
 
Posts: 25 | Thanked: 8 times | Joined on Feb 2008
#2
Ah, I'm guessing that the absence of these bindings also means the task navigator panels aren't going to work just yet. Maybe I'll give Khertan's unofficial package a whirl.
 
Khertan's Avatar
Posts: 1,012 | Thanked: 817 times | Joined on Jul 2007 @ France
#3
You could try with the unofficial packages i ve made. But i ven't tryed myself to make TaskNav

But HomeApplet works
 
Posts: 25 | Thanked: 8 times | Joined on Feb 2008
#4
Well, I installed the Khertan bindings (the desktop applets work great, thanks!), but so far I'm getting no love on the task navigator panel.

This is what I tried:

/usr/share/applications/hildon-navigator/pythontest.desktop
Code:
[Desktop Entry]
Name=Python Test
Type=python
X-Path=pythontest
/usr/lib/hildon-navigator/pythontest.py
(taken from sample file above)
Code:
import gtk
import hildondesktop

class PythonTestApp(hildondesktop.TaskNavigatorItem):

	def __init__(self):

		hildondesktop.TaskNavigatorItem.__init__(self)

		image = gtk.Image()
		image.set_from_stock(gtk.STOCK_CUT, gtk.ICON_SIZE_LARGE_TOOLBAR)

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

		self.add(button)

def hd_plugin_get_objects():
	plugin = PythonTestApp()
	return [plugin]
The panel shows up in the "Panels" control panel and I can activate it, but it doesn't actually display it in the task navigator (though it tries, the one I disabled goes away, but the rest of the bar just slides up over where it used to be).

I'm afraid I really have no idea what I'm doing, so I'm not sure how to proceed. Any thoughts?
 
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:
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#6
Sweet! A single launcher is certainly more useful (to me) than the non-editable contacts button. Perhaps I should learn enough Python to make a second menu... Thanks for showing the way!
 
Posts: 88 | Thanked: 15 times | Joined on Jun 2007
#7
SpiritGeek - do you have an example of making a multi application menu (like the default one)? I'd love to have a menu with just my test apps.
 
Posts: 25 | Thanked: 8 times | Joined on Feb 2008
#8
Originally Posted by Benson View Post
Sweet! A single launcher is certainly more useful (to me) than the non-editable contacts button. Perhaps I should learn enough Python to make a second menu... Thanks for showing the way!
You're quite welcome, I'm glad you found it useful!

I've only just started taking up Python myself. I've done mostly VB/VBScript, PHP, and JavaScript, and coming from that background it's been very easy to learn. There are a couple of quirks (mostly the indentation and data types), but after I acclimated to those it has rapidly become my very favorite language. I highly recommend it for fast, easy, cross-platform development.

Happy coding!
 
Posts: 25 | Thanked: 8 times | Joined on Feb 2008
#9
Originally Posted by jgallen23 View Post
SpiritGeek - do you have an example of making a multi application menu (like the default one)? I'd love to have a menu with just my test apps.
Unfortunately I don't, but it should be fairly straight-forward. The task navigator panels are just GTK widgets, so I imagine you would just need to create additional widgets representing your menu (perhaps a treeview?) off to the side when it's clicked. However, I'm brand-new both to Python and GTK programming in general, so I couldn't give you any examples just yet.

Good luck!
 
Khertan's Avatar
Posts: 1,012 | Thanked: 817 times | Joined on Jul 2007 @ France
#10
Hum ... you give me a idea ... a script menu
 
Reply


 
Forum Jump


All times are GMT. The time now is 13:01.