ó
    Ãu„j–  ã                  ó�   • S SK Jr  S SKJrJr  S SKJrJr  \(       a  S SKJ	r	  S SK
Jr  S SKJr  S SKJr  S SKJr   " S	 S
\5      rg)é    )Úannotations)ÚTYPE_CHECKINGÚcast)ÚAlignÚAlignMethod)ÚRenderResult)ÚSize)ÚDigits)Ú	Selection)ÚWidgetc                  ó¤   ^ • \ rS rSrSrSr SSSSSS.           SU 4S jjjjr\SS j5       rSS	 jr	SS
 jr
SS jrSS jrSS jrSrU =r$ )r
   é   zLA widget to display numerical values using a 3x3 grid of unicode characters.z„
    Digits {
        width: 1fr;
        height: auto;
        text-align: left;        
        box-sizing: border-box;
    }
    NF©ÚnameÚidÚclassesÚdisabledc               ón   >• [        U[        5      (       d  [        S5      e[        TU ]  X#XES9  Xl        g)z÷Initialize a Digits widget.

Args:
    value: Value to display in widget.
    name: The name of the widget.
    id: The ID of the widget in the DOM.
    classes: The CSS classes of the widget.
    disabled: Whether the widget is disabled or not.

úvalue must be a strr   N)Ú
isinstanceÚstrÚ	TypeErrorÚsuperÚ__init__Ú_value)ÚselfÚvaluer   r   r   r   Ú	__class__s         €Ú¥C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\textual/widgets/_digits.pyr   ÚDigits.__init__   s5   ø€ ô& ˜%¤×%Ñ%ÜÐ1Ó2Ð2Ü‰Ñ˜d°7ÐÑNØ�ó    c                ó   • U R                   $ )z*The current value displayed in the Digits.©r   )r   s    r   r   ÚDigits.value4   s   € ð �{‰{Ðr!   c                ó   • U R                   $ )Nr#   )r   Ú	selections     r   Úget_selectionÚDigits.get_selection9   s   € Ø�{‰{Ðr!   c                ó,  • [        U[        5      (       d  [        S5      e[        U5      [        U R                  5      :g  =(       d7    [
        R                  " U R                  5      [
        R                  " U5      :g  nXl        U R                  US9  g)z€Update the Digits with a new value.

Args:
    value: New value to display.

Raises:
    TypeError: If the value isn't a `str`.
r   )ÚlayoutN)r   r   r   Úlenr   ÚDigitsRenderableÚ	get_widthÚrefresh)r   r   Úlayout_requireds      r   ÚupdateÚDigits.update<   su   € ô ˜%¤×%Ñ%ÜÐ1Ó2Ð2Ü˜e›*¬¨D¯K©KÓ(8Ñ8÷ 
Ü×&Ò& t§{¡{Ó3Ô7G×7QÒ7QÐRWÓ7XÑXð 	ð ŒØ�‰˜OˆÒ,r!   c                ó  • U R                   nU R                  (       a  U R                  R                  SSS9n[	        U R
                  U5      nU R                  R                  nUS;  a  SOUn[        U[        [        U5      U5      $ )zRender digits.zscreen--selectionT)Úpartial>   ÚleftÚrightÚcenterr4   )Ú
rich_styleÚtext_selectionÚscreenÚget_component_rich_styler,   r   ÚstylesÚ
text_alignr   r   r   )r   r7   Údigitsr<   Úaligns        r   ÚrenderÚDigits.renderM   sx   € à—_‘_ˆ
Ø××ØŸ™×=Ñ=Ø#¨Tð >ð ˆJô " $§+¡+¨zÓ:ˆØ—[‘[×+Ñ+ˆ
Ø$Ð,GÓG‘ÈZˆÜ�VœT¤+¨uÓ5°zÓBÐBr!   c                óB   • [         R                  " U R                  5      $ )zÓCalled by textual to get the width of the content area.

Args:
    container: Size of the container (immediate parent) widget.
    viewport: Size of the viewport.

Returns:
    The optimal width of the content.
)r,   r-   r   )r   Ú	containerÚviewports      r   Úget_content_widthÚDigits.get_content_widthY   s   € ô  ×)Ò)¨$¯+©+Ó6Ð6r!   c                ó   • g)zíCalled by Textual to get the height of the content area.

Args:
    container: Size of the container (immediate parent) widget.
    viewport: Size of the viewport.
    width: Width of renderable.

Returns:
    The height of the content.
é   © )r   rB   rC   Úwidths       r   Úget_content_heightÚDigits.get_content_heighte   s   € ð r!   r#   )Ú )r   r   r   ú
str | Noner   rM   r   rM   r   ÚboolÚreturnÚNone)rO   r   )r&   r   rO   rM   )r   r   rO   rP   )rO   r   )rB   r	   rC   r	   rO   Úint)rB   r	   rC   r	   rI   rQ   rO   rQ   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚDEFAULT_CSSr   Úpropertyr   r'   r0   r?   rD   rJ   Ú__static_attributes__Ú__classcell__)r   s   @r   r
   r
      sœ   ø† ÙVð€Kð ðð  ØØ"Øñàðð ð	ð
 ðð ðð ðð 
÷ñ ð0 óó ðôô-ô"
Cô
7÷ò r!   r
   N)Ú
__future__r   Útypingr   r   Ú
rich.alignr   r   Útextual.appr   Útextual.geometryr	   Útextual.renderables.digitsr
   r,   Útextual.selectionr   Útextual.widgetr   rH   r!   r   Ú<module>rc      s.   ðÝ "ç &ç )æÝ(å !Ý AÝ 'Ý !ô`ˆVõ `r!   