
    AHjl                    f    d dl mZ d dlmZ erd dlmZ d dlmZmZm	Z	 d dl
mZ  G d ded	      Zy
)    )annotations)TYPE_CHECKING)RenderResult)Visual
VisualType	visualize)Widgetc            	           e Zd ZdZdZ	 ddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZedd       Zedd	       Zej                  dd
       ZddZ
dddddZ xZS )Statica%  A widget to display simple static content, or use as a base class for more complex widgets.

    Args:
        content: A Content object, Rich renderable, or string containing console markup.
        expand: Expand content if required to fill container.
        shrink: Shrink content if required to fill container.
        markup: True if markup should be parsed and rendered.
        name: Name of widget.
        id: ID of Widget.
        classes: Space separated list of class names.
        disabled: Whether the static is disabled or not.
    z.
    Static {
        height: auto;
    }
    FTN)expandshrinkmarkupnameidclassesdisabledc               f    t         	|   |||||       || _        || _        || _        d | _        y )N)r   r   r   r   r   )super__init__r   r   _Static__content_Static__visual)
selfcontentr   r   r   r   r   r   r   	__class__s
            O/root/tools/cai/cai_env/lib/python3.12/site-packages/textual/widgets/_static.pyr   zStatic.__init__    s@     	"g 	 	
  '+    c                    | j                   't        | | j                  | j                        | _         | j                   S )aG  The visual to be displayed.

        Note that the visual is what is ultimately rendered in the widget, but may not be the
        same object set with the `update` method  or `content` property. For instance, if you
        update with a string, then the visual will be a [Content][textual.content.Content] instance.

        r   )r   r   r   _render_markupr   s    r   visualzStatic.visual4   s2     == %dDNN4CVCVWDM}}r   c                    | j                   S )z,The original content set in the constructor.)r   r    s    r   r   zStatic.contentA   s     ~~r   c                    || _         t        | || j                        | _        | j	                          | j                  d       y )Nr   Tlayout)r   r   r   r   clear_cached_dimensionsrefresh)r   r   s     r   r   zStatic.contentF   s9     !$8K8KL$$&D!r   c                    | j                   S )ziGet a rich renderable for the widget's content.

        Returns:
            A rich renderable.
        )r!   r    s    r   renderzStatic.renderM   s     {{r   r$   c               p    || _         t        | || j                        | _        | j	                  |       y)a\  Update the widget's content area with a string, a Visual (such as [Content][textual.content.Content]), or a [Rich renderable](https://rich.readthedocs.io/en/latest/protocol.html).

        Args:
            content: New content.
            layout: Also perform a layout operation (set to `False` if you are certain the size won't change).
        r   r$   N)r   r   r   r   r'   )r   r   r%   s      r   updatezStatic.updateU   s/     !!$8K8KLF#r   ) )r   r   r   boolr   r-   r   r-   r   
str | Noner   r.   r   r.   r   r-   returnNone)r/   r   )r/   r   )r   r   r/   r0   )r/   r   )r   r   r%   r-   r/   r0   )__name__
__module____qualname____doc__DEFAULT_CSSr   propertyr!   r   setterr)   r+   __classcell__)r   s   @r   r   r      s    K !, ",, 	,
 , , , , , , 
,( 
 
   ^^" "
$ 
$ 
$r   r   F)inherit_bindingsN)
__future__r   typingr   textual.appr   textual.visualr   r   r   textual.widgetr	   r    r   r   <module>r@      s*    "  ( 8 8 !S$Ve S$r   