How to use the libtmux.common.TmuxRelationalObject function in libtmux

To help you get started, we’ve selected a few libtmux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tmux-python / libtmux / libtmux / window.py View on Github external
"""
from __future__ import absolute_import, unicode_literals, with_statement

import logging
import os
import shlex

from . import exc, formats
from .common import TmuxMappingObject, TmuxRelationalObject, handle_option_error
from .pane import Pane

logger = logging.getLogger(__name__)


class Window(TmuxMappingObject, TmuxRelationalObject):
    """
    A :term:`tmux(1)` :term:`window` [#]_.

    Holds :class:`Pane` objects.

    Parameters
    ----------
    session : :class:`Session`

    References
    ----------
    .. [#] tmux window. openbsd manpage for TMUX(1).
           "Each session has one or more windows linked to it. A window
           occupies the entire screen and may be split into rectangular
           panes..."
github tmux-python / tmuxp / libtmux / window.py View on Github external
"""
from __future__ import (absolute_import, division, print_function,
                        unicode_literals, with_statement)

import logging
import os

from . import exc, formats
from .pane import Pane
from .common import TmuxMappingObject, TmuxRelationalObject

logger = logging.getLogger(__name__)


class Window(TmuxMappingObject, TmuxRelationalObject):
    """:term:`tmux(1)` window."""

    childIdAttribute = 'pane_id'

    def __init__(self, session=None, **kwargs):

        if not session:
            raise ValueError('Window requires a Session, session=Session')

        self.session = session
        self.server = self.session.server

        if 'window_id' not in kwargs:
            raise ValueError('Window requires a `window_id`')

        self._window_id = kwargs['window_id']
github tmux-python / tmuxp / libtmux / pane.py View on Github external
tmuxp.pane
~~~~~~~~~~

"""
from __future__ import (absolute_import, division, print_function,
                        unicode_literals, with_statement)

import logging

from . import exc
from .common import TmuxMappingObject, TmuxRelationalObject

logger = logging.getLogger(__name__)


class Pane(TmuxMappingObject, TmuxRelationalObject):

    """:term:`tmux(1)` :term:`pane`.

    :param window: :class:`Window`

    :versionchanged: 0.8
        Renamed from ``.tmux`` to ``.cmd``.

    """

    def __init__(self, window=None, **kwargs):
        if not window:
            raise ValueError('Pane must have \
                             ``Window`` object')

        self.window = window
github tmux-python / libtmux / libtmux / pane.py View on Github external
libtmux.pane
~~~~~~~~~~~~

"""
from __future__ import absolute_import, unicode_literals, with_statement

import logging

from . import exc
from .common import TmuxMappingObject, TmuxRelationalObject

logger = logging.getLogger(__name__)


class Pane(TmuxMappingObject, TmuxRelationalObject):
    """
    A :term:`tmux(1)` :term:`pane` [#]_.

    ``Pane`` instances can send commands directly to a pane, or traverse
    between linked tmux objects.

    Parameters
    ----------
    window : :class:`Window`

    Notes
    -----

    .. versionchanged:: 0.8
        Renamed from ``.tmux`` to ``.cmd``.
github tmux-python / libtmux / libtmux / server.py View on Github external
import os

from . import exc, formats
from .common import (
    EnvironmentMixin,
    TmuxRelationalObject,
    has_gte_version,
    session_check_name,
    tmux_cmd,
)
from .session import Session

logger = logging.getLogger(__name__)


class Server(TmuxRelationalObject, EnvironmentMixin):

    """
    The :term:`tmux(1)` :term:`server` [#]_.

    - :attr:`Server._sessions` [:class:`Session`, ...]

      - :attr:`Session._windows` [:class:`Window`, ...]

        - :attr:`Window._panes` [:class:`Pane`, ...]

          - :class:`Pane`

    When instantiated stores information on live, running tmux server.

    Parameters
    ----------
github tmux-python / libtmux / libtmux / session.py View on Github external
from . import exc, formats
from ._compat import text_type
from .common import (
    EnvironmentMixin,
    TmuxMappingObject,
    TmuxRelationalObject,
    handle_option_error,
    has_version,
    session_check_name,
)
from .window import Window

logger = logging.getLogger(__name__)


class Session(TmuxMappingObject, TmuxRelationalObject, EnvironmentMixin):
    """
    A :term:`tmux(1)` :term:`session` [#]_.

    Holds :class:`Window` objects.

    Parameters
    ----------
    server : :class:`Server`

    References
    ----------
    .. [#] tmux session. openbsd manpage for TMUX(1).
           "When tmux is started it creates a new session with a single window
           and displays it on screen..."

           "A session is a single collection of pseudo terminals under the