2023-10-23 13:44:07 +03:00
|
|
|
from turtle import Turtle
|
|
|
|
from typing import Optional, Collection, Any
|
|
|
|
from controls.device import SynchronyDevice
|
|
|
|
from controls.device import TraitDescriptor
|
|
|
|
from controls.device import ActionDescriptor
|
|
|
|
|
|
|
|
|
|
|
|
class TurtleDevice(SynchronyDevice):
|
|
|
|
def open(self):
|
|
|
|
super().open()
|
|
|
|
|
|
|
|
def close(self):
|
|
|
|
self.turtle.clear()
|
|
|
|
super().close()
|
|
|
|
|
|
|
|
def trait_descriptors(self) -> Collection[TraitDescriptor]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
def action_descriptors(self) -> Collection[ActionDescriptor]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
def __getitem__(self, trait_name: str) -> Optional[Any]:
|
|
|
|
"""Return logical state of trait `trait_name`."""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def read(self, trait_name: str) -> Any:
|
2023-10-24 10:11:30 +03:00
|
|
|
pass
|
2023-10-23 13:44:07 +03:00
|
|
|
|
|
|
|
def write(self, trait_name: str, value: Any) -> bool:
|
|
|
|
self.turtle.write()
|
|
|
|
|
2023-10-24 10:11:30 +03:00
|
|
|
def execute(self, action_name: str, *args, **kwargs):
|
|
|
|
"""Execute action `action_name`, using `args` and `kwargs` as action argument."""
|
|
|
|
pass
|
|
|
|
|
2023-10-23 13:44:07 +03:00
|
|
|
def invalidate(self, trait_name: str):
|
2023-10-24 10:11:30 +03:00
|
|
|
pass
|