Пример #1
0
 def message_cb(self, msg):
     """ DiagnosticArray message callback """
     for status in msg.status:
         path = status.name.split('/')
         if path[0] == '':
             path = path[1:]
         tmp_tree = self._tree
         for p in path:
             tmp_tree = tmp_tree[p]
         tmp_tree.update(status, util.get_resource_name(status.name))
     self.emit(SIGNAL('UpdateDiagnostics'))
Пример #2
0
    def message_cb(self, msg):
        """ DiagnosticArray message callback """
        self._current_msg = msg

        # Walk the status array and update the tree
        for status in msg.status:
            # Compute path and walk to appropriate subtree
            path = status.name.split('/')
            if path[0] == '':
                path = path[1:]
            tmp_tree = self._tree
            for p in path:
                tmp_tree = tmp_tree[p]
            tmp_tree.update(status, util.get_resource_name(status.name))

            tier=5
            module='?'

            for kv in status.values:
                if kv.key.lower()=='tier':
                    tier = int(kv.value)
                if kv.key.lower()=='module':
                    module = kv.value

            if tier > self.tierSpinner.value():
                continue

            # Check for warnings
            if status.level == DiagnosticStatus.WARN:
                name = status.name
                self._warn_tree[name].update(status, status.name)

            # Check for errors
            if (status.level == DiagnosticStatus.ERROR or
                    status.level == DiagnosticStatus.STALE):
                name = status.name
                self._err_tree[name].update(status, status.name)

        # For any items in the tree that were not updated, remove them
        self._tree.prune()
        self._warn_tree.prune()
        self._err_tree.prune()

        # TODO(ahendrix): implement
        # Insight: for any item that is not OK, it only provides additional
        #          information if all of it's children are OK
        #
        #          otherwise, it's just an aggregation of its children
        #          and doesn't provide any additional value when added to
        #          the warning and error flat trees

        self.tree_all_devices.resizeColumnToContents(0)
        self.warn_flattree.resizeColumnToContents(0)
        self.err_flattree.resizeColumnToContents(0)
Пример #3
0
    def _signal_message_updated(self, status):
        """ DiagnosticArray message callback """

        # Walk the status array and update the tree
        for name, status in status.items():
            # Compute path and walk to appropriate subtree
            path = name.split('/')
            if path[0] == '':
                path = path[1:]
            tmp_tree = self._tree
            for p in path:
                tmp_tree = tmp_tree[p]
            tmp_tree.update(status, util.get_resource_name(name))

            # Check for warnings
            if status.level == DiagnosticStatus.WARN:
                self._warn_tree[name].update(status, name)

            # Check for errors
            if (status.level == DiagnosticStatus.ERROR
                    or status.level == DiagnosticStatus.STALE):
                self._err_tree[name].update(status, name)

        # For any items in the tree that were not updated, remove them
        self._tree.prune()
        self._warn_tree.prune()
        self._err_tree.prune()

        # TODO(ahendrix): implement
        # Insight: for any item that is not OK, it only provides additional
        #          information if all of it's children are OK
        #
        #          otherwise, it's just an aggregation of its children
        #          and doesn't provide any additional value when added to
        #          the warning and error flat trees

        self.tree_all_devices.resizeColumnToContents(0)
        self.warn_flattree.resizeColumnToContents(0)
        self.err_flattree.resizeColumnToContents(0)

        self._message_updated_processing = False