Class: RuntimeDisplay
- Defined in:
- lib/roby/log/gui/runtime.rb
Constant Summary collapse
- DISPLAY_MINIMUM_DURATION =
5
Instance Attribute Summary collapse
-
#streams ⇒ Object
readonly
Returns the value of attribute streams.
-
#streams_model ⇒ Object
readonly
Returns the value of attribute streams_model.
-
#ui_displays ⇒ Object
readonly
Returns the value of attribute ui_displays.
Instance Method Summary collapse
- #add_display(kind = nil) ⇒ Object
-
#initialize(broadcast, port, period) ⇒ RuntimeDisplay
constructor
A new instance of RuntimeDisplay.
Constructor Details
#initialize(broadcast, port, period) ⇒ RuntimeDisplay
Returns a new instance of RuntimeDisplay.
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/roby/log/gui/runtime.rb', line 60 def initialize(broadcast, port, period) super() # Create the vertical layout for this window = Qt::Widget.new(self) self. = layout = Qt::VBoxLayout.new() layout.spacing = 6 layout.margin = 0 # add GUI for the data streams and display setup @streams = Array.new @streams_model = RemoteStreamListModel.new(streams) displays_holder = Qt::Widget.new() layout. displays_holder @ui_displays = Ui_DataDisplays.new ui_displays.setupUi(displays_holder) ui_displays.streams.model = streams_model ui_displays.add_stream.enabled = false ui_displays.remove_stream.enabled = false connect(ui_displays.display_add, SIGNAL("clicked()"), self, SLOT("add_display()")) # Set up the stream discovery Roby::Log::Server.enable_discovery(broadcast, port, period) # This timer is used to call Thread.pass ... of course needed or Ruby # threads won't be woken up Thread.current.priority = -1 @threads_timer = Qt::Timer.new(self) connect(@threads_timer, SIGNAL('timeout()')) do Thread.pass end @threads_timer.start(50) @display_timer = Qt::Timer.new(self) connect(@display_timer, SIGNAL('timeout()')) do streams.each do |s| s.synchronize do s.display end end end @display_timer.start(5000) sleep(0.5) streams_model.update @discovery_timer = Qt::Timer.new(self) connect(@discovery_timer, SIGNAL('timeout()')) do streams_model.update end @discovery_timer.start(Integer(period * 1000)) end |
Instance Attribute Details
#streams ⇒ Object (readonly)
Returns the value of attribute streams.
55 56 57 |
# File 'lib/roby/log/gui/runtime.rb', line 55 def streams @streams end |
#streams_model ⇒ Object (readonly)
Returns the value of attribute streams_model.
56 57 58 |
# File 'lib/roby/log/gui/runtime.rb', line 56 def streams_model @streams_model end |
#ui_displays ⇒ Object (readonly)
Returns the value of attribute ui_displays.
53 54 55 |
# File 'lib/roby/log/gui/runtime.rb', line 53 def ui_displays @ui_displays end |
Instance Method Details
#add_display(kind = nil) ⇒ Object
115 116 117 |
# File 'lib/roby/log/gui/runtime.rb', line 115 def add_display(kind = nil) ui_displays.add_display(streams_model, kind) end |