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


Python curses.ungetch方法代码示例

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


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

示例1: _catch_interrupt

# 需要导入模块: import curses [as 别名]
# 或者: from curses import ungetch [as 别名]
def _catch_interrupt(signal_no, frame):
            """
            SIGINT handler.  We ignore the signal and frame info passed in.
            """
            # Stop pep-8 shouting at me for unused params I can't control.
            del frame

            # The OS already caught the ctrl-c, so inject it now for the next
            # input.
            if signal_no == signal.SIGINT:
                curses.ungetch(3)
            elif signal_no == signal.SIGTSTP:
                curses.ungetch(26) 
开发者ID:peterbrittain,项目名称:asciimatics,代码行数:15,代码来源:screen.py

示例2: _inject_key

# 需要导入模块: import curses [as 别名]
# 或者: from curses import ungetch [as 别名]
def _inject_key(screen, char):
        """
        Inject a specified character into the input buffers.
        """
        if sys.platform == "win32":
            event = win32console.PyINPUT_RECORDType(win32console.KEY_EVENT)
            event.RepeatCount = 1
            event.ControlKeyState = 0
            event.VirtualScanCode = 0
            if char >= 0:
                event.Char = chr(char)
                event.VirtualKeyCode = ord(chr(char).upper())
            else:
                # Lookup in mapping dicts
                reverse = dict((v, k) for k, v in
                               screen._EXTRA_KEY_MAP.items())
                if char in reverse:
                    event.VirtualKeyCode = reverse[char]
                else:
                    # Fudge key state required for BACK_TAB if needed.
                    if char == Screen.KEY_BACK_TAB:
                        char = Screen.KEY_TAB
                        event.ControlKeyState = win32con.SHIFT_PRESSED
                    reverse = dict((v, k) for k, v in
                                   screen._KEY_MAP.items())
                    event.VirtualKeyCode = reverse[char]
            event.KeyDown = 1
            screen._stdin.WriteConsoleInput([event])
            event.KeyDown = 0
            screen._stdin.WriteConsoleInput([event])
        else:
            if char > 0:
                # Curses uses a LIFO stack for key injection, so reverse the
                # byte string to be injected.  Note that this still works for
                # ASCII as it is a single char subset of UTF-8.
                for c in reversed(bytes(chr(char).encode("utf-8"))):
                    curses.ungetch(c)
            else:
                reverse = dict((v, k) for k, v in
                               screen._KEY_MAP.items())
                curses.ungetch(reverse[char]) 
开发者ID:peterbrittain,项目名称:asciimatics,代码行数:43,代码来源:test_screen.py

示例3: _catch_interrupt

# 需要导入模块: import curses [as 别名]
# 或者: from curses import ungetch [as 别名]
def _catch_interrupt(signal_no, frame):
            """
            SIGINT handler.  We ignore the signal and frame info passed in.
            """
            # Stop pep-8 shouting at me for unused params I can't control.
            del frame

            # The OS already caught the ctrl-c, so inject it now for the next
            # input.
            if signal_no == signal.SIGINT:
                curses.ungetch(3)
            elif signal_no == signal.SIGTSTP:
                curses.ungetch(26)
            return 
开发者ID:QData,项目名称:deepWordBug,代码行数:16,代码来源:screen.py

示例4: hackCursesFixes

# 需要导入模块: import curses [as 别名]
# 或者: from curses import ungetch [as 别名]
def hackCursesFixes():
    if sys.platform == u'darwin':

        def windowChangedHandler(signum, frame):
            curses.ungetch(curses.KEY_RESIZE)

        signal.signal(signal.SIGWINCH, windowChangedHandler)

    def wakeGetch(signum, frame):
        curses.ungetch(0)

    signal.signal(signal.SIGUSR1, wakeGetch) 
开发者ID:google,项目名称:ci_edit,代码行数:14,代码来源:curses_util.py

示例5: changeToFindPrior

# 需要导入模块: import curses [as 别名]
# 或者: from curses import ungetch [as 别名]
def changeToFindPrior(self):
        curses.ungetch(self.savedCh)
        self.findAndChangeTo('interactiveFind') 
开发者ID:google,项目名称:ci_edit,代码行数:5,代码来源:controller.py

示例6: saveEventChangeToHostWindow

# 需要导入模块: import curses [as 别名]
# 或者: from curses import ungetch [as 别名]
def saveEventChangeToHostWindow(self, *args):
        curses.ungetch(self.savedCh)
        host = self.getNamedWindow('inputWindow')
        host.bringToFront()
        self.view.changeFocusTo(host) 
开发者ID:google,项目名称:ci_edit,代码行数:7,代码来源:controller.py


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