
    hj                     X    d dl Z d dlZdgZ ej                  e      Zd Z G d d      Zy)    NTrameComponentc                 Z    t        j                  |       xs t        j                  |       S N)inspectismethod
isfunction)xs    G/DATA/.local/lib/python3.12/site-packages/trame_common/obj/component.pycan_be_decoratedr      s#    A7'"4"4Q"77    c                   d    e Zd ZdZd
dZed        Zed        Zed        Zed        Z	d Z
d	 Zy)r   z
    Base trame class that has access to a trame server instance
    on which we provide simple accessor and method decoration capabilities.
    Nc                 T    || _         |r| | j                  |<   | j                          y)z
        Initialize TrameComponent with its server.

        Keyword arguments:
        server -- the server to link to (default None)
        ctx_name -- name to use to bind current instance to server.context (default None)
        N)_serverctx_bind_annotated_methods)selfserverctx_name_s       r
   __init__zTrameComponent.__init__   s(     !%DHHX$$&r   c                     | j                   S )z+Return the associated trame server instance)r   r   s    r
   r   zTrameComponent.server$   s     ||r   c                 .    | j                   j                  S )z"Return the associated server state)r   stater   s    r
   r   zTrameComponent.state)   s     {{   r   c                 .    | j                   j                  S )z'Return the associated server controller)r   
controllerr   s    r
   ctrlzTrameComponent.ctrl.   s     {{%%%r   c                 .    | j                   j                  S )z$Return the associated server context)r   contextr   s    r
   r   zTrameComponent.ctx3   s     {{"""r   c           
         t        j                  | j                  t              D ]  }t	        | |d         }| j
                  j                  }d|j                  v ru|j                  d   }t        j                  d|D cg c]  }|j                  |        c}|d            | j
                  j                  |D cg c]  }|  c} |       d|j                  v rR|j                  d   }|D ]>  }t        j                  d||d           | j                  j                  |       |       @ d|j                  v s|j                  d   }|D ]c  }	|	j                  d      }
|	j                  d      }t	        | j                  |      }t        j                  d	||
|d            ||
      |       e  y c c}w c c}w )
Nr   _trame_state_changezstate.change(%s)(%s)_trame_trigger_namesztrigger(%s)(%s)_trame_controllernamemethodzctrl.%s(%s)(%s))r   
getmembers	__class__r   getattrr   
translator__dict__loggerdebugtranslate_keychanger   triggergetr   )r   kfns_translatorstate_change_namesvtrigger_namestrigger_nameactionsactionr$   r%   decorates                r
   r   z&TrameComponent._bind_annotated_methods8   s   ##DNN4DEAqt$B  ::00L$3%'[[1F%G"*ASTASA221567ASTaD
 I!

!!4F#G4FqqcF4F#GHL &4 ",B C$1LLL!2L!A$G:DKK''<.:2> %2
 #bkk1++&9:%F!::f-D#ZZ1F&tyy&9HLL!2FD!A$G"HTN2& &1 F U $Hs   ?F<>
Gc                 Z   t        j                  | j                  t              D ]  }t	        | |d         }i }d|j
                  v r|j                  |       |s6| j                  j                  j                         D ](  }t        |      |z  }|D ]  }|j                  |        *  y )Nr   r!   )r   r&   r'   r   r(   r*   addr   _change_callbacksvaluessetremove)r   r1   r2   methods_to_detachfn_list	to_removes         r
   _unbind_annotated_methodsz(TrameComponent._unbind_annotated_methodsY   s    ##DNN4DEAqt$B !#$3!%%b) #zz;;BBDG #G/@ @I'r* (  E Fr   r   )__name__
__module____qualname____doc__r   propertyr   r   r   r   r   rD    r   r
   r   r      sg    
'   ! ! & & # #'B+r   )r   logging__all__	getLoggerrE   r+   r   r   rJ   r   r
   <module>rN      s<       
		8	$8X+ X+r   