36 from python_qt_binding
import loadUi
37 from python_qt_binding.QtCore
import qWarning
38 from python_qt_binding.QtWidgets
import QWidget
44 Widget for use with LoggerLevelServiceCaller class to alter the ROS logger levels
50 service caller instance for sending service calls, ''LoggerLevelServiceCaller''
52 super(LoggerLevelWidget, self).
__init__()
54 ui_file = os.path.join(rp.get_path(
'rqt_logger_level'),
'resource',
'logger_level.ui')
56 self.setObjectName(
'LoggerLevelWidget')
59 self.node_list.currentRowChanged[int].connect(self.
node_changed)
60 self.logger_list.currentRowChanged[int].connect(self.
logger_changed)
61 self.level_list.currentRowChanged[int].connect(self.
level_changed)
65 if self.node_list.count() > 0:
66 self.node_list.setCurrentRow(0)
70 Refreshes the top level node list and repoulates the node_list widget.
71 As a side effect the level and logger lists are cleared
73 self.level_list.clear()
74 self.logger_list.clear()
75 self.node_list.clear()
76 for name
in self.
_caller.get_node_names():
77 self.node_list.addItem(name)
81 Handles the rowchanged event for the node_list widget
82 Populates logger_list with the loggers for the node selected
83 :param row: the selected row in node_list, ''int''
87 if row < 0
or row >= self.node_list.count():
88 qWarning(
'Node row %s out of bounds. Current count: %s' % (row, self.node_list.count()))
90 self.logger_list.clear()
91 self.level_list.clear()
92 loggers = self.
_caller.get_loggers(self.node_list.item(row).text())
95 for logger
in sorted(loggers):
96 self.logger_list.addItem(logger)
97 if self.logger_list.count() != 0:
98 self.logger_list.setCurrentRow(0)
102 Handles the rowchanged event for the logger_list widget
103 Populates level_list with the levels for the logger selected
104 :param row: the selected row in logger_list, ''int''
108 if row < 0
or row >= self.logger_list.count():
109 qWarning(
'Logger row %s out of bounds. Current count: %s' %
110 (row, self.logger_list.count()))
112 if self.level_list.count() == 0:
113 for level
in self.
_caller.get_levels():
114 self.level_list.addItem(level)
115 for index
in range(self.level_list.count()):
116 if self.level_list.item(index).text().lower() == \
117 self.
_caller._current_levels[self.logger_list.currentItem().text()].lower():
118 self.level_list.setCurrentRow(index)
122 Handles the rowchanged event for the level_list widget
123 Makes a service call to change the logger level for the indicated node/logger to the
125 :param row: the selected row in level_list, ''int''
129 if row < 0
or row >= self.level_list.count():
130 qWarning(
'Level row %s out of bounds. Current count: %s' %
131 (row, self.level_list.count()))
133 self.
_caller.send_logger_change_message(
134 self.node_list.currentItem().text(),
135 self.logger_list.currentItem().text(),
136 self.level_list.item(row).text())