Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion api/library/python/iterm2/iterm2/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,27 @@ class Session:
Represents an iTerm2 session.
"""

class Delegate:
class Delegate(abc.ABC):
"""
Provides callbacks for Session.
"""
@abc.abstractmethod
def session_delegate_get_tab(
self, session) -> typing.Optional['iterm2.Tab']:
"""Returns the tab for a session."""
...

@abc.abstractmethod
def session_delegate_get_window(
self, session) -> typing.Optional['iterm2.Window']:
"""Returns the window for a session."""
...

@abc.abstractmethod
async def session_delegate_create_session(
self, session_id: str) -> typing.Optional['iterm2.session.Session']:
"""Creates a new Session object given a session ID."""
...

delegate: typing.Optional[Delegate] = None

Expand Down
4 changes: 3 additions & 1 deletion api/library/python/iterm2/iterm2/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ class Tab:
Don't create this yourself. Instead, use :class:`~iterm2.App`."""

# pylint: disable=too-few-public-methods
class Delegate:
class Delegate(abc.ABC):
"""Delegate for Tab."""
@abc.abstractmethod
def tab_delegate_get_window(
self, tab: 'Tab') -> typing.Optional['iterm2.window.Window']:
"""Returns the Window for a Tab."""
...

@abc.abstractmethod
async def tab_delegate_get_window_by_id(
self,
window_id: str) -> typing.Optional['iterm2.window.Window']:
"""Returns the Window with the given ID."""
...
# pylint: enable=too-few-public-methods

delegate: typing.Optional[Delegate] = None
Expand Down
9 changes: 7 additions & 2 deletions api/library/python/iterm2/iterm2/tmux.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@
import iterm2.window


@abc.abstractmethod
class Delegate:
class Delegate(abc.ABC):
"""Delegate interface for tmux."""
@abc.abstractmethod
async def tmux_delegate_async_get_window_for_tab_id(
self, tab_id: str) -> typing.Optional[iterm2.window.Window]:
"""Refreshes and gets the window for the specified tab."""
...

@abc.abstractmethod
def tmux_delegate_get_session_by_id(
self, session_id: str) -> typing.Optional[iterm2.session.Session]:
"""Returns the session with the given ID."""
...

@abc.abstractmethod
def tmux_delegate_get_connection(self) -> iterm2.connection.Connection:
"""Returns the connection."""
...


DELEGATE: typing.Optional[Delegate] = None
Expand Down
5 changes: 4 additions & 1 deletion api/library/python/iterm2/iterm2/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,28 @@ class Window:
:meth:`async_create`.
"""

class Delegate:
class Delegate(abc.ABC):
"""Delegate for Window"""
@abc.abstractmethod
async def window_delegate_get_window_with_session_id(
self,
session_id: str) -> typing.Optional['Window']:
"""Gets the Window that contains a Session by ID."""
...

@abc.abstractmethod
async def window_delegate_get_tab_by_id(
self,
tab_id: str) -> typing.Optional[iterm2.tab.Tab]:
"""Gets a Tab by ID."""
...

@abc.abstractmethod
async def window_delegate_get_tab_with_session_id(
self,
session_id: str) -> typing.Optional[iterm2.tab.Tab]:
"""Returns the Tab containing a Session by ID."""
...

delegate: typing.Optional[Delegate] = None

Expand Down