本文整理汇总了Python中terminator.Terminator.create_group方法的典型用法代码示例。如果您正苦于以下问题:Python Terminator.create_group方法的具体用法?Python Terminator.create_group怎么用?Python Terminator.create_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类terminator.Terminator
的用法示例。
在下文中一共展示了Terminator.create_group方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Window
# 需要导入模块: from terminator import Terminator [as 别名]
# 或者: from terminator.Terminator import create_group [as 别名]
#.........这里部分代码省略.........
child = self.get_child()
if not maker.isinstance(child, 'Notebook'):
dbg('child is not a notebook, nothing to change to')
return
if num == -1:
# Go to the next tab
cur = child.get_current_page()
pages = child.get_n_pages()
if cur == pages - 1:
num = 0
else:
num = cur + 1
elif num == -2:
# Go to the previous tab
cur = child.get_current_page()
if cur > 0:
num = cur - 1
else:
num = child.get_n_pages() - 1
child.set_current_page(num)
# Work around strange bug in gtk-2.12.11 and pygtk-2.12.1
# Without it, the selection changes, but the displayed page doesn't
# change
child.set_current_page(child.get_current_page())
# FIXME: All of these (un)group_(all|tab) methods need refactoring work
def group_all(self, widget):
"""Group all terminals"""
# FIXME: Why isn't this being done by Terminator() ?
group = _('All')
self.terminator.create_group(group)
for terminal in self.terminator.terminals:
terminal.set_group(None, group)
def ungroup_all(self, widget):
"""Ungroup all terminals"""
for terminal in self.terminator.terminals:
terminal.set_group(None, None)
def group_tab(self, widget):
"""Group all terminals in the current tab"""
maker = Factory()
notebook = self.get_child()
if not maker.isinstance(notebook, 'Notebook'):
dbg('not in a notebook, refusing to group tab')
return
pagenum = notebook.get_current_page()
while True:
group = _('Tab %d') % pagenum
if group not in self.terminator.groups:
break
pagenum += 1
for terminal in self.get_visible_terminals():
terminal.set_group(None, group)
def ungroup_tab(self, widget):
"""Ungroup all terminals in the current tab"""
maker = Factory()
notebook = self.get_child()
if not maker.isinstance(notebook, 'Notebook'):