當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。