@@ -45,7 +45,8 @@ async def initialise(self):
4545 pass
4646
4747 async def attribute_initialise (self ) -> None :
48- # Initialise any registered handlers for attributes
48+ """Register update and send callbacks for attributes on this controller
49+ and all subcontrollers"""
4950 self ._add_io_callbacks ()
5051
5152 for controller in self .get_sub_controllers ().values ():
@@ -56,7 +57,6 @@ def _add_io_callbacks(self):
5657 ref = attr .io_ref if attr .has_io_ref () else None
5758 io = self ._attribute_ref_io_map .get (type (ref ))
5859 if isinstance (attr , AttrW ):
59- # is it on process or write_display?
6060 attr .add_process_callback (self ._create_send_callback (io , attr , ref ))
6161 if isinstance (attr , AttrR ):
6262 attr .add_update_callback (self ._create_update_callback (io , attr , ref ))
@@ -72,15 +72,14 @@ async def send_callback(value):
7272
7373 async def send_callback (value ):
7474 await io .send (attr , value )
75- # TODO, should we just then call the above send_callback here?
7675
7776 return send_callback
7877
7978 def _create_update_callback (self , io , attr , ref ):
8079 if ref is None :
8180
8281 async def error_callback ():
83- raise RuntimeError ("Attributes without io_ref can not be updated " )
82+ raise RuntimeError ("Can't call update on Attributes without an io_ref " )
8483
8584 return error_callback
8685 else :
0 commit comments