class Vizkit::Timer

Attributes

timer[R]

Public Class Methods

new(sec,single_shot=false,&block) click to toggle source
# File lib/vizkit/timer.rb, line 14
def initialize(sec,single_shot=false,&block)
    @timer = Qt::Timer.new
    @timer.setSingleShot(single_shot)
    @timer.connect(SIGNAL('timeout()'),&block)
    start(sec)
    Timer.timer << self
end
stop_all() click to toggle source
# File lib/vizkit/timer.rb, line 8
def self.stop_all
    @timer.each do |t|
        t.stop
    end
end

Public Instance Methods

start(sec) click to toggle source
# File lib/vizkit/timer.rb, line 22
def start(sec)
    @timer.start((sec*1000).to_i)
end
stop() click to toggle source
# File lib/vizkit/timer.rb, line 26
def stop
    @timer.stop
end