# uncompyle6 version 3.7.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.8.5 (default, Aug 12 2020, 00:00:00) 
# [GCC 10.2.1 20200723 (Red Hat 10.2.1-1)]
# Embedded file name: c:\Jenkins\live\output\Live\win_64_static\Release\python-bundle\MIDI Remote Scripts\Push\special_physical_display.py
# Compiled at: 2020-05-05 13:23:28
from __future__ import absolute_import, print_function, unicode_literals
from ableton.v2.base import group, flatten
from ableton.v2.control_surface.elements import PhysicalDisplayElement
DISPLAY_BLOCK_LENGTH = 18

class SpecialPhysicalDisplay(PhysicalDisplayElement):
    """
    Special physical display subclass that handles custom and special characters
    """
    ascii_translations = {b'\x00': 0, 
       b'\x01': 1, 
       b'\x02': 2, 
       b'\x03': 3, 
       b'\x04': 4, 
       b'\x05': 5, 
       b'\x06': 6, 
       b'\x07': 7, 
       b'¦': 8, 
       b'°': 9, 
       b'Ä': 10, 
       b'Ç': 11, 
       b'Ö': 12, 
       b'Ü': 13, 
       b'ß': 14, 
       b'à': 15, 
       b'ä': 16, 
       b'ç': 17, 
       b'è': 18, 
       b'é': 19, 
       b'ê': 20, 
       b'î': 21, 
       b'ñ': 22, 
       b'ö': 23, 
       b'÷': 24, 
       b'ø': 25, 
       b'ü': 26, 
       b'♭': 27, 
       b'\x1b': 27, 
       b'\x1c': 28, 
       b'\x1d': 29, 
       b'\x1e': 30, 
       b'\x1f': 31, 
       b' ': 32, 
       b'!': 33, 
       b'"': 34, 
       b'#': 35, 
       b'$': 36, 
       b'%': 37, 
       b'&': 38, 
       b"'": 39, 
       b'(': 40, 
       b')': 41, 
       b'*': 42, 
       b'+': 43, 
       b',': 44, 
       b'-': 45, 
       b'.': 46, 
       b'/': 47, 
       b'0': 48, 
       b'1': 49, 
       b'2': 50, 
       b'3': 51, 
       b'4': 52, 
       b'5': 53, 
       b'6': 54, 
       b'7': 55, 
       b'8': 56, 
       b'9': 57, 
       b':': 58, 
       b';': 59, 
       b'<': 60, 
       b'=': 61, 
       b'>': 62, 
       b'?': 63, 
       b'@': 64, 
       b'A': 65, 
       b'B': 66, 
       b'C': 67, 
       b'D': 68, 
       b'E': 69, 
       b'F': 70, 
       b'G': 71, 
       b'H': 72, 
       b'I': 73, 
       b'J': 74, 
       b'K': 75, 
       b'L': 76, 
       b'M': 77, 
       b'N': 78, 
       b'O': 79, 
       b'P': 80, 
       b'Q': 81, 
       b'R': 82, 
       b'S': 83, 
       b'T': 84, 
       b'U': 85, 
       b'V': 86, 
       b'W': 87, 
       b'X': 88, 
       b'Y': 89, 
       b'Z': 90, 
       b'[': 91, 
       b'\\': 92, 
       b']': 93, 
       b'^': 94, 
       b'_': 95, 
       b'`': 96, 
       b'a': 97, 
       b'b': 98, 
       b'c': 99, 
       b'd': 100, 
       b'e': 101, 
       b'f': 102, 
       b'g': 103, 
       b'h': 104, 
       b'i': 105, 
       b'j': 106, 
       b'k': 107, 
       b'l': 108, 
       b'm': 109, 
       b'n': 110, 
       b'o': 111, 
       b'p': 112, 
       b'q': 113, 
       b'r': 114, 
       b's': 115, 
       b't': 116, 
       b'u': 117, 
       b'v': 118, 
       b'w': 119, 
       b'x': 120, 
       b'y': 121, 
       b'z': 122, 
       b'{': 125, 
       b'|': 124, 
       b'}': 125, 
       b'~': 126, 
       b'\x7f': 127}

    def set_num_segments(self, num_segments):
        super(SpecialPhysicalDisplay, self).set_num_segments(num_segments)
        for segment in self._logical_segments:
            segment.separator = b' '

    def _build_inner_message(self, message):
        message = super(SpecialPhysicalDisplay, self)._build_inner_message(message)
        return flatten([ g[:-1] for g in group(message, DISPLAY_BLOCK_LENGTH) ])
# okay decompiling /home/deniz/data/projects/midiremote/Live 10.1.18/Push/special_physical_display.pyc
