
    AHjc                    Z    d Z ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ  G d de      Zy	)
z"Provides a pretty-printing widget.    )annotations)Any)Pretty)RenderResult)Widgetc                  T     e Zd ZdZdZdddd	 	 	 	 	 	 	 	 	 d fdZd	dZd
dZ xZS )r   zDA pretty-printing widget.

    Used to pretty-print any object.
    z.
    Pretty {
        height: auto;
    }
    Nnameidclassesc               X    t         |   |||       d| _        t        |      | _        y)zInitialise the `Pretty` widget.

        Args:
            object: The object to pretty-print.
            name: The name of the pretty widget.
            id: The ID of the pretty in the DOM.
            classes: The CSS classes of the pretty.
        r	   FN)super__init__shrinkPrettyRenderable_pretty_renderable)selfobjectr
   r   r   	__class__s        O/root/tools/cai/cai_env/lib/python3.12/site-packages/textual/widgets/_pretty.pyr   zPretty.__init__   s-      	dr7;"26":    c                    | j                   S )N)r   )r   s    r   renderzPretty.render-   s    &&&r   c                h    t        |      | _        | j                          | j                  d       y)zpUpdate the content of the pretty widget.

        Args:
            object: The object to pretty-print.
        T)layoutN)r   r   clear_cached_dimensionsrefresh)r   r   s     r   updatezPretty.update0   s+     #36":$$&D!r   )
r   r   r
   
str | Noner   r   r   r   returnNone)r    r   )r   r   r    r!   )	__name__
__module____qualname____doc__DEFAULT_CSSr   r   r   __classcell__)r   s   @r   r   r      sY    
K  ";; 	;
 ; ; 
;('"r   r   N)r%   
__future__r   typingr   rich.prettyr   r   textual.appr   textual.widgetr    r   r   <module>r.      s#    ( "  2 $ !+"V +"r   