33 from rosgraph_msgs.msg
import Log
36 from python_qt_binding.QtCore
import QMutex, QMutexLocker, QSize, QTimer
43 from .icon_tool_button
import IconToolButton
48 A widget which brings up the ROS console.
50 :param context: The plugin context to create the monitor in.
51 :type context: qt_gui.plugin_context.PluginContext
53 def __init__(self, context, icon_paths=None, minimal=True):
54 ok_icon = [
'bg-green.svg',
'ic-console.svg']
55 warn_icon = [
'bg-yellow.svg',
'ic-console.svg',
'ol-warn-badge.svg']
56 err_icon = [
'bg-red.svg',
'ic-console.svg',
'ol-err-badge.svg']
57 stale_icon = [
'bg-grey.svg',
'ic-console.svg',
'ol-stale-badge.svg']
59 icons = [ok_icon, warn_icon, err_icon, stale_icon]
61 super(ConsoleDashWidget, self).
__init__(
'Console Widget', icons, icon_paths=icon_paths)
64 self.setFixedSize(self.
_icons[0].actualSize(QSize(50, 30)))
89 self.setToolTip(
"Rosout")
107 with QMutexLocker(self.
_mutex):
122 msg = Console.convert_rosgraph_log_message(log_msg)
123 with QMutexLocker(self.
_mutex):
128 if (rospy.get_time() < 30.0):
129 summary_dur = rospy.get_time() - 1.0
131 if (summary_dur < 0):
134 summary = self.
_console.get_message_summary(summary_dur)
136 if (summary.fatal
or summary.error):
145 tooltip +=
"\nFatal: %s" % (summary.fatal)
147 tooltip +=
"\nError: %s" % (summary.error)
149 tooltip +=
"\nWarn: %s" % (summary.warn)
151 tooltip +=
"\nInfo: %s" % (summary.info)
153 tooltip +=
"\nDebug: %s" % (summary.debug)
155 if (len(tooltip) == 0):
156 tooltip =
"Rosout: no recent activity"
158 tooltip =
"Rosout: recent activity:" + tooltip
160 if tooltip != self.toolTip():
161 self.setToolTip(tooltip)
165 self.
_console.cleanup_browsers_on_close()
170 self.
_console.cleanup_browsers_on_close()