Class: Roby::GUI::Stepping
- Defined in:
- lib/roby/gui/stepping.rb
Overview
GUI dialog that allows to display plans step-by-step instead of cycle-by-cycle
Instance Attribute Summary collapse
-
#logfile ⇒ Object
readonly
Returns the value of attribute logfile.
-
#plan ⇒ Object
readonly
Returns the value of attribute plan.
-
#plan_rebuilder ⇒ Object
readonly
Returns the value of attribute plan_rebuilder.
-
#ui ⇒ Object
readonly
Returns the value of attribute ui.
Instance Method Summary collapse
- #display_current_position ⇒ Object
-
#initialize(main_widget, plan, logfile, starting_cycle) ⇒ Stepping
constructor
Create a step-by-step replay starting at the beginning of a cycle in the log stream.
- #step_forward ⇒ Object
Constructor Details
#initialize(main_widget, plan, logfile, starting_cycle) ⇒ Stepping
Create a step-by-step replay starting at the beginning of a cycle in the log stream
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/roby/gui/stepping.rb', line 24 def initialize(, plan, logfile, starting_cycle) super() @ui = Ui_Stepping.new @ui.setupUi(self) Qt::Object.connect(ui.btn_next, SIGNAL("clicked()"), self, SLOT("step_forward()")) = @plan = plan plan.clear @plan_rebuilder = DRoby::PlanRebuilder.new(plan: plan) @logfile = logfile PlanRebuilderWidget.analyze(plan_rebuilder, logfile, until_cycle: starting_cycle - 1) .redraw @current_cycle_data = [] @current_cycle_position = 0 @current_cycle_size = 0 if !logfile.eof? @current_cycle_data = logfile.load_one_cycle @current_cycle_position = 0 @current_cycle_size = @current_cycle_data.size / 4 end display_current_position end |
Instance Attribute Details
#logfile ⇒ Object (readonly)
Returns the value of attribute logfile.
11 12 13 |
# File 'lib/roby/gui/stepping.rb', line 11 def logfile @logfile end |
#plan ⇒ Object (readonly)
Returns the value of attribute plan.
10 11 12 |
# File 'lib/roby/gui/stepping.rb', line 10 def plan @plan end |
#plan_rebuilder ⇒ Object (readonly)
Returns the value of attribute plan_rebuilder.
12 13 14 |
# File 'lib/roby/gui/stepping.rb', line 12 def plan_rebuilder @plan_rebuilder end |
#ui ⇒ Object (readonly)
Returns the value of attribute ui.
8 9 10 |
# File 'lib/roby/gui/stepping.rb', line 8 def ui @ui end |
Instance Method Details
#display_current_position ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/roby/gui/stepping.rb', line 52 def display_current_position ui.index.text = @current_cycle_position.to_s ui.index_count.text = @current_cycle_size.to_s ui.cycle.text = @plan_rebuilder.cycle_index.to_s ui.cycle_count.text = @logfile.index.cycle_count.to_s ui.time.text = @plan_rebuilder.current_time.to_hms end |
#step_forward ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/roby/gui/stepping.rb', line 60 def step_forward plan_rebuilder.clear_integrated @plan_rebuilder.plan.clear_integrated while !logfile.eof? while @current_cycle_data.empty? @current_cycle_data = logfile.load_one_cycle @current_cycle_position = 0 @current_cycle_size = @current_cycle_data.size / 4 end while !@current_cycle_data.empty? data = [] 4.times do data << @current_cycle_data.shift end @current_cycle_position += 1 plan_rebuilder.process_one_cycle(data) if plan_rebuilder.has_event_propagation_updates? || plan_rebuilder.has_structure_updates? plan_rebuilder.clear_changes return end end end ensure display_current_position .redraw end |