Python curses.reset_prog_mode() Examples

The following are 12 code examples of curses.reset_prog_mode(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module curses , or try the search function .
Example #1
Source File: npyssafewrapper.py    From apple_bleee with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #2
Source File: npyssafewrapper.py    From HomePWN with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #3
Source File: npyssafewrapper.py    From EDCOP with Apache License 2.0 6 votes vote down vote up
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) 
Example #4
Source File: npyssafewrapper.py    From TelegramTUI with MIT License 6 votes vote down vote up
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) 
Example #5
Source File: npyspmfuncs.py    From apple_bleee with GNU General Public License v3.0 5 votes vote down vote up
def CallSubShell(subshell):
    """Call this function if you need to execute an external command in a subshell (os.system).  All the usual warnings apply -- the command line will be
    expanded by the shell, so make sure it is safe before passing it to this function."""
    curses.def_prog_mode()
    #curses.endwin() # Probably causes a memory leak.
    
    rtn = os.system("%s" % (subshell))
    curses.reset_prog_mode()
    if rtn is not 0: return False
    else: return True

    curses.reset_prog_mode() 
Example #6
Source File: external_item.py    From curses-menu with MIT License 5 votes vote down vote up
def clean_up(self):
        """
        This class overrides this method
        """
        self.menu.clear_screen()
        curses.reset_prog_mode()
        curses.curs_set(1)  # reset doesn't do this right
        curses.curs_set(0)
        self.menu.resume() 
Example #7
Source File: submenu_item.py    From curses-menu with MIT License 5 votes vote down vote up
def clean_up(self):
        """
        This class overrides this method
        """
        self.submenu.join()
        self.menu.clear_screen()
        curses.reset_prog_mode()
        curses.curs_set(1)  # reset doesn't do this right
        curses.curs_set(0)
        self.menu.resume() 
Example #8
Source File: npyspmfuncs.py    From HomePWN with GNU General Public License v3.0 5 votes vote down vote up
def CallSubShell(subshell):
    """Call this function if you need to execute an external command in a subshell (os.system).  All the usual warnings apply -- the command line will be
    expanded by the shell, so make sure it is safe before passing it to this function."""
    curses.def_prog_mode()
    #curses.endwin() # Probably causes a memory leak.
    
    rtn = os.system("%s" % (subshell))
    curses.reset_prog_mode()
    if rtn is not 0: return False
    else: return True

    curses.reset_prog_mode() 
Example #9
Source File: npyspmfuncs.py    From EDCOP with Apache License 2.0 5 votes vote down vote up
def CallSubShell(subshell):
    """Call this function if you need to execute an external command in a subshell (os.system).  All the usual warnings apply -- the command line will be
    expanded by the shell, so make sure it is safe before passing it to this function."""
    curses.def_prog_mode()
    #curses.endwin() # Probably causes a memory leak.
    
    rtn = os.system("%s" % (subshell))
    curses.reset_prog_mode()
    if rtn is not 0: return False
    else: return True

    curses.reset_prog_mode() 
Example #10
Source File: npyspmfuncs.py    From TelegramTUI with MIT License 5 votes vote down vote up
def CallSubShell(subshell):
    """Call this function if you need to execute an external command in a subshell (os.system).  All the usual warnings apply -- the command line will be
    expanded by the shell, so make sure it is safe before passing it to this function."""
    curses.def_prog_mode()
    #curses.endwin() # Probably causes a memory leak.
    
    rtn = os.system("%s" % (subshell))
    curses.reset_prog_mode()
    if rtn is not 0: return False
    else: return True

    curses.reset_prog_mode() 
Example #11
Source File: external_item.py    From GPIOnext with MIT License 5 votes vote down vote up
def clean_up(self):
        """
        This class overrides this method
        """
        self.menu.clear_screen()
        curses.reset_prog_mode()
        curses.curs_set(1)  # reset doesn't do this right
        curses.curs_set(0)
        self.menu.resume() 
Example #12
Source File: submenu_item.py    From GPIOnext with MIT License 5 votes vote down vote up
def clean_up(self):
        """
        This class overrides this method
        """
        self.submenu.join()
        self.menu.clear_screen()
        curses.reset_prog_mode()
        curses.curs_set(1)  # reset doesn't do this right
        curses.curs_set(0)
        self.menu.resume()