
    \h                      l    S SK Jr  S SKJr  S SKJrJr  \" 5       r " S S\5      r\	S:X  a  \" 5         gg)    )Window)Clock)ThreadLockc                   \   ^  \ rS rSrSrSrSSSSS.rS	 rU 4S
 jrS r	S r
S rS rSrU =r$ )ManagedWindow	   z
A pyglet window with an event loop which executes automatically
in a separate thread. Behavior is added by creating a subclass
which overrides setup, update, and/or draw.
   iX  i  FT)widthheightvsync	resizablec                     UR                  SS5      (       a  g[        U R                  40 UD6U l        [	        U R
                  S9U l        U R                  R                  5         g)z
It is best not to override this function in the child
class, unless you need to take additional arguments.
Do any OpenGL initialization calls in setup().
runfromdoctesterFN)target)getdictdefault_win_argswin_argsr   __event_loop__start)selfr   s     `/var/www/auris/envauris/lib/python3.13/site-packages/sympy/plotting/pygletplot/managed_window.py__init__ManagedWindow.__init__   sR     <<*E22T22?h?D$7$78    c                   > [         R                  5           [        TU ]  " S0 U R                  D6  U R                  5         U R                  5         [         R                  5         [        5       nU R                  Ul        U R                  (       d  UR                  5       n[         R                  5           U R                  5         U R                  5         U R!                  5         U R#                  U5        U R%                  5         U R'                  5         [         R                  5         U R                  (       d  M  [        TU ]Q  5         g! [         a)  n[        S[        U5      -  5        SU l
         SnAGN+SnAff = f! [         R                  5         f = f! [         a(  n[        S[        U5      -  5        SU l
         SnANSnAff = f! [         R                  5         f = f)z^
The event loop thread function. Do not override or call
directly (it is called by __init__).
z Window initialization failed: %sTNz$Uncaught exception in event loop: %s )gl_lockacquiresuperr   r   	switch_tosetup	Exceptionprintstrhas_exitreleaser   	fps_limittickdispatch_eventsclearupdatedrawflipclose)r   r   eclockdt	__class__s        r   r   ManagedWindow.__event_loop__$   sU   
 			% 14==1 


 OO..--BOO"	)NN$((*JJLKKOIIKIIK
 ! ---  	1  %8CFCD $% OO ! )@3q6IJ$(DMM) !sT   :E 8A!F 
FE=7F =FF F
G(GG GG G)c                     SU l         g)z
Closes the window.
TN)r'   r   s    r   r0   ManagedWindow.closeI   s     r   c                     g)z
Called once before the event loop begins.
Override this method in a child class. This
is the best place to put things like OpenGL
initialization calls.
Nr   r7   s    r   r#   ManagedWindow.setupO        	r   c                     g)z
Called before draw during each iteration of
the event loop. dt is the elapsed time in
seconds since the last update. OpenGL rendering
calls are best put in draw() rather than here.
Nr   )r   r3   s     r   r-   ManagedWindow.updateX   r;   r   c                     g)z_
Called after update during each iteration of
the event loop. Put OpenGL rendering calls
here.
Nr   r7   s    r   r.   ManagedWindow.drawa   s     	r   )r   r'   r   )__name__
__module____qualname____firstlineno____doc__r)   r   r   r   r0   r#   r-   r.   __static_attributes____classcell__)r4   s   @r   r   r   	   sG    
 I!$&)%*)-/
#J r   r   __main__N)
pyglet.windowr   pyglet.clockr   	threadingr   r   r   r   r@   r   r   r   <module>rK      s8       "
&^F ^@ zO r   