roby 0.7
Sign up to get free protection for your applications and to get access to all the features.
- 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,83 @@
|
|
1
|
+
<ui version="4.0" >
|
2
|
+
<class>BasicDisplayConfig</class>
|
3
|
+
<widget class="QWidget" name="BasicDisplayConfig" >
|
4
|
+
<property name="geometry" >
|
5
|
+
<rect>
|
6
|
+
<x>0</x>
|
7
|
+
<y>0</y>
|
8
|
+
<width>333</width>
|
9
|
+
<height>77</height>
|
10
|
+
</rect>
|
11
|
+
</property>
|
12
|
+
<property name="windowTitle" >
|
13
|
+
<string>Form</string>
|
14
|
+
</property>
|
15
|
+
<layout class="QGridLayout" >
|
16
|
+
<property name="margin" >
|
17
|
+
<number>9</number>
|
18
|
+
</property>
|
19
|
+
<property name="spacing" >
|
20
|
+
<number>6</number>
|
21
|
+
</property>
|
22
|
+
<item row="0" column="0" >
|
23
|
+
<layout class="QGridLayout" >
|
24
|
+
<property name="margin" >
|
25
|
+
<number>0</number>
|
26
|
+
</property>
|
27
|
+
<property name="spacing" >
|
28
|
+
<number>6</number>
|
29
|
+
</property>
|
30
|
+
<item row="1" column="0" >
|
31
|
+
<widget class="QLabel" name="label" >
|
32
|
+
<property name="sizePolicy" >
|
33
|
+
<sizepolicy>
|
34
|
+
<hsizetype>1</hsizetype>
|
35
|
+
<vsizetype>5</vsizetype>
|
36
|
+
<horstretch>0</horstretch>
|
37
|
+
<verstretch>0</verstretch>
|
38
|
+
</sizepolicy>
|
39
|
+
</property>
|
40
|
+
<property name="text" >
|
41
|
+
<string>Data stream</string>
|
42
|
+
</property>
|
43
|
+
</widget>
|
44
|
+
</item>
|
45
|
+
<item row="0" column="2" >
|
46
|
+
<widget class="QPushButton" name="close" >
|
47
|
+
<property name="text" >
|
48
|
+
<string>Close</string>
|
49
|
+
</property>
|
50
|
+
</widget>
|
51
|
+
</item>
|
52
|
+
<item row="0" column="0" colspan="2" >
|
53
|
+
<spacer>
|
54
|
+
<property name="orientation" >
|
55
|
+
<enum>Qt::Horizontal</enum>
|
56
|
+
</property>
|
57
|
+
<property name="sizeHint" >
|
58
|
+
<size>
|
59
|
+
<width>161</width>
|
60
|
+
<height>20</height>
|
61
|
+
</size>
|
62
|
+
</property>
|
63
|
+
</spacer>
|
64
|
+
</item>
|
65
|
+
<item row="1" column="1" colspan="2" >
|
66
|
+
<widget class="QComboBox" name="stream" >
|
67
|
+
<property name="sizePolicy" >
|
68
|
+
<sizepolicy>
|
69
|
+
<hsizetype>3</hsizetype>
|
70
|
+
<vsizetype>0</vsizetype>
|
71
|
+
<horstretch>0</horstretch>
|
72
|
+
<verstretch>0</verstretch>
|
73
|
+
</sizepolicy>
|
74
|
+
</property>
|
75
|
+
</widget>
|
76
|
+
</item>
|
77
|
+
</layout>
|
78
|
+
</item>
|
79
|
+
</layout>
|
80
|
+
</widget>
|
81
|
+
<resources/>
|
82
|
+
<connections/>
|
83
|
+
</ui>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'roby/log/gui/basic_display_ui'
|
2
|
+
require 'roby/log/chronicle'
|
3
|
+
|
4
|
+
module Ui
|
5
|
+
class ChronicleConfig < Ui::BasicDisplayConfig
|
6
|
+
attr_reader :streams_model
|
7
|
+
|
8
|
+
def setupUi(streams_model, widget)
|
9
|
+
super(widget)
|
10
|
+
|
11
|
+
display = Roby::Log::ChronicleDisplay.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("--chronicle") do
|
21
|
+
replay.add_display('Chronicle')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'roby/log/gui/chronicle_view_ui'
|
2
|
+
|
3
|
+
class Ui::ChronicleView
|
4
|
+
TIME_SCALE_STEP = 2.0
|
5
|
+
ZOOM_STEP = 0.25
|
6
|
+
|
7
|
+
attr_reader :display
|
8
|
+
def setupUi(display, widget)
|
9
|
+
@display = display
|
10
|
+
super(widget)
|
11
|
+
|
12
|
+
actionZoom.connect(SIGNAL(:triggered)) do
|
13
|
+
scale = graphics.matrix.m11
|
14
|
+
if scale + ZOOM_STEP > 1
|
15
|
+
scale = 1 - ZOOM_STEP
|
16
|
+
end
|
17
|
+
graphics.resetMatrix
|
18
|
+
graphics.scale scale + ZOOM_STEP, scale + ZOOM_STEP
|
19
|
+
end
|
20
|
+
actionUnZoom.connect(SIGNAL(:triggered)) do
|
21
|
+
scale = graphics.matrix.m11
|
22
|
+
graphics.resetMatrix
|
23
|
+
graphics.scale scale - ZOOM_STEP, scale - ZOOM_STEP
|
24
|
+
end
|
25
|
+
actionTimeScale.connect(SIGNAL(:triggered)) do
|
26
|
+
current_scale = display.time_scale
|
27
|
+
if current_scale * TIME_SCALE_STEP >= 1000
|
28
|
+
display.time_scale = 1000
|
29
|
+
actionTimeScale.enabled = false
|
30
|
+
else
|
31
|
+
display.time_scale = current_scale * TIME_SCALE_STEP
|
32
|
+
end
|
33
|
+
end
|
34
|
+
actionTimeUnscale.connect(SIGNAL(:triggered)) do
|
35
|
+
display.time_scale /= TIME_SCALE_STEP
|
36
|
+
actionTimeScale.enabled = true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
<ui version="4.0" >
|
2
|
+
<class>ChronicleView</class>
|
3
|
+
<widget class="QMainWindow" name="ChronicleView" >
|
4
|
+
<property name="geometry" >
|
5
|
+
<rect>
|
6
|
+
<x>0</x>
|
7
|
+
<y>0</y>
|
8
|
+
<width>800</width>
|
9
|
+
<height>600</height>
|
10
|
+
</rect>
|
11
|
+
</property>
|
12
|
+
<property name="windowTitle" >
|
13
|
+
<string>MainWindow</string>
|
14
|
+
</property>
|
15
|
+
<widget class="QWidget" name="centralwidget" >
|
16
|
+
<layout class="QVBoxLayout" >
|
17
|
+
<item>
|
18
|
+
<widget class="QGraphicsView" name="graphics" >
|
19
|
+
<property name="renderHints" >
|
20
|
+
<set>QPainter::Antialiasing|QPainter::TextAntialiasing</set>
|
21
|
+
</property>
|
22
|
+
</widget>
|
23
|
+
</item>
|
24
|
+
</layout>
|
25
|
+
</widget>
|
26
|
+
<widget class="QMenuBar" name="menubar" >
|
27
|
+
<property name="geometry" >
|
28
|
+
<rect>
|
29
|
+
<x>0</x>
|
30
|
+
<y>0</y>
|
31
|
+
<width>800</width>
|
32
|
+
<height>29</height>
|
33
|
+
</rect>
|
34
|
+
</property>
|
35
|
+
<widget class="QMenu" name="menuView" >
|
36
|
+
<property name="title" >
|
37
|
+
<string>View</string>
|
38
|
+
</property>
|
39
|
+
<addaction name="actionTimeScale" />
|
40
|
+
<addaction name="actionTimeUnscale" />
|
41
|
+
<addaction name="actionZoom" />
|
42
|
+
<addaction name="actionUnZoom" />
|
43
|
+
</widget>
|
44
|
+
<addaction name="menuView" />
|
45
|
+
</widget>
|
46
|
+
<widget class="QStatusBar" name="statusbar" />
|
47
|
+
<action name="actionTimeScale" >
|
48
|
+
<property name="text" >
|
49
|
+
<string>Timescale +</string>
|
50
|
+
</property>
|
51
|
+
</action>
|
52
|
+
<action name="actionTimeUnscale" >
|
53
|
+
<property name="text" >
|
54
|
+
<string>Timescale -</string>
|
55
|
+
</property>
|
56
|
+
</action>
|
57
|
+
<action name="actionZoom" >
|
58
|
+
<property name="text" >
|
59
|
+
<string>Zoom +</string>
|
60
|
+
</property>
|
61
|
+
</action>
|
62
|
+
<action name="actionUnZoom" >
|
63
|
+
<property name="text" >
|
64
|
+
<string> Zoom-</string>
|
65
|
+
</property>
|
66
|
+
</action>
|
67
|
+
</widget>
|
68
|
+
<resources/>
|
69
|
+
<connections/>
|
70
|
+
</ui>
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'Qt4'
|
2
|
+
require 'roby/app'
|
3
|
+
require 'roby/log/gui/data_displays_ui'
|
4
|
+
require 'roby/log/gui/relations'
|
5
|
+
require 'roby/log/gui/notifications'
|
6
|
+
require 'roby/log/gui/chronicle'
|
7
|
+
|
8
|
+
class DataStreamListModel < Qt::AbstractListModel
|
9
|
+
attr_reader :streams
|
10
|
+
def initialize(streams)
|
11
|
+
@streams = streams
|
12
|
+
super()
|
13
|
+
end
|
14
|
+
|
15
|
+
def rowCount(parent)
|
16
|
+
if parent.valid? then 0
|
17
|
+
else streams.size
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def flags(index)
|
22
|
+
Qt::ItemIsSelectable | Qt::ItemIsEnabled
|
23
|
+
end
|
24
|
+
|
25
|
+
def data(index, role)
|
26
|
+
return Qt::Variant.new unless role == Qt::DisplayRole && index.valid? && index.row < streams.size
|
27
|
+
s = streams[index.row]
|
28
|
+
return Qt::Variant.new(s.name + " [#{s.type}]")
|
29
|
+
end
|
30
|
+
|
31
|
+
def edit_at(index)
|
32
|
+
return unless index.valid? && index.row < streams.size
|
33
|
+
edit(streams[index.row])
|
34
|
+
emit dataChanged(index, index)
|
35
|
+
end
|
36
|
+
|
37
|
+
def insertRow(row, parent)
|
38
|
+
emit beginInsertRows(parent, row, row)
|
39
|
+
if stream = edit(nil)
|
40
|
+
@streams.insert row, stream
|
41
|
+
return true
|
42
|
+
end
|
43
|
+
ensure
|
44
|
+
emit endInsertRows()
|
45
|
+
end
|
46
|
+
|
47
|
+
def removeRow(row, parent)
|
48
|
+
emit beginRemoveRows(parent, row, row)
|
49
|
+
@streams.delete_at row
|
50
|
+
emit endRemoveRows()
|
51
|
+
true
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_new(stream = nil)
|
55
|
+
if stream
|
56
|
+
emit beginInsertRows(Qt::ModelIndex.new, streams.size, streams.size)
|
57
|
+
streams << stream
|
58
|
+
emit endInsertRows()
|
59
|
+
else
|
60
|
+
insertRow(streams.size, Qt::ModelIndex.new)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
class FilteredDataStreamListModel < Qt::SortFilterProxyModel
|
67
|
+
attr_reader :type, :streams
|
68
|
+
attr_reader :stream_combo
|
69
|
+
attr_reader :display
|
70
|
+
def initialize(stream_combo, display, type, streams)
|
71
|
+
super()
|
72
|
+
@display = display
|
73
|
+
@type = type
|
74
|
+
@streams = streams
|
75
|
+
@stream_combo = stream_combo
|
76
|
+
end
|
77
|
+
def filterAcceptsRow(stream_row, stream_parent)
|
78
|
+
if s = streams[stream_row]
|
79
|
+
s.type == type
|
80
|
+
else
|
81
|
+
false
|
82
|
+
end
|
83
|
+
end
|
84
|
+
def selectedStream()
|
85
|
+
index = stream_combo.current_index
|
86
|
+
index = self.index(index, 0, Qt::ModelIndex.new)
|
87
|
+
display.stream = streams[mapToSource(index).row]
|
88
|
+
end
|
89
|
+
slots 'selectedStream()'
|
90
|
+
end
|
91
|
+
|
92
|
+
class DisplayConfigHandler < Qt::Widget
|
93
|
+
attr_reader :display_configs
|
94
|
+
attr_reader :config_ui
|
95
|
+
attr_reader :display
|
96
|
+
|
97
|
+
def setup(data_displays, config_ui)
|
98
|
+
@display_configs = data_displays.display_configs
|
99
|
+
@display = data_displays.displays[config_ui]
|
100
|
+
@config_ui = config_ui
|
101
|
+
|
102
|
+
connect(config_ui.close, SIGNAL('clicked()'), self, SLOT('close()'))
|
103
|
+
end
|
104
|
+
|
105
|
+
def close
|
106
|
+
idx = display_configs.index_of(self)
|
107
|
+
if display.decoder
|
108
|
+
display.decoder.displays.delete(display)
|
109
|
+
end
|
110
|
+
display.main.close
|
111
|
+
display_configs.remove_item idx
|
112
|
+
end
|
113
|
+
slots 'close()'
|
114
|
+
end
|
115
|
+
|
116
|
+
class Ui_DataDisplays
|
117
|
+
DISPLAYS = {
|
118
|
+
'Relations' => Ui::RelationsConfig,
|
119
|
+
'Chronicle' => Ui::ChronicleConfig,
|
120
|
+
'Notifications' => Ui::NotificationsConfig
|
121
|
+
}
|
122
|
+
attr_reader :displays
|
123
|
+
|
124
|
+
def initialize
|
125
|
+
super()
|
126
|
+
|
127
|
+
@displays = Hash.new
|
128
|
+
@display_number = 0
|
129
|
+
end
|
130
|
+
|
131
|
+
def allocate_display_number; @display_number += 1 end
|
132
|
+
def add_display(streams, kind = nil)
|
133
|
+
kind ||= display_types.current_text
|
134
|
+
|
135
|
+
begin
|
136
|
+
config_widget = DisplayConfigHandler.new
|
137
|
+
config_ui = DISPLAYS[kind].new
|
138
|
+
rescue Exception => e
|
139
|
+
Qt::MessageBox.critical nil, "Cannot create display", "cannot create display #{kind}: #{e.message}"
|
140
|
+
return
|
141
|
+
end
|
142
|
+
|
143
|
+
display = config_ui.setupUi(streams, config_widget)
|
144
|
+
|
145
|
+
name = "#{kind}##{allocate_display_number}"
|
146
|
+
idx = display_configs.add_item(config_widget, name)
|
147
|
+
display_configs.current_index = idx
|
148
|
+
|
149
|
+
displays[config_ui] = display
|
150
|
+
display.main.window_title = name
|
151
|
+
display.main.show
|
152
|
+
display.config_ui = config_ui
|
153
|
+
|
154
|
+
main_window = display.main
|
155
|
+
main_window.singleton_class.class_eval do
|
156
|
+
define_method(:closeEvent) do |event|
|
157
|
+
config_ui.close.clicked
|
158
|
+
end
|
159
|
+
end
|
160
|
+
config_widget.setup(self, config_ui)
|
161
|
+
|
162
|
+
display
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
if $0 == __FILE__
|
167
|
+
a = Qt::Application.new(ARGV)
|
168
|
+
w = Replay.new
|
169
|
+
w.show
|
170
|
+
a.exec
|
171
|
+
end
|
172
|
+
|
@@ -0,0 +1,155 @@
|
|
1
|
+
<ui version="4.0" >
|
2
|
+
<class>DataDisplays</class>
|
3
|
+
<widget class="QWidget" name="DataDisplays" >
|
4
|
+
<property name="geometry" >
|
5
|
+
<rect>
|
6
|
+
<x>0</x>
|
7
|
+
<y>0</y>
|
8
|
+
<width>548</width>
|
9
|
+
<height>508</height>
|
10
|
+
</rect>
|
11
|
+
</property>
|
12
|
+
<property name="windowTitle" >
|
13
|
+
<string>Form</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
|
+
<widget class="QGroupBox" name="groupBox" >
|
24
|
+
<property name="title" >
|
25
|
+
<string>Data sources</string>
|
26
|
+
</property>
|
27
|
+
<layout class="QVBoxLayout" >
|
28
|
+
<property name="margin" >
|
29
|
+
<number>9</number>
|
30
|
+
</property>
|
31
|
+
<property name="spacing" >
|
32
|
+
<number>6</number>
|
33
|
+
</property>
|
34
|
+
<item>
|
35
|
+
<widget class="QListView" name="streams" />
|
36
|
+
</item>
|
37
|
+
<item>
|
38
|
+
<layout class="QHBoxLayout" >
|
39
|
+
<property name="margin" >
|
40
|
+
<number>0</number>
|
41
|
+
</property>
|
42
|
+
<property name="spacing" >
|
43
|
+
<number>6</number>
|
44
|
+
</property>
|
45
|
+
<item>
|
46
|
+
<spacer>
|
47
|
+
<property name="orientation" >
|
48
|
+
<enum>Qt::Horizontal</enum>
|
49
|
+
</property>
|
50
|
+
<property name="sizeHint" >
|
51
|
+
<size>
|
52
|
+
<width>40</width>
|
53
|
+
<height>20</height>
|
54
|
+
</size>
|
55
|
+
</property>
|
56
|
+
</spacer>
|
57
|
+
</item>
|
58
|
+
<item>
|
59
|
+
<widget class="QPushButton" name="add_stream" >
|
60
|
+
<property name="text" >
|
61
|
+
<string>&Add</string>
|
62
|
+
</property>
|
63
|
+
</widget>
|
64
|
+
</item>
|
65
|
+
<item>
|
66
|
+
<widget class="QPushButton" name="remove_stream" >
|
67
|
+
<property name="text" >
|
68
|
+
<string>Remove</string>
|
69
|
+
</property>
|
70
|
+
</widget>
|
71
|
+
</item>
|
72
|
+
</layout>
|
73
|
+
</item>
|
74
|
+
</layout>
|
75
|
+
</widget>
|
76
|
+
</item>
|
77
|
+
<item>
|
78
|
+
<widget class="QGroupBox" name="displaysGroup" >
|
79
|
+
<property name="title" >
|
80
|
+
<string>Displays</string>
|
81
|
+
</property>
|
82
|
+
<layout class="QVBoxLayout" >
|
83
|
+
<property name="margin" >
|
84
|
+
<number>9</number>
|
85
|
+
</property>
|
86
|
+
<property name="spacing" >
|
87
|
+
<number>6</number>
|
88
|
+
</property>
|
89
|
+
<item>
|
90
|
+
<layout class="QHBoxLayout" >
|
91
|
+
<property name="margin" >
|
92
|
+
<number>0</number>
|
93
|
+
</property>
|
94
|
+
<property name="spacing" >
|
95
|
+
<number>6</number>
|
96
|
+
</property>
|
97
|
+
<item>
|
98
|
+
<widget class="QComboBox" name="display_types" >
|
99
|
+
<property name="sizePolicy" >
|
100
|
+
<sizepolicy>
|
101
|
+
<hsizetype>5</hsizetype>
|
102
|
+
<vsizetype>0</vsizetype>
|
103
|
+
<horstretch>1</horstretch>
|
104
|
+
<verstretch>0</verstretch>
|
105
|
+
</sizepolicy>
|
106
|
+
</property>
|
107
|
+
<item>
|
108
|
+
<property name="text" >
|
109
|
+
<string>Relations</string>
|
110
|
+
</property>
|
111
|
+
</item>
|
112
|
+
<item>
|
113
|
+
<property name="text" >
|
114
|
+
<string>Chronicle</string>
|
115
|
+
</property>
|
116
|
+
</item>
|
117
|
+
<item>
|
118
|
+
<property name="text" >
|
119
|
+
<string>Notifications</string>
|
120
|
+
</property>
|
121
|
+
</item>
|
122
|
+
</widget>
|
123
|
+
</item>
|
124
|
+
<item>
|
125
|
+
<widget class="QPushButton" name="display_add" >
|
126
|
+
<property name="text" >
|
127
|
+
<string>&Add</string>
|
128
|
+
</property>
|
129
|
+
</widget>
|
130
|
+
</item>
|
131
|
+
</layout>
|
132
|
+
</item>
|
133
|
+
<item>
|
134
|
+
<widget class="QToolBox" name="display_configs" >
|
135
|
+
<property name="sizePolicy" >
|
136
|
+
<sizepolicy>
|
137
|
+
<hsizetype>5</hsizetype>
|
138
|
+
<vsizetype>3</vsizetype>
|
139
|
+
<horstretch>0</horstretch>
|
140
|
+
<verstretch>0</verstretch>
|
141
|
+
</sizepolicy>
|
142
|
+
</property>
|
143
|
+
<property name="currentIndex" >
|
144
|
+
<number>-1</number>
|
145
|
+
</property>
|
146
|
+
</widget>
|
147
|
+
</item>
|
148
|
+
</layout>
|
149
|
+
</widget>
|
150
|
+
</item>
|
151
|
+
</layout>
|
152
|
+
</widget>
|
153
|
+
<resources/>
|
154
|
+
<connections/>
|
155
|
+
</ui>
|