parameters: (self)
docstring: this method is called when the Ctrl+Space is pressed
docstring_summary: this method is called when the Ctrl+Space is pressed
docstring_tokens: this method is called when the Ctrl + Space is pressed
function: def processCtrlSpace(self):
          """
          this method is called when the Ctrl+Space is pressed
          """
          if not self.__interactive:
              # get the complete user input from screen image (this is done so we don't
              # have to worry about handling any key)
              user_input = self.session.em.getLastOutputFromScreenImage(get_spaces=True)
              # parse input to get the prompt and command in separated parts
              
              prompt, username, current_path, command_string, command_len = self.__parseUserInput(user_input,get_spaces=True)
              api.devlog("processCtrlSpace info("+user_input+")("+command_string+")")
              api.devlog("-"*60)
              api.devlog("CTRL + SPACE \nprompt = %r\ncommand = %r" % (prompt, command_string))
              api.devlog("self.__interactive = %s" % self.__interactive )
              api.devlog("-"*60)
              
              
              words=command_string.split(" ")
              #words2=command_string.split(" ")
              cword=words[len(words)-1] #obtengo la ultima palabra
              #words.remove(cword) #elimino la ultima palabra
              options=[]
              search=0
              mindex=0
              
              try: # si encuentra la palabra significa que se encuentra en una interaccion
                  mindex = self._options.index(cword)
                  #api.devlog("El tname es:" + self._tname)
                  # Si no es la misma herramienta o cambio la cantidad de palabra significa que tengo que empezar de nuevo
                  if (self._tname != words[1] and self._tname != "") or (self._lcount != len(words)): 
                      mindex = -1
              except ValueError:
                  mindex = -1
  
              if mindex == -1: # si no la encuentra inicia de nuevo.
                  self._options=[]
                  self._optionsh={}
                  search=1
              else:
                  options=self._options                    
              
              #Guardo la cantidad palabras para comparar despues
              self._lcount = len(words)
              
              #save first command
              if len(words) >2:
                  self._tname = words[1] #guardo el nombre de la tool
              else:
                  self._tname = ""
  
              
              if search ==1 and cword !="":
                  #Busqueda de Hosts (ignore si el comando que escribi es blanco)
                  for h in self._model_controller._hosts.itervalues():
                      if re.search(str("^"+cword),h.name,flags=re.IGNORECASE):
                          if len(options) == 0:
                              options.append(cword)
                          api.devlog("Host name found: " + h.name + " id ("+h.id+")");
                          options.append(h.name)
                      #Busqueda de Hostname dentro de las interfaces
                      for i in h.getAllInterfaces():
                          for hostname in i.getHostnames():                            
                              if re.search(str("^"+cword),hostname,flags=re.IGNORECASE):
                                  if len(options) == 0:
                                      options.append(cword)
                                  api.devlog("Hostname found: " + hostname + " id ("+i.id+")");
                                  options.append(hostname)
  
                  self._options = options
              
              new_options={}
              api.devlog("Cantidad de _options" + str(len(self._options)))
              
              #Si no se encontro nada, busco opciones en el plugin
              if len(self._options) == 0:
                  #try:
                  if 1==1:
                      #Llamo al controller para ver si hay algun plugin que pueda dar opciones
                      #Devuelve un dict del estilo 'option' : 'help de la option'
                      new_options = self.plugin_controller.getPluginAutocompleteOptions(prompt, username,
                                                                           current_path,
                                                                           command_string,
                                                                           self.__interactive)
                      
                      
                      if new_options != None: 
                          if len(new_options) >= 1: #Si encontro plugin que maneje y  trae opciones hago iteracciones.
                              api.devlog("Options de plugin encontradas: ("+str(len(new_options))+") valores ("+str(new_options)+")")
                              options = [cword]+new_options.keys() #Guardo las opciones (agrego la word inicial)
                              self._options = options 
                              self._optionsh = new_options
                                  
                              api.devlog("getPluginAutocompleteOptions: %r" % user_input)
                              api.devlog("new_options:" + str(options))
                  if 1==2:
                  #except Exception:
                      api.devlog("Exception: Plugin")
                      # if anything in the plugins fails and raises an exception we continue wihout doing anything
                      new_cmd = None                
              
              # Recorro las opciones disponibles
              #TODO: Reemplazar esto por una ventana desplegable o 
              i=0
              newword=""
              if len(options) > 1: # Reemplazar solo si hay opciones
                  for w in options:
                      #api.devlog("Por la palabra ("+ w +") (" + str(i)+") la palabra(" + cword+")")
                      if cword==w:
                          if len(options) > i+1:
                              newword=options[i+1]
                              #api.devlog("La encontre next ("+ newword +") (" + str(i)+")"+ str(options) )
                          else:
                              newword=options[0]
                              #api.devlog("La encontre last ("+ newword +") (" + str(i)+")"+ str(options) )
                              #newword="-h"
                      i+=1
                      
                  if self._optionsh.has_key(newword):
                      #TODO: reemplazar esto por un help distinto no usar el devlog
                      api.showPopup( newword + " :" + self._optionsh[newword])
                      #api.devlog("pluginhelp: " + newword + " :" + self._optionsh[newword])
                  
                  #Hago el cambio en la shell
                  self.session.sh.sendBytes("\b" * len(cword) +  newword)
function_tokens: def processCtrlSpace ( self ) : if not self . __interactive : # get the complete user input from screen image (this is done so we don't # have to worry about handling any key) user_input = self . session . em . getLastOutputFromScreenImage ( get_spaces = True ) # parse input to get the prompt and command in separated parts prompt , username , current_path , command_string , command_len = self . __parseUserInput ( user_input , get_spaces = True ) api . devlog ( "processCtrlSpace info(" + user_input + ")(" + command_string + ")" ) api . devlog ( "-" * 60 ) api . devlog ( "CTRL + SPACE \nprompt = %r\ncommand = %r" % ( prompt , command_string ) ) api . devlog ( "self.__interactive = %s" % self . __interactive ) api . devlog ( "-" * 60 ) words = command_string . split ( " " ) #words2=command_string.split(" ") cword = words [ len ( words ) - 1 ] #obtengo la ultima palabra #words.remove(cword) #elimino la ultima palabra options = [ ] search = 0 mindex = 0 try : # si encuentra la palabra significa que se encuentra en una interaccion mindex = self . _options . index ( cword ) #api.devlog("El tname es:" + self._tname) # Si no es la misma herramienta o cambio la cantidad de palabra significa que tengo que empezar de nuevo if ( self . _tname != words [ 1 ] and self . _tname != "" ) or ( self . _lcount != len ( words ) ) : mindex = - 1 except ValueError : mindex = - 1 if mindex == - 1 : # si no la encuentra inicia de nuevo. self . _options = [ ] self . _optionsh = { } search = 1 else : options = self . _options #Guardo la cantidad palabras para comparar despues self . _lcount = len ( words ) #save first command if len ( words ) > 2 : self . _tname = words [ 1 ] #guardo el nombre de la tool else : self . _tname = "" if search == 1 and cword != "" : #Busqueda de Hosts (ignore si el comando que escribi es blanco) for h in self . _model_controller . _hosts . itervalues ( ) : if re . search ( str ( "^" + cword ) , h . name , flags = re . IGNORECASE ) : if len ( options ) == 0 : options . append ( cword ) api . devlog ( "Host name found: " + h . name + " id (" + h . id + ")" ) options . append ( h . name ) #Busqueda de Hostname dentro de las interfaces for i in h . getAllInterfaces ( ) : for hostname in i . getHostnames ( ) : if re . search ( str ( "^" + cword ) , hostname , flags = re . IGNORECASE ) : if len ( options ) == 0 : options . append ( cword ) api . devlog ( "Hostname found: " + hostname + " id (" + i . id + ")" ) options . append ( hostname ) self . _options = options new_options = { } api . devlog ( "Cantidad de _options" + str ( len ( self . _options ) ) ) #Si no se encontro nada, busco opciones en el plugin if len ( self . _options ) == 0 : #try: if 1 == 1 : #Llamo al controller para ver si hay algun plugin que pueda dar opciones #Devuelve un dict del estilo 'option' : 'help de la option' new_options = self . plugin_controller . getPluginAutocompleteOptions ( prompt , username , current_path , command_string , self . __interactive ) if new_options != None : if len ( new_options ) >= 1 : #Si encontro plugin que maneje y  trae opciones hago iteracciones. api . devlog ( "Options de plugin encontradas: (" + str ( len ( new_options ) ) + ") valores (" + str ( new_options ) + ")" ) options = [ cword ] + new_options . keys ( ) #Guardo las opciones (agrego la word inicial) self . _options = options self . _optionsh = new_options api . devlog ( "getPluginAutocompleteOptions: %r" % user_input ) api . devlog ( "new_options:" + str ( options ) ) if 1 == 2 : #except Exception: api . devlog ( "Exception: Plugin" ) # if anything in the plugins fails and raises an exception we continue wihout doing anything new_cmd = None # Recorro las opciones disponibles #TODO: Reemplazar esto por una ventana desplegable o  i = 0 newword = "" if len ( options ) > 1 : # Reemplazar solo si hay opciones for w in options : #api.devlog("Por la palabra ("+ w +") (" + str(i)+") la palabra(" + cword+")") if cword == w : if len ( options ) > i + 1 : newword = options [ i + 1 ] #api.devlog("La encontre next ("+ newword +") (" + str(i)+")"+ str(options) ) else : newword = options [ 0 ] #api.devlog("La encontre last ("+ newword +") (" + str(i)+")"+ str(options) ) #newword="-h" i += 1 if self . _optionsh . has_key ( newword ) : #TODO: reemplazar esto por un help distinto no usar el devlog api . showPopup ( newword + " :" + self . _optionsh [ newword ] ) #api.devlog("pluginhelp: " + newword + " :" + self._optionsh[newword]) #Hago el cambio en la shell self . session . sh . sendBytes ( "\b" * len ( cword ) + newword )