本文整理汇总了Python中curses.endwin方法的典型用法代码示例。如果您正苦于以下问题:Python curses.endwin方法的具体用法?Python curses.endwin怎么用?Python curses.endwin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses
的用法示例。
在下文中一共展示了curses.endwin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refresh_window
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [as 别名]
def refresh_window(procs, disks_read, disks_write):
"""Print results on screen by using curses."""
curses.endwin()
templ = "%-5s %-7s %11s %11s %s"
win.erase()
disks_tot = "Total DISK READ: %s | Total DISK WRITE: %s" \
% (bytes2human(disks_read), bytes2human(disks_write))
print_line(disks_tot)
header = templ % ("PID", "USER", "DISK READ", "DISK WRITE", "COMMAND")
print_line(header, highlight=True)
for p in procs:
line = templ % (
p.pid,
p._username[:7],
bytes2human(p._read_per_sec),
bytes2human(p._write_per_sec),
p._cmdline)
try:
print_line(line)
except curses.error:
break
win.refresh()
示例2: main
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [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")
示例3: wrapper_basic
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [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()
示例4: wrapper_fork
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [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)
示例5: start
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [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()
示例6: run
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [as 别名]
def run(self):
while any(_.is_alive() for _ in self.processes):
time.sleep(0.1)
self.stdscr_size = self.stdscr.getmaxyx()
self.build_progress_screen()
self.build_status_screen()
self.build_output_screen()
# terminate manually when all tasks finished
if self.task_num == self.task_total:
for _ in self.processes:
_.terminate()
self.stdscr.addstr(self.stdscr_size[0] - 2, 0,
'Done! please type "q" to exit.')
self.stdscr.refresh()
while self.stdscr.getch() != ord('q'):
time.sleep(1)
curses.endwin()
示例7: manipulate
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [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
示例8: donate
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [as 别名]
def donate(s):
curses.endwin()
clearscreen()
print JColor.FGYELLOW + JColor.BOLDON + "Donate Bitcoin" + JColor.ENDC + JColor.BOLDOFF
print "19Ve bRAu 8ZdT zf7A JnJv dCyh qSBZ qMon T\n"
print JColor.FGYELLOW + JColor.BOLDON + "Donate Dogecoin" + JColor.ENDC + JColor.BOLDOFF
print "DBGX4dwhD7SHhfcgzKjSZ2yJDhruAPgPUP\n"
print JColor.FGYELLOW + JColor.BOLDON + "Donate via Paypal" + JColor.ENDC + JColor.BOLDOFF
print "http://bit.ly/1klxN1M\n"
print JColor.FGGREEN + JColor.BOLDON + """
However, what I'd really love more than a donation is a job! I'm fresh out
of college and haven't had much luck finding one. I know it's a long shot,
but if you are interested in hiring me, full-time, part-time or on
a freelance basis, please email me at hall.jared.m@gmail.com and let
me know! My resume is available on my website at
http://www.jaredmhall.com. I'm also the proud creator of
http://www.doge4.us as well as the android app over at
http://goo.gl/JpeJFV. So if you're into that sort of thing,
give 'em a look sometime! Thank you for your time and stay stoked!\n""" + JColor.ENDC + JColor.BOLDOFF
print raw_input("Press [ENTER] to continue..")
start_raspberry_cloud(s)
示例9: cleanup
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [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)
示例10: stop
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [as 别名]
def stop(self):
curses.nocbreak();
curses.echo()
curses.endwin()
示例11: shut_down
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [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)
示例12: on_finish
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [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()
示例13: cleanup
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [as 别名]
def cleanup():
curses.endwin()
示例14: main
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [as 别名]
def main():
data = [
{
"testspersecond": 1,
"testcount": 2,
"crashcount": 3,
},
{
"testspersecond": 11,
"testcount": 22,
"crashcount": 33,
},
{
"testspersecond": 111,
"testcount": 222,
"crashcount": 333,
}
]
screen, boxes = initGui( len(data) )
try:
while True:
data[0]["testspersecond"] += 1
updateGui(screen, boxes, data)
# handle key presses
#c = screen.getch()
#if c == ord('q'):
# break;
time.sleep(1)
except KeyboardInterrupt:
curses.endwin()
示例15: __del__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import endwin [as 别名]
def __del__(self):
try:
curses.echo()
curses.endwin()
print('\n'*(NTHREADS+1))
except:
pass