roby 0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +29 -0
- data/History.txt +4 -0
- data/License-fr.txt +519 -0
- data/License.txt +515 -0
- data/Manifest.txt +245 -0
- data/NOTES +4 -0
- data/README.txt +163 -0
- data/Rakefile +161 -0
- data/TODO.txt +146 -0
- data/app/README.txt +24 -0
- data/app/Rakefile +8 -0
- data/app/config/ROBOT.rb +5 -0
- data/app/config/app.yml +91 -0
- data/app/config/init.rb +7 -0
- data/app/config/roby.yml +3 -0
- data/app/controllers/.gitattributes +0 -0
- data/app/controllers/ROBOT.rb +2 -0
- data/app/data/.gitattributes +0 -0
- data/app/planners/ROBOT/main.rb +6 -0
- data/app/planners/main.rb +5 -0
- data/app/scripts/distributed +3 -0
- data/app/scripts/generate/bookmarks +3 -0
- data/app/scripts/replay +3 -0
- data/app/scripts/results +3 -0
- data/app/scripts/run +3 -0
- data/app/scripts/server +3 -0
- data/app/scripts/shell +3 -0
- data/app/scripts/test +3 -0
- data/app/tasks/.gitattributes +0 -0
- data/app/tasks/ROBOT/.gitattributes +0 -0
- data/bin/roby +210 -0
- data/bin/roby-log +168 -0
- data/bin/roby-shell +25 -0
- data/doc/images/event_generalization.png +0 -0
- data/doc/images/exception_propagation_1.png +0 -0
- data/doc/images/exception_propagation_2.png +0 -0
- data/doc/images/exception_propagation_3.png +0 -0
- data/doc/images/exception_propagation_4.png +0 -0
- data/doc/images/exception_propagation_5.png +0 -0
- data/doc/images/replay_handler_error.png +0 -0
- data/doc/images/replay_handler_error_0.png +0 -0
- data/doc/images/replay_handler_error_1.png +0 -0
- data/doc/images/roby_cycle_overview.png +0 -0
- data/doc/images/roby_replay_02.png +0 -0
- data/doc/images/roby_replay_03.png +0 -0
- data/doc/images/roby_replay_04.png +0 -0
- data/doc/images/roby_replay_event_representation.png +0 -0
- data/doc/images/roby_replay_first_state.png +0 -0
- data/doc/images/roby_replay_relations.png +0 -0
- data/doc/images/roby_replay_startup.png +0 -0
- data/doc/images/task_event_generalization.png +0 -0
- data/doc/papers.rdoc +11 -0
- data/doc/styles/allison.css +314 -0
- data/doc/styles/allison.js +316 -0
- data/doc/styles/allison.rb +276 -0
- data/doc/styles/jamis.rb +593 -0
- data/doc/tutorials/01-GettingStarted.rdoc +86 -0
- data/doc/tutorials/02-GoForward.rdoc +220 -0
- data/doc/tutorials/03-PlannedPath.rdoc +268 -0
- data/doc/tutorials/04-EventPropagation.rdoc +236 -0
- data/doc/tutorials/05-ErrorHandling.rdoc +319 -0
- data/doc/tutorials/06-Overview.rdoc +40 -0
- data/doc/videos.rdoc +69 -0
- data/ext/droby/dump.cc +175 -0
- data/ext/droby/extconf.rb +3 -0
- data/ext/graph/algorithm.cc +746 -0
- data/ext/graph/extconf.rb +7 -0
- data/ext/graph/graph.cc +529 -0
- data/ext/graph/graph.hh +183 -0
- data/ext/graph/iterator_sequence.hh +102 -0
- data/ext/graph/undirected_dfs.hh +226 -0
- data/ext/graph/undirected_graph.hh +421 -0
- data/lib/roby.rb +41 -0
- data/lib/roby/app.rb +870 -0
- data/lib/roby/app/rake.rb +56 -0
- data/lib/roby/app/run.rb +14 -0
- data/lib/roby/app/scripts/distributed.rb +13 -0
- data/lib/roby/app/scripts/generate/bookmarks.rb +162 -0
- data/lib/roby/app/scripts/replay.rb +31 -0
- data/lib/roby/app/scripts/results.rb +15 -0
- data/lib/roby/app/scripts/run.rb +26 -0
- data/lib/roby/app/scripts/server.rb +18 -0
- data/lib/roby/app/scripts/shell.rb +88 -0
- data/lib/roby/app/scripts/test.rb +40 -0
- data/lib/roby/basic_object.rb +151 -0
- data/lib/roby/config.rb +5 -0
- data/lib/roby/control.rb +747 -0
- data/lib/roby/decision_control.rb +17 -0
- data/lib/roby/distributed.rb +32 -0
- data/lib/roby/distributed/base.rb +440 -0
- data/lib/roby/distributed/communication.rb +871 -0
- data/lib/roby/distributed/connection_space.rb +592 -0
- data/lib/roby/distributed/distributed_object.rb +206 -0
- data/lib/roby/distributed/drb.rb +62 -0
- data/lib/roby/distributed/notifications.rb +539 -0
- data/lib/roby/distributed/peer.rb +550 -0
- data/lib/roby/distributed/protocol.rb +529 -0
- data/lib/roby/distributed/proxy.rb +343 -0
- data/lib/roby/distributed/subscription.rb +311 -0
- data/lib/roby/distributed/transaction.rb +498 -0
- data/lib/roby/event.rb +897 -0
- data/lib/roby/exceptions.rb +234 -0
- data/lib/roby/executives/simple.rb +30 -0
- data/lib/roby/graph.rb +166 -0
- data/lib/roby/interface.rb +390 -0
- data/lib/roby/log.rb +3 -0
- data/lib/roby/log/chronicle.rb +303 -0
- data/lib/roby/log/console.rb +72 -0
- data/lib/roby/log/data_stream.rb +197 -0
- data/lib/roby/log/dot.rb +279 -0
- data/lib/roby/log/event_stream.rb +151 -0
- data/lib/roby/log/file.rb +340 -0
- data/lib/roby/log/gui/basic_display.ui +83 -0
- data/lib/roby/log/gui/chronicle.rb +26 -0
- data/lib/roby/log/gui/chronicle_view.rb +40 -0
- data/lib/roby/log/gui/chronicle_view.ui +70 -0
- data/lib/roby/log/gui/data_displays.rb +172 -0
- data/lib/roby/log/gui/data_displays.ui +155 -0
- data/lib/roby/log/gui/notifications.rb +26 -0
- data/lib/roby/log/gui/relations.rb +248 -0
- data/lib/roby/log/gui/relations.ui +123 -0
- data/lib/roby/log/gui/relations_view.rb +185 -0
- data/lib/roby/log/gui/relations_view.ui +149 -0
- data/lib/roby/log/gui/replay.rb +327 -0
- data/lib/roby/log/gui/replay_controls.rb +200 -0
- data/lib/roby/log/gui/replay_controls.ui +259 -0
- data/lib/roby/log/gui/runtime.rb +130 -0
- data/lib/roby/log/hooks.rb +185 -0
- data/lib/roby/log/logger.rb +202 -0
- data/lib/roby/log/notifications.rb +244 -0
- data/lib/roby/log/plan_rebuilder.rb +470 -0
- data/lib/roby/log/relations.rb +1056 -0
- data/lib/roby/log/server.rb +550 -0
- data/lib/roby/log/sqlite.rb +47 -0
- data/lib/roby/log/timings.rb +164 -0
- data/lib/roby/plan-object.rb +247 -0
- data/lib/roby/plan.rb +762 -0
- data/lib/roby/planning.rb +13 -0
- data/lib/roby/planning/loops.rb +302 -0
- data/lib/roby/planning/model.rb +906 -0
- data/lib/roby/planning/task.rb +151 -0
- data/lib/roby/propagation.rb +562 -0
- data/lib/roby/query.rb +619 -0
- data/lib/roby/relations.rb +583 -0
- data/lib/roby/relations/conflicts.rb +70 -0
- data/lib/roby/relations/ensured.rb +20 -0
- data/lib/roby/relations/error_handling.rb +23 -0
- data/lib/roby/relations/events.rb +9 -0
- data/lib/roby/relations/executed_by.rb +193 -0
- data/lib/roby/relations/hierarchy.rb +239 -0
- data/lib/roby/relations/influence.rb +10 -0
- data/lib/roby/relations/planned_by.rb +63 -0
- data/lib/roby/robot.rb +7 -0
- data/lib/roby/standard_errors.rb +218 -0
- data/lib/roby/state.rb +5 -0
- data/lib/roby/state/events.rb +221 -0
- data/lib/roby/state/information.rb +55 -0
- data/lib/roby/state/pos.rb +110 -0
- data/lib/roby/state/shapes.rb +32 -0
- data/lib/roby/state/state.rb +353 -0
- data/lib/roby/support.rb +92 -0
- data/lib/roby/task-operations.rb +182 -0
- data/lib/roby/task.rb +1618 -0
- data/lib/roby/test/common.rb +399 -0
- data/lib/roby/test/distributed.rb +214 -0
- data/lib/roby/test/tasks/empty_task.rb +9 -0
- data/lib/roby/test/tasks/goto.rb +36 -0
- data/lib/roby/test/tasks/simple_task.rb +23 -0
- data/lib/roby/test/testcase.rb +519 -0
- data/lib/roby/test/tools.rb +160 -0
- data/lib/roby/thread_task.rb +87 -0
- data/lib/roby/transactions.rb +462 -0
- data/lib/roby/transactions/proxy.rb +292 -0
- data/lib/roby/transactions/updates.rb +139 -0
- data/plugins/fault_injection/History.txt +4 -0
- data/plugins/fault_injection/README.txt +37 -0
- data/plugins/fault_injection/Rakefile +18 -0
- data/plugins/fault_injection/TODO.txt +0 -0
- data/plugins/fault_injection/app.rb +52 -0
- data/plugins/fault_injection/fault_injection.rb +89 -0
- data/plugins/fault_injection/test/test_fault_injection.rb +84 -0
- data/plugins/subsystems/README.txt +40 -0
- data/plugins/subsystems/Rakefile +18 -0
- data/plugins/subsystems/app.rb +171 -0
- data/plugins/subsystems/test/app/README +24 -0
- data/plugins/subsystems/test/app/Rakefile +8 -0
- data/plugins/subsystems/test/app/config/app.yml +71 -0
- data/plugins/subsystems/test/app/config/init.rb +9 -0
- data/plugins/subsystems/test/app/config/roby.yml +3 -0
- data/plugins/subsystems/test/app/planners/main.rb +20 -0
- data/plugins/subsystems/test/app/scripts/distributed +3 -0
- data/plugins/subsystems/test/app/scripts/replay +3 -0
- data/plugins/subsystems/test/app/scripts/results +3 -0
- data/plugins/subsystems/test/app/scripts/run +3 -0
- data/plugins/subsystems/test/app/scripts/server +3 -0
- data/plugins/subsystems/test/app/scripts/shell +3 -0
- data/plugins/subsystems/test/app/scripts/test +3 -0
- data/plugins/subsystems/test/app/tasks/services.rb +15 -0
- data/plugins/subsystems/test/test_subsystems.rb +71 -0
- data/test/distributed/test_communication.rb +178 -0
- data/test/distributed/test_connection.rb +282 -0
- data/test/distributed/test_execution.rb +373 -0
- data/test/distributed/test_mixed_plan.rb +341 -0
- data/test/distributed/test_plan_notifications.rb +238 -0
- data/test/distributed/test_protocol.rb +516 -0
- data/test/distributed/test_query.rb +102 -0
- data/test/distributed/test_remote_plan.rb +491 -0
- data/test/distributed/test_transaction.rb +463 -0
- data/test/mockups/tasks.rb +27 -0
- data/test/planning/test_loops.rb +380 -0
- data/test/planning/test_model.rb +427 -0
- data/test/planning/test_task.rb +106 -0
- data/test/relations/test_conflicts.rb +42 -0
- data/test/relations/test_ensured.rb +38 -0
- data/test/relations/test_executed_by.rb +149 -0
- data/test/relations/test_hierarchy.rb +158 -0
- data/test/relations/test_planned_by.rb +54 -0
- data/test/suite_core.rb +24 -0
- data/test/suite_distributed.rb +9 -0
- data/test/suite_planning.rb +3 -0
- data/test/suite_relations.rb +8 -0
- data/test/test_bgl.rb +508 -0
- data/test/test_control.rb +399 -0
- data/test/test_event.rb +894 -0
- data/test/test_exceptions.rb +592 -0
- data/test/test_interface.rb +37 -0
- data/test/test_log.rb +114 -0
- data/test/test_log_server.rb +132 -0
- data/test/test_plan.rb +584 -0
- data/test/test_propagation.rb +210 -0
- data/test/test_query.rb +266 -0
- data/test/test_relations.rb +180 -0
- data/test/test_state.rb +414 -0
- data/test/test_support.rb +16 -0
- data/test/test_task.rb +938 -0
- data/test/test_testcase.rb +122 -0
- data/test/test_thread_task.rb +73 -0
- data/test/test_transactions.rb +569 -0
- data/test/test_transactions_proxy.rb +198 -0
- metadata +570 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'roby/log/gui/basic_display_ui'
|
|
2
|
+
require 'roby/log/notifications'
|
|
3
|
+
|
|
4
|
+
module Ui
|
|
5
|
+
class NotificationsConfig < Ui::BasicDisplayConfig
|
|
6
|
+
attr_reader :streams_model
|
|
7
|
+
|
|
8
|
+
def setupUi(streams_model, widget)
|
|
9
|
+
super(widget)
|
|
10
|
+
|
|
11
|
+
display = Roby::Log::NotificationsDisplay.new
|
|
12
|
+
@streams_model = FilteredDataStreamListModel.new(stream, display, 'roby-events', streams_model.streams)
|
|
13
|
+
Qt::Object.connect(stream, SIGNAL("currentIndexChanged(int)"), @streams_model, SLOT("selectedStream()"))
|
|
14
|
+
@streams_model.source_model = streams_model
|
|
15
|
+
stream.model = @streams_model
|
|
16
|
+
display
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.setup_optparse(opt, replay)
|
|
20
|
+
opt.on("--notifications") do
|
|
21
|
+
replay.add_display('Notifications')
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
require 'Qt4'
|
|
2
|
+
require 'roby'
|
|
3
|
+
require 'roby/log/relations'
|
|
4
|
+
require 'roby/log/gui/relations_ui'
|
|
5
|
+
|
|
6
|
+
module Ui
|
|
7
|
+
# Manage relations using a two-level tree structure. The relation
|
|
8
|
+
# categories (tasks and events) have a model index of (row, column, nil)
|
|
9
|
+
# while the relations have a model index of (row, column, category), where
|
|
10
|
+
# category is TASK_ROOT_INDEX for task relations and EVENT_ROOT_INDEX for
|
|
11
|
+
# event relations
|
|
12
|
+
class RelationConfigModel < Qt::AbstractItemModel
|
|
13
|
+
COL_NAME = 0
|
|
14
|
+
COL_COLOR = 1
|
|
15
|
+
|
|
16
|
+
TASK_ROOT_INDEX = 0
|
|
17
|
+
EVENT_ROOT_INDEX = 1
|
|
18
|
+
CATEGORIES = ['Task structure']
|
|
19
|
+
|
|
20
|
+
def event_root_index; createIndex(TASK_ROOT_INDEX, 0, -1) end
|
|
21
|
+
def task_root_index; createIndex(EVENT_ROOT_INDEX, 0, -1) end
|
|
22
|
+
|
|
23
|
+
attr_reader :relations
|
|
24
|
+
attr_reader :display
|
|
25
|
+
def initialize(display)
|
|
26
|
+
super()
|
|
27
|
+
|
|
28
|
+
Roby.load_all_relations
|
|
29
|
+
@current_color = 0
|
|
30
|
+
@display = display
|
|
31
|
+
@relations = []
|
|
32
|
+
|
|
33
|
+
relations[TASK_ROOT_INDEX] = Roby::TaskStructure.enum_for(:each_relation).to_a
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def index(row, column, parent)
|
|
37
|
+
if parent.valid? && parent.internalPointer == -1
|
|
38
|
+
createIndex(row, column, parent.row)
|
|
39
|
+
elsif row < relations.size
|
|
40
|
+
createIndex(row, column, -1)
|
|
41
|
+
else
|
|
42
|
+
Qt::ModelIndex.new
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
def parent(index)
|
|
46
|
+
category = index.internalPointer
|
|
47
|
+
if !index.valid? || category == -1 then Qt::ModelIndex.new
|
|
48
|
+
else createIndex(category, 0, -1) end
|
|
49
|
+
end
|
|
50
|
+
def columnCount(parent); 2 end
|
|
51
|
+
def hasChildren(parent); !parent.valid? || parent.internalPointer == -1 end
|
|
52
|
+
def rowCount(parent)
|
|
53
|
+
if !parent.valid? then relations.size
|
|
54
|
+
else relations[parent.row].size end
|
|
55
|
+
end
|
|
56
|
+
def headerData(section, orientation, role)
|
|
57
|
+
return Qt::Variant.new unless role == Qt::DisplayRole && orientation == Qt::Horizontal
|
|
58
|
+
value = if section == 0 then "Relation"
|
|
59
|
+
else "Color" end
|
|
60
|
+
Qt::Variant.new(value)
|
|
61
|
+
end
|
|
62
|
+
def data(index, role)
|
|
63
|
+
return Qt::Variant.new unless index.valid?
|
|
64
|
+
|
|
65
|
+
category = index.internalPointer
|
|
66
|
+
value = if category == -1
|
|
67
|
+
if index.column == COL_NAME && role == Qt::DisplayRole
|
|
68
|
+
CATEGORIES[index.row]
|
|
69
|
+
end
|
|
70
|
+
else
|
|
71
|
+
relation = relations[category][index.row]
|
|
72
|
+
if index.column == COL_NAME && role == Qt::CheckStateRole
|
|
73
|
+
if display.relation_enabled?(relation) then Qt::Checked.to_i
|
|
74
|
+
elsif display.layout_relation?(relation) then Qt::PartiallyChecked.to_i
|
|
75
|
+
else Qt::Unchecked.to_i
|
|
76
|
+
end
|
|
77
|
+
elsif index.column == COL_NAME && role == Qt::DisplayRole
|
|
78
|
+
relation.name.gsub(/.*Structure::/, '')
|
|
79
|
+
elsif index.column == COL_COLOR && role == Qt::DisplayRole
|
|
80
|
+
display.relation_color(relation)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if value then Qt::Variant.new(value)
|
|
85
|
+
else Qt::Variant.new
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
def setData(index, value, role)
|
|
89
|
+
category = index.internalPointer
|
|
90
|
+
relation = relations[category][index.row]
|
|
91
|
+
if role == Qt::CheckStateRole
|
|
92
|
+
case value.to_i
|
|
93
|
+
when Qt::Checked.to_i
|
|
94
|
+
display.enable_relation(relation)
|
|
95
|
+
when Qt::PartiallyChecked.to_i
|
|
96
|
+
display.layout_relation(relation)
|
|
97
|
+
else
|
|
98
|
+
display.ignore_relation(relation)
|
|
99
|
+
end
|
|
100
|
+
else
|
|
101
|
+
display.update_relation_color(relation, value.to_string)
|
|
102
|
+
end
|
|
103
|
+
display.update
|
|
104
|
+
emit dataChanged(index, index)
|
|
105
|
+
end
|
|
106
|
+
def flags(index)
|
|
107
|
+
if !index.valid? || index.internalPointer == -1 then Qt::ItemIsEnabled
|
|
108
|
+
else
|
|
109
|
+
flags = Qt::ItemIsSelectable | Qt::ItemIsTristate | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable
|
|
110
|
+
if index.column == 1
|
|
111
|
+
flags = Qt::ItemIsEditable | flags
|
|
112
|
+
end
|
|
113
|
+
flags
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
class RelationDelegate < Qt::ItemDelegate
|
|
118
|
+
MAX_WIDTH = 50
|
|
119
|
+
def createEditor(parent, option, index)
|
|
120
|
+
color = index.model.data(index, Qt::DisplayRole).to_string
|
|
121
|
+
new_color = Qt::ColorDialog.get_color(Qt::Color.new(color))
|
|
122
|
+
index.model.setData(index, Qt::Variant.new(new_color.name), Qt::DisplayRole)
|
|
123
|
+
|
|
124
|
+
nil
|
|
125
|
+
end
|
|
126
|
+
def paint(painter, option, index)
|
|
127
|
+
if index.column == 1 && index.internalPointer >= 0
|
|
128
|
+
color = index.model.data(index, Qt::DisplayRole).to_string
|
|
129
|
+
rect = option.rect
|
|
130
|
+
rect.adjust(1, 1, -1, -1)
|
|
131
|
+
if rect.width > MAX_WIDTH
|
|
132
|
+
rect.width = MAX_WIDTH
|
|
133
|
+
end
|
|
134
|
+
painter.fill_rect rect, Qt::Brush.new(Qt::Color.new(color))
|
|
135
|
+
else
|
|
136
|
+
super
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
class LayoutMethodModel < Qt::AbstractListModel
|
|
142
|
+
METHODS = ["Auto", "dot [rankdir=LR]", "dot [rankdir=TB]", "circo", "neato [overlap=false]", "neato [overlap=false,mode=hier]", "twopi", "fdp"]
|
|
143
|
+
attr_reader :display, :combo
|
|
144
|
+
def initialize(display, combo)
|
|
145
|
+
super()
|
|
146
|
+
@display, @combo = display, combo
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def rowCount(parent)
|
|
150
|
+
return 0 if parent.valid?
|
|
151
|
+
return METHODS.size
|
|
152
|
+
end
|
|
153
|
+
def data(index, role)
|
|
154
|
+
return Qt::Variant.new unless role == Qt::DisplayRole && index.valid?
|
|
155
|
+
Qt::Variant.new(METHODS[index.row])
|
|
156
|
+
end
|
|
157
|
+
def layout_method(index)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def flags(index)
|
|
161
|
+
Qt::ItemIsSelectable | Qt::ItemIsEnabled
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def selected
|
|
165
|
+
index = combo.current_index
|
|
166
|
+
display.layout_method = if index == 0 then nil
|
|
167
|
+
else METHODS[index]
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
slots 'selected()'
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
class RelationsConfig
|
|
174
|
+
attr_reader :current_color
|
|
175
|
+
attr_reader :relation_color
|
|
176
|
+
attr_reader :relation_item
|
|
177
|
+
attr_reader :model
|
|
178
|
+
attr_reader :delegate
|
|
179
|
+
|
|
180
|
+
def initialize(*args)
|
|
181
|
+
super()
|
|
182
|
+
if !system("dot", "-V")
|
|
183
|
+
raise "the 'dot' tool is unavailable"
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def setupUi(streams_model, widget)
|
|
188
|
+
super(widget)
|
|
189
|
+
|
|
190
|
+
display = Roby::Log::RelationsDisplay.new
|
|
191
|
+
@model = RelationConfigModel.new(display)
|
|
192
|
+
@delegate = RelationDelegate.new
|
|
193
|
+
relations.set_item_delegate @delegate
|
|
194
|
+
relations.header.resize_mode = Qt::HeaderView::Stretch
|
|
195
|
+
relations.model = @model
|
|
196
|
+
relations.set_expanded model.task_root_index, true
|
|
197
|
+
relations.set_expanded model.event_root_index, true
|
|
198
|
+
|
|
199
|
+
@streams_model = FilteredDataStreamListModel.new(stream, display, 'roby-events', streams_model.streams)
|
|
200
|
+
Qt::Object.connect(stream, SIGNAL("currentIndexChanged(int)"), @streams_model, SLOT("selectedStream()"))
|
|
201
|
+
@streams_model.source_model = streams_model
|
|
202
|
+
stream.model = @streams_model
|
|
203
|
+
|
|
204
|
+
@layout_model = LayoutMethodModel.new(display, layout_method)
|
|
205
|
+
Qt::Object.connect(layout_method, SIGNAL("currentIndexChanged(int)"), @layout_model, SLOT("selected()"))
|
|
206
|
+
layout_method.model = @layout_model
|
|
207
|
+
|
|
208
|
+
display
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def self.setup_optparse(opt, replay)
|
|
212
|
+
opt.on("--relations=REL1,REL2", Array, "create a relation display with the given relations") do |relations|
|
|
213
|
+
if relations.include?("all")
|
|
214
|
+
relations = Roby::TaskStructure.relations
|
|
215
|
+
else
|
|
216
|
+
relations.map! do |relname|
|
|
217
|
+
rel = Roby::TaskStructure.relations.find { |rel| rel.name =~ /#{relname}/ }
|
|
218
|
+
unless rel
|
|
219
|
+
STDERR.puts "Unknown relation #{relname}. Available relations are:"
|
|
220
|
+
STDERR.puts " Tasks: " + Roby::TaskStructure.enum_for(:each_relation).map { |r| r.name.gsub(/.*Structure::/, '') }.join(", ")
|
|
221
|
+
exit(1)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
rel
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
replay.initial_setup << lambda do |gui|
|
|
229
|
+
if relation_display = gui.add_display('Relations')
|
|
230
|
+
relations.each do |rel|
|
|
231
|
+
relation_display.enable_relation(rel)
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
if $0 == __FILE__
|
|
241
|
+
a = Qt::Application.new(ARGV)
|
|
242
|
+
u = Ui::RelationsConfig.new
|
|
243
|
+
w = Qt::Widget.new
|
|
244
|
+
u.setupUi(w)
|
|
245
|
+
w.show
|
|
246
|
+
a.exec
|
|
247
|
+
end
|
|
248
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<ui version="4.0" >
|
|
2
|
+
<class>RelationsConfig</class>
|
|
3
|
+
<widget class="QWidget" name="RelationsConfig" >
|
|
4
|
+
<property name="geometry" >
|
|
5
|
+
<rect>
|
|
6
|
+
<x>0</x>
|
|
7
|
+
<y>0</y>
|
|
8
|
+
<width>696</width>
|
|
9
|
+
<height>668</height>
|
|
10
|
+
</rect>
|
|
11
|
+
</property>
|
|
12
|
+
<property name="windowTitle" >
|
|
13
|
+
<string>RelationsConfig</string>
|
|
14
|
+
</property>
|
|
15
|
+
<layout class="QVBoxLayout" >
|
|
16
|
+
<property name="margin" >
|
|
17
|
+
<number>9</number>
|
|
18
|
+
</property>
|
|
19
|
+
<property name="spacing" >
|
|
20
|
+
<number>6</number>
|
|
21
|
+
</property>
|
|
22
|
+
<item>
|
|
23
|
+
<layout class="QHBoxLayout" >
|
|
24
|
+
<property name="margin" >
|
|
25
|
+
<number>0</number>
|
|
26
|
+
</property>
|
|
27
|
+
<property name="spacing" >
|
|
28
|
+
<number>6</number>
|
|
29
|
+
</property>
|
|
30
|
+
<item>
|
|
31
|
+
<spacer>
|
|
32
|
+
<property name="orientation" >
|
|
33
|
+
<enum>Qt::Horizontal</enum>
|
|
34
|
+
</property>
|
|
35
|
+
<property name="sizeHint" >
|
|
36
|
+
<size>
|
|
37
|
+
<width>40</width>
|
|
38
|
+
<height>20</height>
|
|
39
|
+
</size>
|
|
40
|
+
</property>
|
|
41
|
+
</spacer>
|
|
42
|
+
</item>
|
|
43
|
+
<item>
|
|
44
|
+
<widget class="QPushButton" name="close" >
|
|
45
|
+
<property name="text" >
|
|
46
|
+
<string>Close</string>
|
|
47
|
+
</property>
|
|
48
|
+
</widget>
|
|
49
|
+
</item>
|
|
50
|
+
</layout>
|
|
51
|
+
</item>
|
|
52
|
+
<item>
|
|
53
|
+
<layout class="QGridLayout" >
|
|
54
|
+
<property name="margin" >
|
|
55
|
+
<number>0</number>
|
|
56
|
+
</property>
|
|
57
|
+
<property name="spacing" >
|
|
58
|
+
<number>6</number>
|
|
59
|
+
</property>
|
|
60
|
+
<item row="1" column="2" >
|
|
61
|
+
<widget class="QComboBox" name="layout_method" >
|
|
62
|
+
<property name="sizePolicy" >
|
|
63
|
+
<sizepolicy>
|
|
64
|
+
<hsizetype>3</hsizetype>
|
|
65
|
+
<vsizetype>0</vsizetype>
|
|
66
|
+
<horstretch>0</horstretch>
|
|
67
|
+
<verstretch>0</verstretch>
|
|
68
|
+
</sizepolicy>
|
|
69
|
+
</property>
|
|
70
|
+
</widget>
|
|
71
|
+
</item>
|
|
72
|
+
<item row="0" column="0" >
|
|
73
|
+
<widget class="QLabel" name="label" >
|
|
74
|
+
<property name="sizePolicy" >
|
|
75
|
+
<sizepolicy>
|
|
76
|
+
<hsizetype>1</hsizetype>
|
|
77
|
+
<vsizetype>5</vsizetype>
|
|
78
|
+
<horstretch>0</horstretch>
|
|
79
|
+
<verstretch>0</verstretch>
|
|
80
|
+
</sizepolicy>
|
|
81
|
+
</property>
|
|
82
|
+
<property name="text" >
|
|
83
|
+
<string>Data stream</string>
|
|
84
|
+
</property>
|
|
85
|
+
</widget>
|
|
86
|
+
</item>
|
|
87
|
+
<item row="0" column="1" colspan="2" >
|
|
88
|
+
<widget class="QComboBox" name="stream" >
|
|
89
|
+
<property name="sizePolicy" >
|
|
90
|
+
<sizepolicy>
|
|
91
|
+
<hsizetype>3</hsizetype>
|
|
92
|
+
<vsizetype>0</vsizetype>
|
|
93
|
+
<horstretch>0</horstretch>
|
|
94
|
+
<verstretch>0</verstretch>
|
|
95
|
+
</sizepolicy>
|
|
96
|
+
</property>
|
|
97
|
+
</widget>
|
|
98
|
+
</item>
|
|
99
|
+
<item row="1" column="0" colspan="2" >
|
|
100
|
+
<widget class="QLabel" name="label_2" >
|
|
101
|
+
<property name="sizePolicy" >
|
|
102
|
+
<sizepolicy>
|
|
103
|
+
<hsizetype>1</hsizetype>
|
|
104
|
+
<vsizetype>5</vsizetype>
|
|
105
|
+
<horstretch>0</horstretch>
|
|
106
|
+
<verstretch>0</verstretch>
|
|
107
|
+
</sizepolicy>
|
|
108
|
+
</property>
|
|
109
|
+
<property name="text" >
|
|
110
|
+
<string>Layout method</string>
|
|
111
|
+
</property>
|
|
112
|
+
</widget>
|
|
113
|
+
</item>
|
|
114
|
+
</layout>
|
|
115
|
+
</item>
|
|
116
|
+
<item>
|
|
117
|
+
<widget class="QTreeView" name="relations" />
|
|
118
|
+
</item>
|
|
119
|
+
</layout>
|
|
120
|
+
</widget>
|
|
121
|
+
<resources/>
|
|
122
|
+
<connections/>
|
|
123
|
+
</ui>
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
require 'roby/log/gui/relations_view_ui'
|
|
2
|
+
|
|
3
|
+
class Ui::RelationsView
|
|
4
|
+
def scene; graphics.scene end
|
|
5
|
+
attr_reader :display
|
|
6
|
+
attr_reader :prefixActions
|
|
7
|
+
|
|
8
|
+
def config_path
|
|
9
|
+
"#{display.decoder.name}-events.yml"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def load_config
|
|
13
|
+
if File.readable?(config_path)
|
|
14
|
+
STDERR.puts "Loading config from #{config_path}"
|
|
15
|
+
config_data = File.open(config_path) do |io|
|
|
16
|
+
YAML.load(io)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
display.removed_prefixes.clear
|
|
20
|
+
if removed_prefixes_config = config_data['prefixes']
|
|
21
|
+
removed_prefixes_config.each do |name, enabled|
|
|
22
|
+
display.removed_prefixes[name] = enabled
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
else
|
|
26
|
+
STDERR.puts "No such config file #{config_path}"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
def save_config
|
|
30
|
+
STDERR.puts "Saving config into #{display.decoder.name}-events.yml"
|
|
31
|
+
config = { 'prefixes' => Hash.new }
|
|
32
|
+
display.removed_prefixes.each do |name, enabled|
|
|
33
|
+
config['prefixes'][name] = enabled
|
|
34
|
+
end
|
|
35
|
+
config['show_ownership'] = display.show_ownership
|
|
36
|
+
config['show_arguments'] = display.show_arguments
|
|
37
|
+
config['hide_finalized'] = display.hide_finalized
|
|
38
|
+
|
|
39
|
+
File.open(config_path, 'w') do |io|
|
|
40
|
+
YAML.dump(config, io)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def update_prefix_menu
|
|
45
|
+
@prefixActions ||= []
|
|
46
|
+
prefixActions.each do |action|
|
|
47
|
+
menuRemovedPrefixes.remove_action(action)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
prefixActions.clear
|
|
51
|
+
display.removed_prefixes.each do |prefix, bool|
|
|
52
|
+
action = Qt::Action.new prefix, menuRemovedPrefixes
|
|
53
|
+
prefixActions << action
|
|
54
|
+
action.checkable = true
|
|
55
|
+
action.checked = bool
|
|
56
|
+
action.connect(SIGNAL(:triggered)) do
|
|
57
|
+
display.removed_prefixes[prefix] = action.checked?
|
|
58
|
+
display.update
|
|
59
|
+
end
|
|
60
|
+
menuRemovedPrefixes.add_action action
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
ZOOM_STEP = 0.25
|
|
65
|
+
def setupUi(relations_display)
|
|
66
|
+
@display = relations_display
|
|
67
|
+
super(relations_display.main)
|
|
68
|
+
|
|
69
|
+
actionOwnership.connect(SIGNAL(:triggered)) do
|
|
70
|
+
display.show_ownership = actionOwnership.checked?
|
|
71
|
+
display.update
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
actionHideFinalized.connect(SIGNAL(:triggered)) do
|
|
75
|
+
display.hide_finalized = actionHideFinalized.checked?
|
|
76
|
+
display.update
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
#############################################################
|
|
80
|
+
# Build the removed_prefixes menu
|
|
81
|
+
actionPrefixAdd.connect(SIGNAL(:triggered)) do
|
|
82
|
+
new_prefix = Qt::InputDialog.get_text display.main, "New prefix", "New prefix to remove"
|
|
83
|
+
if !new_prefix.nil?
|
|
84
|
+
display.removed_prefixes[new_prefix] = true
|
|
85
|
+
save_config
|
|
86
|
+
update_prefix_menu
|
|
87
|
+
display.update
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
update_prefix_menu
|
|
91
|
+
|
|
92
|
+
#############################################################
|
|
93
|
+
# Handle the other toolbar's buttons
|
|
94
|
+
graphics.singleton_class.class_eval do
|
|
95
|
+
define_method(:contextMenuEvent) do |event|
|
|
96
|
+
item = itemAt(event.pos)
|
|
97
|
+
if item
|
|
98
|
+
unless obj = relations_display.object_of(item)
|
|
99
|
+
return super(event)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
return unless obj.kind_of?(Roby::LoggedTask)
|
|
104
|
+
|
|
105
|
+
menu = Qt::Menu.new
|
|
106
|
+
hide_this = menu.add_action("Hide")
|
|
107
|
+
hide_children = menu.add_action("Hide children")
|
|
108
|
+
show_children = menu.add_action("Show children")
|
|
109
|
+
return unless action = menu.exec(event.globalPos)
|
|
110
|
+
|
|
111
|
+
case action.text
|
|
112
|
+
when "Hide"
|
|
113
|
+
relations_display.set_visibility(obj, false)
|
|
114
|
+
when "Hide children"
|
|
115
|
+
for child in Roby::TaskStructure.children_of(obj, relations_display.enabled_relations)
|
|
116
|
+
relations_display.set_visibility(child, false)
|
|
117
|
+
end
|
|
118
|
+
when "Show children"
|
|
119
|
+
for child in Roby::TaskStructure.children_of(obj, relations_display.enabled_relations)
|
|
120
|
+
relations_display.set_visibility(child, true)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
relations_display.update
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
actionShowAll.connect(SIGNAL(:triggered)) do
|
|
129
|
+
display.graphics.keys.each do |obj|
|
|
130
|
+
display.set_visibility(obj, true) if obj.kind_of?(Roby::Task::DRoby) || (obj.kind_of?(Roby::EventGenerator::DRoby) && !obj.respond_to?(:task))
|
|
131
|
+
end
|
|
132
|
+
display.update
|
|
133
|
+
end
|
|
134
|
+
actionRedraw.connect(SIGNAL(:triggered)) do
|
|
135
|
+
display.update
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
actionZoom.connect(SIGNAL(:triggered)) do
|
|
139
|
+
scale = graphics.matrix.m11
|
|
140
|
+
if scale + ZOOM_STEP > 1
|
|
141
|
+
scale = 1 - ZOOM_STEP
|
|
142
|
+
end
|
|
143
|
+
graphics.resetMatrix
|
|
144
|
+
graphics.scale scale + ZOOM_STEP, scale + ZOOM_STEP
|
|
145
|
+
end
|
|
146
|
+
actionUnzoom.connect(SIGNAL(:triggered)) do
|
|
147
|
+
scale = graphics.matrix.m11
|
|
148
|
+
graphics.resetMatrix
|
|
149
|
+
graphics.scale scale - ZOOM_STEP, scale - ZOOM_STEP
|
|
150
|
+
end
|
|
151
|
+
actionFit.connect(SIGNAL(:triggered)) do
|
|
152
|
+
graphics.fitInView(graphics.scene.items_bounding_rect, Qt::KeepAspectRatio)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
actionKeepSignals.connect(SIGNAL(:triggered)) do
|
|
156
|
+
display.keep_signals = actionKeepSignals.checked?
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
actionPrint.connect(SIGNAL(:triggered)) do
|
|
160
|
+
return unless scene
|
|
161
|
+
printer = Qt::Printer.new;
|
|
162
|
+
if Qt::PrintDialog.new(printer).exec() == Qt::Dialog::Accepted
|
|
163
|
+
painter = Qt::Painter.new(printer);
|
|
164
|
+
painter.setRenderHint(Qt::Painter::Antialiasing);
|
|
165
|
+
scene.render(painter);
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
actionSVGExport.connect(SIGNAL(:triggered)) do
|
|
170
|
+
return unless scene
|
|
171
|
+
|
|
172
|
+
if path = Qt::FileDialog.get_save_file_name(nil, "SVG Export")
|
|
173
|
+
svg = Qt::SvgGenerator.new
|
|
174
|
+
svg.file_name = path
|
|
175
|
+
svg.size = Qt::Size.new(Integer(scene.width * 0.8), Integer(scene.height * 0.8))
|
|
176
|
+
painter = Qt::Painter.new
|
|
177
|
+
painter.begin(svg)
|
|
178
|
+
scene.render(painter)
|
|
179
|
+
painter.end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
actionSVGExport.enabled = defined?(Qt::SvgGenerator)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|