예제 #1
0
    def get_extensions(self):
        if not gl_info.have_context():
            warnings.warn("Can't query WGL until a context is created.")
            return []

        try:
            return asstr(wglGetExtensionsStringEXT()).split()
        except MissingFunctionException:
            return asstr(cast(glGetString(GL_EXTENSIONS), c_char_p).value).split()
예제 #2
0
파일: wgl_info.py 프로젝트: Chris-m41/CS241
    def get_extensions(self):
        if not gl_info.have_context():
            warnings.warn("Can't query WGL until a context is created.")
            return []

        try:
            return asstr(wglGetExtensionsStringEXT()).split()
        except MissingFunctionException:
            return asstr(cast(glGetString(GL_EXTENSIONS), c_char_p).value).split()
예제 #3
0
    def set_active_context(self):
        """Store information for the currently active context.

        This method is called automatically for the default context.
        """
        self.have_context = True
        if not self._have_info:
            self.extensions = asstr(cast(gluGetString(GLU_EXTENSIONS), c_char_p).value).split()
            self.version = asstr(cast(gluGetString(GLU_VERSION), c_char_p).value)
            self._have_info = True
예제 #4
0
파일: glu_info.py 프로젝트: rougier/pyglet
    def set_active_context(self):
        """Store information for the currently active context.

        This method is called automatically for the default context.
        """
        self.have_context = True
        if not self._have_info:
            self.extensions = asstr(cast(gluGetString(GLU_EXTENSIONS), c_char_p).value).split()
            self.version = asstr(cast(gluGetString(GLU_VERSION), c_char_p).value)
            self._have_info = True
예제 #5
0
파일: gl_info.py 프로젝트: izacus/pyglet
    def set_active_context(self):
        '''Store information for the currently active context.

        This method is called automatically for the default context.
        '''
        self.have_context = True
        if not self._have_info:
            self.vendor = asstr(cast(glGetString(GL_VENDOR), c_char_p).value)
            self.renderer = asstr(cast(glGetString(GL_RENDERER),
                                       c_char_p).value)
            self.extensions = asstr(cast(glGetString(GL_EXTENSIONS),
                                         c_char_p).value)
            if self.extensions:
                self.extensions = set(self.extensions.split())
            self.version = asstr(cast(glGetString(GL_VERSION), c_char_p).value)
            self._have_info = True
예제 #6
0
    def _get_string(self, name):
        value = self._get_value(name)

        if value and value.type == FcTypeString:
            return asstr(value.u.s)
        else:
            return None
예제 #7
0
    def _get_string(self, name):
        value = self._get_value(name)

        if value and value.type == FcTypeString:
            return asstr(value.u.s)
        else:
            return None
예제 #8
0
    def __init__(self, display, device_info):
        super(XInputDevice, self).__init__(display, asstr(device_info.name))

        self._device_id = device_info.id
        self._device = None

        # Read device info
        self.buttons = []
        self.keys = []
        self.axes = []

        ptr = device_info.inputclassinfo
        for i in range(device_info.num_classes):
            cp = ctypes.cast(ptr, ctypes.POINTER(xi.XAnyClassInfo))
            cls_class = getattr(cp.contents, 'class')

            if cls_class == xi.KeyClass:
                cp = ctypes.cast(ptr, ctypes.POINTER(xi.XKeyInfo))
                self.min_keycode = cp.contents.min_keycode
                num_keys = cp.contents.num_keys
                for i in range(num_keys):
                    self.keys.append(Button('key%d' % i))

            elif cls_class == xi.ButtonClass:
                cp = ctypes.cast(ptr, ctypes.POINTER(xi.XButtonInfo))
                num_buttons = cp.contents.num_buttons
                # Pointer buttons start at index 1, with 0 as 'AnyButton'
                for i in range(num_buttons + 1):
                    self.buttons.append(Button('button%d' % i))

            elif cls_class == xi.ValuatorClass:
                cp = ctypes.cast(ptr, ctypes.POINTER(xi.XValuatorInfo))
                num_axes = cp.contents.num_axes
                mode = cp.contents.mode
                axes = ctypes.cast(cp.contents.axes,
                                   ctypes.POINTER(xi.XAxisInfo))
                for i in range(num_axes):
                    axis = axes[i]
                    if mode == xi.Absolute:
                        self.axes.append(
                            AbsoluteAxis('axis%d' % i,
                                         min=axis.min_value,
                                         max=axis.max_value))
                    elif mode == xi.Relative:
                        self.axes.append(RelativeAxis('axis%d' % i))

            cls = cp.contents
            ptr = ptr_add(ptr, cls.length)

        self.controls = self.buttons + self.keys + self.axes

        # Can't detect proximity class event without opening device.  Just
        # assume there is the possibility of a control if there are any axes.
        if self.axes:
            self.proximity_control = Button('proximity')
            self.controls.append(self.proximity_control)
        else:
            self.proximity_control = None
예제 #9
0
def ffmpeg_file_info(file):
    """Get information on the file:

        - number of streams
        - duration
        - artist
        - album
        - date
        - track

    :rtype: FileInfo
    :return: The file info instance containing all the meta information.
    """
    info = FileInfo()
    info.n_streams = file.context.contents.nb_streams
    info.start_time = file.context.contents.start_time
    info.duration = file.context.contents.duration

    entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('title'), None, 0)
    if entry:
        info.title = asstr(entry.contents.value)

    entry = avutil.av_dict_get(file.context.contents.metadata,
                               asbytes('artist'),
                               None,
                               0) \
            or \
            avutil.av_dict_get(file.context.contents.metadata,
                               asbytes('album_artist'),
                               None,
                               0)
    if entry:
        info.author = asstr(entry.contents.value)

    entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('copyright'), None, 0)
    if entry:
        info.copyright = asstr(entry.contents.value)

    entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('comment'), None, 0)
    if entry:
        info.comment = asstr(entry.contents.value)

    entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('album'), None, 0)
    if entry:
        info.album = asstr(entry.contents.value)

    entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('date'), None, 0)
    if entry:
        info.year = int(entry.contents.value)

    entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('track'), None, 0)
    if entry:
        info.track = asstr(entry.contents.value)

    entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('genre'), None, 0)
    if entry:
        info.genre = asstr(entry.contents.value)

    return info
예제 #10
0
    def __init__(self, display, device_info):
        super(XInputDevice, self).__init__(display, asstr(device_info.name))

        self._device_id = device_info.id
        self._device = None

        # Read device info
        self.buttons = []
        self.keys = []
        self.axes = []

        ptr = device_info.inputclassinfo
        for i in range(device_info.num_classes):
            cp = ctypes.cast(ptr, ctypes.POINTER(xi.XAnyClassInfo))
            cls_class = getattr(cp.contents, 'class')

            if cls_class == xi.KeyClass:
                cp = ctypes.cast(ptr, ctypes.POINTER(xi.XKeyInfo))
                self.min_keycode = cp.contents.min_keycode
                num_keys = cp.contents.num_keys
                for i in range(num_keys):
                    self.keys.append(Button('key%d' % i))

            elif cls_class == xi.ButtonClass:
                cp = ctypes.cast(ptr, ctypes.POINTER(xi.XButtonInfo))
                num_buttons = cp.contents.num_buttons
                for i in range(num_buttons):
                    self.buttons.append(Button('button%d' % i))

            elif cls_class == xi.ValuatorClass:
                cp = ctypes.cast(ptr, ctypes.POINTER(xi.XValuatorInfo))
                num_axes = cp.contents.num_axes
                mode = cp.contents.mode
                axes = ctypes.cast(cp.contents.axes,
                                   ctypes.POINTER(xi.XAxisInfo))
                for i in range(num_axes):
                    axis = axes[i]
                    if mode == xi.Absolute:
                        self.axes.append(AbsoluteAxis('axis%d' % i,
                            min=axis.min_value,
                            max=axis.max_value))
                    elif mode == xi.Relative:
                        self.axes.append(RelativeAxis('axis%d' % i))

            cls = cp.contents
            ptr = ptr_add(ptr, cls.length)

        self.controls = self.buttons + self.keys + self.axes

        # Can't detect proximity class event without opening device.  Just
        # assume there is the possibility of a control if there are any axes.
        if self.axes:
            self.proximity_control = Button('proximity')
            self.controls.append(self.proximity_control)
        else:
            self.proximity_control = None
예제 #11
0
    def set_active_context(self):
        '''Store information for the currently active context.

        This method is called automatically for the default context.
        '''
        self.have_context = True
        if not self._have_info:
            self.vendor = asstr(cast(glGetString(GL_VENDOR), c_char_p).value)
            self.renderer = asstr(cast(glGetString(GL_RENDERER),
                                       c_char_p).value)
            self.version = asstr(cast(glGetString(GL_VERSION), c_char_p).value)
            if self.have_version(3):
                from pyglet.gl.glext_arb import glGetStringi, GL_NUM_EXTENSIONS
                num_extensions = GLint()
                glGetIntegerv(GL_NUM_EXTENSIONS, num_extensions)
                self.extensions = (asstr(cast(glGetStringi(GL_EXTENSIONS, i),
                                         c_char_p).value) for i in range(num_extensions.value))
            else:
                self.extensions = asstr(cast(glGetString(GL_EXTENSIONS),
                         c_char_p).value).split()
            if self.extensions:
                self.extensions = set(self.extensions)
            self._have_info = True
예제 #12
0
파일: gl_info.py 프로젝트: dee6600/RL
    def set_active_context(self):
        '''Store information for the currently active context.

        This method is called automatically for the default context.
        '''
        self.have_context = True
        if not self._have_info:
            self.vendor = asstr(cast(glGetString(GL_VENDOR), c_char_p).value)
            self.renderer = asstr(cast(glGetString(GL_RENDERER),
                                       c_char_p).value)
            self.version = asstr(cast(glGetString(GL_VERSION), c_char_p).value)
            if self.have_version(3):
                from pyglet.gl.glext_arb import glGetStringi, GL_NUM_EXTENSIONS
                num_extensions = GLint()
                glGetIntegerv(GL_NUM_EXTENSIONS, num_extensions)
                self.extensions = (asstr(cast(glGetStringi(GL_EXTENSIONS, i),
                                         c_char_p).value) for i in range(num_extensions.value))
            else:
                self.extensions = asstr(cast(glGetString(GL_EXTENSIONS),
                         c_char_p).value).split()
            if self.extensions:
                self.extensions = set(self.extensions)
            self._have_info = True
예제 #13
0
 def get_server_vendor(self):
     self.check_display()
     return asstr(glXQueryServerString(self.display, 0, GLX_VENDOR))
예제 #14
0
 def get_extensions(self):
     self.check_display()
     return asstr(glXQueryExtensionsString(self.display, 0)).split()
예제 #15
0
 def get_client_extensions(self):
     self.check_display()
     return asstr(glXGetClientString(self.display, GLX_EXTENSIONS)).split()
예제 #16
0
 def get_client_version(self):
     self.check_display()
     return asstr(glXGetClientString(self.display, GLX_VERSION))
예제 #17
0
 def get_client_vendor(self):
     self.check_display()
     return asstr(glXGetClientString(self.display, GLX_VENDOR))
예제 #18
0
 def get_server_extensions(self):
     self.check_display()
     return asstr(glXQueryServerString(self.display, 0,
                                       GLX_EXTENSIONS)).split()
예제 #19
0
 def get_server_extensions(self):
     self.check_display()
     return asstr(glXQueryServerString(self.display, 0, GLX_EXTENSIONS)).split()
예제 #20
0
 def family_name(self):
     return asstr(self.ft_face.contents.family_name)
예제 #21
0
 def get_extensions(self):
     self.check_display()
     return asstr(glXQueryExtensionsString(self.display, 0)).split()
예제 #22
0
 def get_server_vendor(self):
     self.check_display()
     return asstr(glXQueryServerString(self.display, 0, GLX_VENDOR))
예제 #23
0
파일: glx_info.py 프로젝트: sangh/LaserShow
 def get_client_vendor(self):
     self.check_display()
     return asstr(glXGetClientString(self.display, GLX_VENDOR))
예제 #24
0
파일: glx_info.py 프로젝트: sangh/LaserShow
 def get_client_version(self):
     self.check_display()
     return asstr(glXGetClientString(self.display, GLX_VERSION))
예제 #25
0
파일: glx_info.py 프로젝트: sangh/LaserShow
 def get_client_extensions(self):
     self.check_display()
     return asstr(glXGetClientString(self.display, GLX_EXTENSIONS)).split()
예제 #26
0
파일: freetype.py 프로젝트: ajhager/copycat
 def family_name(self):
     return asstr(self.ft_face.contents.family_name)