Reply
Thread Tools
Posts: 122 | Thanked: 73 times | Joined on Jan 2010 @ Turku, Finland
#1
Anyone have any ideas on how to access the N900's zoom buttons using python (without Qt, but with hildon and gtk). I have this far only found ways to do it in C/C++...

Help greatly appreciated
 
Posts: 56 | Thanked: 31 times | Joined on Jul 2008 @ Austria
#2
See http://talk.maemo.org/showthread.php...t=headset+dbus
In short:
bus = dbus.SystemBus()

headset = bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/devices/platform_retu_headset_logicaldev_input')
headset_iface = dbus.Interface(headset, dbus_interface='org.freedesktop.Hal.Device')
headset_iface.connect_to_signal("Condition", handler)

http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Porting_Software/Porting_Existing_GTK%2B_Application_to_Maemo_5

"Enabling volume/zoom keys"

Last edited by dannym; 2010-07-15 at 22:54.
 

The Following User Says Thank You to dannym For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#3
Code:
import gtk
import hildon

def enable_zoom_cb(window):
	window.window.property_change(gtk.gdk.atom_intern("_HILDON_ZOOM_KEY_ATOM"), gtk.gdk.atom_intern("INTEGER"), 32, gtk.gdk.PROP_MODE_REPLACE, [1]);

def enable_zoom_keys(window):
	if window.flags() & gtk.REALIZED:
        	enable_zoom_cb(window)
	else:
		window.connect("realize", enable_zoom_cb)


def key_press_handler(widget, event):
	if event.keyval in [hildon.KEY_DECREASE, hildon.KEY_INCREASE]:
		hildon.hildon_banner_show_information(widget, "None", "A zoom key hit")
		return True
	return False

window = hildon.Window()
enable_zoom_keys(window)
window.connect("key-press-event", key_press_handler)
window.show_all()
gtk.main()
 

The Following 5 Users Say Thank You to qwerty12 For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 21:50.