Exemple #1
0
    def pixel(token):
        '''
        Converts a raw pixel value into a PixelId /w integer

        P0x3 -> 3
        '''
        if isinstance(token, int):
            return PixelId(token)
        else:
            return PixelId(int(token[1:], 0))
Exemple #2
0
    def pixelmod(pixels, modifiers):
        '''
        Apply modifiers to list of pixels/pixellists

        Results in a combination of pixel capabilities
        '''
        pixelcap_list = []
        for pixel in pixels:
            # Convert HIDIds into PixelIds
            if isinstance(pixel, HIDId) or isinstance(pixel, ScanCodeId):
                pixel = PixelId(pixel)
            pixel.setModifiers(modifiers)
            pixelcap_list.append(pixel)
        return pixelcap_list
Exemple #3
0
    def pixelmod(pixels, modifiers):
        '''
        Apply modifiers to list of pixels/pixellists

        Results in a combination of pixel capabilities
        '''
        pixelcap_list = []
        for pixel in pixels:
            # Convert HIDIds into PixelIds
            if isinstance(pixel, HIDId) or isinstance(pixel, ScanCodeId):
                pixel = PixelId(pixel)
            pixel.setModifiers(modifiers)
            pixelcap_list.append(pixel)
        return pixelcap_list
Exemple #4
0
 def pixel_list(pixel_list):
     '''
     Converts a list a numbers into a list of PixelIds
     '''
     pixels = []
     for pixel in pixel_list:
         pixels.append(PixelId(pixel))
     return pixels