class Syskit::GUI::LoggingConfigurationItem

A QStandardItem that displays a Sysit::ShellInterface::LoggingConfiguration in a tree view

Attributes

conf_logs_item_name[R]
conf_logs_item_value[R]
groups_item_name[R]
groups_item_value[R]
options[R]
port_logs_item_name[R]
port_logs_item_value[R]

Public Class Methods

new(logging_configuration, options = Hash.new) click to toggle source
Calls superclass method
# File lib/syskit/gui/logging_configuration_item.rb, line 18
def initialize(logging_configuration, options = Hash.new)
    super(logging_configuration)
    @options = options    
    setText 'Logging Configuration'

    @conf_logs_item_name, @conf_logs_item_value = add_conf_item('Enable conf logs', 
                                            :conf_logs_enabled)
    @port_logs_item_name, @port_logs_item_value = add_conf_item('Enable port logs', 
                                            :port_logs_enabled)

    @groups_item_name = LoggingGroupsItem.new(@current_model.groups, 'Enable group')
    @groups_item_value = Vizkit::VizkitItem.new("#{@current_model.groups.size} logging group(s)")
    appendRow([@groups_item_name, @groups_item_value])
end

Public Instance Methods

accept_changes() click to toggle source

Notify child to also accept user changes, updates internal copy of the logging configuration, and calls a block that should the data to the remote side

Calls superclass method
# File lib/syskit/gui/logging_configuration_item.rb, line 48
def accept_changes
    super
    @groups_item_name.accept_changes
    @current_model.groups = @groups_item_name.current_model
    @commit_block.call current_model
end
on_accept_changes(&block) click to toggle source

Sets the block to be called when the user accepts the changes made to the model

# File lib/syskit/gui/logging_configuration_item.rb, line 66
def on_accept_changes(&block)
    @commit_block = block
end
update_conf(new_model) click to toggle source

Updates the model with a new logging configuration

# File lib/syskit/gui/logging_configuration_item.rb, line 56
def update_conf(new_model)
    @current_model = deep_copy(new_model)
    @editing_model = deep_copy(new_model)
    @groups_item_name.update_groups(@current_model.groups)
    @groups_item_value.setText "#{@current_model.groups.size} logging group(s)"
    model.layoutChanged
end
write() click to toggle source

Called when the user commit changes made to the model

# File lib/syskit/gui/logging_configuration_item.rb, line 34
def write
    if column == 1
        i = index.sibling(row, 0)
        return if !i.isValid

        item = i.model.itemFromIndex i
        item.accept_changes
    end
    modified!(false)        
end