import arm
import readline
import settings

class command :
    def __init__(self, cmd):
        s = cmd.split();
        self.cmdName = s[0]
        self.cmdArg = []
        argList = s[1:]
        for arg in argList :
            pair = arg.split('=')
            self.cmdArg += [[pair[0],int(pair[1])]]

class userTerminal :
    def __init__(self,settingPath=None,debug=False):
        motorSettings = settings.motorSettings(settingPath)
        self.motorControl = arm.MotorControl(motorSettings.get())       

    def start(self):
        isRunning = True
        while isRunning :
            try:
                cmd = command(raw_input('$ '))
                print cmd.cmdName 
                print cmd.cmdArg
 
                if cmd.cmdName == "q":
                    isRunning = False   
                elif cmd.cmdName == "setById":
                    self.motorControl.setAllMotors(cmd.cmdArg)  
                elif cmd.cmdName == "setByName":
                    self.motorControl.setAllMotorsByName(cmd.cmdArg)    

            except:
                 # And EOF may have been sent, we exit cleanly
                print("")
                isRunning = False
                
ui = userTerminal()
ui.start()

@@ -53,18 +53,16 @@
 mmand :%0A
-  
   def __
@@ -80,20 +80,16 @@
 , cmd):%0A
-    
     s = 
@@ -101,28 +101,24 @@
 plit();%0A    
-  
-  
 self.cmdName
@@ -125,20 +125,16 @@
  = s%5B0%5D%0A
-    
     self
@@ -150,20 +150,16 @@
  %5B%5D%0A    
- 
-   
 argList 
@@ -166,20 +166,16 @@
 = s%5B1:%5D%0A
-    
     for 
@@ -197,22 +197,16 @@
 :%0A      
- 
-     
 pair = a
@@ -221,30 +221,24 @@
 ('=')%0A      
-  
-    
 self.cmdArg 
@@ -287,18 +287,16 @@
 minal :%0A
-  
   def __
@@ -342,20 +342,16 @@
 e):%0A    
-  
-  
 motorSet
@@ -394,20 +394,16 @@
 ngPath)%0A
-    
     self
@@ -466,18 +466,16 @@
     %0A%0A  
- 
- 
 def star
@@ -483,28 +483,24 @@
 (self):%0A    
-   
- 
 isRunning = 
@@ -508,20 +508,16 @@
 rue%0A    
-   
- 
 while is
@@ -526,22 +526,16 @@
 nning :%0A
-      
       tr
@@ -537,24 +537,16 @@
    try:%0A
-        
         
@@ -580,32 +580,24 @@
 '))%0A        
-       
- 
 print cmd.cm
@@ -607,32 +607,24 @@
 me %0A        
-       
- 
 print cmd.cm
@@ -638,24 +638,16 @@
         
-      
-  
 if cmd.c
@@ -667,34 +667,24 @@
 :%0A          
-      
-    
 isRunning = 
@@ -696,32 +696,24 @@
    %0A        
-   
-     
 elif cmd.cmd
@@ -729,28 +729,42 @@
 setById%22
-:%0A          
+ or cmd.cmdName == %22sbi%22:%0A
         
@@ -810,24 +810,16 @@
 dArg)  %0A
-        
         
@@ -849,28 +849,42 @@
 tByName%22
-:%0A          
+ or cmd.cmdName == %22sbn%22:%0A
         
@@ -949,22 +949,16 @@
     
- 
-     
 except:%0A
     
@@ -953,25 +953,16 @@
 except:%0A
-         
         
@@ -1007,24 +1007,16 @@
 cleanly%0A
-        
         
@@ -1025,24 +1025,16 @@
 int(%22%22)%0A
-        
         
@@ -1063,21 +1063,46 @@
         
-    %0A
+%0Aif __name__ == %22__main__%22:%0A  
 ui = use
@@ -1113,16 +1113,18 @@
 minal()%0A
+  
 ui.start

Update uiTerminal