Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../lib64/python2..../curses
File: wrapper.py
"""curses.wrapper
[0] Fix | Delete
[1] Fix | Delete
Contains one function, wrapper(), which runs another function which
[2] Fix | Delete
should be the rest of your curses-based application. If the
[3] Fix | Delete
application raises an exception, wrapper() will restore the terminal
[4] Fix | Delete
to a sane state so you can read the resulting traceback.
[5] Fix | Delete
[6] Fix | Delete
"""
[7] Fix | Delete
[8] Fix | Delete
import curses
[9] Fix | Delete
[10] Fix | Delete
def wrapper(func, *args, **kwds):
[11] Fix | Delete
"""Wrapper function that initializes curses and calls another function,
[12] Fix | Delete
restoring normal keyboard/screen behavior on error.
[13] Fix | Delete
The callable object 'func' is then passed the main window 'stdscr'
[14] Fix | Delete
as its first argument, followed by any other arguments passed to
[15] Fix | Delete
wrapper().
[16] Fix | Delete
"""
[17] Fix | Delete
[18] Fix | Delete
try:
[19] Fix | Delete
# Initialize curses
[20] Fix | Delete
stdscr = curses.initscr()
[21] Fix | Delete
[22] Fix | Delete
# Turn off echoing of keys, and enter cbreak mode,
[23] Fix | Delete
# where no buffering is performed on keyboard input
[24] Fix | Delete
curses.noecho()
[25] Fix | Delete
curses.cbreak()
[26] Fix | Delete
[27] Fix | Delete
# In keypad mode, escape sequences for special keys
[28] Fix | Delete
# (like the cursor keys) will be interpreted and
[29] Fix | Delete
# a special value like curses.KEY_LEFT will be returned
[30] Fix | Delete
stdscr.keypad(1)
[31] Fix | Delete
[32] Fix | Delete
# Start color, too. Harmless if the terminal doesn't have
[33] Fix | Delete
# color; user can test with has_color() later on. The try/catch
[34] Fix | Delete
# works around a minor bit of over-conscientiousness in the curses
[35] Fix | Delete
# module -- the error return from C start_color() is ignorable.
[36] Fix | Delete
try:
[37] Fix | Delete
curses.start_color()
[38] Fix | Delete
except:
[39] Fix | Delete
pass
[40] Fix | Delete
[41] Fix | Delete
return func(stdscr, *args, **kwds)
[42] Fix | Delete
finally:
[43] Fix | Delete
# Set everything back to normal
[44] Fix | Delete
if 'stdscr' in locals():
[45] Fix | Delete
stdscr.keypad(0)
[46] Fix | Delete
curses.echo()
[47] Fix | Delete
curses.nocbreak()
[48] Fix | Delete
curses.endwin()
[49] Fix | Delete
[50] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function