Module: Roby::EventGeneratorDisplay

Included in:
Roby::EventGenerator::DRoby, TaskEventGenerator::DRoby
Defined in:
lib/roby/log/relations.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prioritiesObject



55
56
57
# File 'lib/roby/log/relations.rb', line 55

def self.priorities
    @@priorities ||= Hash.new
end

.style(object, flags) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/roby/log/relations.rb', line 19

def self.style(object, flags)
    # This is for backward compatibility only. All events are now marshalled
    # with their controllability.
    if !object.controlable.nil?
	flags |= (object.controlable ? Log::EVENT_CONTROLABLE : Log::EVENT_CONTINGENT)
    elsif (flags & Log::EVENT_CALLED) != 0
	flags |= Log::EVENT_CONTROLABLE
    end

    if !styles.has_key?(flags)
	raise ArgumentError, "event flags #{flags} have not style"
    end

    styles[flags]
end

.stylesObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/roby/log/relations.rb', line 35

def self.styles
    if defined? @@event_styles
	return @@event_styles
    end

    @@event_styles = Hash.new
    @@event_styles[Log::EVENT_CONTROLABLE | Log::EVENT_CALLED] =
	[Qt::Brush.new(Qt::Color.new(Log::PENDING_EVENT_COLOR)),
	    Qt::Pen.new(Qt::Color.new(Log::PENDING_EVENT_COLOR))]
    @@event_styles[Log::EVENT_CONTROLABLE | Log::EVENT_EMITTED] =
	[Qt::Brush.new(Qt::Color.new(Log::FIRED_EVENT_COLOR)),
	    Qt::Pen.new(Qt::Color.new(Log::FIRED_EVENT_COLOR))]
    @@event_styles[Log::EVENT_CONTROLABLE | Log::EVENT_CALLED_AND_EMITTED] =
	[Qt::Brush.new(Qt::Color.new(Log::FIRED_EVENT_COLOR)),
	    Qt::Pen.new(Qt::Color.new(Log::PENDING_EVENT_COLOR))]
    @@event_styles[Log::EVENT_CONTINGENT | Log::EVENT_EMITTED] =
	[Qt::Brush.new(Qt::Color.new('white')), Qt::Pen.new(Qt::Color.new(Log::FIRED_EVENT_COLOR))]
    @@event_styles
end

Instance Method Details

#display_create(display) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/roby/log/relations.rb', line 59

def display_create(display)
    scene = display.scene
    circle = scene.add_ellipse(-Log::EVENT_CIRCLE_RADIUS, -Log::EVENT_CIRCLE_RADIUS, Log::EVENT_CIRCLE_RADIUS * 2, Log::EVENT_CIRCLE_RADIUS * 2)
    text   = scene.add_text(display_name(display))
    circle.singleton_class.class_eval { attr_accessor :text }
    circle.z_value = Log::EVENT_LAYER

    text.parent_item = circle
    text_width   = text.bounding_rect.width
    text.set_pos(-text_width / 2, 0)
    circle.text = text
    circle
end

#display_time_end(circle, pos) ⇒ Object



74
# File 'lib/roby/log/relations.rb', line 74

def display_time_end(circle, pos); end

#display_time_start(circle, pos) ⇒ Object



73
# File 'lib/roby/log/relations.rb', line 73

def display_time_start(circle, pos); circle.translate(pos) end