Пример #1
0
    def new_tab(self, command='', cwd='', args=[]):
        hbox = Gtk.HBox(False, 3)
        self.tools = Gtk.VBox(False)
        self.tools2 = Gtk.VBox(False)

        # FIXME!!!!! Terminals are broken!!
        return
        # FIXME: Even when vte is not present, this is still called (and causes an error).
        term = Vte.Terminal()

        term.set_font(Pango.FontDescription('mono 8'))
        term.set_pty(Vte.Pty())
        term.connect("child-exited", self.on_terminal_child_exit)
        if command:
            self.pid = term.pty.spawn_async(command=command,
                                            argv=args,
                                            working_directory=cwd)
        else:
            self.pid = term.pty.spawn_async(working_directory=cwd)
        self.pids.append(self.pid)
        term.set_scrollback_lines(1000)
        term.set_scroll_on_output = True
        term.set_size_request(200, 200)
        term.show_all()
        self._create_term_buttons(term)
        hbox.pack_start(self.tools, False, False, 0)
        hbox.pack_start(term, True, True, 0)
        hbox.pack_start(self.tools2, False, False, 0)

        self.append_page(hbox)

        label = self.create_tab_label(command, hbox)
        label.show_all()

        image = Gtk.Image()
        self.set_tab_label_packing(image, True, True, Gtk.PACK_START)
        self.set_tab_label(hbox, label)
        term.show_all()
        if self.get_current_page() == -1:
            GObject.timeout_add(500, self._update_cwd)