def __init__(self, name, qapp, gui_parent, model_controller, plugin_controller, close_callback=None): ModelObject.__init__(self) self._id = self.get_id() self.name = name # a reference used to add new hosts self._model_controller = model_controller # create the widget self.widget = ShellWidget(qapp,gui_parent,name) self.widget.setupLayout() # For safesty we don't use the user shell, we force it to bash progname = "/bin/bash" # create the session #Session(gui, pgm, args, term, sessionid='session-1', cwd=None): #self.process_controller = ProcessController() self.session = Session(self.widget, progname, [], "xterm", name); self.session.setConnect(True) self.session.setHistory(HistoryTypeBuffer(1000)) self._setUpSessionSinalHandlers() #self.__last_user_input = None #self.__user_input_signal = False # flag that determines if output has to be ignored self.__ignore_process_output = False self.__ignore_process_output_once = False self.__first_process_output = True self.__save_output_prompt_format = False # determines if input is for an interactive command or not self.__interactive = False #TODO: check if we need to connect to this signal self.session.myconnect('done', self.close) # instance a new plugin controller self.plugin_controller = plugin_controller(self.id) self._initial_prompt = "" #self._custom_prompt_format = re.compile("\\x1B\[1;32m\[.+@.+\s.+\]>(\$|#)\s+\\x1B\[m") #self._custom_prompt_format = re.compile("\[.+@.+\s.+\]>(\$|#)\s+") self._custom_prompt_format = re.compile("\[(?P<user>.+)@(?P<host>.+):(?P<path>.+)\]>(\$|#)") #TODO: somewhere in the config there should be a list of regexes used to match # prompts. Be careful with this because if regexes are too generic they will # match more that is needed. self._generic_prompt_formats = [] #XXX: adding this format just as a test! This should be in the config somehow # Also this may be is too generic to use... self._generic_prompt_formats.append(re.compile("^.+@.+:.+(\$|#)$")) #This is a reference to MainApplication.deleteShellEnvironment self._close_callback = close_callback # flag that determines if shell environment is running self.__running = False #Autocomplete self._options=[] #only keys self._tname="" # last tool executed self._lcount=0 self._optionsh={} #keys + help self.__command = ''