|
6 | 6 | from robocompdsl.templates.common.templatedict import TemplateDict |
7 | 7 |
|
8 | 8 | DSR_SAVE = """\ |
9 | | -//G->write_to_json_file("./"+agent_name+".json"); |
| 9 | +/* |
| 10 | +for (auto const& [name, g] : Graphs) { |
| 11 | + g->write_to_json_file("./"+agent_name+"_"+name+".json"); |
| 12 | +} |
| 13 | +*/ |
10 | 14 | """ |
11 | 15 |
|
12 | 16 | DSR_CONNECTIONS= """\ |
13 | | -//dsr update signals |
14 | | -//connect(G.get(), &DSR::DSRGraph::update_node_signal, this, &SpecificWorker::modify_node_slot); |
15 | | -//connect(G.get(), &DSR::DSRGraph::update_edge_signal, this, &SpecificWorker::modify_edge_slot); |
16 | | -//connect(G.get(), &DSR::DSRGraph::update_node_attr_signal, this, &SpecificWorker::modify_node_attrs_slot); |
17 | | -//connect(G.get(), &DSR::DSRGraph::update_edge_attr_signal, this, &SpecificWorker::modify_edge_attrs_slot); |
18 | | -//connect(G.get(), &DSR::DSRGraph::del_edge_signal, this, &SpecificWorker::del_edge_slot); |
19 | | -//connect(G.get(), &DSR::DSRGraph::del_node_signal, this, &SpecificWorker::del_node_slot); |
| 17 | +//Subscription to DSR graph update signals. |
| 18 | +// If multiple graphs exist, it is necessary to specify the graph name |
| 19 | +// using 'Graphs.at("name")' to connect its signals to the Worker's slots. |
| 20 | +//connect(Graphs.at("").get(), &DSR::DSRGraph::update_node_signal, this, &SpecificWorker::modify_node_slot); |
| 21 | +//connect(Graphs.at("").get(), &DSR::DSRGraph::update_edge_signal, this, &SpecificWorker::modify_edge_slot); |
| 22 | +//connect(Graphs.at("").get(), &DSR::DSRGraph::update_node_attr_signal, this, &SpecificWorker::modify_node_attrs_slot); |
| 23 | +//connect(Graphs.at("").get(), &DSR::DSRGraph::update_edge_attr_signal, this, &SpecificWorker::modify_edge_attrs_slot); |
| 24 | +//connect(Graphs.at("").get(), &DSR::DSRGraph::del_edge_signal, this, &SpecificWorker::del_edge_slot); |
| 25 | +//connect(Graphs.at("").get(), &DSR::DSRGraph::del_node_signal, this, &SpecificWorker::del_node_slot); |
20 | 26 | """ |
21 | 27 |
|
22 | 28 |
|
|
28 | 34 | either with a QtDesigner or directly from scratch in a class of its own. |
29 | 35 | The add_custom_widget_to_dock method receives a name for the widget and a reference to the class instance. |
30 | 36 | ***/ |
31 | | -
|
| 37 | +//If you have more than one graph, you need to connect to the specific graph with the name |
32 | 38 | //graph_viewers.at("")->add_custom_widget_to_dock("CustomWidget", &custom_widget); |
33 | 39 | """ |
34 | 40 |
|
|
0 commit comments