Class: Syskit::GUI::ComponentNetworkView
- Inherits:
-
ComponentNetworkBaseView
- Object
- Qt::Object
- ComponentNetworkBaseView
- Syskit::GUI::ComponentNetworkView
- Defined in:
- lib/syskit/gui/component_network_view.rb
Overview
Generic component network visualization
It displays the task hierarchy as well as the dataflow network
Direct Known Subclasses
Constant Summary
Constants inherited from ComponentNetworkBaseView
Syskit::GUI::ComponentNetworkBaseView::Button, Syskit::GUI::ComponentNetworkBaseView::DATA_SERVICE_WITHOUT_NAMES_TEMPLATE, Syskit::GUI::ComponentNetworkBaseView::DATA_SERVICE_WITH_NAMES_TEMPLATE
Instance Attribute Summary collapse
-
#dataflow_options ⇒ Object
readonly
Default rendering options for Syskit::GUI::ComponentNetworkBaseView#push_plan for the dataflow graph.
-
#hierarchy_options ⇒ Object
readonly
Default rendering options for Syskit::GUI::ComponentNetworkBaseView#push_plan for the hierarchy graph.
-
#plan ⇒ Roby::Plan
readonly
The plan object that holds the network we render.
-
#task ⇒ Syskit::Component
readonly
The toplevel task for the model we render.
Attributes inherited from ComponentNetworkBaseView
Instance Method Summary collapse
-
#initialize(page) ⇒ ComponentNetworkView
constructor
A new instance of ComponentNetworkView.
- #process_options(kind, model, options) ⇒ Object
-
#render(model, method: :instanciate_model, name: nil, show_requirements: false, instanciate_options: Hash.new, dataflow: Hash.new, hierarchy: Hash.new, **render_options) ⇒ Object
Render a model on this view.
-
#render_plan(hierarchy: Hash.new, dataflow: Hash.new, **options) ⇒ Object
Renders #plan.
-
#view_partial_plans=(flag) ⇒ Object
Whether the plan should be displayed regardless of errors during deployment or not.
-
#view_partial_plans? ⇒ Object
Whether the plan should be displayed regardless of errors during deployment or not.
Methods inherited from ComponentNetworkBaseView
#buttonClicked, #clear, common_graph_buttons, #compute_system_network, #disable, #enable, find_definition_place, graph_annotation_buttons, html_defined_in, #instanciate_model, #list_services, make_annotation_buttons, #push_plan, #render_data_services, #render_require_section, #save_svg, task_annotation_buttons
Constructor Details
#initialize(page) ⇒ ComponentNetworkView
Returns a new instance of ComponentNetworkView
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/syskit/gui/component_network_view.rb', line 34 def initialize(page) super @view_partial_plans = true @plan = Roby::Plan.new @hierarchy_options = Hash[ title: 'Task Dependency Hierarchy', id: 'hierarchy', remove_compositions: false, annotations: ['task_info', 'port_details'].to_set, zoom: 1 ] @dataflow_options = Hash[ title: 'Dataflow', id: 'dataflow', remove_compositions: false, show_all_ports: false, annotations: ['task_info'].to_set, excluded_models: Set.new, zoom: 1 ] = [] << Button.new("dataflow/show_compositions", on_text: 'Show compositions', off_text: 'Hide compositions', state: ![:remove_compositions]) << Button.new("dataflow/show_all_ports", on_text: 'Show all ports', off_text: 'Hide unused ports', state: [:show_all_ports]) if defined? OroGen::Logger::Logger [:excluded_models] << OroGen::Logger::Logger << Button.new("dataflow/show_loggers", on_text: 'Show loggers', off_text: 'Hide loggers', state: false) end .concat(self.class.('dataflow')) .concat(self.class.('dataflow', [:annotations])) .concat(self.class.('dataflow', [:annotations])) [:buttons] = = [] .concat(self.class.('hierarchy')) [:buttons] = end |
Instance Attribute Details
#dataflow_options ⇒ Object (readonly)
Default rendering options for Syskit::GUI::ComponentNetworkBaseView#push_plan for the dataflow graph
18 19 20 |
# File 'lib/syskit/gui/component_network_view.rb', line 18 def @dataflow_options end |
#hierarchy_options ⇒ Object (readonly)
Default rendering options for Syskit::GUI::ComponentNetworkBaseView#push_plan for the hierarchy graph
22 23 24 |
# File 'lib/syskit/gui/component_network_view.rb', line 22 def @hierarchy_options end |
#plan ⇒ Roby::Plan (readonly)
The plan object that holds the network we render
27 28 29 |
# File 'lib/syskit/gui/component_network_view.rb', line 27 def plan @plan end |
#task ⇒ Syskit::Component (readonly)
The toplevel task for the model we render
32 33 34 |
# File 'lib/syskit/gui/component_network_view.rb', line 32 def task @task end |
Instance Method Details
#process_options(kind, model, options) ⇒ Object
157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/syskit/gui/component_network_view.rb', line 157 def (kind, model, ) = Kernel. name = [:name] if [:id] [:id] = [:id] % "#{kind}-#{name}" end if externals = .delete(:external_objects) [:external_objects] = externals % "#{kind}-#{name}" end end |
#render(model, method: :instanciate_model, name: nil, show_requirements: false, instanciate_options: Hash.new, dataflow: Hash.new, hierarchy: Hash.new, **render_options) ⇒ Object
Render a model on this view
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/syskit/gui/component_network_view.rb', line 102 def render(model, method: :instanciate_model, name: nil, show_requirements: false, instanciate_options: Hash.new, dataflow: Hash.new, hierarchy: Hash.new, **) super plan.clear if show_requirements html = ModelViews.render_instance_requirements(page, model.to_instance_requirements, resolve_dependency_injection: true).join("\n") page.push("Resolved Requirements", "<pre>#{html}</pre>") end begin if method == :compute_system_network tic = Time.now @task = compute_system_network(model, plan) timing = Time.now - tic else @task = instanciate_model(model, plan, ) end rescue Exception => e if view_partial_plans? then exception = e else raise end end [:name] ||= model.object_id.to_s if timing page.push("", "<p>Network generated in %.3f</p>" % [timing], id: "timing-#{name}") end = self.. merge(). merge(hierarchy) = ('hierarchy', model, ) = self.. merge(). merge(dataflow) = ('dataflow', model, ) render_plan if exception raise exception end end |
#render_plan(hierarchy: Hash.new, dataflow: Hash.new, **options) ⇒ Object
Renders #plan
This renders the plan's hierarchy and dataflow
Syskit::GUI::ComponentNetworkBaseView#push_plan for both the hierarchy and dataflow graphs
183 184 185 186 187 188 189 190 191 192 |
# File 'lib/syskit/gui/component_network_view.rb', line 183 def render_plan(hierarchy: Hash.new, dataflow: Hash.new, **) all_annotations = Syskit::Graphviz.available_annotations.to_set = .merge(self.).merge(hierarchy) push_plan('hierarchy', plan, ) = Hash[annotations: all_annotations]. merge(self.).merge().merge(dataflow) push_plan('dataflow', plan, ) emit updated end |
#view_partial_plans=(flag) ⇒ Object
Whether the plan should be displayed regardless of errors during deployment or not. It defaults to true.
14 |
# File 'lib/syskit/gui/component_network_view.rb', line 14 attr_predicate :view_partial_plans?, true |
#view_partial_plans? ⇒ Object
Whether the plan should be displayed regardless of errors during deployment or not. It defaults to true.
14 |
# File 'lib/syskit/gui/component_network_view.rb', line 14 attr_predicate :view_partial_plans?, true |