35 from python_qt_binding
import QT_BINDING
36 from python_qt_binding.QtCore
import qDebug
41 from .plot_widget
import PlotWidget
43 from .data_plot
import DataPlot
50 self.setObjectName(
'Plot')
56 initial_topics=self.
_args.topics, start_paused=self.
_args.start_paused)
61 self.
_data_plot.set_autoscale(y=DataPlot.SCALE_EXTEND | DataPlot.SCALE_VISIBLE)
65 if context.serial_number() > 1:
67 self.
_widget.windowTitle() + (
' (%d)' % context.serial_number()))
68 context.add_widget(self.
_widget)
71 parser = argparse.ArgumentParser(prog=
'rqt_plot', add_help=
False)
72 Plot.add_arguments(parser)
73 args = parser.parse_args(argv)
81 for sub_t
in [x
for x
in t.split(
',')
if x]:
84 base = sub_t[:sub_t.find(
':')]
88 parser.error(
"%s must contain a topic and field name" % sub_t)
89 base = base[:base.rfind(
'/')]
92 fields = sub_t.split(
':')[1:]
93 c_topics.extend([
"%s/%s" % (base, f)
for f
in fields
if f])
95 c_topics.append(sub_t)
98 c_topics = [rosgraph.names.script_resolve_name(
'rqt_plot', n)
for n
in c_topics]
99 if type(c_topics) == list:
100 topic_list.extend(c_topics)
102 topic_list.append(c_topics)
103 args.topics = topic_list
109 group = parser.add_argument_group(
'Options for rqt_plot plugin')
110 group.add_argument(
'-P',
'--pause', action=
'store_true', dest=
'start_paused',
111 help=
'Start in paused state')
112 group.add_argument(
'-e',
'--empty', action=
'store_true', dest=
'start_empty',
113 help=
'Start without restoring previous topics')
114 group.add_argument(
'topics', nargs=
'*', default=[], help=
'Topics to plot')
118 if self.
_context.serial_number() > 1:
120 self.
_widget.windowTitle() + (
' (%d)' % self.
_context.serial_number()))
124 instance_settings.set_value(
'autoscroll', self.
_widget.autoscroll_checkbox.isChecked())
125 instance_settings.set_value(
'topics', pack(self.
_widget._rosdata.keys()))
128 autoscroll = instance_settings.value(
'autoscroll',
True)
in [
True,
'true']
129 self.
_widget.autoscroll_checkbox.setChecked(autoscroll)
134 if len(self.
_widget._rosdata.keys()) == 0
and not self.
_args.start_empty:
135 topics = unpack(instance_settings.value(
'topics', []))
147 self.
_widget.clean_up_subscribers()