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


Python ConfigManager.key_event_compare方法代码示例

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


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

示例1: on_keypress

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import key_event_compare [as 别名]
    def on_keypress(self, widget, event):
        if ConfigManager.key_event_compare('quit-key', event):
            Gtk.main_quit()
            return True

        if ConfigManager.key_event_compare('select-all-key', event):
            self.notebook.get_nth_page(self.notebook.get_current_page()).active_terminal.vte.select_all()
            return True

        if ConfigManager.key_event_compare('copy-key', event):
            self.notebook.get_nth_page(self.notebook.get_current_page()).active_terminal.vte.copy_clipboard()
            return True

        if ConfigManager.key_event_compare('paste-key', event):
            self.notebook.get_nth_page(self.notebook.get_current_page()).active_terminal.vte.paste_clipboard()
            return True

        if ConfigManager.key_event_compare('split-v-key', event):
            self.notebook.get_nth_page(self.notebook.get_current_page()).active_terminal.split_axis(None, 'v')
            return True

        if ConfigManager.key_event_compare('split-h-key', event):
            self.notebook.get_nth_page(self.notebook.get_current_page()).active_terminal.split_axis(None, 'h')
            return True

        if ConfigManager.key_event_compare('close-node-key', event):
            self.notebook.get_nth_page(self.notebook.get_current_page()).active_terminal.close_node(None)
            return True

        if ConfigManager.key_event_compare('fullscreen-key', event):
            self.toggle_fullscreen()
            return True

        if ConfigManager.key_event_compare('new-page-key', event):
            self.add_page()
            return True

        if ConfigManager.key_event_compare('rename-page-key', event):
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    self.page_rename(None, button)
                    return True

        if ConfigManager.key_event_compare('close-page-key', event):
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    self.page_close(None, button)
                    return True

        if ConfigManager.key_event_compare('next-page-key', event):
            page_button_list = []
            for button in self.buttonbox:
                if button != self.radio_group_leader:
                    page_button_list.append(button)

            for i in range(len(page_button_list)):
                if (page_button_list[i].get_active() == True):
                    if (i + 1 < len(page_button_list)):
                        page_button_list[i+1].set_active(True)
                    else:
                        page_button_list[0].set_active(True)
                    return True


        if ConfigManager.key_event_compare('prev-page-key', event):
            page_button_list = []
            for button in self.buttonbox:
                if button != self.radio_group_leader:
                    page_button_list.append(button)

            for i in range(len(page_button_list)):
                if page_button_list[i].get_active():
                    if i > 0:
                        page_button_list[i-1].set_active(True)
                    else:
                        page_button_list[-1].set_active(True)
                    return True
开发者ID:Cleitonfs,项目名称:terra-terminal,代码行数:79,代码来源:terminal.py

示例2: on_keypress

# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import key_event_compare [as 别名]
    def on_keypress(self, widget, event):
        if ConfigManager.key_event_compare('toggle-scrollbars-key', event):
            ConfigManager.set_conf('show-scrollbar', not ConfigManager.get_conf('show-scrollbar'))
            ConfigManager.save_config()
            ConfigManager.callback()
            return True

        if ConfigManager.key_event_compare('move-up-key', event):
            self.get_active_terminal().move(direction=1)
            return True

        if ConfigManager.key_event_compare('move-down-key', event):
            self.get_active_terminal().move(direction=2)
            return True

        if ConfigManager.key_event_compare('move-left-key', event):
            self.get_active_terminal().move(direction=3)
            return True

        if ConfigManager.key_event_compare('move-right-key', event):
            self.get_active_terminal().move(direction=4)
            return True

        if ConfigManager.key_event_compare('quit-key', event):
            self.quit()
            return True

        if ConfigManager.key_event_compare('select-all-key', event):
            self.get_active_terminal().select_all()
            return True

        if ConfigManager.key_event_compare('copy-key', event):
            self.get_active_terminal().copy_clipboard()
            return True

        if ConfigManager.key_event_compare('paste-key', event):
            self.get_active_terminal().paste_clipboard()
            return True

        if ConfigManager.key_event_compare('split-v-key', event):
            self.get_active_terminal().split_axis(None, 'h')
            return True

        if ConfigManager.key_event_compare('split-h-key', event):
            self.get_active_terminal().split_axis(None, 'v')
            return True

        if ConfigManager.key_event_compare('close-node-key', event):
            self.get_active_terminal().close_node(None)
            return True

        if ConfigManager.key_event_compare('fullscreen-key', event):
            self.toggle_fullscreen()
            return True

        if ConfigManager.key_event_compare('new-page-key', event):
            self.add_page()
            return True

        if ConfigManager.key_event_compare('rename-page-key', event):
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    self.page_rename(None, button)
                    return True

        if ConfigManager.key_event_compare('close-page-key', event):
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    self.page_close(None, button)
                    return True

        if ConfigManager.key_event_compare('next-page-key', event):
            page_button_list = self.buttonbox.get_children()[1:]

            for i in range(len(page_button_list)):
                if (page_button_list[i].get_active() == True):
                    if (i + 1 < len(page_button_list)):
                        page_button_list[i+1].set_active(True)
                    else:
                        page_button_list[0].set_active(True)
                    return True


        if ConfigManager.key_event_compare('prev-page-key', event):
            page_button_list = self.buttonbox.get_children()[1:]

            for i in range(len(page_button_list)):
                if page_button_list[i].get_active():
                    if i > 0:
                        page_button_list[i-1].set_active(True)
                    else:
                        page_button_list[-1].set_active(True)
                    return True

        if ConfigManager.key_event_compare('move-page-left', event):
            i = 0
            for button in self.buttonbox:
                if button != self.radio_group_leader and button.get_active():
                    if (i - 1) > 0:
                        self.notebook.reorder_child(self.notebook.get_nth_page(i - 1), i - 2)
#.........这里部分代码省略.........
开发者ID:Sixdsn,项目名称:terra-terminal,代码行数:103,代码来源:terminal.py


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