Package advene :: Package model :: Package cam :: Module list
[hide private]
[frames] | no frames]

Source Code for Module advene.model.cam.list

 1  from advene.model.cam.consts import CAMSYS_TYPE 
 2  from advene.model.cam.element import CamElementMixin 
 3  from advene.model.cam.group import CamGroupMixin 
 4  import advene.model.cam.util.bookkeeping as bk 
 5  from advene.model.core.list import List as CoreList 
6 7 -class List(CoreList, CamGroupMixin, CamElementMixin) :
8 9 @classmethod
10 - def instantiate(cls, owner, id, *args):
11 r = super(List, cls).instantiate(owner, id, *args) 12 r._transtype() 13 r._self_connect("modified-items", bk.update_element) 14 return r
15
16 - def __iter__(self):
17 # necessary to override CamGroupMixin __iter__ 18 return CoreList.__iter__(self)
19
20 - def _set_camsys_type(self, value, val_is_idref=False):
21 super(List, self)._set_camsys_type(value, val_is_idref) 22 self._transtype(value)
23
24 - def _transtype(self, systype=None):
25 """ 26 Transtypes this List to Schema if its systype is 'schema'. 27 28 If systype is omitted, it is retrieved from the metadata. 29 """ 30 if systype is None: 31 systype = self.get_meta(CAMSYS_TYPE, None) 32 if systype == "schema": 33 newtype = Schema 34 else: 35 newtype = List 36 if self.__class__ is not newtype: 37 self.__class__ = newtype
38 39 List.make_metadata_property(CAMSYS_TYPE, "system_type", default=None)
40 41 -class Schema(List):
42 """ 43 The class of annotation types. 44 """ 45 # This class is automatically transtyped from List (and back) when 46 # CAMSYS_TYPE is modified. See List.set_meta 47 pass
48