def on_key_in_tab_threads(screen: Screen, c): if c in ['w', 'c', 't', 'k', 'd', 'r', 'z', '+', '-']: # Over a PThread pthread = screen.selected_pthread() if pthread is None: raise Exception('You must select a thread first.') if c == 'c': # Close (Ctrl+C) pthread.send_sig_int() elif c == 't': # Terminate (Ctrl+C) pthread.terminate_sub_p() elif c == 'k': # Kill (Ctrl+C) pthread.kill_sub_p() elif c == 'w': # Watch screen.watch(pthread) elif c == 'd': # Delete screen.stop_and_pop_pthread(pthread) elif c == 'r': # Run (again). # This will does the part 'restart' only. screen.add_pthread_or_restart(pthread.clone()) elif c == 'z': print(pthread.execution_exception_traceback_info) read_input('Press Enter to continue. ') elif c == '-': pthread.add_to_nice(-1) elif c == '+': pthread.add_to_nice(1) elif c == 'n': command = read_input('Command (for instance "ping google.com"): ') if command: pthread = screen.build_pthread( SingleCommandVirtualScriptFile(command)) screen.add_pthread_and_start(pthread) elif char_is_enter(c): pass else: raise UndefinedBehaviorException