UI Elements do not go through register_factory
[gregoa/zavai.git] / plugins / 50_sat_monitor.py
index 7100182e324094c22096662345d60a4551e209fa..243697dea4f9b02092889bae8405a604033777cd 100644 (file)
@@ -37,11 +37,11 @@ class SatelliteMonitor(gtk.VBox, zavai.Applet):
         zavai.Applet.__init__(self, registry, name)
         gtk.VBox.__init__(self)
 
-        self.gps = registry.resource("gps")
+        self.registry = registry
+        self.gps = None
 
         self.store = gtk.ListStore(str, str, str, str, str, str, str, str, str, str, str)
         self.view = gtk.TreeView(self.store)
-
         renderer = gtk.CellRendererText()
         for idx, name in enumerate((_("CH"), _("ID"), _("SN"), _("ELE"), _("AZI"),
                      _("Used"), _("Diff"), _("Alm"), _("Eph"),
@@ -54,7 +54,13 @@ class SatelliteMonitor(gtk.VBox, zavai.Applet):
         self.pack_start(self.view, True, True)
         self.pack_start(self.make_parent_link(), False, False)
 
+
+    def init(self):
+        self.gps = self.registry.resource("gps")
+
     def start(self, *args):
+        if self.gps is None:
+            self.init()
         self.gps.monitor.connect(self.on_ubxdebug_packet)
 
     def stop(self, *args):
@@ -99,4 +105,5 @@ class SatelliteMonitor(gtk.VBox, zavai.Applet):
                 qi])
 
 def init(conf = None, registry = None, **kw):
-    registry.register_factory("menu.main.gps.satellite_monitor", SatelliteMonitor, _("Satellite monitor"))
+    name = "menu.main.gps.satellite_monitor"
+    registry.register(name, SatelliteMonitor(registry, name), _("Satellite monitor"))