Change blocking

This commit is contained in:
zefirova.am 2023-12-14 01:07:05 +03:00
parent ecf00c92bc
commit 444f35b71f

View File

@ -1,5 +1,6 @@
import cmd
import threading
from threading import Thread
from queue import Empty, Queue
@ -21,7 +22,7 @@ class TurtleDeviceThread(threading.Thread):
else:
if (item == 'exit'):
break
self.device.execute(item[0], item[1:])
self.device.execute(*item)
self.queue.task_done()
@ -31,7 +32,9 @@ class NoBlockingTurtleShell(cmd.Cmd):
file = None
def __init__(self, turtle_thread: TurtleDeviceThread):
super(NoBlockingTurtleShell, self).__init__()
self.turtle_thread = TurtleDeviceThread()
def do_execute(self, arg):
self.turtle_thread.queue.put(arg)