def _get_data_items_for_path(self, slot_name, slot_type, slot_path,
                              **kwargs):
     expression_item = QStandardItem('')
     expression_item.setToolTip(
         'enter valid Python expression here, using "i" as counter and functions from math, random and time modules'
     )
     return (ReadonlyItem(slot_name),
             ReadonlyItem(QStandardItem(slot_type)), expression_item)
Example #2
0
 def _get_data_items_for_path(self, slot_name, slot_type_name, slot_path,
                              **kwargs):
     if slot_name.startswith('/'):
         return (CheckableItem(slot_name), ReadonlyItem(slot_type_name),
                 QStandardItem(''), ReadonlyItem(''))
     expression_item = QStandardItem('')
     expression_item.setToolTip(
         'enter valid Python expression here, using "i" as counter and functions from math, '
         'random and time modules')
     return (ReadonlyItem(slot_name), QStandardItem(slot_type_name),
             ReadonlyItem(''), expression_item)
    def _build_tree_recursive(stditem_parent, names_on_branch):
        name_curr = names_on_branch.pop(0)
        stditem_curr = ReadonlyItem(name_curr)

        row_index_parent = stditem_parent.rowCount() - 1
        # item at the bottom is your most recent node.

        name_prev = ''
        stditem_prev = None
        if stditem_parent.child(row_index_parent) is not None:
            stditem_prev = stditem_parent.child(row_index_parent)
            name_prev = stditem_prev.text()

        stditem = None
        if not name_prev == name_curr:
            stditem_parent.appendRow(stditem_curr)
            stditem = stditem_curr
        else:
            stditem = stditem_prev

        MessageTreeModel._logger.debug(
            'add_tree_node 1 name_curr={} \n\t\tname_prev={} row_index_parent={}'
            .format((name_curr, name_prev, row_index_parent)))

        if (0 < len(names_on_branch)):
            MessageTreeModel._build_tree_recursive(stditem, names_on_branch)
Example #4
0
 def enable_param_items(self):
     """
     Create QStdItem per parameter and addColumn them to myself.
     :rtype: None if _dynreconf_client is not initiated.
     """
     if not self._dynreconfclient_widget:
         return None
     paramnames = self._dynreconfclient_widget.get_treenode_names()
     paramnames_items = []
     brush = QBrush(Qt.lightGray)
     for paramname in paramnames:
         item = ReadonlyItem(paramname)
         item.setBackground(brush)
         paramnames_items.append(item)
     rospy.logdebug('enable_param_items len of paramnames={}'.format(
         len(paramnames_items)))
     self.appendColumn(paramnames_items)
 def enable_param_items(self):
     """
     Create QStdItem per parameter and addColumn them to myself.
     :rtype: None if _dynreconf_client is not initiated.
     """
     if not self._dynreconfclient_widget:
         return None
     paramnames = self._dynreconfclient_widget.get_treenode_names()
     paramnames_items = []
     brush = QBrush(Qt.lightGray)
     for paramname in paramnames:
         item = ReadonlyItem(paramname)
         item.setBackground(brush)
         paramnames_items.append(item)
     rospy.logdebug('enable_param_items len of paramnames={}'.format(
                                                     len(paramnames_items)))
     self.appendColumn(paramnames_items)
    def _get_data_items_for_path(self, package_name, file_name, cpu, ram,
                                 restarts, **kwargs):
        file_item = ReadonlyItem(file_name)
        if len(file_name) > 0 and file_name[0] == '*':
            package_item = ReadonlyItem(package_name)
            package_item.setData(QColor(255, 0, 0), Qt.ForegroundRole)
            file_item.setData(QColor(255, 0, 0), Qt.ForegroundRole)
        elif len(cpu) == 0:  # NOTE: this will not work for dead nodes
            package_item = CheckableItem(package_name)
            icon = QIcon.fromTheme('media-playback-stop')
            package_item.setIcon(icon)
        else:
            package_item = ReadonlyItem(package_name)

        return (package_item, file_item, ReadonlyItem(cpu), ReadonlyItem(ram),
                ReadonlyItem(restarts))