box.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 
6 
7 """ Contains a class that holds box informations
8 .. module:: node
9 """
10 
11 import converter.node as node
12 import converter.xar_types as xar_types
13 
14 
15 class Box(node.Node):
16  """ Stores informations about box in the xar format
17  """
18 
19  def __init__(self, attrs):
20  super(Box, self).__init__("Box")
21 
22  self.child = None
23  self.parent = None
24 
25  # Attributes
26  self.name = attrs.getValue("name")
27  self.robot = attrs.getValue("robot")
28  self.id = attrs.getValue("id")
29  self.localization = attrs.getValue("localization")
30  self.tooltip = attrs.getValue("tooltip")
31  self.bitmap_expanded = attrs.getValue("bitmap_expanded")
32  self.plugin = attrs.getValue("plugin")
33  self.x_pos = attrs.getValue("x")
34  self.y_pos = attrs.getValue("y")
35 
36  # Elements
37  self.bitmaps = []
38  self.script = None
39  self.inputs = []
40  self.outputs = []
41  self.parameters = []
42  self.resources = []
43  self.plugin_content = None
44  self.timeline = None
45 
46  # Function map to speed up process
47  self._function_map = {'bitmap': Box.attach_bitmap,
48  'script': Box.attach_script,
49  'Input': Box.attach_input,
50  'Output': Box.attach_output,
51  'Parameter': Box.attach_parameter,
52  'Resource': Box.attach_resource,
53  'pluginContent': Box.attach_plugin_content,
54  'Timeline': Box.attach_timeline}
55 
56  def attach_timeline(self, timeline):
57  self.timeline = timeline
58 
59  def attach_bitmap(self, bitmap):
60  self.bitmaps.append(bitmap)
61 
62  def attach_script(self, script):
63  self.script = script
64 
65  def attach_input(self, attrs):
66  ioType = attrs.getValue('type')
67  ioSize = attrs.getValue('type_size')
68 
69  signature = xar_types.resolve_io_signature(ioType, ioSize)
70  input = xar_types.IO(attrs.getValue('name'),
71  signature,
72  attrs.getValue('nature'),
73  attrs.getValue('stm_value_name'),
74  attrs.getValue('inner'),
75  attrs.getValue('tooltip'),
76  attrs.getValue('id'))
77  self.inputs.append(input)
78 
79  def attach_output(self, attrs):
80  ioType = attrs.getValue('type')
81  ioSize = attrs.getValue('type_size')
82 
83  signature = xar_types.resolve_io_signature(ioType, ioSize)
84  output = xar_types.IO(attrs.getValue('name'),
85  signature,
86  attrs.getValue('nature'),
87  attrs.getValue('stm_value_name'),
88  attrs.getValue('inner'),
89  attrs.getValue('tooltip'),
90  attrs.getValue('id'))
91  self.outputs.append(output)
92 
93  def attach_parameter(self, parameter):
94  self.parameters.append(parameter)
95 
96  def attach_resource(self, attrs):
97  resource = xar_types.resource(attrs.getValue('name'),
98  attrs.getValue('type'),
99  attrs.getValue('timeout'))
100  self.resources.append(resource)
101 
102  def attach_plugin_content(self, plugin_content):
103  self.plugin_content = plugin_content
converter.node.box.Box.attach_input
def attach_input(self, attrs)
Definition: box.py:65
converter.node.Node.id
id
Definition: xarconverter/converter/node/__init__.py:17
converter.xar_types.resource
Definition: xar_types.py:46
converter.node.box.Box.resources
resources
Definition: box.py:42
converter.node.box.Box.attach_plugin_content
def attach_plugin_content(self, plugin_content)
Definition: box.py:102
converter.node.box.Box.bitmap_expanded
bitmap_expanded
Definition: box.py:31
converter.node
Definition: xarconverter/converter/node/__init__.py:1
converter.xar_types.IO
Definition: xar_types.py:26
converter.node.box.Box.parameters
parameters
Definition: box.py:41
converter.node.box.Box.attach_script
def attach_script(self, script)
Definition: box.py:62
converter.node.box.Box
Definition: box.py:15
converter.node.box.Box.timeline
timeline
Definition: box.py:44
converter.node.box.Box.attach_resource
def attach_resource(self, attrs)
Definition: box.py:96
converter.xar_types
Definition: xar_types.py:1
converter.node.box.Box.inputs
inputs
Definition: box.py:39
converter.node.box.Box.attach_parameter
def attach_parameter(self, parameter)
Definition: box.py:93
converter.node.box.Box.outputs
outputs
Definition: box.py:40
converter.node.box.Box.script
script
Definition: box.py:38
converter.node.box.Box.tooltip
tooltip
Definition: box.py:30
converter.node.Node._function_map
_function_map
Definition: xarconverter/converter/node/__init__.py:25
converter.node.box.Box.y_pos
y_pos
Definition: box.py:34
converter.node.box.Box.robot
robot
Definition: box.py:27
converter.node.box.Box.attach_output
def attach_output(self, attrs)
Definition: box.py:79
converter.node.box.Box.bitmaps
bitmaps
Definition: box.py:37
converter.node.box.Box.child
child
Definition: box.py:22
converter.node.box.Box.parent
parent
Definition: box.py:23
converter.node.box.Box.localization
localization
Definition: box.py:29
converter.node.box.Box.attach_timeline
def attach_timeline(self, timeline)
Definition: box.py:56
converter.node.box.Box.__init__
def __init__(self, attrs)
Definition: box.py:19
converter.node.box.Box.plugin_content
plugin_content
Definition: box.py:43
converter.node.box.Box.attach_bitmap
def attach_bitmap(self, bitmap)
Definition: box.py:59
converter.node.Node.name
name
Definition: xarconverter/converter/node/__init__.py:18
converter.node.box.Box.plugin
plugin
Definition: box.py:32
converter.node.box.Box.x_pos
x_pos
Definition: box.py:33
converter.node.Node
Definition: xarconverter/converter/node/__init__.py:12


naoqi_libqicore
Author(s): Aldebaran
autogenerated on Wed Sep 14 2022 02:22:41