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.



200
201
202
203
204
205
206
207
# File 'lib/roby/gui/relations_view/relations_config.rb', line 200

def initialize(widget, display)
    super()
    if !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.



193
194
195
# File 'lib/roby/gui/relations_view/relations_config.rb', line 193

def current_color
  @current_color
end

#delegateObject (readonly)

Returns the value of attribute delegate.



197
198
199
# File 'lib/roby/gui/relations_view/relations_config.rb', line 197

def delegate
  @delegate
end

#displayObject (readonly)

Returns the value of attribute display.



198
199
200
# File 'lib/roby/gui/relations_view/relations_config.rb', line 198

def display
  @display
end

#modelObject (readonly)

Returns the value of attribute model.



196
197
198
# File 'lib/roby/gui/relations_view/relations_config.rb', line 196

def model
  @model
end

#relation_colorObject (readonly)

Returns the value of attribute relation_color.



194
195
196
# File 'lib/roby/gui/relations_view/relations_config.rb', line 194

def relation_color
  @relation_color
end

#relation_itemObject (readonly)

Returns the value of attribute relation_item.



195
196
197
# File 'lib/roby/gui/relations_view/relations_config.rb', line 195

def relation_item
  @relation_item
end

Instance Method Details

#delayed_updateObject



278
279
280
# File 'lib/roby/gui/relations_view/relations_config.rb', line 278

def delayed_update
    @delayed_update_timer.start(DELAYED_UPDATE_TIMEOUT)
end

#setupUi(widget, display) ⇒ Object



209
210
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
237
238
239
240
241
242
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
# File 'lib/roby/gui/relations_view/relations_config.rb', line 209

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
    if display.display_policy == :explicit
        displayExplicit.checked = true
    elsif display.display_policy == :emitters
        displayEmitters.checked = true
    elsif display.display_policy == :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