
    _e                        d Z ddlZddlmZmZmZmZmZmZ ddl	m
Z
  G d de      Z G d de      Z G d	 d
ee      Zeeur G d dee      ZneZ G d dee      Z G d dee      Zedk(  r edd      Z edd      Z edd      ZddlZeeefD ]t  Z ej4                   ej6                  e            Zeek(  sJ  ee       ee      f       ej<                  ej<                  k(  rYJ ej<                  ej<                  f        yy)z)Implementation of OpenGL constant objects    N)bytesunicodeas_8_bitlonginteger_typesmaxsize)_configflagsc                   4     e Zd ZdZd fd	Zd Z fdZ xZS )ConstantaH  OpenGL constant that displays itself as a name rather than a value

    The purpose of this class is to make debugging OpenGL code easier,
    as you recieve messages that say what value you passed in in a
    human-readable form, rather than as a bald number that requires
    lookup and disambiguation in the header file.
    c                    t        |t              st        |t              r| t        urt        ||      S t        |t              r| t
        urt        ||      S t        |t              r| t        urt        ||      S t        |t        t        f      r| t        urt        |t        |            S t        |t              r|t        kD  r
|t        z   }t        t        | ?  | |      }||_        t"        j$                  rbt'        j(                         j*                  }|rB|j*                  r6d|j*                  j,                  v r|j*                  j,                  d   |_        |S )z5Initialise the constant with the given name and value__name__)
isinstancer   floatFloatConstantintIntConstantr   LongConstantr   r   StringConstantr   r   r   super__new__namer	   MODULE_ANNOTATIONSsys	_getframef_back	f_globals
__module__)clsr   valuebaseframe	__class__s        1/usr/lib/python3/dist-packages/OpenGL/constant.pyr   zConstant.__new__   s   5(,5%)c.F$dE33UC)c.D"D%11UD*s,/F#T522UU7O5#^:S%tXe_>>um-w 7?+Xc*C8	**MMO**E*8N8N*N"',,"8"8"D    c                     | j                   S )z+Return the name, rather than the bald valuer   selfs    r#   __repr__zConstant.__repr__#       yyr$   c                 D    | j                   ft        t        |          z   S )z5Produce the new arguments for recreating the instance)r   r   r   __getnewargs__r(   r"   s    r#   r,   zConstant.__getnewargs__&   s    		|eXtDFFFr$   N)r   r   __qualname____doc__r   r)   r,   __classcell__r"   s   @r#   r   r      s    *G Gr$   r   c                   .     e Zd ZdZ fdZd Zd Z xZS )NumericConstantz&Base class for numeric-value constantsc                 H    | j                   dt        t        |          dS z+Return the value as a human-friendly stringz ()r   r   r   __str__r-   s    r#   r9   zNumericConstant.__str__,       ))E(4$@$BCCr$   c                     | j                   S )z&Retrieve state for pickle and the liker&   r'   s    r#   __getstate__zNumericConstant.__getstate__/   r*   r$   c                     || _         y r.   r&   )r(   states     r#   __setstate__zNumericConstant.__setstate__2   s	    	r$   )r   r   r/   r0   r9   r<   r?   r1   r2   s   @r#   r4   r4   *   s    0Dr$   r4   c                       e Zd ZdZy)r   zInteger constantNr   r   r/   r0    r$   r#   r   r   5   s    r$   r   c                       e Zd ZdZy)r   zLong integer constantNrA   rB   r$   r#   r   r   8   s    #r$   r   c                       e Zd ZdZy)r   zFloat constantNrA   rB   r$   r#   r   r   <   s    r$   r   c                   "     e Zd ZdZ fdZ xZS )r   zString constantsc                 H    | j                   dt        t        |          dS r6   r8   r-   s    r#   r)   zStringConstant.__repr__A   r:   r$   )r   r   r/   r0   r)   r1   r2   s   @r#   r   r   ?   s    D Dr$   r   __main__testint   	testfloatg      @teststrzsome testing string)r0   r   OpenGL._bytesr   r   r   r   r   r   OpenGLr	   objectr   r4   r   r   r   r   r   r   r   xyzpicklevalloadsdumpsrestoredstrr   rB   r$   r#   <module>rX      s&   / 
 N N "G "GH	x 	?C d?$ $ L_e Dh D zY#A{C)A	#8:A1u C6<<s!4538Xs3x 88}}(B8==*BB(C r$   