class AngleEditor

Public Class Methods

new(parent=nil) click to toggle source
Calls superclass method
# File lib/vizkit/widgets/base_types_editor/angle_editor.rb, line 5
def initialize(parent=nil)
    super
    setWindowTitle("AngleEditor")
    @layout = Qt::GridLayout.new
    self.setLayout @layout
    @callback_angle = nil;
    @angle = nil

    @label = Qt::Label.new
    @label.setText("Angle[Deg]")
    @layout.addWidget(@label,0,0)

    @spin_box = Qt::DoubleSpinBox.new
    @spin_box.setMaximum(180.0)
    @spin_box.setMinimum(-180.0)
    @spin_box.setSingleStep(1.0)
    @layout.addWidget(@spin_box,0,1)

    @button_cancel = Qt::PushButton.new(@widget)
    @button_cancel.setText("Cancel")
    @layout.addWidget(@button_cancel,1,0)
    @button_cancel.connect(SIGNAL("clicked()")) do 
        close()
    end

    @button = Qt::PushButton.new(@widget)
    @button.setText("Ok")
    @layout.addWidget(@button,1,1)
    @button.connect(SIGNAL("clicked()")) do 
        if(@callback_angle)
            Orocos.load_typekit_for("/base/Angle",false)
            angle = @angle ? @angle : Types.base.Angle.new
            angle.rad = @spin_box.value()*Math::PI/180
            @callback_angle.call(angle)
        else
            puts "No callback function to forward the angle"
        end
    end
end

Public Instance Methods

angle(angle=nil,options=nil,&block) click to toggle source
# File lib/vizkit/widgets/base_types_editor/angle_editor.rb, line 54
def angle(angle=nil,options=nil,&block)
    @angle = angle
    @callback_angle = block
end
default_options() click to toggle source
# File lib/vizkit/widgets/base_types_editor/angle_editor.rb, line 45
def default_options
    options = Hash.new
end
options(hash = Hash.new) click to toggle source
# File lib/vizkit/widgets/base_types_editor/angle_editor.rb, line 49
def options(hash = Hash.new)
    @options ||= default_options
    @options.merge!(hash)
end