Class: Ui::RelationsConfig

Inherits:
Ui_RelationsConfig show all
Defined in:
lib/roby/log/gui/relations.rb,
lib/roby/log/gui/relations_ui.rb

Instance Attribute Summary collapse

Attributes inherited from Ui_RelationsConfig

#close, #gridLayout, #hboxLayout, #label, #label_2, #layout_method, #relations, #spacerItem, #stream, #vboxLayout

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Ui_RelationsConfig

#retranslateUi, #retranslate_ui, #setup_ui

Constructor Details

#initialize(*args) ⇒ RelationsConfig

Returns a new instance of RelationsConfig.



180
181
182
183
184
185
# File 'lib/roby/log/gui/relations.rb', line 180

def initialize(*args)
    super()
    if !system("dot", "-V")
        raise "the 'dot' tool is unavailable"
    end
end

Instance Attribute Details

#current_colorObject (readonly)

Returns the value of attribute current_color.



174
175
176
# File 'lib/roby/log/gui/relations.rb', line 174

def current_color
  @current_color
end

#delegateObject (readonly)

Returns the value of attribute delegate.



178
179
180
# File 'lib/roby/log/gui/relations.rb', line 178

def delegate
  @delegate
end

#modelObject (readonly)

Returns the value of attribute model.



177
178
179
# File 'lib/roby/log/gui/relations.rb', line 177

def model
  @model
end

#relation_colorObject (readonly)

Returns the value of attribute relation_color.



175
176
177
# File 'lib/roby/log/gui/relations.rb', line 175

def relation_color
  @relation_color
end

#relation_itemObject (readonly)

Returns the value of attribute relation_item.



176
177
178
# File 'lib/roby/log/gui/relations.rb', line 176

def relation_item
  @relation_item
end

Class Method Details

.setup_optparse(opt, replay) ⇒ Object



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/roby/log/gui/relations.rb', line 211

def self.setup_optparse(opt, replay)
    opt.on("--relations=REL1,REL2", Array, "create a relation display with the given relations") do |relations|
  if relations.include?("all")
      relations = Roby::TaskStructure.relations
  else
      relations.map! do |relname|
    rel = Roby::TaskStructure.relations.find { |rel| rel.name =~ /#{relname}/ }
    unless rel
        STDERR.puts "Unknown relation #{relname}. Available relations are:"
        STDERR.puts "  Tasks: " + Roby::TaskStructure.enum_for(:each_relation).map { |r| r.name.gsub(/.*Structure::/, '') }.join(", ")
        exit(1)
    end

    rel
      end
  end

  replay.initial_setup << lambda do |gui|
      if relation_display = gui.add_display('Relations')
                       relations.each do |rel|
                           relation_display.enable_relation(rel)
                       end
                   end
  end
    end
end

Instance Method Details

#setupUi(streams_model, widget) ⇒ Object



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/roby/log/gui/relations.rb', line 187

def setupUi(streams_model, widget)
    super(widget)

    display   = Roby::Log::RelationsDisplay.new
    @model    = RelationConfigModel.new(display)
    @delegate = RelationDelegate.new
    relations.set_item_delegate @delegate
    relations.header.resize_mode = Qt::HeaderView::Stretch
    relations.model = @model
    relations.set_expanded model.task_root_index, true
    relations.set_expanded model.event_root_index, true

    @streams_model = FilteredDataStreamListModel.new(stream, display, 'roby-events', streams_model.streams)
    Qt::Object.connect(stream, SIGNAL("currentIndexChanged(int)"), @streams_model, SLOT("selectedStream()"))
    @streams_model.source_model = streams_model
    stream.model    = @streams_model

    @layout_model = LayoutMethodModel.new(display, layout_method)
    Qt::Object.connect(layout_method, SIGNAL("currentIndexChanged(int)"), @layout_model, SLOT("selected()"))
    layout_method.model = @layout_model

    display
end