def new_page(self, directory=None): terminal = GuakeTerminal(self.guake) terminal.grab_focus() if not isinstance(directory, str): directory = os.environ['HOME'] try: if self.guake.settings.general.get_boolean('open-tab-cwd'): active_terminal = self.get_focused_terminal() directory = os.path.expanduser('~') if active_terminal: directory = active_terminal.get_current_directory() except Exception as e: pass terminal.spawn_sync_pid(directory) terminal_box = TerminalBox() terminal_box.set_terminal(terminal) root_terminal_box = RootTerminalBox(self.guake) root_terminal_box.set_child(terminal_box) page_num = self.append_page(root_terminal_box, None) self.set_tab_reorderable(root_terminal_box, True) self.show_all() # needed to show newly added tabs and pages # this is needed to initially set the last_terminal_focused, # one could also call terminal.get_parent().on_terminal_focus() terminal.emit("focus", Gtk.DirectionType.TAB_FORWARD) self.emit('terminal-spawned', terminal, terminal.pid) return root_terminal_box, page_num, terminal
def new_page(self, directory=None): terminal = self.terminal_spawn(directory) terminal_box = TerminalBox() terminal_box.set_terminal(terminal) root_terminal_box = RootTerminalBox(self.guake, self) root_terminal_box.set_child(terminal_box) page_num = self.append_page(root_terminal_box, None) self.set_tab_reorderable(root_terminal_box, True) self.show_all() # needed to show newly added tabs and pages # this is needed to initially set the last_terminal_focused, # one could also call terminal.get_parent().on_terminal_focus() self.terminal_attached(terminal) return root_terminal_box, page_num, terminal
def new_page(self): terminal = self.guake.setup_new_terminal() terminal_box = TerminalBox() terminal_box.set_terminal(terminal) root_terminal_box = RootTerminalBox(self.guake) root_terminal_box.set_child(terminal_box) page_num = self.append_page(root_terminal_box, None) self.set_tab_reorderable(root_terminal_box, True) self.show_all() # needed to show newly added tabs and pages # this is needed to initially set the last_terminal_focused, # one could also call terminal.get_parent().on_terminal_focus() terminal.emit("focus", Gtk.DirectionType.TAB_FORWARD) return root_terminal_box, page_num
def new_page(self, directory=None, position=None): terminal = self.terminal_spawn(directory) terminal_box = TerminalBox() terminal_box.set_terminal(terminal) root_terminal_box = RootTerminalBox(self.guake, self) root_terminal_box.set_child(terminal_box) page_num = self.insert_page(root_terminal_box, None, position if position is not None else -1) self.set_tab_reorderable(root_terminal_box, True) self.show_all() # needed to show newly added tabs and pages # this is needed because self.window.show_all() results in showing every # thing which includes the scrollbar too self.guake.settings.general.triggerOnChangedValue( self.guake.settings.general, "use-scrollbar") # this is needed to initially set the last_terminal_focused, # one could also call terminal.get_parent().on_terminal_focus() self.terminal_attached(terminal) return root_terminal_box, page_num, terminal