From 939b433841580b718da9f11c0b1a071d556ca1f9 Mon Sep 17 00:00:00 2001 From: Igor Dunaev Date: Thu, 16 Nov 2023 18:57:59 +0300 Subject: [PATCH] Change class names to less misleading --- noblocking_turtle_shell.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/noblocking_turtle_shell.py b/noblocking_turtle_shell.py index c1f5b1b..b6473ba 100644 --- a/noblocking_turtle_shell.py +++ b/noblocking_turtle_shell.py @@ -14,7 +14,7 @@ def select(fr: Collection[ActionDescriptor], where: tuple[str, Any]) -> Optional return None if len(results) == 0 else results[0] -class TurtleDeviceThread(): +class TurtleDeviceController(): def __init__(self): super().__init__() self._device = TurtleDevice() @@ -52,24 +52,24 @@ class NoBlockingTurtleShell(cmd.Cmd): prompt = '(turtle) ' file = None - def __init__(self, turtle_thread: TurtleDeviceThread): + def __init__(self, turtle_thread: TurtleDeviceController): super(NoBlockingTurtleShell, self).__init__() - self._turtle_thread = turtle_thread + self._turtle_controller = turtle_thread def do_execute(self, arg: str): 'Execute a turtle command: EXECUTE COMMAND ARG1 ARG2 ...' - self._turtle_thread.send(arg.split(' ')) + self._turtle_controller.send(arg.split(' ')) def do_exit(self, arg): 'close the turtle window, and exit: EXIT' print('Waiting for the turtle to finish jobs...') - self._turtle_thread.send(['stop']) + self._turtle_controller.send(['stop']) return True if __name__ == '__main__': - turtle_thread = TurtleDeviceThread() - shell = NoBlockingTurtleShell(turtle_thread) + turtle_controller = TurtleDeviceController() + shell = NoBlockingTurtleShell(turtle_controller) cmd_thread = threading.Thread(target=shell.cmdloop) cmd_thread.start() - turtle_thread.run() \ No newline at end of file + turtle_controller.run()