dedicated to seddi
authorRico Schulte <ricoschulte@users.schwerkraft.elitedvb.net>
Sun, 16 Nov 2008 10:04:30 +0000 (10:04 +0000)
committerRico Schulte <ricoschulte@users.schwerkraft.elitedvb.net>
Sun, 16 Nov 2008 10:04:30 +0000 (10:04 +0000)
- adding a Searchfunktion
- fix URL for overlays
- adding more config option

googlemaps/src/plugin.py

index b77e425..f865ebc 100644 (file)
 # DEALINGS IN THE SOFTWARE.
 ###############################################################################
 
-from enigma import getDesktop,eSize
+import urllib
+from twisted.web.client import getPage
+from xml.dom.minidom import parseString
+
+from enigma import eTimer, getDesktop, eSize, eRCInput
 from Plugins.Plugin import PluginDescriptor
 from Screens.Screen import Screen
+from Screens.InputBox import InputBox
 from Screens.HelpMenu import HelpableScreen
 from Components.ActionMap import ActionMap
 from Components.Label import Label
 from Components.MenuList import MenuList
+from Components.Input import Input
 from Components.config import config, ConfigSubList, ConfigSubsection, ConfigInteger, ConfigYesNo, ConfigText, getConfigListEntry
 from Components.ConfigList import ConfigListScreen
 
+from Plugins.Extensions.GoogleMaps.globalmaptiles import GlobalMercator
 from Plugins.Extensions.GoogleMaps.KMLlib import RootFolder,KmlFolder,KmlPlace
 from Plugins.Extensions.GoogleMaps.WebPixmap import WebPixmap
 
 config.plugins.GoogleMaps = ConfigSubsection()
+config.plugins.GoogleMaps.stop_service_on_start = ConfigYesNo(default = False)
 config.plugins.GoogleMaps.add_mainmenu_entry = ConfigYesNo(default = True)
 config.plugins.GoogleMaps.save_last_position = ConfigYesNo(default = True)
 config.plugins.GoogleMaps.load_map_overlay = ConfigYesNo(default = True)
@@ -42,7 +50,14 @@ config.plugins.GoogleMaps.position = ConfigSubsection()
 config.plugins.GoogleMaps.position.x = ConfigInteger(33)
 config.plugins.GoogleMaps.position.y = ConfigInteger(21)
 config.plugins.GoogleMaps.position.z = ConfigInteger(6)
+config.plugins.GoogleMaps.last_searchkey = ConfigText(default="New York")
+config.plugins.GoogleMaps.show_preview_on_searchresults = ConfigYesNo(default = True)
+config.plugins.GoogleMaps.default_zoomlevel_for_searchresults = ConfigInteger(18, (1,99)) #zoomlevel previewpic
 
+global plugin_path,not_found_pic,not_found_pic_overlay
+plugin_path = ""
+not_found_pic = "404.png"
+not_found_pic_overlay = "404_transparent.png"
 
 def applySkinVars(skin,dict):
     for key in dict.keys():
@@ -52,6 +67,22 @@ def applySkinVars(skin,dict):
             print e,"@key=",key
     return skin
 
+def getURL(x,y,z):
+    url = "http://khm1.google.com/kh?v=32&hl=de&x=%i&y=%i&z=%i"%(x,y,z)
+    return url
+   
+def getMapURL(x,y,z):
+    url = "http://mt1.google.com/mt?v=w2t.86&hl=de&x=%i&y=%i&z=%i&s=G"%(x,y,z)
+    return url   
+
+def getMaptilesFromLonLat(lon,lat,zoomlevel):
+    # calc map tiles
+    mercator = GlobalMercator()
+    mx, my = mercator.LatLonToMeters( lat, lon )
+    tminx, tminy = mercator.MetersToTile( mx, my, zoomlevel )
+    gx, gy = mercator.GoogleTile(tminx, tminy, zoomlevel)
+    return gx,gy
+
 class GoogleMapsConfigScreen(ConfigListScreen,Screen):
     skin = """
         <screen position="100,100" size="550,400" title="Google Maps Setup" >
@@ -65,9 +96,12 @@ class GoogleMapsConfigScreen(ConfigListScreen,Screen):
         Screen.__init__(self, session)
         self.list = []
         self.list.append(getConfigListEntry(_("add Entry to Main Menu"), config.plugins.GoogleMaps.add_mainmenu_entry))
+        self.list.append(getConfigListEntry(_("stop TV Service on Start"), config.plugins.GoogleMaps.stop_service_on_start))
         self.list.append(getConfigListEntry(_("save last Map Position"), config.plugins.GoogleMaps.save_last_position))
         self.list.append(getConfigListEntry(_("load Map Overlay"), config.plugins.GoogleMaps.load_map_overlay))
         self.list.append(getConfigListEntry(_("enable caching of Images in /tmp/"), config.plugins.GoogleMaps.cache_enabled))
+        self.list.append(getConfigListEntry(_("show Preview Image for Searchresults"), config.plugins.GoogleMaps.show_preview_on_searchresults))
+        self.list.append(getConfigListEntry(_("default Zoomlevel for Preview Images"), config.plugins.GoogleMaps.default_zoomlevel_for_searchresults))
         
         ConfigListScreen.__init__(self, self.list)
         self["buttonred"] = Label(_("cancel"))
@@ -97,7 +131,7 @@ class GoogleMapsConfigScreen(ConfigListScreen,Screen):
 class GoogleMapsMainScreen(Screen,HelpableScreen):
     raw_skin =  """
             <screen position="{screen.position}" size="{screen.size}" title="GoogleMaps" flags="wfNoBorder">
-    <widget  name="pic1b" position="{pixmap1.pos}" size="{pixmap.size}" zPosition="0" alphatest="blend"/>
+    <!-- widget  name="pic1b" position="{pixmap1.pos}" size="{pixmap.size}" zPosition="0" alphatest="blend"//-->
     <widget  name="pic1" position="{pixmap1.pos}" size="{pixmap.size}" zPosition="1" alphatest="blend"/>
     <widget name="pic1o" position="{pixmap1.pos}" size="{pixmap.size}" zPosition="2" alphatest="blend"/>
     <widget name="pic2" position="{pixmap2.pos}" size="{pixmap.size}" zPosition="1" alphatest="blend"/>
@@ -117,12 +151,13 @@ class GoogleMapsMainScreen(Screen,HelpableScreen):
     <widget name="pic9" position="{pixmap9.pos}" size="{pixmap.size}" zPosition="1" alphatest="blend"/>
     <widget name="pic9o" position="{pixmap9.pos}" size="{pixmap.size}" zPosition="2" alphatest="blend"/>
     
-    <widget name="infopanel" position="{infopanel.pos}" size="{infopanel.size}" zPosition="0"  backgroundColor="blue"/>
+    <!-- widget name="infopanel" position="{infopanel.pos}" size="{infopanel.size}" zPosition="0"  backgroundColor="blue" //-->
     <widget name="posx" position="{posx.pos}" size="{posx.size}" font="{font}" zPosition="1" />
     <widget name="posy" position="{posy.pos}" size="{posy.size}" font="{font}" zPosition="1" />
     <widget name="posz" position="{posz.pos}" size="{posz.size}" font="{font}" zPosition="1" />
     <widget name="placeslist" position="{placeslist.pos}" size="{placeslist.size}" zPosition="1"/>
     <widget name="buttonmenu" position="{buttonmenu.pos}" size="{buttonmenu.size}" font="{font}" halign="center" valign="center"  zPosition="1"/>        
+    <widget name="buttonsearch" position="{buttonsearch.pos}" size="{buttonsearch.size}" font="{font}" halign="center" valign="center"  zPosition="1"  backgroundColor="red"/>        
     <widget name="buttonhelp" position="{buttonhelp.pos}" size="{buttonhelp.size}" font="{font}" halign="center" valign="center"  zPosition="1"/>
 
             </screen>
@@ -175,10 +210,13 @@ class GoogleMapsMainScreen(Screen,HelpableScreen):
                 'placeslist.size': '%i,%i'%(infopanel_width,int(infopanel_height-(label_height*4))),
 
                 'buttonmenu.pos': '%i,%i'%(int(p_h*3),int(infopanel_height-(label_height*4)+(label_height*3))),
-                'buttonmenu.size': '%i,%i'%(int(infopanel_width/2),label_height),
+                'buttonmenu.size': '%i,%i'%(int(infopanel_width/3),label_height),
                 
-                'buttonhelp.pos': '%i,%i'%(int(p_h*3+(infopanel_width/2)),int(infopanel_height-(label_height*4)+(label_height*3))),
-                'buttonhelp.size': '%i,%i'%(int(infopanel_width/2),label_height),
+                'buttonsearch.pos': '%i,%i'%(int(p_h*3+(infopanel_width/3)),int(infopanel_height-(label_height*4)+(label_height*3))),
+                'buttonsearch.size': '%i,%i'%(int(infopanel_width/3),label_height),
+                
+                'buttonhelp.pos': '%i,%i'%(int(p_h*3+((infopanel_width/3)*2)),int(infopanel_height-(label_height*4)+(label_height*3))),
+                'buttonhelp.size': '%i,%i'%(int(infopanel_width/3),label_height),
                 
                 }
         
@@ -186,36 +224,37 @@ class GoogleMapsMainScreen(Screen,HelpableScreen):
         Screen.__init__(self, session)
         HelpableScreen.__init__(self)
     
-        self["infopanel"] = Label()
+        #self["infopanel"] = Label()
         self["posx"] = Label("")
         self["posy"] = Label("")
         self["posz"] = Label("")
         self["placeslist"] = MenuList([])
         self["buttonmenu"] = Label(_("Menu"))
+        self["buttonsearch"] = Label(_("Search"))
         self["buttonhelp"] = Label(_("Help"))
         
-        self["pic1b"] = WebPixmap()
-        self["pic1"] = WebPixmap()
-        self["pic2"] = WebPixmap()
-        self["pic3"] = WebPixmap()
-        self["pic4"] = WebPixmap()
-        self["pic5"] = WebPixmap()
-        self["pic6"] = WebPixmap()
-        self["pic7"] = WebPixmap()
-        self["pic8"] = WebPixmap()
-        self["pic9"] = WebPixmap()
+        #self["pic1b"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["pic1"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["pic2"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["pic3"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["pic4"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["pic5"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["pic6"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["pic7"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["pic8"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["pic9"] = WebPixmap(default=plugin_path+not_found_pic)
         
-        self["pic1o"] = WebPixmap()
-        self["pic2o"] = WebPixmap()
-        self["pic3o"] = WebPixmap()
-        self["pic4o"] = WebPixmap()
-        self["pic5o"] = WebPixmap()
-        self["pic6o"] = WebPixmap()
-        self["pic7o"] = WebPixmap()
-        self["pic8o"] = WebPixmap()
-        self["pic9o"] = WebPixmap()
+        self["pic1o"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
+        self["pic2o"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
+        self["pic3o"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
+        self["pic4o"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
+        self["pic5o"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
+        self["pic6o"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
+        self["pic7o"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
+        self["pic8o"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
+        self["pic9o"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
         
-        self["actionmap"] = ActionMap(["OkCancelActions", "NumberActions","DirectionActions","MenuActions","InfobarChannelSelection"],
+        self["actionmap"] = ActionMap(["OkCancelActions", "NumberActions","DirectionActions","MenuActions","ColorActions","InfobarChannelSelection"],
             {
              "cancel": self.close,
              "ok": self.keyOk,
@@ -229,6 +268,7 @@ class GoogleMapsMainScreen(Screen,HelpableScreen):
              "8": self.key8,
              "9": self.key9,
              "0": self.key0,
+             "red": self.openSearchScreen,
              "menu": self.keymenu,
              "historyNext": self.toggleMapOverlay,
              
@@ -250,6 +290,7 @@ class GoogleMapsMainScreen(Screen,HelpableScreen):
         self.helpList.append((self["actionmap"], "NumberActions", [("9",'move south-east')]))
         self.helpList.append((self["actionmap"], "NumberActions", [("5",'zoom in')]))
         self.helpList.append((self["actionmap"], "NumberActions", [("0",'zoom out')]))
+        self.helpList.append((self["actionmap"], "ColorActions", [("red",'open Search Screen')]))
         self.helpList.append((self["actionmap"], "InfobarChannelSelection", [("historyNext",'show/unshow Map Overlay')]))
         
         self.onLayoutFinish.append(self.onLayoutFinished)
@@ -258,6 +299,13 @@ class GoogleMapsMainScreen(Screen,HelpableScreen):
         """ returning a real random number """
         return 4 # fairly choosen by using a dice
     
+    def openSearchScreen(self):
+        self.session.openWithCallback(self.searchCB,GoogleMapsGeoSearchScreen)
+    
+    def searchCB(self,result,adress,x,y,zoomlevel):
+        if result:
+            self.setNewXYZ(x,y,zoomlevel)
+            
     def buildMenuRoot(self):
         list = []
         root = RootFolder()
@@ -397,15 +445,15 @@ class GoogleMapsMainScreen(Screen,HelpableScreen):
         self["posy"].setText(_('Pos.')+" Y: "+str(y))
         self["posz"].setText(_('Zoom')+" : "+str(z))
         
-        self["pic1"].load(self.getURL(x-1,y-1,z))
-        self["pic2"].load(self.getURL(x,y-1,z))
-        self["pic3"].load(self.getURL(x+1,y-1,z))
-        self["pic4"].load(self.getURL(x-1,y,z))
-        self["pic5"].load(self.getURL(x,y,z))
-        self["pic6"].load(self.getURL(x+1,y,z))
-        self["pic7"].load(self.getURL(x-1,y+1,z))
-        self["pic8"].load(self.getURL(x,y+1,z))
-        self["pic9"].load(self.getURL(x+1,y+1,z))
+        self["pic1"].load(getURL(x-1,y-1,z))
+        self["pic2"].load(getURL(x,y-1,z))
+        self["pic3"].load(getURL(x+1,y-1,z))
+        self["pic4"].load(getURL(x-1,y,z))
+        self["pic5"].load(getURL(x,y,z))
+        self["pic6"].load(getURL(x+1,y,z))
+        self["pic7"].load(getURL(x-1,y+1,z))
+        self["pic8"].load(getURL(x,y+1,z))
+        self["pic9"].load(getURL(x+1,y+1,z))
 
         if config.plugins.GoogleMaps.load_map_overlay.value:
             self["pic1o"].show()
@@ -417,15 +465,15 @@ class GoogleMapsMainScreen(Screen,HelpableScreen):
             self["pic7o"].show()
             self["pic8o"].show()
             self["pic9o"].show()
-            self["pic1o"].load(self.getMapURL(x-1,y-1,z))
-            self["pic2o"].load(self.getMapURL(x,y-1,z))
-            self["pic3o"].load(self.getMapURL(x+1,y-1,z))
-            self["pic4o"].load(self.getMapURL(x-1,y,z))
-            self["pic5o"].load(self.getMapURL(x,y,z))
-            self["pic6o"].load(self.getMapURL(x+1,y,z))
-            self["pic7o"].load(self.getMapURL(x-1,y+1,z))
-            self["pic8o"].load(self.getMapURL(x,y+1,z))
-            self["pic9o"].load(self.getMapURL(x+1,y+1,z))
+            self["pic1o"].load(getMapURL(x-1,y-1,z))
+            self["pic2o"].load(getMapURL(x,y-1,z))
+            self["pic3o"].load(getMapURL(x+1,y-1,z))
+            self["pic4o"].load(getMapURL(x-1,y,z))
+            self["pic5o"].load(getMapURL(x,y,z))
+            self["pic6o"].load(getMapURL(x+1,y,z))
+            self["pic7o"].load(getMapURL(x-1,y+1,z))
+            self["pic8o"].load(getMapURL(x,y+1,z))
+            self["pic9o"].load(getMapURL(x+1,y+1,z))
         else:
             self["pic1o"].hide()
             self["pic2o"].hide()
@@ -437,16 +485,156 @@ class GoogleMapsMainScreen(Screen,HelpableScreen):
             self["pic8o"].hide()
             self["pic9o"].hide()
 
-    def getURL(self,x,y,z):
-        url = "http://khm1.google.com/kh?v=32&hl=de&x=%i&y=%i&z=%i"%(x,y,z)
-        return url
-   
-    def getMapURL(self,x,y,z):
-        url = "http://mt1.google.com/mt?v=w2t.99&hl=de&x=%i&y=%i&z=%i&s=G"%(x,y,z)
-        return url   
         
 ##################################
 
+class GoogleMapsGeoSearchScreen(InputBox):
+    raw_skin =  """
+            <screen position="{screen.position}" size="{screen.size}" title="GoogleMaps Search" flags="wfNoBorder">
+                <widget name="text" position="{text.position}" size="{text.size}" font="Regular;23"/>
+                <widget name="input" position="{input.position}" size="{input.size}" font="Regular;23"/>
+                <widget name="list" position="{list.position}" size="{list.size}" />
+                <widget name="infotext" position="{infotext.position}" size="{infotext.size}"   font="Regular;20"/>
+                
+                <widget name="preview" position="{preview.position}" size="{preview.size}"  zPosition="1" alphatest="blend"/>
+                <widget name="previewo" position="{preview.position}" size="{preview.size}"  zPosition="2" alphatest="blend"/>
+            </screen>
+            """
+    def __init__(self,session):
+        self.session = session
+        screen_size_w = int(getDesktop(0).size().width()*0.9)    
+        screen_size_h = int(getDesktop(0).size().height()*0.9)
+        screen_pos_w = int((getDesktop(0).size().width()-screen_size_w)/2)
+        screen_pos_h = int((getDesktop(0).size().height()-screen_size_h)/2)
+        
+        label_height = 30
+        offset = 5
+        
+        list_h = int(screen_size_h-(label_height*3)-(offset*5))
+        list_w = int((screen_size_w/2)-offset)
+        list_pos_x = offset
+        list_pos_y = int((offset*3)+(label_height*2))
+                
+        font = "Regular;21"
+        skindict = {
+                
+                'font': font,
+                
+                'screen.size': "%i,%i"%(screen_size_w,screen_size_h),
+                'screen.position': "%i,%i"%(screen_pos_w,screen_pos_h),
+                
+                'text.position': "%i,%i"%(offset,offset),
+                'text.size': "%i,%i"%(list_w-offset,label_height),
+                
+                'input.position': "%i,%i"%(offset,(offset*2)+label_height),
+                'input.size': "%i,%i"%(list_w-offset,label_height),
+                
+                'list.position': "%i,%i"%(list_pos_x,list_pos_y),
+                'list.size': "%i,%i"%(list_w-offset,list_h),
+                
+                "infotext.position": "%i,%i"%(offset,list_pos_y+list_h+offset),
+                "infotext.size": "%i,%i"%(int(screen_size_w-(offset*2)),label_height),
+                
+                'preview.position': "%i,%i"%(offset+list_w,offset),
+                'preview.size': "%i,%i"%(list_w-offset,screen_size_h-(offset*3)-label_height),
+                
+                }
+        
+        self.skin = applySkinVars(GoogleMapsGeoSearchScreen.raw_skin,skindict)
+        
+        self["list"] = MenuList([])
+        self["list"].onSelectionChanged.append(self.onListSelectionChanged)
+        self["preview"] = WebPixmap(default=plugin_path+not_found_pic)
+        self["previewo"] = WebPixmap(default=plugin_path+not_found_pic_overlay)
+        self["infotext"] = Label("")
+                
+        InputBox.__init__(self,session, title = "Please enter a City or Locationname:", windowTitle = _("GoogleMaps Search"),text=config.plugins.GoogleMaps.last_searchkey.value)
+        self.onLayoutFinish.append(self.onLayoutFinished)
+        
+        self.do_preview_timer = eTimer()
+        self.do_search_timer = eTimer()
+
+    def onLayoutFinished(self):
+        self.doSearch(self["input"].getText())    
+    
+    def onListSelectionChanged(self):
+        listitem = self["list"].getCurrent()
+        self.do_preview_timer.stop()
+        if listitem:
+            #print "list changed",listitem
+            adress,lon,lat = listitem[1]
+            for i in self.do_preview_timer.timeout.get():
+                self.do_preview_timer.timeout.get().remove(i)
+            self.do_preview_timer.timeout.get().append(lambda : self.loadPreview(lon, lat))
+            self.do_preview_timer.start(1500)
+        else:
+            pass #print "nothing selected"
+    
+    def loadPreview(self,lon,lat):
+        self.do_preview_timer.stop()
+        if config.plugins.GoogleMaps.show_preview_on_searchresults.value:
+            zoomlevel = config.plugins.GoogleMaps.default_zoomlevel_for_searchresults.value
+            gx,gy = getMaptilesFromLonLat(lon,lat,zoomlevel)
+            self["preview"].load(getURL(gx, gy, zoomlevel))
+            self["previewo"].load(getMapURL(gx, gy, zoomlevel))    
+
+    def keyNumberGlobal(self, number):
+        self["input"].number(number)
+        self.do_search_timer.stop()
+        for i in self.do_search_timer.timeout.get():
+            self.do_search_timer.timeout.get().remove(i)
+        self.do_search_timer.timeout.get().append(lambda : self.doSearch(self["input"].getText()))
+        self.do_search_timer.start(1000)
+
+        #self.doSearch(self["input"].getText())
+    
+    def go(self):
+        # overwritten from InputBox
+        listitem = self["list"].getCurrent()
+        if listitem:
+            adress,lon,lat = listitem[1]
+            zoomlevel = config.plugins.GoogleMaps.default_zoomlevel_for_searchresults.value
+            gx,gy = getMaptilesFromLonLat(lon,lat,zoomlevel)
+            self.close(True,adress,gx,gy,zoomlevel)
+    
+    def cancel(self):
+        # overwritten from InputBox
+        rcinput = eRCInput.getInstance()
+        rcinput.setKeyboardMode(rcinput.kmNone)
+        self.do_preview_timer.stop()
+        self.do_search_timer.stop()
+        self.close(False,False,False,False,False)
+            
+    def doSearch(self,searchkey):
+        self.do_search_timer.stop()
+        config.plugins.GoogleMaps.last_searchkey.value = searchkey
+        self["infotext"].setText("searching with '%s' ..."%(searchkey))
+        s = urllib.quote(searchkey)
+        url = "http://maps.google.com/maps/geo?q=%s&output=xml&key=abcdefg&oe=utf8"%s
+        cb = lambda result: self.onLoadFinished(searchkey,result) 
+        getPage(url).addCallback(cb).addErrback(self.onLoadFailed)
+    
+    def onLoadFinished(self,searchkey,result):
+        xmldoc = parseString(result)
+        list = []
+        for i in xmldoc.getElementsByTagName('Placemark'):
+            adress = i.getElementsByTagName('address')[0].firstChild.data.encode('utf-8')
+            lon,lat,unknown = i.getElementsByTagName('coordinates')[0].firstChild.data.encode("utf-8").split(",")
+            list.append((adress,[adress,float(lon),float(lat)]))
+        
+        self["list"].setList(list)
+        
+        if len(list):
+            self["infotext"].setText("found %i Locations with '%s'"%(len(list),searchkey))
+        else:
+            self["infotext"].setText("nothing found with '%s'"%(searchkey))
+    
+    def onLoadFailed(self,reason):
+        print reason
+        self["infotext"].setText(str(reason)) 
+    
+##################################
+
 def start_from_mainmenu(menuid, **kwargs):
     #starting from main menu
     if menuid == "mainmenu":
@@ -460,17 +648,20 @@ def start_from_pluginmenu(session,**kwargs):
     global originalservice,mysession
     mysession = session
     originalservice = session.nav.getCurrentlyPlayingServiceReference()
-    #session.nav.stopService()
+    if  config.plugins.GoogleMaps.stop_service_on_start.value:
+        session.nav.stopService()
     session.openWithCallback(mainCB,GoogleMapsMainScreen)    
 
 def mainCB():
     global originalservice,mysession
-    #mysession.nav.playService(originalservice)
+    mysession.nav.playService(originalservice)
     config.plugins.GoogleMaps.position.x.save()    
     config.plugins.GoogleMaps.position.y.save()    
     config.plugins.GoogleMaps.position.z.save()    
     
 def Plugins(path,**kwargs):
+    global plugin_path
+    plugin_path = path+"/"
     pname = "Google Maps"
     pdesc = "browse google maps"
     desc_mainmenu  = PluginDescriptor(name=pname, description=pdesc,  where = PluginDescriptor.WHERE_MENU, fnc = start_from_mainmenu)