class Vizkit::TaskContextItem

Attributes

task[R]

Public Class Methods

new(task,options = Hash.new) click to toggle source
Calls superclass method Vizkit::VizkitItem.new
# File lib/vizkit/vizkit_items.rb, line 923
def initialize(task,options = Hash.new)
    super()
    @options = Kernel.validate_options options,:item_type => :label,:basename => false

    @task = task
    if @options[:item_type] == :label
        if @options[:basename]
            setText task.basename
        else
            setText task.name
        end
        @task_model = TaskModelItem.new(task)
        @task_model2 = TaskModelItem.new(task, :item_type => :value)
        @input_ports = InputPortsItem.new(task)
        @input_ports2 = InputPortsItem.new(task,:item_type => :value)
        @output_ports = OutputPortsItem.new(task)
        @output_ports2 = OutputPortsItem.new(task,:item_type => :value)
        @properties = PropertiesItem.new(task)
        @properties2 = PropertiesItem.new(task,:item_type => :value)
        @properties2.setEditable true

        appendRow [@task_model, @task_model2]
        appendRow [@input_ports,@input_ports2]
        appendRow [@output_ports,@output_ports2]
        appendRow [@properties,@properties2]

        task.on_unreachable do
            enabled false
        end
        task.on_reachable do
            enabled true
        end
    else #just display the statues of the task
        task.on_state_change do |state|
            setText state.to_s
        end
        task.on_unreachable do
            setText "UNREACHABLE"
            enabled false
        end
        task.on_reachable do
            setText "INITIALIZING"
            enabled true
        end
    end
end

Public Instance Methods

context_menu(pos,parent_widget,items = []) click to toggle source
# File lib/vizkit/vizkit_items.rb, line 970
def context_menu(pos,parent_widget,items = [])
    if task.respond_to? :current_state
        ContextMenu.task(task,parent_widget,pos)
        true
    end
end