本文整理汇总了Python中tmuxp.workspacebuilder.WorkspaceBuilder.iter_create_windows方法的典型用法代码示例。如果您正苦于以下问题:Python WorkspaceBuilder.iter_create_windows方法的具体用法?Python WorkspaceBuilder.iter_create_windows怎么用?Python WorkspaceBuilder.iter_create_windows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tmuxp.workspacebuilder.WorkspaceBuilder
的用法示例。
在下文中一共展示了WorkspaceBuilder.iter_create_windows方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_window_options
# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_windows [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'])
示例2: test_pane_order
# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_windows [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
示例3: test_automatic_rename_option
# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_windows [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')
示例4: test_window_index
# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_windows [as 别名]
def test_window_index(session):
yaml_config = loadfixture("workspacebuilder/window_index.yaml")
proc = session.cmd('show-option', '-gv', 'base-index')
base_index = int(proc.stdout[0])
name_index_map = {'zero': 0 + base_index, 'one': 1 + base_index, 'five': 5}
sconfig = kaptan.Kaptan(handler='yaml')
sconfig = sconfig.import_config(yaml_config).get()
sconfig = config.expand(sconfig)
sconfig = config.trickle(sconfig)
builder = WorkspaceBuilder(sconf=sconfig)
for window, _ in builder.iter_create_windows(session):
expected_index = name_index_map[window['window_name']]
assert int(window['window_index']) == expected_index
示例5: test_split_windows
# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_windows [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
示例6: test_window_shell
# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_windows [as 别名]
def test_window_shell(session):
yaml_config = loadfixture("workspacebuilder/window_shell.yaml")
s = session
sconfig = kaptan.Kaptan(handler='yaml')
sconfig = sconfig.import_config(yaml_config).get()
sconfig = config.expand(sconfig)
builder = WorkspaceBuilder(sconf=sconfig)
for w, wconf in builder.iter_create_windows(s):
if 'window_shell' in wconf:
assert wconf['window_shell'] == text_type('top')
while retry():
session.server._update_windows()
if w['window_name'] != 'top':
break
assert w.name != text_type('top')
示例7: test_split_windows_three_pane
# 需要导入模块: from tmuxp.workspacebuilder import WorkspaceBuilder [as 别名]
# 或者: from tmuxp.workspacebuilder.WorkspaceBuilder import iter_create_windows [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'])