Skip to content

Commit

Permalink
Fixed telnet functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
jooste committed Aug 9, 2017
1 parent 60d95a0 commit 73b414e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions BlueSky_qtgl.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def MainLoop():
# Initialize the gui (loading graphics data, etc.)
gui.init()

# Connect gui stack command to telnet_in
telnet_in.connect(gui.win.console.stack)

# Start the node manager
manager.start()

Expand Down
3 changes: 1 addition & 2 deletions bluesky/stack/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,6 @@ def saveic(fname):

def process():
"""process and empty command stack"""
global cmdstack

# Process stack of commands
for line in cmdstack:
Expand Down Expand Up @@ -1245,7 +1244,7 @@ def process():
#**********************************************************************

# End of for-loop of cmdstack
cmdstack = []
cmdstack.clear()
return


Expand Down
14 changes: 11 additions & 3 deletions bluesky/tools/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import time
import socket
import threading
from bluesky import settings, stack
from bluesky import settings

if settings.gui == 'qtgl':
try:
Expand Down Expand Up @@ -113,7 +113,7 @@ def receiver(self):
self.processData(data)
time.sleep(0.1)
except Exception as err:
print("Revecier Error: %s" % err)
print("Receiver Error: %s" % err)
time.sleep(1.0)

def processData(self, data):
Expand All @@ -132,8 +132,16 @@ def processData(self, sender_id, data):


class StackTelnetServer(TcpServer):
@staticmethod
def dummy_process(cmd):
pass

def __init__(self):
super(StackTelnetServer, self).__init__()
self.process = StackTelnetServer.dummy_process

def connect(self, fun):
self.process = fun

def processData(self, sender_id, data):
stack.stack(str(data).strip())
self.process(bytearray(data).decode(encoding='ascii', errors='ignore').strip())

0 comments on commit 73b414e

Please sign in to comment.