REFACTORING : Use the 'string operator' to write logfile
[wifihood] / wifiscanner / wifimap / gps.py
index aaaf4fe..b435bf2 100644 (file)
@@ -1,5 +1,8 @@
 
-import location
+try :
+    import location
+except :
+    import hildongtk.location as location
 
 
 import gobject
@@ -70,9 +73,9 @@ class GPSObject ( gobject.GObject ) :
 
             lat , lon , alt = None , None , None
             if self.device.fix[1] & location.GPS_DEVICE_LATLONG_SET:
-                lat , lon = device.fix[4:6]
+                lat , lon = self.device.fix[4:6]
             if self.device.fix[1] & location.GPS_DEVICE_ALTITUDE_SET:
-                alt = device.fix[7]
+                alt = self.device.fix[7]
             # FIXME : get time from GPS fix
             self.info = state , self.device.satellites_in_view , self.device.satellites_in_use , self.device.fix[2] , lat , lon , alt
             self.satellites = self.device.satellites
@@ -80,6 +83,10 @@ class GPSObject ( gobject.GObject ) :
         else :
             self.info = None, 0, 0, None, None, None, None
 
+    def __str__ ( self ) :
+        output = map( str , self.info )
+        return " ".join( output )
+
     def report ( self ) :
         return "%d gps" % self.ngps