當前位置: 首頁>>代碼示例>>Python>>正文


Python Terminator.create_group方法代碼示例

本文整理匯總了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'):
開發者ID:adiabuk,項目名稱:arch-tf701t,代碼行數:70,代碼來源:window.py


注:本文中的terminator.Terminator.create_group方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。