source: trigger/PythonShell.py@ 77

Last change on this file since 77 was 77, checked in by rissim, 15 years ago
trigger: gui added, interface modified
  • Property svn:executable set to *
File size: 1.4 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 print GlobalVariables.ServerMessage
41 self.lastvar=GlobalVariables.ServerMessage
42
43 print "EXITING OUTPUTSHELL...press <enter> to exit "
44 #sys.exit(0)
Note: See TracBrowser for help on using the repository browser.