当前位置: 首页>>代码示例>>Python>>正文


Python WorkspaceBuilder.iter_create_panes方法代码示例

本文整理汇总了Python中tmuxp.workspacebuilder.WorkspaceBuilder.iter_create_panes方法的典型用法代码示例。如果您正苦于以下问题:Python WorkspaceBuilder.iter_create_panes方法的具体用法?Python WorkspaceBuilder.iter_create_panes怎么用?Python WorkspaceBuilder.iter_create_panes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tmuxp.workspacebuilder.WorkspaceBuilder的用法示例。


在下文中一共展示了WorkspaceBuilder.iter_create_panes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_window_options

# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_panes [as 别名]
def test_window_options(session):
    yaml_config = loadfixture("workspacebuilder/window_options.yaml")
    s = session
    sconfig = kaptan.Kaptan(handler='yaml')
    sconfig = sconfig.import_config(yaml_config).get()
    sconfig = config.expand(sconfig)

    if has_gte_version('2.3'):
        sconfig['windows'][0]['options']['pane-border-format'] = ' #P '

    builder = WorkspaceBuilder(sconf=sconfig)

    window_count = len(session._windows)  # current window count
    assert len(s._windows) == window_count
    for w, wconf in builder.iter_create_windows(s):
        for p in builder.iter_create_panes(w, wconf):
            w.select_layout('tiled')  # fix glitch with pane size
            p = p
            assert len(s._windows) == window_count
        assert isinstance(w, Window)
        assert w.show_window_option('main-pane-height') == 5
        if has_gte_version('2.3'):
            assert w.show_window_option('pane-border-format') == ' #P '

        assert len(s._windows) == window_count
        window_count += 1
        w.select_layout(wconf['layout'])
开发者ID:digitalsatori,项目名称:tmuxp,代码行数:29,代码来源:test_workspacebuilder.py

示例2: test_pane_order

# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_panes [as 别名]
def test_pane_order(session):
    """Pane ordering based on position in config and ``pane_index``.

    Regression test for https://github.com/tmux-python/tmuxp/issues/15.

    """

    yaml_config = loadfixture("workspacebuilder/pane_ordering.yaml").format(
        HOME=os.path.realpath(os.path.expanduser('~'))
    )

    # test order of `panes` (and pane_index) above aganist pane_dirs
    pane_paths = [
        '/usr/bin',
        '/usr',
        '/usr/sbin',
        os.path.realpath(os.path.expanduser('~')),
    ]

    s = session
    sconfig = kaptan.Kaptan(handler='yaml')
    sconfig = sconfig.import_config(yaml_config).get()
    sconfig = config.expand(sconfig)
    sconfig = config.trickle(sconfig)

    builder = WorkspaceBuilder(sconf=sconfig)

    window_count = len(session._windows)  # current window count
    assert len(s._windows) == window_count
    for w, wconf in builder.iter_create_windows(s):
        for p in builder.iter_create_panes(w, wconf):
            w.select_layout('tiled')  # fix glitch with pane size
            p = p
            assert len(s._windows) == window_count

        assert isinstance(w, Window)

        assert len(s._windows) == window_count
        window_count += 1

    for w in session.windows:
        pane_base_index = w.show_window_option('pane-base-index', g=True)
        for p_index, p in enumerate(w.list_panes(), start=pane_base_index):
            assert int(p_index) == int(p.index)

            # pane-base-index start at base-index, pane_paths always start
            # at 0 since python list.
            pane_path = pane_paths[p_index - pane_base_index]

            while retry():
                p.server._update_panes()
                if p.current_path == pane_path:
                    break

            assert p.current_path, pane_path
开发者ID:digitalsatori,项目名称:tmuxp,代码行数:57,代码来源:test_workspacebuilder.py

示例3: test_automatic_rename_option

# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_panes [as 别名]
def test_automatic_rename_option(session):
    """With option automatic-rename: on."""
    yaml_config = loadfixture("workspacebuilder/window_automatic_rename.yaml")
    s = session
    sconfig = kaptan.Kaptan(handler='yaml')
    sconfig = sconfig.import_config(yaml_config).get()

    builder = WorkspaceBuilder(sconf=sconfig)

    window_count = len(session._windows)  # current window count
    assert len(s._windows) == window_count
    for w, wconf in builder.iter_create_windows(s):

        for p in builder.iter_create_panes(w, wconf):
            w.select_layout('tiled')  # fix glitch with pane size
            p = p
            assert len(s._windows), window_count
        assert isinstance(w, Window)
        assert w.show_window_option('automatic-rename') == 'on'

        assert len(s._windows) == window_count

        window_count += 1
        w.select_layout(wconf['layout'])

    assert s.name != 'tmuxp'
    w = s.windows[0]

    while retry():
        session.server._update_windows()
        if w.name != 'sh':
            break

    assert w.name != 'sh'

    pane_base_index = w.show_window_option('pane-base-index', g=True)
    w.select_pane(pane_base_index)

    while retry():
        session.server._update_windows()
        if w.name == 'sh':
            break

    assert w.name == text_type('sh')

    w.select_pane('-D')

    while retry():
        session.server._update_windows()
        if w['window_name'] != 'sh':
            break

    assert w.name != text_type('sh')
开发者ID:digitalsatori,项目名称:tmuxp,代码行数:55,代码来源:test_workspacebuilder.py

示例4: test_split_windows

# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_panes [as 别名]
def test_split_windows(session):
    yaml_config = loadfixture("workspacebuilder/two_pane.yaml")
    s = session
    sconfig = kaptan.Kaptan(handler='yaml')
    sconfig = sconfig.import_config(yaml_config).get()

    builder = WorkspaceBuilder(sconf=sconfig)

    window_count = len(session._windows)  # current window count
    assert len(s._windows) == window_count
    for w, wconf in builder.iter_create_windows(s):
        for p in builder.iter_create_panes(w, wconf):
            p = p
            assert len(s._windows) == window_count
        assert isinstance(w, Window)

        assert len(s._windows) == window_count
        window_count += 1
开发者ID:fpietka,项目名称:tmuxp,代码行数:20,代码来源:test_workspacebuilder.py

示例5: test_split_windows_three_pane

# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_panes [as 别名]
def test_split_windows_three_pane(session):
    yaml_config = loadfixture("workspacebuilder/three_pane.yaml")

    s = session
    sconfig = kaptan.Kaptan(handler='yaml')
    sconfig = sconfig.import_config(yaml_config).get()

    builder = WorkspaceBuilder(sconf=sconfig)

    window_count = len(s._windows)  # current window count
    assert len(s._windows) == window_count
    for w, wconf in builder.iter_create_windows(s):
        for p in builder.iter_create_panes(w, wconf):
            p = p
            assert len(s._windows) == window_count
        assert isinstance(w, Window)

        assert len(s._windows) == window_count
        window_count += 1
        w.set_window_option('main-pane-height', 50)
        w.select_layout(wconf['layout'])
开发者ID:fpietka,项目名称:tmuxp,代码行数:23,代码来源:test_workspacebuilder.py


注:本文中的tmuxp.workspacebuilder.WorkspaceBuilder.iter_create_panes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。