def __init__(self, widget, nodepath, msgclass, name=None): self._log = LOG.getChild("TopicWidget+%s" % nodepath) self._sub = SubscriberGObject(nodepath, msgclass) self._sub.connect("message", self._on_message) self.widget = widget self.nodepath = self._sub.nodepath self.name = name or self.nodepath
def __init__(self, widget, nodepath, msgclass, name=None): self._log = LOG.getChild("TopicWidget+%s" % nodepath) self._sub = SubscriberGObject(nodepath, msgclass) self._sub.connect("message", self._on_message) self.widget = widget self.nodepath = self._sub.nodepath self.name = name or self.nodepath
class TopicWidget(_MagicLabel): def __init__(self, widget, nodepath, msgclass, name=None): self._log = LOG.getChild("TopicWidget+%s" % nodepath) self._sub = SubscriberGObject(nodepath, msgclass) self._sub.connect("message", self._on_message) self.widget = widget self.nodepath = self._sub.nodepath self.name = name or self.nodepath def _on_message(self, sub, msg): self.set_message(msg) def set_message(self, msg): raise NotImplementedError def show_all(self): if self.widget is not None: self.widget.show_all() if self._label is not None: self._label.show_all()
class TopicWidget(_MagicLabel): def __init__(self, widget, nodepath, msgclass, name=None): self._log = LOG.getChild("TopicWidget+%s" % nodepath) self._sub = SubscriberGObject(nodepath, msgclass) self._sub.connect("message", self._on_message) self.widget = widget self.nodepath = self._sub.nodepath self.name = name or self.nodepath def _on_message(self, sub, msg): self.set_message(msg) def set_message(self, msg): raise NotImplementedError def show_all(self): if self.widget is not None: self.widget.show_all() if self._label is not None: self._label.show_all()