Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# tmux < 1.7. This is added in 1.7.
if pane.stderr:
raise exc.LibTmuxException(pane.stderr)
if 'pane too small' in pane.stderr:
pass
raise exc.LibTmuxException(pane.stderr, self._info, self.panes)
else:
pane = pane.stdout[0]
pane = dict(zip(pformats, pane.split('\t')))
# clear up empty dict
pane = dict((k, v) for k, v in pane.items() if v)
return Pane(window=self, **pane)
# tmux < 1.7. This is added in 1.7.
if pane.stderr:
raise exc.LibTmuxException(pane.stderr)
if 'pane too small' in pane.stderr:
pass
raise exc.LibTmuxException(pane.stderr, self._TMUX, self.panes)
else:
pane = pane.stdout[0]
pane = dict(zip(pformats, pane.split('\t')))
# clear up empty dict
pane = dict((k, v) for k, v in pane.items() if v)
return Pane(window=self, **pane)
def list_panes(self):
"""Return list of :class:`Pane` for the window.
:rtype: list of :class:`Pane`
"""
return [Pane(window=self, **pane) for pane in self._panes]
def attached_pane(self):
"""Return the attached :class:`Pane`.
:rtype: :class:`Pane`
"""
for pane in self._panes:
if 'pane_active' in pane:
# for now pane_active is a unicode
if pane.get('pane_active') == '1':
# return Pane(window=self, **pane)
return Pane(window=self, **pane)
else:
continue
return []
def list_panes(self):
"""
Return list of :class:`Pane` for the window.
Returns
-------
list of :class:`Pane`
"""
return [Pane(window=self, **pane) for pane in self._panes]
else:
def get_pane_start_directory():
if 'start_directory' in pconf:
return pconf['start_directory']
elif 'start_directory' in wconf:
return wconf['start_directory']
else:
return None
p = w.split_window(
attach=True, start_directory=get_pane_start_directory(), target=p.id
)
assert isinstance(p, Pane)
if 'layout' in wconf:
w.select_layout(wconf['layout'])
if 'suppress_history' in pconf:
suppress = pconf['suppress_history']
elif 'suppress_history' in wconf:
suppress = wconf['suppress_history']
else:
suppress = True
for cmd in pconf['shell_command']:
p.send_keys(cmd, suppress_history=suppress)
if 'focus' in pconf and pconf['focus']:
w.select_pane(p['pane_id'])
def attached_pane(self):
"""
Return the attached :class:`Pane`.
Returns
-------
:class:`Pane`
"""
for pane in self._panes:
if 'pane_active' in pane:
# for now pane_active is a unicode
if pane.get('pane_active') == '1':
return Pane(window=self, **pane)
else:
continue
return []