Class: Ui::RelationsConfig

Inherits:
Object show all
Defined in:
lib/roby/gui/relations_view/relations_config.rb

Constant Summary collapse

DELAYED_UPDATE_TIMEOUT =

The amount of time we wait before triggering an update on the display. This is meant to avoid unnecessary updates (for instance for configuration parameters in textboxes)

500

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(widget, display) ⇒ RelationsConfig

Returns a new instance of RelationsConfig.



234
235
236
237
238
239
240
241
# File 'lib/roby/gui/relations_view/relations_config.rb', line 234

def initialize(widget, display)
    super()
    unless system("dot", "-V")
        raise "the 'dot' tool is unavailable"
    end

    setupUi(widget, display)
end

Instance Attribute Details

#current_colorObject (readonly)

Returns the value of attribute current_color.



232
233
234
# File 'lib/roby/gui/relations_view/relations_config.rb', line 232

def current_color
  @current_color
end

#delegateObject (readonly)

Returns the value of attribute delegate.



232
233
234
# File 'lib/roby/gui/relations_view/relations_config.rb', line 232

def delegate
  @delegate
end

#displayObject (readonly)

Returns the value of attribute display.



232
233
234
# File 'lib/roby/gui/relations_view/relations_config.rb', line 232

def display
  @display
end

#modelObject (readonly)

Returns the value of attribute model.



232
233
234
# File 'lib/roby/gui/relations_view/relations_config.rb', line 232

def model
  @model
end

#relation_colorObject (readonly)

Returns the value of attribute relation_color.



232
233
234
# File 'lib/roby/gui/relations_view/relations_config.rb', line 232

def relation_color
  @relation_color
end

#relation_itemObject (readonly)

Returns the value of attribute relation_item.



232
233
234
# File 'lib/roby/gui/relations_view/relations_config.rb', line 232

def relation_item
  @relation_item
end

Instance Method Details

#delayed_updateObject



313
314
315
# File 'lib/roby/gui/relations_view/relations_config.rb', line 313

def delayed_update
    @delayed_update_timer.start(DELAYED_UPDATE_TIMEOUT)
end

#setupUi(widget, display) ⇒ Object



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/roby/gui/relations_view/relations_config.rb', line 243

def setupUi(widget, display)
    super(widget)

    @display = display
    @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

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

    showOwnership.checked = display.show_ownership
    showOwnership.connect(SIGNAL("clicked(bool)")) do |state|
        display.show_ownership = state
        display.update
    end
    showFinalized.checked = !display.hide_finalized
    showFinalized.connect(SIGNAL("clicked(bool)")) do |state|
        display.hide_finalized = !state
        display.update
    end
    removedPrefixes.setText(display.removed_prefixes.to_a.join(","))
    removedPrefixes.connect(SIGNAL("textChanged(QString)")) do |removed_prefixes|
        display.removed_prefixes = removed_prefixes.split(",")
        delayed_update
    end
    hiddenLabels.setText(display.hidden_labels.to_a.join(","))
    hiddenLabels.connect(SIGNAL("textChanged(QString)")) do |hidden_labels|
        display.hidden_labels = hidden_labels.split(",")
        delayed_update
    end
    case display.display_policy
    when :explicit
        displayExplicit.checked = true
    when :emitters
        displayEmitters.checked = true
    when :emitters_and_parents
        displayEmittersAndParents.checked = true
    end

    displayExplicit.connect(SIGNAL("clicked()")) do
        display.display_policy = :explicit
        delayed_update
    end
    displayEmitters.connect(SIGNAL("clicked()")) do
        display.display_policy = :emitters
        delayed_update
    end
    displayEmittersAndParents.connect(SIGNAL("clicked()")) do
        display.display_policy = :emitters_and_parents
        delayed_update
    end

    @delayed_update_timer = Qt::Timer.new(display)
    @delayed_update_timer.setSingleShot(true)
    @delayed_update_timer.connect(SIGNAL("timeout()")) do
        display.update
    end
end