The idea is capture the information of GPS from cell phone and display location in application with gtk, webkit and python with Google Maps.
The glade interface shown below.
It's actually the same application web browser but, I remove the text entry and button "go ".
Below the code:
#!/usr/bin/env python2.6 # -*- coding: utf-8 -*- """ Nombre:Geolocalizacion Descripción: Program that capture the location of cell phone shown in google maps on the Linux desktop. Versión:0.1 Licence:GPLv3 Author: Ernesto Crespo Email: ecrespo@gmail.com """ #Import gtk and webkit import gtk import webkit #Import android and time import android from time import sleep #class App class App: def __init__(self): #init function #Binding glade file with Builder self.glade_file = "geolocalizcion.glade" self.glade = gtk.Builder() self.glade.add_from_file(self.glade_file) #Bind window geo self.window = self.glade.get_object('geo') #Bind button exit self.exit = self.glade.get_object('salir') #Bind scrolledwindow self.scrolledwindow1 = self.glade.get_object('scrolledwindow1') # #Linking destroy event with function self.window.connect("destroy",self.on_geo_destroy) #Linking clicked event with function self.exit.connect('clicked', self.on_salir_clicked) #Open google maps site #create Object webview self.webview = webkit.WebView() #Add webview in scrolledwindow self.scrolledwindow1.add(self.webview) #Capture location tupla = localizacion() #Open google maps URL win longitude and latitude self.__go("http://maps.google.com/maps?q=%s,%s" %tupla) #Show window self.window.show_all() def __go(self,url): #Open URL self.webview.open(url) def on_geo_destroy(self,*args): #close application gtk.main_quit() def on_exit_clicked(self,*args): #close application gtk.main_quit() def main(self): #Start application gtk.main() def localizacion(): #create android object droid = android.Android() #start location droid.startLocating() #wait 15 seconds sleep(15) #capture latitude and longitude latitude = droid.readLocation().result["network"]["latitude"] longitude = droid.readLocation().result["network"]["longitude"] #Stop location droid.stopLocating() #return latitude and longitude return (latitude,longitude) if __name__ == '__main__': app = App() app.main()
The figure showing the app running with google maps site.