class Syskit::GUI::LoggingConfigurationItemBase

Base class for most items in the LoggingConfiguration widget with common functionality

Attributes

current_model[R]
editing_model[R]

Public Class Methods

new(model) click to toggle source
Calls superclass method
# File lib/syskit/gui/logging_configuration_item_base.rb, line 12
def initialize(model)
    super()
    @current_model = deep_copy(model)
    @editing_model = deep_copy(model)
end

Public Instance Methods

accept_changes() click to toggle source
# File lib/syskit/gui/logging_configuration_item_base.rb, line 68
def accept_changes
    @current_model = deep_copy(@editing_model)
end
add_conf_item(label, accessor = nil) click to toggle source

Adds a ruby primitive type to the tree view

# File lib/syskit/gui/logging_configuration_item_base.rb, line 24
def add_conf_item(label, accessor = nil)
    item1 = Vizkit::VizkitItem.new(label)
    item2 = RubyItem.new

    if !accessor.nil?
        item2.getter do
            @editing_model.method(accessor).call
        end

        item2.setter do |value|
            @editing_model.method("#{accessor}=".to_sym).call value
        end
    end

    appendRow([item1, item2])
    return item1, item2
end
data(role = Qt::UserRole+1) click to toggle source
Calls superclass method
# File lib/syskit/gui/logging_configuration_item_base.rb, line 42
def data(role = Qt::UserRole+1)
    if role == Qt::EditRole 
        Qt::Variant.from_ruby self
    else
        super
    end
end
deep_copy(model) click to toggle source

Creates a marshallable deep copy of the object

# File lib/syskit/gui/logging_configuration_item_base.rb, line 19
def deep_copy(model)
    Marshal.load(Marshal.dump(model))
end
modified!(value = true, items = [],update_parent = false) click to toggle source

Updates view's sibling modified? state possibly rejecting changes made to the model

Calls superclass method
# File lib/syskit/gui/logging_configuration_item_base.rb, line 52
def modified!(value = true, items = [],update_parent = false)
    super
    reject_changes unless value
    if column == 0
        i = index.sibling(row,1)
        if i.isValid
            item = i.model.itemFromIndex i
            item.modified!(value,items)
        end
    end
end
reject_changes() click to toggle source
# File lib/syskit/gui/logging_configuration_item_base.rb, line 64
def reject_changes
    @editing_model = deep_copy(@current_model)
end