Mobile player is also a python application.
Maybe it's not the best way to launch python application, but it can be a 
reference.
1. create an exe file under /usr/bin -- mobile-player
        #!/bin/sh
        Cd /usr/share/mobile-player
        Python media_gui.py
2. add mobile-player in *.desktop file
        Exec=mobile-player
        Type=Application
        ...
3. add mobile-player in conf.xml
        <app id="6" title="Media Player" desc="Mobile media player" 
icon="icons/media.png" path="/usr/bin/mobile-player" />


Best Regards,
Cathy Shen
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian
Sent: 2007年7月29日 19:07
To: Spencer, Bob
Cc: [email protected]
Subject: RE: How to call a python plugin in UI

Hi,

I will try to explain better what I want to do.
If you have a look at 
http://ianlawrence.info/downloads/UME/flash/flash_home.html this is the
Gnash UI. If you scroll you will see the Location Services Plugin icon. 
Clicking that icon should
launch this python code:

import gtk
import pygtk
import hildondesktop
import dbus
import os
import webbrowser

class GeocluePlugin(hildondesktop.HomeItem):
    def __init__(self):
        hildondesktop.HomeItem.__init__(self)

        # Start with getting position from GeoClue
        bus = dbus.SessionBus()

        # TODO: Get the GeoClue interface to use from 
/schemas/apps/geoclue/position/defaultpath
        # and /schemas/apps/geoclue/position/defaultserviceGConf keys
        proxy_obj = bus.get_object('org.foinse_project.geoclue.position.hostip',
'/org/foinse_project/geoclue/position/hostip')
        geoclue_iface = dbus.Interface(proxy_obj, 
'org.foinse_project.geoclue.position')

        # Get the coordinates from the service
        coordinates = geoclue_iface.current_position()


        #print "According to GeoClue you are in %s %s." % (coordinates[0], 
coordinates[1])
        url = "http://mapufacture.com/search?lat=%s"; % coordinates[0] + 
"&lng=%s" % coordinates[1]
        webbrowser.open(url, new=1, autoraise=1)

def hd_plugin_get_objects():
    plugin = GeocluePlugin()
    return [plugin]


This code uses d-bus to get the users co-ordinates (either from GPS device or 
hostip.info) and
then using the default system browser queries a geo-aggregator to find out what 
is going on in the
users area.

I have placed:
geoclue.desktop in fs/usr/share/applications
geoclue.py in fs/usr/lib/hildon-desktop and made it executable (dunno if this 
needs to be done?).

[I am pretty confident that these are in the right place]

I have put nothing yet in the fs/etc/hildon-desktop folder so maybe this is my 
problem?

thanks for your help
[]'s
Ian


-- 
http://ianlawrence.info



-- 
Ubuntu-mobile mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-mobile

-- 
Ubuntu-mobile mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-mobile

Reply via email to