Class: Roby::GUI::ModelViews::Task

Inherits:
Qt::Object
  • Object
show all
Defined in:
lib/roby/gui/model_views/task.rb

Overview

Handler class to display information about a task model

Constant Summary collapse

TEMPLATE_PATH =
File.expand_path('task.rhtml', File.dirname(__FILE__))
TEMPLATE =
ERB.new(File.read(TEMPLATE_PATH))

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ Task

Returns a new instance of Task.



10
11
12
13
# File 'lib/roby/gui/model_views/task.rb', line 10

def initialize(page)
    @page = page
    super()
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



8
9
10
# File 'lib/roby/gui/model_views/task.rb', line 8

def page
  @page
end

Instance Method Details

#clearObject



18
19
# File 'lib/roby/gui/model_views/task.rb', line 18

def clear
end

#disableObject



16
17
# File 'lib/roby/gui/model_views/task.rb', line 16

def disable
end

#enableObject



14
15
# File 'lib/roby/gui/model_views/task.rb', line 14

def enable
end

#render(task_model, options = Hash.new) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/roby/gui/model_views/task.rb', line 25

def render(task_model, options = Hash.new)
    html = TEMPLATE.result(binding)
    svg  = RelationsCanvasTask.to_svg(task_model.new(plan: DRoby::RebuiltPlan.new))

    options, push_options = Kernel.filter_options options,
        external_objects: false, doc: true
    if external_objects = options[:external_objects]
        file = external_objects % 'roby_task' + ".svg"
        File.open(file, 'w') { |io| io.write(svg) }
        svg = "<object data=\"#{file}\" type=\"image/svg+xml\"></object>"
    end

    if options[:doc] && task_model.doc
        page.push nil, page.main_doc(task_model.doc)
    end
    page.push('Roby Task Model', TEMPLATE.result(binding), push_options)
end