
    ;i2                     x    S r SrSSKrSS0r0 rSSS.S jrSS	.S
 jrSS.S jrSS.S jr	SSS.S jr
SS.S jrg)z
Similar to ``addon_utils``, except we can only have one active at a time.

In most cases users of this module will simply call 'activate'.
)activateimport_from_pathimport_from_idreset    Nid F)handle_errorignore_not_foundc                >   SSK Jn  Uc  S nU" 5           [        XS9nU[        U '   Uc
   S S S 5        g SUl         UR                  5          S S S 5        SWl        [        R                  R                  (       a  [        S	UR                  5        U$ ! [         a  nU" U5         S nAS S S 5        g S nAff = f! [         aF  n[        SR                  [        USU 5      5      5        U" U5        [        U 	  S nAS S S 5        g S nAff = f! , (       d  f       N= f)
Nr   )RestrictBlendc                 ,    SS K nUR                  5         g Nr   	traceback	print_exc_exr   s     ]/home/wildlama/Downloads/blender-5.1.2-linux-x64/5.1/scripts/modules/bl_app_template_utils.pyr	   _enable.<locals>.handle_error)       !    r
   Fz$Exception in module register(): {!r}__file__Tz	app_template_utils.enable)_bpy_restrict_stater   r   	Exception_modules__template_enabled__registerprintformatgetattr_bpyappdebug_python__name__)template_idr	   r
   r   modexs         r   _enabler)   %   s    1	" 
	 PC
 !$; 
 $) 	LLN! 
0  $Cxx+S\\:J1  	 

	  	8??ZYd@efg%+ 
"	# 
s[   D	BDDB;
B8B3&D3B88D;
D4D9DDD
D)r	   c          
         Uc  S n[         R                  U S5      nUc  [         U 	 OK[        USS5      SLa  SUl         UR	                  5         O"[        SR                  U USL a  SOS	5      5        [        R                  R                  (       a  [        S
U 5        gg! [
         a7  n[        SR                  [        USU 5      5      5        U" U5         SnANiSnAff = f)z
Disables a template by name.

:param template_id: The name of the template and module.
:type template_id: str
:param handle_error: Called in the case of an error,
   taking an exception argument.
:type handle_error: Callable[[Exception], None] | None
Nc                 ,    SS K nUR                  5         g r   r   r   s     r   r	   _disable.<locals>.handle_error^   r   r   Fr   z&Exception in module unregister(): {!r}r   z+	app_template_utils.disable: {:s} not {:s}.disabledloadedz	app_template_utils.disable)r   getr!   r   
unregisterr   r   r    r"   r#   r$   )r&   r	   r'   r(   s       r   _disabler1   R   s     	" ,,{E
*C
{[!	,e	4E	A#( 	NN
 	:AA!Ul
	
 xx,k:   	:AA'#z[fBghi	s    B   
C!*-CC!r   c                    SS K nSSKJn  U R                  UR                  S5      SS  u  pEUS-   U-   n U" U5      $ ! [
         a#  nU(       a  UR                  U:X  a   S nAg UeS nAff = f)Nr   )import_module   .)os	importlibr3   rsplitsepModuleNotFoundErrorname)pathr
   r7   r3   base_moduler&   module_namer(   s           r   r   r   {   sk    '#{{26615bc:K#k1K[)) ; 6s   = 
A*A%#A%%A*c                J   SS K n[        [        [        R                  R                  U S95      S 5      nUc"  U(       a  g [        SR                  U 5      5      eU(       a;  UR                  R                  UR                  R                  US5      5      (       d  g [        X1S9$ )Nr   )r=   z{!r} template not found!z__init__.pyr   )r7   nextiterr"   utilsapp_template_pathsr   r    r=   existsjoinr   )r&   r
   r7   r=   s       r   r   r      s}    TZZ222DEtLD|6==kJKK77>>"'',,t]"CDDHHr   r&   reload_scriptsc                     [         S   nU(       d  X :X  a  g U(       a  [        U5        U (       a
  [        U SS9OS nU [         S'   g )Nr   Tr   )_app_templater1   r)   )r&   rH   template_id_prev_mods       r   r   r      sD    $T* .=!" ;F7;64D%M$r   )rH   c                     [         R                  R                  R                  n[         R                  R
                  (       a  [        SR                  U5      5        [        XS9  g)z
Sets default state.
z#bl_app_template_utils.reset('{:s}')rG   N)	r"   contextpreferencesapp_templater#   r$   r   r    r   )rH   r&   s     r   r   r      sB     ,,**77Kxx3::;GHDr   )__doc____all__bpyr"   rJ   r   r)   r1   r   r   r   r    r   r   <module>rU      so   
 
 	"  *. *Z +/ &;R 05  5: I ! &" " Er   