Change blocking
This commit is contained in:
parent
ecf00c92bc
commit
444f35b71f
@ -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,8 +32,10 @@ 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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user