__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
"""Implementation of OpenGL constant objects"""
import sys
from OpenGL._bytes import bytes,unicode,as_8_bit, long, integer_types, maxsize
from OpenGL import _configflags
class Constant( object ):
"""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.
"""
def __new__( cls, name, value=None ):
"""Initialise the constant with the given name and value"""
if not isinstance( value, Constant ):
if isinstance( value, float ) and cls is not FloatConstant:
return FloatConstant( name, value )
elif isinstance( value, int ) and cls is not IntConstant:
return IntConstant( name, value )
elif isinstance( value, long ) and cls is not LongConstant:
return LongConstant( name, value )
elif isinstance( value, (bytes,unicode) ) and cls is not StringConstant:
return StringConstant( name, as_8_bit(value) )
if isinstance( value, integer_types ):
if value > maxsize: # TODO: I'm guessing this should really by sizeof GLint, not
value = - (value & maxsize)
base = super(Constant,cls).__new__( cls, value )
base.name = name
if _configflags.MODULE_ANNOTATIONS:
frame = sys._getframe().f_back
if frame and frame.f_back and '__name__' in frame.f_back.f_globals:
base.__module__ = frame.f_back.f_globals['__name__']
return base
def __repr__( self ):
"""Return the name, rather than the bald value"""
return self.name
def __getnewargs__( self ):
"""Produce the new arguments for recreating the instance"""
return (self.name,) + super( Constant, self ).__getnewargs__()
class NumericConstant( Constant ):
"""Base class for numeric-value constants"""
def __str__( self ):
"""Return the value as a human-friendly string"""
return '%s (%s)'%(self.name,super(Constant,self).__str__())
def __getstate__(self):
"""Retrieve state for pickle and the like"""
return self.name
def __setstate__( self, state ):
self.name = state
class IntConstant( NumericConstant, int ):
"""Integer constant"""
if int is not long:
class LongConstant( NumericConstant, long ):
"""Long integer constant"""
else:
LongConstant = IntConstant
class FloatConstant( NumericConstant, float ):
"""Float constant"""
class StringConstant( Constant, bytes ):
"""String constants"""
def __repr__( self ):
"""Return the value as a human-friendly string"""
return '%s (%s)'%(self.name,super(Constant,self).__str__())
if __name__ == "__main__":
x = IntConstant( 'testint', 3 )
y = FloatConstant( 'testfloat', 3.0 )
z = StringConstant( 'teststr', 'some testing string' )
import pickle
for val in x,y,z:
restored = pickle.loads( pickle.dumps( val ))
assert restored == val, (str(restored),str(val))
assert restored.name == val.name, (restored.name,val.name)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AGL | Folder | 0755 |
|
|
| DLLS | Folder | 0755 |
|
|
| EGL | Folder | 0755 |
|
|
| GL | Folder | 0755 |
|
|
| GLE | Folder | 0755 |
|
|
| GLES1 | Folder | 0755 |
|
|
| GLES2 | Folder | 0755 |
|
|
| GLES3 | Folder | 0755 |
|
|
| GLU | Folder | 0755 |
|
|
| GLUT | Folder | 0755 |
|
|
| GLX | Folder | 0755 |
|
|
| Tk | Folder | 0755 |
|
|
| WGL | Folder | 0755 |
|
|
| __pycache__ | Folder | 0755 |
|
|
| arrays | Folder | 0755 |
|
|
| osmesa | Folder | 0755 |
|
|
| platform | Folder | 0755 |
|
|
| raw | Folder | 0755 |
|
|
| __init__.py | File | 12.39 KB | 0644 |
|
| _bytes.py | File | 2.56 KB | 0644 |
|
| _configflags.py | File | 450 B | 0644 |
|
| _null.py | File | 72 B | 0644 |
|
| _opaque.py | File | 850 B | 0644 |
|
| acceleratesupport.py | File | 884 B | 0644 |
|
| constant.py | File | 3.23 KB | 0644 |
|
| constants.py | File | 149 B | 0644 |
|
| contextdata.py | File | 4.44 KB | 0644 |
|
| converters.py | File | 12.73 KB | 0644 |
|
| error.py | File | 9.39 KB | 0644 |
|
| extensions.py | File | 9.28 KB | 0644 |
|
| images.py | File | 6.73 KB | 0644 |
|
| latebind.py | File | 2.47 KB | 0644 |
|
| lazywrapper.py | File | 2.07 KB | 0644 |
|
| logs.py | File | 3.08 KB | 0644 |
|
| plugins.py | File | 2.41 KB | 0644 |
|
| version.py | File | 93 B | 0644 |
|
| wrapper.py | File | 73.84 KB | 0644 |
|