[docs]classNotificationHandle(NotificationProps):"""Handle for a notification in our visualizer."""def__init__(self,impl:_NotificationHandleState)->None:self._impl=impl# Support property-style read/write. Similar to `_OverridableScenePropApi`.ifnotTYPE_CHECKING:def__setattr__(self,name:str,value:Any)->None:ifnameinNotificationProps.__annotations__:setattr(self._impl.props,name,value)self._sync_with_client("update")else:returnobject.__setattr__(self,name,value)def__getattr__(self,name:str)->Any:ifnameinNotificationProps.__annotations__:returngetattr(self._impl.props,name)else:raiseAttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")def_sync_with_client(self,mode:Literal["show","update"])->None:msg=NotificationMessage(mode,self._impl.uuid,self._impl.props)self._impl.websock_interface.queue_message(msg)
[docs]defremove(self)->None:self._impl.websock_interface.get_message_buffer().remove_from_buffer(# Don't send outdated GUI updates to new clients.# This is brittle...lambdamessage:getattr(message,"uuid",None)==self._impl.uuid)msg=RemoveNotificationMessage(self._impl.uuid)self._impl.websock_interface.queue_message(msg)