source: trigger/PythonShell.py@ 228

Last change on this file since 228 was 115, checked in by daqct3, 15 years ago
New Functions
  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/usr/bin/python
2import readline
3import threading
4import time
5import GlobalVariables
6
7class InputShell(threading.Thread):
8
9 def __init__(self):
10 threading.Thread.__init__(self)
11
12
13 def run (self):
14 outputShell= OutputShell()
15 OutputShell.start(outputShell)
16
17 while(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"):
18 dummy=raw_input("SHELL>>> ")
19 if(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"):
20 GlobalVariables.counter +=1
21 GlobalVariables.counter%=10
22 GlobalVariables.UserInput = str(GlobalVariables.counter)+dummy
23
24 else:
25 break
26 time.sleep(0.7)
27
28
29 print "EXITING INPUTSHELL... press <enter> to exit"
30
31
32class OutputShell(threading.Thread):
33 lastvar=''
34 def run (self):
35 while(GlobalVariables.UserInput!="exit" and GlobalVariables.UserInput != "EXIT"):
36 time.sleep(0.001)
37 if(GlobalVariables.ServerMessage!=self.lastvar):
38 #print "\n(SHELL) You entered:",GlobalVariables.ServerMessage
39 #sys.stdout.write( "SHELL2 >>>")
40 if GlobalVariables.ServerMessage[0]!="[":
41 print GlobalVariables.ServerMessage
42 self.lastvar=GlobalVariables.ServerMessage
43
44 print "EXITING OUTPUTSHELL...press <enter> to exit "
45 #sys.exit(0)
Note: See TracBrowser for help on using the repository browser.