Ejemplo n.º 1
0
    async def async_create_tmux_tab(self, tmux_connection: iterm2.tmux.TmuxConnection) -> typing.Optional[iterm2.tab.Tab]:
        """Creates a new tmux tab in this window.

        This may not be called from within a :class:`~iterm2.transaction.Transaction`.

        :param tmux_connection: The tmux connection to own the new tab.

        :returns: A newly created tab, or `None` if it could not be created.

        :throws: `~iterm2.app.CreateTabException` if something went wrong.

        .. seealso:: Example ":ref:`tmux_example`"
        """
        tmux_window_id = "{}".format(-(self.__number + 1))
        response = await iterm2.rpc.async_rpc_create_tmux_window(
            self.connection,
            tmux_connection.connection_id,
            tmux_window_id)
        if response.tmux_response.status != iterm2.api_pb2.TmuxResponse.Status.Value("OK"):
            raise CreateTabException(
                iterm2.api_pb2.TmuxResponse.Status.Name(response.tmux_response.status))
        tab_id = response.tmux_response.create_window.tab_id
        app = await iterm2.app.async_get_app(self.connection)
        assert(app)
        return app.get_tab_by_id(tab_id)
Ejemplo n.º 2
0
    async def async_create_tmux_tab(self, tmux_connection: iterm2.tmux.TmuxConnection) -> typing.Optional[iterm2.tab.Tab]:
        """Creates a new tmux tab in this window.

        This may not be called from within a :class:`~iterm2.transaction.Transaction`.

        :param tmux_connection: The tmux connection to own the new tab.

        :returns: A newly created tab, or `None` if it could not be created.

        :throws: `~iterm2.app.CreateTabException` if something went wrong.

        .. seealso:: Example ":ref:`tmux_example`"
        """
        tmux_window_id = "{}".format(-(self.__number + 1))
        response = await iterm2.rpc.async_rpc_create_tmux_window(
            self.connection,
            tmux_connection.connection_id,
            tmux_window_id)
        if response.tmux_response.status != iterm2.api_pb2.TmuxResponse.Status.Value("OK"):
            raise CreateTabException(
                iterm2.api_pb2.TmuxResponse.Status.Name(response.tmux_response.status))
        tab_id = response.tmux_response.create_window.tab_id
        app = await iterm2.app.async_get_app(self.connection)
        assert(app)
        return app.get_tab_by_id(tab_id)
Ejemplo n.º 3
0
    async def async_create_tmux_tab(self, tmux_connection):
        """Creates a new tmux tab in this window.

        :param tmux_connection: A :class:`TmuxConnection` that owns the new tab.

        :returns: :class:`Tab`"""
        tmux_window_id = "{}".format(-(self.__number + 1))
        response = await iterm2.rpc.async_rpc_create_tmux_window(
            self.connection, tmux_connection.connection_id, tmux_window_id)
        if response.tmux_response.status != iterm2.api_pb2.TmuxResponse.Status.Value(
                "OK"):
            raise CreateTabException(
                iterm2.api_pb2.TmuxResponse.Status.Name(
                    response.tmux_response.status))
        tab_id = response.tmux_response.create_window.tab_id
        app = await iterm2.app.async_get_app(self.connection)
        return app.get_tab_by_id(tab_id)
Ejemplo n.º 4
0
Archivo: window.py Proyecto: knu/iTerm2
    async def async_create_tmux_tab(self, tmux_connection):
        """Creates a new tmux tab in this window.

        :param tmux_connection: A :class:`TmuxConnection` that owns the new tab.

        :returns: :class:`Tab`"""
        tmux_window_id = "{}".format(-(self.__number + 1))
        response = await iterm2.rpc.async_rpc_create_tmux_window(
            self.connection,
            tmux_connection.connection_id,
            tmux_window_id)
        if response.tmux_response.status != iterm2.api_pb2.TmuxResponse.Status.Value("OK"):
            raise CreateTabException(
                iterm2.api_pb2.TmuxResponse.Status.Name(response.tmux_response.status))
        tab_id = response.tmux_response.create_window.tab_id
        app = await iterm2.app.async_get_app(self.connection)
        return app.get_tab_by_id(tab_id)