Пример #1
0
 def Run(self):        
     while(self.running):
         command = raw_input("> ")
         if(command.startswith("llamar")):
             try:
                 numero = command.split(" ")[1]
                 duracion = command.split(" ")[2]
                 self.crearLlamada(numero,duracion)                
             except:
                 print "Uso: \"> llamar numero duracion(en segundos)\""
         elif(command.startswith("mensaje")):
             try:
                 numero = numero = command.split(" ")[1]
                 mensaje = command.split(" ")[2]
                 for n in range(3, len(command.split(" "))):
                     mensaje += " " + command.split(" ")[n]
                 self.crearMensaje(numero,mensaje)
             except:
                 print "Uso: \"> mensaje numero mensaje_a_enviar\"" 
         elif(command == "exit"):
             self.instruction.value = "exit"
             self.running = False
         elif(command.startswith("archivo")):
             #try:
             filename = command.split(" ")[1]
             self.cargarArchivo(filename)
             #except:
              #   print "Uso: \"> archivo nombreArchivo\""
         elif(command == "top"):
             self.instruction.value = "top"            
         elif(command.startswith("ver")):
             try:
                 cmd = command.split(' ')[1]
                 if(cmd == "llamadas"):
                     fm.showCalls()
                 elif(cmd == "mensajes"):
                     fm.showMessages()
                 elif(cmd == "contactos"):
                     contacts = fm.showContacts()
                     self.callContact(contacts)
             except:
                 print "Uso: \"> ver <opcion>\" (llamadas, mensajes o contactos)"
         elif(command.startswith("contacto")):
             try:
                 info = command.split(" ")[1]
                 for n in range(2, len(command.split(" "))):
                     info += " " + command.split(" ")[n]
                 nombre = info.split(';')[0]
                 numero = info.split(';')[1]
                 fm.almacenarContacto(nombre,numero)                
             except:
                 print "Uso: \"> contacto <nombre>;<numero>\""
Пример #2
0
 def guardar_en_memoria(self):
     fileManager.almacenarContacto(self.nombreContacto, self.numeroContacto)