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


Python curses.echo方法代码示例

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


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

示例1: curses_input

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [as 别名]
def curses_input(self, stdscr, row, col, prompt_string, ascii_mode=False):
        """
        Get an input string with curses.

        Row and col are the start position ot the prompt_string.
        """
        curses.echo()
        stdscr.addstr(row, col, str(prompt_string), curses.A_REVERSE)
        stdscr.addstr(row + 1, col, " " * (curses.COLS - 1))
        stdscr.refresh()
        input_val = ""

        while len(input_val) <= 0:
            if ascii_mode:
                input_val = chr(stdscr.getch())
                break
            else:
                input_val = stdscr.getstr(row + 1, col, 20)

        return input_val 
开发者ID:aaronjanse,项目名称:asciidots,代码行数:22,代码来源:__main__.py

示例2: wrapper_basic

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [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 echo [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 echo [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 echo [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: stop

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [as 别名]
def stop(self):
        """
        Restore the screen.
        """
        if self._started == False:
            return
        curses.echo()
        self._curs_set(1)
        try:
            curses.endwin()
        except _curses.error:
            pass # don't block original error with curses error
        
        if self._old_signal_keys:
            self.tty_signal_keys(*self._old_signal_keys)

        super(Screen, self).stop() 
开发者ID:AnyMesh,项目名称:anyMesh-Python,代码行数:19,代码来源:curses_display.py

示例7: clean_exit

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [as 别名]
def clean_exit(message=''):
    
    scr.create_text_win(1, ' ')

    for doc in bufs.docs:
        # save current state
        doc.write_state()
        # close the document
        doc.close()

    # close curses
    scr.stdscr.keypad(False)
    curses.echo()
    curses.curs_set(1)
    curses.endwin()

    raise SystemExit(message) 
开发者ID:dsanson,项目名称:termpdf.py,代码行数:19,代码来源:termpdf.py

示例8: setup

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [as 别名]
def setup(self):
        curses.start_color()
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)

        curses.cbreak()
        curses.echo()

        lines, cols = self.stdscr.getmaxyx()
        self.logwin = self.stdscr.subwin(lines - 2, cols, 0, 0)
        self.sepwin = self.stdscr.subwin(1, cols, lines - 2, 0)
        self.cmdwin = self.stdscr.subwin(1, cols, lines - 1, 0)

        self.logwin.scrollok(True)

        self.sepwin.bkgd(curses.color_pair(1))
        self.sepwin.refresh() 
开发者ID:flux3dp,项目名称:fluxclient,代码行数:18,代码来源:console.py

示例9: get_input

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [as 别名]
def get_input(self, prompt):
        """Get user input through the user interface and return it."""
        curses.curs_set(2)

        self.prompt_area.clear()
        self.input_prompt.addstr(0, 0, prompt)
        self.search_window.clear()
        self.prompt_area.refresh()

        curses.echo()
        user_input = self.search_window.getstr().decode(encoding="utf-8")
        curses.noecho()

        self.prompt_area.clear()
        self.prompt_area.refresh()

        curses.curs_set(0)
        return user_input 
开发者ID:JonShepChen,项目名称:SpotipyTUI,代码行数:20,代码来源:command.py

示例10: get_int_value

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [as 别名]
def get_int_value(self, message):
        dimensions = self.screen.getmaxyx()
        if len(message) < dimensions[1]:
            empty = dimensions[1] - len(message) - 2
            self.screen.addstr(dimensions[0] - 2, len(message) + 1, \
                               " " * empty, curses.A_STANDOUT)
        self.screen.addstr(dimensions[0] - 2, 1, message, curses.A_STANDOUT)
        curses.curs_set(1);
        curses.echo()  # show cursor
        value = self.screen.getstr()
        self.draw_help()
        curses.curs_set(0);
        curses.noecho()
        try:
            return int(value)
        except ValueError:
            return None 
开发者ID:abcabhishek,项目名称:PyLimitOrderBook,代码行数:19,代码来源:bookViewer.py

示例11: terminate

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [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

示例12: signal_handler

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [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

示例13: disas_ndisasm

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [as 别名]
def disas_ndisasm(b):
    b = ''.join('\\x%02x' % ord(c) for c in b)
    if arch == "64":
        dis, errors = subprocess.Popen("echo -ne '%s' | ndisasm -b64 - | head -2" % b,
                stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate()
    else:
        dis, errors = subprocess.Popen("echo -ne '%s' | ndisasm -b32 - | head -2" % b,
                stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate()
    dis = dis.split("\n")
    extra = dis[1]
    dis = dis[0].split(None, 4)
    if extra.strip()[0] == '-':
        dis[1] = dis[1] + extra.strip()[1:]

    address = dis[0]
    insn = dis[1]
    mnemonic = dis[2]
    if len(dis) > 3:
        op_str = dis[3]
    else:
        op_str = ""

    if mnemonic == "db":
        mnemonic = "(unk)"
        insn = ""
        op_str = ""
    size = len(insn)/2

    return (mnemonic, op_str, size)

# objdump disassembler
# (objdump breaks unnecessary prefixes onto its own line, which makes parsing
# the output difficult.  really only useful with the -P0 flag to disallow
# prefixes) 
开发者ID:Battelle,项目名称:sandsifter,代码行数:36,代码来源:sifter.py

示例14: cleanup

# 需要导入模块: import curses [as 别名]
# 或者: from curses import echo [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

示例15: stop

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


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