first attempt at packaging -- a few rough edges
[gregoa/zavai.git] / plugins / 50_sat_monitor.py
index 243697dea4f9b02092889bae8405a604033777cd..e44108463806dbf3b5c363fddecf2586d8f11318 100644 (file)
@@ -32,12 +32,12 @@ SAT_QI_NAMES = {
     7: _("receiving data")
 }
 
     7: _("receiving data")
 }
 
-class SatelliteMonitor(gtk.VBox, zavai.Applet):
-    def __init__(self, registry, name, **kw):
-        zavai.Applet.__init__(self, registry, name)
-        gtk.VBox.__init__(self)
+class SatelliteMonitor(zavai.Applet):
+    def __init__(self, registry, **kw):
+        super(SatelliteMonitor, self).__init__(registry,
+                "menu.main.gps.satellite_monitor",
+                _("Satellite monitor"))
 
 
-        self.registry = registry
         self.gps = None
 
         self.store = gtk.ListStore(str, str, str, str, str, str, str, str, str, str, str)
         self.gps = None
 
         self.store = gtk.ListStore(str, str, str, str, str, str, str, str, str, str, str)
@@ -50,21 +50,18 @@ class SatelliteMonitor(gtk.VBox, zavai.Applet):
             col.pack_start(renderer, False)
             col.add_attribute(renderer, "text", idx)
             self.view.append_column(col)
             col.pack_start(renderer, False)
             col.add_attribute(renderer, "text", idx)
             self.view.append_column(col)
-
-        self.pack_start(self.view, True, True)
-        self.pack_start(self.make_parent_link(), False, False)
-
+        self.add(self.view)
 
     def init(self):
 
     def init(self):
-        self.gps = self.registry.resource("gps")
+        self.gps = self.zavai_registry.resource("gps")
 
     def start(self, *args):
         if self.gps is None:
             self.init()
 
     def start(self, *args):
         if self.gps is None:
             self.init()
-        self.gps.monitor.connect(self.on_ubxdebug_packet)
+        self.gps.monitor.connect("satellites", self.on_ubxdebug_packet)
 
     def stop(self, *args):
 
     def stop(self, *args):
-        self.gps.monitor.disconnect(self.on_ubxdebug_packet)
+        self.gps.monitor.disconnect("satellites", self.on_ubxdebug_packet)
 
     def on_ubxdebug_packet(self, clid, length, data):
         # In zhone it is cbUBXDebugPacket
 
     def on_ubxdebug_packet(self, clid, length, data):
         # In zhone it is cbUBXDebugPacket
@@ -105,5 +102,4 @@ class SatelliteMonitor(gtk.VBox, zavai.Applet):
                 qi])
 
 def init(conf = None, registry = None, **kw):
                 qi])
 
 def init(conf = None, registry = None, **kw):
-    name = "menu.main.gps.satellite_monitor"
-    registry.register(name, SatelliteMonitor(registry, name), _("Satellite monitor"))
+    registry.register(SatelliteMonitor(registry))