}BFj dZddlZddlZddlZddlmZdaejdkrdZ nej dkrdZ nd Z d e fd Z d Z d ZdadZdZejdkr5ejddZedreZ eZn0ej dkr%ddlZejjjZejge_dZ dZdZddededeeeffdZdS)z Utilities for working with terminals. Authors: * Brian E. Granger * Fernando Perez * Alexander Belchenko (e-mail: bialix AT ukr.net) N)get_terminal_sizeTposixc.tjddS)NclearossystemDC:\PYTHON\_runtimes\venv\Lib\site-packages\IPython/utils/terminal.py _term_clearr s 'r win32c.tjddS)Nclsrr r r r r s %r cdSNr r r r r r s r valc | adS)aControl whether set_term_title is active or not. set_term_title() allows writing to the console titlebar. In embedded widgets this can cause problems, so this call can be used to toggle it on or off as needed. The default state of the module is for the function to be disabled. Parameters ---------- val : bool If True, set_term_title() actually writes to the terminal (using the appropriate platform-specific module). If False, it is a no-op. N)ignore_termtitle)rs r toggle_set_term_titler%s xr cdS)z Dummy no-op.Nr )argskws r _set_term_titler8sDr cdSrr r r r _restore_term_titler=sDr Fcts!tjddatjd|zdS)z3 Change virtual terminal title in xterm-workalikes zTz]0;%sN)_xterm_term_title_savedsysstdoutwritetitles r _set_term_title_xtermr$DsI #' &&&"&J_u,-----r ctstjdddStjddadS)NzYExpecting xterm_term_title_saved to be True, but is not; will not restore terminal title.) stacklevelzF)rwarningswarnrr r!r r r _restore_term_title_xtermr*PsT # g     J\"""#r TERMxtermc$t|dS)z9Set terminal title using ctypes to access the Win32 APIs.N)SetConsoleTitleWr"s r rrisr c6trdSt|dS)z@Set terminal title using the necessary platform-dependent calls.N)rrr"s r set_term_titler1ns#Er c4trdStdS)z:Restore, if possible, terminal title to the original stateN)rrr r r restore_term_titler3us!r Pdefaultxdefaultyreturnc$t||fSr)_get_terminal_size)r6r7s r rr|s x2 3 33r )r4r5) __doc__rrr(shutilrr:rnamer platformboolrrrrr$r*environgetr+ startswithctypeswindllkernel32r/ c_wchar_pargtypesr1r3inttupler r r rJs ::::::7g\W    t    &        . . . $ $ $7g :>>& $ $D w8/7\WMMM}->!'!1 2   444C4sCx444444r