added tags to boxes. For now only one tag: MOBILE
[nepi.git] / src / nepi / core / design.py
index 50e00c1..c942d10 100644 (file)
@@ -184,6 +184,8 @@ class Box(AttributesMap):
         self._container = container
         # traces -- list of available traces for the box
         self._traces = dict()
+        # tags -- list of tags for the box
+        self._tags = list()
         # connectors -- list of available connectors for the box
         self._connectors = dict()
         # factory_attributes -- factory attributes for box construction
@@ -197,6 +199,8 @@ class Box(AttributesMap):
         for trace in factory.traces:
             tr = Trace(trace.trace_id, trace.help, trace.enabled)
             self._traces[trace.trace_id] = tr
+        for tag_id in factory.tags:
+            self._tags.append(tag_id)
         for attr in factory.box_attributes.attributes:
             self.add_attribute(attr.name, attr.help, attr.type, attr.value, 
                     attr.range, attr.allowed, attr.flags, 
@@ -240,6 +244,10 @@ class Box(AttributesMap):
     def factory_attributes(self):
         return self._factory_attributes
 
+    @property
+    def tags(self):
+        return self._tags
+
     @property
     def addresses(self):
         return []
@@ -374,6 +382,7 @@ class Factory(AttributesMap):
         self._category = category
         self._connector_types = list()
         self._traces = list()
+        self._tags = list()
         self._box_attributes = AttributesMap()
         
         if not self._has_addresses and not self._has_routes:
@@ -441,6 +450,10 @@ class Factory(AttributesMap):
     def traces(self):
         return self._traces
 
+    @property
+    def tags(self):
+        return self._tags
+    
     @property
     def box_attributes(self):
         return self._box_attributes
@@ -452,6 +465,9 @@ class Factory(AttributesMap):
         trace = Trace(trace_id, help, enabled)
         self._traces.append(trace)
 
+    def add_tag(self, tag_id):
+        self._tags.append(tag_id)
+
     def add_box_attribute(self, name, help, type, value = None, range = None,
         allowed = None, flags = Attribute.NoFlags, validation_function = None,
         category = None):