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



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

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

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



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

def page
  @page
end

Instance Method Details

#clearObject



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

def clear; end

#disableObject



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

def disable; end

#enableObject



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

def enable; end

#render(task_model, options = {}) ⇒ Object



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

def render(task_model, options = {})
    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