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
22 23 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 |
# File 'lib/roby/gui/stepping.rb', line 22 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()")) @main_widget = @plan = plan plan.clear @plan_rebuilder = DRoby::PlanRebuilder.new(plan: plan) @logfile = logfile PlanRebuilderWidget.analyze(plan_rebuilder, logfile, until_cycle: starting_cycle - 1) @main_widget.redraw @current_cycle_data = [] @current_cycle_position = 0 @current_cycle_size = 0 unless 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.
10 11 12 |
# File 'lib/roby/gui/stepping.rb', line 10 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.
10 11 12 |
# File 'lib/roby/gui/stepping.rb', line 10 def plan_rebuilder @plan_rebuilder end |
#ui ⇒ Object (readonly)
Returns the value of attribute ui.
10 11 12 |
# File 'lib/roby/gui/stepping.rb', line 10 def ui @ui end |
Instance Method Details
#display_current_position ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/roby/gui/stepping.rb', line 50 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
58 59 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 |
# File 'lib/roby/gui/stepping.rb', line 58 def step_forward plan_rebuilder.clear_integrated @plan_rebuilder.plan.clear_integrated until 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 until @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 @main_widget.redraw end |