def __init__(self, parent, notebook, options): Terminal.__init__(self, parent, notebook, options) self._file_list_button.set_tooltip_text(_('Open current directory')) # variable to store process id self._pid = None # make sure we open in a good path self.path = self._options.get('path', user.home) self._close_on_child_exit = self._options.get('close_with_child', True) self._terminal_type = self._parent.options.section('terminal').get( 'type') shell_command = self._options.get('shell_command', os.environ['SHELL']) if self._terminal_type == TerminalType.VTE: # we need TERM environment variable set if not 'TERM' in os.environ: os.environ['TERM'] = 'xterm-color' os.environ['COLORTERM'] = 'gnome-terminal' if self._vte_present: # fork default shell self._terminal.connect('child-exited', self.__child_exited) self._terminal.connect('status-line-changed', self._update_terminal_status) self._terminal.connect('realize', self.__terminal_realized) elif self._terminal_type == TerminalType.EXTERNAL: # connect signals self._terminal.connect('realize', self.__socket_realized) self._terminal.connect('plug-removed', self.__child_exited) # disable controls self._menu_button.set_sensitive(False) # change titles self._change_tab_text(_('Terminal')) self._title_bar.set_title(_('Terminal')) self._title_bar.set_subtitle(shell_command) self.show_all()
def _close_tab(self, widget=None, data=None): """Provide additional functionality""" if self._notebook.get_n_pages() == 1: DefaultList = self._parent.plugin_classes['file_list'] options = Parameters() options.set('path', self.path) self._parent.create_tab(self._notebook, DefaultList, options) return Terminal._close_tab(self, widget, data)
def __init__(self, parent, notebook, options): Terminal.__init__(self, parent, notebook, options) self._file_list_button.set_tooltip_text(_('Open current directory')) # variable to store process id self._pid = None # make sure we open in a good path self.path = self._options.get('path', user.home) self._close_on_child_exit = self._options.get('close_with_child', True) self._terminal_type = self._parent.options.section('terminal').get('type') shell_command = self._options.get('shell_command', os.environ['SHELL']) if self._terminal_type == TerminalType.VTE: # we need TERM environment variable set if not 'TERM' in os.environ: os.environ['TERM'] = 'xterm-color' os.environ['COLORTERM'] = 'gnome-terminal' if self._vte_present: # fork default shell self._terminal.connect('child-exited', self.__child_exited) self._terminal.connect('status-line-changed', self._update_terminal_status) self._terminal.connect('realize', self.__terminal_realized) elif self._terminal_type == TerminalType.EXTERNAL: # connect signals self._terminal.connect('realize', self.__socket_realized) self._terminal.connect('plug-removed', self.__child_exited) # disable controls self._menu_button.set_sensitive(False) # change titles self._change_tab_text(_('Terminal')) self._title_bar.set_title(_('Terminal')) self._title_bar.set_subtitle(shell_command) self.show_all()
def _handle_tab_close(self): """Clean up before closing tab""" Terminal._handle_tab_close(self) self.__update_path_from_pid()