module Orocos::QtOutputPort

Public Instance Methods

connect_to(widget=nil, options = Hash.new,&block) click to toggle source
# File lib/vizkit/qt_orocos.rb, line 26
def connect_to(widget=nil, options = Hash.new,&block)
    widget,options = if widget.is_a?(Hash)
                         [nil,widget]
                     else
                         [widget,options]
                     end

    # connection is to another orocos port or code block in the case of an Orocos Log Port
    if widget.respond_to?(:to_orocos_port) || widget.respond_to?(:find_port) || (!widget && self.is_a?(Orocos::Log::OutputPort))
        return org_connect_to widget,options,&block
    end

    Vizkit.warn "deprecation: use Async API to connect the port #{full_name} to a widget or code block"
    # create a PortProxy and connect to it
    task = begin
               Orocos::Async.get(self.task.name)
           rescue Orocos::NotFound => e
               Vizkit.warn "failed to automatically use the Async API"
               raise e
           end
    port = Orocos::Async.proxy(self.task.name,:use => task).port(self.name,:wait => true)
    port.connect_to(widget,options,&block)
    self
end