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


Python curses.nocbreak方法代码示例

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


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

示例1: main

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def main(block_viewer, window, interface_queue, rpcc, poller, initial_mode=None):
    error_message = False
    rpcc.request("getnetworkinfo")
    rpcc.request("getblockchaininfo")
    try:
        state = init_state()
        splash.draw_window(state, window)
        check_window_size(interface_queue, state, window, 12, 75) # min_y, min_x
        if initial_mode:
            hotkey.change_mode(state, window, initial_mode, poller)
        error_message = loop(block_viewer, state, window, interface_queue, rpcc, poller)
    finally: # restore sane terminal state, end RPC thread
        curses.nocbreak()
        curses.endwin()
    
        if error_message:
            sys.stderr.write("bitcoind-ncurses encountered an error\n")
            sys.stderr.write("Message: " + error_message + "\n") 
开发者ID:esotericnonsense,项目名称:bitcoind-ncurses,代码行数:20,代码来源:interface.py

示例2: wrapper_basic

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def wrapper_basic(call_function):
    #set the locale properly
    locale.setlocale(locale.LC_ALL, '')
    return curses.wrapper(call_function)

#def wrapper(call_function):
#   locale.setlocale(locale.LC_ALL, '')
#   screen = curses.initscr()
#   curses.noecho()
#   curses.cbreak()
#   
#   return_code = call_function(screen)
#   
#   curses.nocbreak()
#   curses.echo()
#   curses.endwin() 
开发者ID:hexway,项目名称:apple_bleee,代码行数:18,代码来源:npyssafewrapper.py

示例3: wrapper_fork

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def wrapper_fork(call_function, reset=True):
    pid = os.fork()
    if pid:
        # Parent
        os.waitpid(pid, 0)
        if reset:
            external_reset()
    else:
        locale.setlocale(locale.LC_ALL, '')
        _SCREEN = curses.initscr()
        try:
            curses.start_color()
        except:
            pass
        _SCREEN.keypad(1)
        curses.noecho()
        curses.cbreak()
        curses.def_prog_mode()
        curses.reset_prog_mode()
        return_code = call_function(_SCREEN)
        _SCREEN.keypad(0)
        curses.echo()
        curses.nocbreak()
        curses.endwin()
        sys.exit(0) 
开发者ID:hexway,项目名称:apple_bleee,代码行数:27,代码来源:npyssafewrapper.py

示例4: start

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def start():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "-v", "--version", help="show this version and exit", action="store_true"
    )
    args = parser.parse_args()
    if args.version:
        latest = Menu().check_version()
        curses.endwin()
        print("NetEase-MusicBox installed version:" + version)
        if latest != version:
            print("NetEase-MusicBox latest version:" + str(latest))
        sys.exit()

    nembox_menu = Menu()
    try:
        nembox_menu.start_fork(version)
    except (OSError, TypeError, ValueError, KeyError, IndexError):
        # clean up terminal while failed
        curses.echo()
        curses.nocbreak()
        curses.endwin()
        traceback.print_exc() 
开发者ID:darknessomi,项目名称:musicbox,代码行数:25,代码来源:__main__.py

示例5: manipulate

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def manipulate(self, pkt):
		if self.save:
			self.file__.write(pkt)
		self.call1(pkt)
		self.call2(pkt)
		call3_varbell = self.call3(pkt)
		if bool(call3_varbell):
			self.ntwk_call_3.append(call3_varbell)
		call4_varbell = self.call4(pkt)
		if bool(call4_varbell):
			self.ntwk_call_4.append(call4_varbell)
		if self.curses:
			try:
				self.display.print_handler()
			except:
				curses.nocbreak()
				self.display.screen.keypad(0)
				curses.echo()
				curses.endwin()
		return 
开发者ID:hash3liZer,项目名称:airpydump,代码行数:22,代码来源:airpydump.py

示例6: terminate

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def terminate(self) -> None:
        """Set console settings to their normal state.

        This method does not, by itself, cause the application to exit. Nor
        does it even cause the input loop to end. It should simply be seen as
        a "wrapping up" method for any actions which need to be performed
        before the object is destroyed.
        """
        self._queue.stop()

        self.database.replace_queue(self._queue)

        curses.nocbreak()
        self._stdscr.keypad(False)
        curses.echo()
        curses.endwin() 
开发者ID:xgi,项目名称:castero,代码行数:18,代码来源:display.py

示例7: signal_handler

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def signal_handler(screen):
    """This function is bound to the SIGINT signal (like ctrl+c) to graciously
    exit the program and reset the curses options.
    """

    if screen:
        screen.clear()
        screen.refresh()

        curses.nocbreak()
        screen.keypad(0)
        curses.echo()
        curses.endwin()

    print("Exiting flowcraft inspection... Bye")
    sys.exit(0) 
开发者ID:assemblerflow,项目名称:flowcraft,代码行数:18,代码来源:inspect.py

示例8: cleanup

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def cleanup(gui, poll, injector, ts, tests, command_line, args):
    ts.run = False
    if gui:
        gui.stop()
    if poll:
        poll.stop()
    if injector:
        injector.stop()

    '''
    # doesn't work
    if gui:
        for (i, c) in enumerate(gui.orig_colors):
            curses.init_color(i, c[0], c[1], c[2])
    '''

    curses.nocbreak();
    curses.echo()
    curses.endwin()

    dump_artifacts(tests, injector, command_line)

    if args.save:
        with open(LAST, "w") as f:
            f.write(hexlify(cstr2py(tests.r.raw_insn)))

    sys.exit(0) 
开发者ID:Battelle,项目名称:sandsifter,代码行数:29,代码来源:sifter.py

示例9: stop

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def stop(self):
        curses.nocbreak();
        curses.echo()
        curses.endwin() 
开发者ID:Battelle,项目名称:sandsifter,代码行数:6,代码来源:gui.py

示例10: shut_down

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def shut_down():
    """Closes connection and restores terminal"""
    curses.nocbreak()
    curses.echo()
    curses.endwin()
    gpsd_socket.close()
    print('Keyboard interrupt received\nTerminated by user\nGood Bye.\n')
    sys.exit(1) 
开发者ID:wadda,项目名称:gps3,代码行数:10,代码来源:human.py

示例11: on_finish

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def on_finish(self):
        """Close cleanly the I/O."""
        # we need to close curses only if it was opened
        if self.debug and not self.compat_debug:
            curses.nocbreak()
            self.stdscr.keypad(False)
            curses.echo()

            curses.endwin() 
开发者ID:aaronjanse,项目名称:asciidots,代码行数:11,代码来源:__main__.py

示例12: close

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def close(self, restore=True):
            """
            Close down this Screen and tidy up the environment as required.

            :param restore: whether to restore the environment or not.
            """
            self._signal_state.restore()
            if restore:
                self._screen.keypad(0)
                curses.echo()
                curses.nocbreak()
                curses.endwin() 
开发者ID:peterbrittain,项目名称:asciimatics,代码行数:14,代码来源:screen.py

示例13: _screen_terminate

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def _screen_terminate(self):
    """Terminate the curses screen."""

    self._stdscr.keypad(0)
    curses.nocbreak()
    curses.echo()
    curses.endwin()

    try:
      # Remove SIGINT handler.
      signal.signal(signal.SIGINT, signal.SIG_DFL)
    except ValueError:
     # Can't catch signals unless you're the main thread.
      pass 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:16,代码来源:curses_ui.py

示例14: wrapper

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def wrapper(func, *args, **kwds):
    """Wrapper function that initializes curses and calls another function,
    restoring normal keyboard/screen behavior on error.
    The callable object 'func' is then passed the main window 'stdscr'
    as its first argument, followed by any other arguments passed to
    wrapper().
    """

    try:
        # Initialize curses
        stdscr = curses.initscr()

        # Turn off echoing of keys, and enter cbreak mode,
        # where no buffering is performed on keyboard input
        curses.noecho()
        curses.cbreak()

        # In keypad mode, escape sequences for special keys
        # (like the cursor keys) will be interpreted and
        # a special value like curses.KEY_LEFT will be returned
        stdscr.keypad(1)

        # Start color, too.  Harmless if the terminal doesn't have
        # color; user can test with has_color() later on.  The try/catch
        # works around a minor bit of over-conscientiousness in the curses
        # module -- the error return from C start_color() is ignorable.
        try:
            curses.start_color()
        except:
            pass

        return func(stdscr, *args, **kwds)
    finally:
        # Set everything back to normal
        if 'stdscr' in locals():
            stdscr.keypad(0)
            curses.echo()
            curses.nocbreak()
            curses.endwin() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:41,代码来源:wrapper.py

示例15: _screen_terminate

# 需要导入模块: import curses [as 别名]
# 或者: from curses import nocbreak [as 别名]
def _screen_terminate(self):
    """Terminate the curses screen."""

    self._stdscr.keypad(0)
    curses.nocbreak()
    curses.echo()
    curses.endwin()

    # Remove SIGINT handler.
    signal.signal(signal.SIGINT, signal.SIG_DFL) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:12,代码来源:curses_ui.py


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