)L i dZddlmZddlmZmZddlmZddlm Z ddl m Z ddl m Z dd lmZd d gZGd d e ZGdd eZy)z Interface for an output. ) annotations)ABCMetaabstractmethod)TextIO) CursorShapeSize)Attrs) ColorDepthOutput DummyOutputcveZdZUdZdZded<ed*dZed+dZed,dZ ed,dZ ed-d Z ed.d Z ed.d Z ed.d Zed.d Zed.dZed.dZed.dZed.dZed.dZed.dZed/dZed.dZed.dZed0d1dZed2dZed2dZed2dZed2dZed.dZed.dZed3dZ ed.dZ!d.d Z"e#d4d!Z$ed5d"Z%d.d#Z&d.d$Z'd.d%Z(d.d&Z)d.d'Z*d*d(Z+ed6d)Z,y)7r z Base class defining the output interface for a :class:`~prompt_toolkit.renderer.Renderer`. Actual implementations are :class:`~prompt_toolkit.output.vt100.Vt100_Output` and :class:`~prompt_toolkit.output.win32.Win32Output`. Nz TextIO | Nonestdoutcy)z@Return the file descriptor to which we can write for the output.Nselfs `/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/prompt_toolkit/output/base.pyfilenoz Output.fileno"cy)z Return the encoding for this output, e.g. 'utf-8'. (This is used mainly to know which characters are supported by the output the data, so that the UI can provide alternatives, when required.) Nrrs rencodingzOutput.encoding&rrcy)z?Write text (Terminal escape sequences will be removed/escaped.)Nrrdatas rwritez Output.write/rrcy)z Write text.Nrrs r write_rawzOutput.write_raw3rrcy)zSet terminal title.Nrrtitles r set_titlezOutput.set_title7rrcy)z/Clear title again. (or restore previous title.)Nrrs r clear_titlezOutput.clear_title;rrcy)z!Write to output stream and flush.Nrrs rflushz Output.flush?rrcy)zc Erases the screen with the background color and moves the cursor to home. Nrrs r erase_screenzOutput.erase_screenCrrcy)zBGo to the alternate screen buffer. (For full screen applications).Nrrs renter_alternate_screenzOutput.enter_alternate_screenJrrcy)z"Leave the alternate screen buffer.Nrrs rquit_alternate_screenzOutput.quit_alternate_screenNrrcy)z Enable mouse.Nrrs renable_mouse_supportzOutput.enable_mouse_supportRrrcy)zDisable mouse.Nrrs rdisable_mouse_supportzOutput.disable_mouse_supportVrrcy)zY Erases from the current cursor position to the end of the current line. Nrrs rerase_end_of_linezOutput.erase_end_of_lineZrrcy)zc Erases the screen from the current line down to the bottom of the screen. Nrrs r erase_downzOutput.erase_down`rrcy)z#Reset color and styling attributes.Nrrs rreset_attributeszOutput.reset_attributesgrrcy)z%Set new color and styling attributes.Nrrattrs color_depths rset_attributeszOutput.set_attributeskrrcy)zDisable auto line wrapping.Nrrs rdisable_autowrapzOutput.disable_autowraporrcy)zEnable auto line wrapping.Nrrs renable_autowrapzOutput.enable_autowrapsrrcy)zMove cursor position.Nrrrowcolumns r cursor_gotozOutput.cursor_gotowrrcy)zMove cursor `amount` place up.Nrramounts r cursor_upzOutput.cursor_up{rrcy)z Move cursor `amount` place down.NrrHs r cursor_downzOutput.cursor_downrrcy)z#Move cursor `amount` place forward.NrrHs rcursor_forwardzOutput.cursor_forwardrrcy)z$Move cursor `amount` place backward.NrrHs rcursor_backwardzOutput.cursor_backwardrrcy)z Hide cursor.Nrrs r hide_cursorzOutput.hide_cursorrrcy)z Show cursor.Nrrs r show_cursorzOutput.show_cursorrrcy)z-Set cursor shape to block, beam or underline.Nrr cursor_shapes rset_cursor_shapezOutput.set_cursor_shaperrcy)zReset cursor shape.Nrrs rreset_cursor_shapezOutput.reset_cursor_shaperrcy)zP Asks for a cursor position report (CPR). (VT100 only.) Nrrs r ask_for_cprzOutput.ask_for_cprrrcy)a `True` if the `Application` can expect to receive a CPR response after calling `ask_for_cpr` (this will come back through the corresponding `Input`). This is used to determine the amount of available rows we have below the cursor position. In the first place, we have this so that the drop down autocompletion menus are sized according to the available space. On Windows, we don't need this, there we have `get_rows_below_cursor_position`. Frrs rresponds_to_cprzOutput.responds_to_cprsrcy)z%Return the size of the output window.Nrrs rget_sizezOutput.get_sizerrcy)z Sound bell.Nrrs rbellz Output.bellrrcyzFor vt100 only.Nrrs renable_bracketed_pastezOutput.enable_bracketed_pasterrcyrdrrs rdisable_bracketed_pastezOutput.disable_bracketed_pasterrcy)z For vt100 only. Put the terminal in normal cursor mode (instead of application mode). See: https://vt100.net/docs/vt100-ug/chapter3.html Nrrs rreset_cursor_key_modezOutput.reset_cursor_key_moderrcy)zFor Win32 only.Nrrs rscroll_buffer_to_promptzOutput.scroll_buffer_to_promptrrct)zFor Windows only.NotImplementedErrorrs rget_rows_below_cursor_positionz%Output.get_rows_below_cursor_position!!rcy)a Get default color depth for this output. This value will be used if no color depth was explicitly passed to the `Application`. .. note:: If the `$PROMPT_TOOLKIT_COLOR_DEPTH` environment variable has been set, then `outputs.defaults.create_output` will pass this value to the implementation as the default_color_depth, which is returned here. (This is not used when the output corresponds to a prompt_toolkit SSH/Telnet session.) Nrrs rget_default_color_depthzOutput.get_default_color_depthrrreturnintrtstrrrwrtNoner#rwrtryrtryr;r r<r rtryrrrDrurErurtryrIrurtryrWrrtry)rtboolrtr rtr )-__name__ __module__ __qualname____doc__r__annotations__rrrrr r$r&r(r*r,r.r0r2r4r6r8r=r?rArFrJrLrNrPrRrTrXrZr\propertyr^r`rbrergrirkrorrrrrr r s!FM KK  JJ::,,  MM--    ..00&&%%  ))++..//88   00 "  r) metaclassc*eZdZdZd&dZd'dZd(dZd(dZd)dZd*dZ d*dZ d*d Z d*d Z d*d Z d*d Zd*d Zd*dZd*dZd*dZd+dZd*dZd*dZd,d-dZd.dZd.dZd.dZd.dZd*dZd*dZd/dZd*dZd*dZd*dZ d*dZ!d*d Z"d*d!Z#d0d"Z$d&d#Z%d1d$Z&y%)2rzD For testing. An output class that doesn't render anything. ct)z*There is no sensible default for fileno().rmrs rrzDummyOutput.filenorprcy)Nzutf-8rrs rrzDummyOutput.encodingsrcyNrrs rrzDummyOutput.write rcyrrrs rr zDummyOutput.write_rawrrcyrrr"s rr$zDummyOutput.set_titlerrcyrrrs rr&zDummyOutput.clear_titlerrcyrrrs rr(zDummyOutput.flushrrcyrrrs rr*zDummyOutput.erase_screenrrcyrrrs rr,z"DummyOutput.enter_alternate_screenrrcyrrrs rr.z!DummyOutput.quit_alternate_screenrrcyrrrs rr0z DummyOutput.enable_mouse_supportrrcyrrrs rr2z!DummyOutput.disable_mouse_supportrrcyrrrs rr4zDummyOutput.erase_end_of_line rrcyrrrs rr6zDummyOutput.erase_down rrcyrrrs rr8zDummyOutput.reset_attributesrrcyrrr:s rr=zDummyOutput.set_attributesrrcyrrrs rr?zDummyOutput.disable_autowraprrcyrrrs rrAzDummyOutput.enable_autowraprrcyrrrCs rrFzDummyOutput.cursor_gotorrcyrrrHs rrJzDummyOutput.cursor_uprrcyrrrHs rrLzDummyOutput.cursor_down!rrcyrrrHs rrNzDummyOutput.cursor_forward$rrcyrrrHs rrPzDummyOutput.cursor_backward'rrcyrrrs rrRzDummyOutput.hide_cursor*rrcyrrrs rrTzDummyOutput.show_cursor-rrcyrrrVs rrXzDummyOutput.set_cursor_shape0rrcyrrrs rrZzDummyOutput.reset_cursor_shape3rrcyrrrs rr\zDummyOutput.ask_for_cpr6rrcyrrrs rrbzDummyOutput.bell9rrcyrrrs rrez"DummyOutput.enable_bracketed_paste<rrcyrrrs rrgz#DummyOutput.disable_bracketed_paste?rrcyrrrs rrkz#DummyOutput.scroll_buffer_to_promptBrrctddS)N(P)rowscolumnsrrs rr`zDummyOutput.get_sizeEsR((rcy)Nrrrs rroz*DummyOutput.get_rows_below_cursor_positionHsrc"tjSr)r DEPTH_1_BITrs rrrz#DummyOutput.get_default_color_depthKs%%%rNrsrvrxrzr{r|r}r~rrrr)'rrrrrrrr r$r&r(r*r,r.r0r2r4r6r8r=r?rArFrJrLrNrPrRrTrXrZr\rbrergrkr`rorrrrrrrs"                              )&rN)r __future__rabcrrtypingrprompt_toolkit.cursor_shapesrprompt_toolkit.data_structuresr prompt_toolkit.stylesr r<r __all__r rrrrrsM#'4/'#   F wF Rm&&m&r