"""System module."""
from __future__ import absolute_import
class EventKey():
    '''Event Key'''
    @staticmethod
    def key_event_table (char):
        ''' key_event_table '''
        char_list= {
                "KEYEVENT_UNKNOWN": "0",
                "KEYEVENT_SOFT_LEFT": "1",
                "KEYEVENT_SOFT_RIGHT": "2",
                "KEYEVENT_HOME": "3",
                "KEYEVENT_BACK": "4",
                "KEYEVENT_CALL": "5",
                "KEYEVENT_ENDCALL": "6",
                "KEYEVENT_0": "7",
                "KEYEVENT_1": "8",
                "KEYEVENT_2": "9",
                "KEYEVENT_3": "10",
                "KEYEVENT_4": "11",
                "KEYEVENT_5": "12",
                "KEYEVENT_6": "13",
                "KEYEVENT_7": "14",
                "KEYEVENT_8": "15",
                "KEYEVENT_9": "16",
                "KEYEVENT_STAR": "17",
                "KEYEVENT_POUND": "18",
                "KEYEVENT_DPAD_UP": "19",
                "KEYEVENT_DPAD_DOWN": "20",
                "KEYEVENT_DPAD_LEFT": "21",
                "KEYEVENT_DPAD_RIGHT": "22",
                "KEYEVENT_DPAD_CENTER": "23",
                "KEYEVENT_VOLUME_UP": "24",
                "KEYEVENT_VOLUME_DOWN": "25",
                "KEYEVENT_POWER": "26",
                "KEYEVENT_CAMERA": "27",
                "KEYEVENT_CLEAR": "28",
                "KEYEVENT_A": "29",
                "KEYEVENT_B": "30",
                "KEYEVENT_C": "31",
                "KEYEVENT_D": "32",
                "KEYEVENT_E": "33",
                "KEYEVENT_F": "34",
                "KEYEVENT_G": "35",
                "KEYEVENT_H": "36",
                "KEYEVENT_I": "37",
                "KEYEVENT_J": "38",
                "KEYEVENT_K": "39",
                "KEYEVENT_L": "40",
                "KEYEVENT_M": "41",
                "KEYEVENT_N": "42",
                "KEYEVENT_O": "43",
                "KEYEVENT_P": "44",
                "KEYEVENT_Q": "45",
                "KEYEVENT_R": "46",
                "KEYEVENT_S": "47",
                "KEYEVENT_T": "48",
                "KEYEVENT_U": "49",
                "KEYEVENT_V": "50",
                "KEYEVENT_W": "51",
                "KEYEVENT_X": "52",
                "KEYEVENT_Y": "53",
                "KEYEVENT_Z": "54",
                "KEYEVENT_,": "55",
                "KEYEVENT_PERIOD": "56",
                "KEYEVENT_ALT_LEFT": "57",
                "KEYEVENT_ALT_RIGHT": "58",
                "KEYEVENT_SHIFT_LEFT": "59",
                "KEYEVENT_SHIFT_RIGHT": "60",
                "KEYEVENT_TAB": "61",
                "KEYEVENT_SPACE": "62",
                "KEYEVENT_SYM": "63",
                "KEYEVENT_EXPLORER": "64",
                "KEYEVENT_ENVELOPE": "65",
                "KEYEVENT_ENTER": "66",
                "KEYEVENT_DEL": "67",
                "KEYEVENT_GRAVE": "68",
                "KEYEVENT_MINUS": "69",
                "KEYEVENT_EQUALS": "70",
                "KEYEVENT_LEFT_BRACKET": "71",
                "KEYEVENT_RIGHT_BRACKET": "72",
                "KEYEVENT_BACKSLASH": "73",
                "KEYEVENT_SEMICOLON": "74",
                "KEYEVENT_APOSTROPHE": "75",
                "KEYEVENT_SLASH": "76",
                "KEYEVENT_AT": "77",
                "KEYEVENT_NUM": "78",
                "KEYEVENT_HEADSETHOOK": "79",
                "KEYEVENT_PLUS": "81",
                "KEYEVENT_MENU": "82",
                "KEYEVENT_NOTIFICATION": "83",
                "KEYEVENT_SEARCH": "84",
                "KEYEVENT_MEDIA_PLAY_PAUSE": "85",
                "KEYEVENT_MEDIA_STOP": "86",
                "KEYEVENT_MEDIA_NEXT": "87",
                "KEYEVENT_MEDIA_PREVIOUS": "88",
                "KEYEVENT_MEDIA_REWIND": "89",
                "KEYEVENT_MEDIA_FAST_FORWARD": "90",
                "KEYEVENT_MUTE": "91",
                "KEYEVENT_PAGE_UP": "92",
                "KEYEVENT_PAGE_DOWN": "93",
                "KEYEVENT_BUTTON_A": "96",
                "KEYEVENT_BUTTON_B": "97",
                "KEYEVENT_BUTTON_C": "98",
                "KEYEVENT_BUTTON_X": "99",
                "KEYEVENT_BUTTON_Y": "100",
                "KEYEVENT_BUTTON_Z": "101",
                "KEYEVENT_BUTTON_L1": "102",
                "KEYEVENT_BUTTON_R1": "103",
                "KEYEVENT_BUTTON_L2": "104",
                "KEYEVENT_BUTTON_R2": "105",
                "KEYEVENT_BUTTON_THUMBL": "106",
                "KEYEVENT_BUTTON_THUMBR": "107",
                "KEYEVENT_BUTTON_START": "108",
                "KEYEVENT_BUTTON_SELECT": "109",
                "KEYEVENT_BUTTON_MODE": "110",
                "KEYEVENT_ESCAPE": "111",
                "KEYEVENT_FORWARD_DEL": "112",
                "KEYEVENT_CTRL_LEFT": "113",
                "KEYEVENT_CTRL_RIGHT": "114",
                "KEYEVENT_CAPS_LOCK": "115",
                "KEYEVENT_SCROLL_LOCK": "116",
                "KEYEVENT_META_LEFT": "117",
                "KEYEVENT_META_RIGHT": "118",
                "KEYEVENT_FUNCTION": "119",
                "KEYEVENT_SYSRQ": "120",
                "KEYEVENT_BREAK": "121",
                "KEYEVENT_MOVE_HOME": "122",
                "KEYEVENT_MOVE_END": "123",
                "KEYEVENT_INSERT": "124",
                "KEYEVENT_FORWARD": "125",
                "KEYEVENT_MEDIA_PLAY": "126",
                "KEYEVENT_MEDIA_PAUSE": "127",
                "KEYEVENT_MEDIA_CLOSE": "128",
                "KEYEVENT_MEDIA_EJECT": "129",
                "KEYEVENT_MEDIA_RECORD": "130",
                "KEYEVENT_F1": "131",
                "KEYEVENT_F2": "132",
                "KEYEVENT_F3": "133",
                "KEYEVENT_F4": "134",
                "KEYEVENT_F5": "135",
                "KEYEVENT_F6": "136",
                "KEYEVENT_F7": "137",
                "KEYEVENT_F8": "138",
                "KEYEVENT_F9": "139",
                "KEYEVENT_F10": "140",
                "KEYEVENT_F11": "141",
                "KEYEVENT_F12": "142",
                "KEYEVENT_NUM_LOCK": "143",
                "KEYEVENT_NUMPAD_0": "144",
                "KEYEVENT_NUMPAD_1": "145",
                "KEYEVENT_NUMPAD_2": "146",
                "KEYEVENT_NUMPAD_3": "147",
                "KEYEVENT_NUMPAD_4": "148",
                "KEYEVENT_NUMPAD_5": "149",
                "KEYEVENT_NUMPAD_6": "150",
                "KEYEVENT_NUMPAD_7": "151",
                "KEYEVENT_NUMPAD_8": "152",
                "KEYEVENT_NUMPAD_9": "153",
                "KEYEVENT_NUMPAD_DIVIDE": "154",
                "KEYEVENT_NUMPAD_MULTIPLY": "155",
                "KEYEVENT_NUMPAD_SUBTRACT": "156",
                "KEYEVENT_NUMPAD_ADD": "157",
                "KEYEVENT_NUMPAD_DOT": "158",
                "KEYEVENT_NUMPAD_COMMA": "159",
                "KEYEVENT_NUMPAD_ENTER": "160",
                "KEYEVENT_NUMPAD_EQUALS": "161",
                "KEYEVENT_NUMPAD_LEFT_PAREN": "162",
                "KEYEVENT_NUMPAD_RIGHT_PAREN": "163",
                "KEYEVENT_VOLUME_MUTE": "164",
                "KEYEVENT_INFO": "165",
                "KEYEVENT_CHANNEL_UP": "166",
                "KEYEVENT_CHANNEL_DOWN": "167",
                "KEYEVENT_ZOOM_IN": "168",
                "KEYEVENT_ZOOM_OUT": "169",
                "KEYEVENT_TV": "170",
                "KEYEVENT_WINDOW": "171",
                "KEYEVENT_GUIDE": "172",
                "KEYEVENT_DVR": "173",
                "KEYEVENT_BOOKMARK": "174",
                "KEYEVENT_CAPTIONS": "175",
                "KEYEVENT_SETTINGS": "176",
                "KEYEVENT_TV_POWER": "177",
                "KEYEVENT_TV_INPUT": "178",
                "KEYEVENT_STB_POWER": "179",
                "KEYEVENT_STB_INPUT": "180",
                "KEYEVENT_AVR_POWER": "181",
                "KEYEVENT_AVR_INPUT": "182",
                "KEYEVENT_PROG_RED": "183",
                "KEYEVENT_PROG_GREEN": "184",
                "KEYEVENT_PROG_YELLOW": "185",
                "KEYEVENT_PROG_BLUE": "186",
                "KEYEVENT_APP_SWITCH": "187",
                "KEYEVENT_BUTTON_1": "188",
                "KEYEVENT_BUTTON_2": "189",
                "KEYEVENT_BUTTON_3": "190",
                "KEYEVENT_BUTTON_4": "191",
                "KEYEVENT_BUTTON_5": "192",
                "KEYEVENT_BUTTON_6": "193",
                "KEYEVENT_META_SHIFT_ON" : "193",
                "KEYEVENT_BUTTON_7": "194",
                "KEYEVENT_BUTTON_8": "195",
                "KEYEVENT_BUTTON_9": "196",
                "KEYEVENT_BUTTON_10": "197",
                "KEYEVENT_BUTTON_11": "198",
                "KEYEVENT_BUTTON_12": "199",
                "KEYEVENT_BUTTON_13": "200",
                "KEYEVENT_BUTTON_14": "201",
                "KEYEVENT_BUTTON_15": "202",
                "KEYEVENT_BUTTON_16": "203",
                "KEYEVENT_LANGUAGE_SWITCH": "204",
                "KEYEVENT_MANNER_MODE": "205",
                "KEYEVENT_3D_MODE": "206",
                "KEYEVENT_CONTACTS": "207",
                "KEYEVENT_CALENDAR": "208",
                "KEYEVENT_MUSIC": "209",
                "KEYEVENT_CALCULATOR": "210",
                "KEYEVENT_ZENKAKU_HANKAKU": "211",
                "KEYEVENT_EISU": "212",
                "KEYEVENT_MUHENKAN": "213",
                "KEYEVENT_HENKAN": "214",
                "KEYEVENT_KATAKANA_HIRAGANA": "215",
                "KEYEVENT_YEN": "216",
                "KEYEVENT_RO": "217",
                "KEYEVENT_KANA": "218",
                "KEYEVENT_ASSIST": "219",
                "KEYEVENT_BRIGHTNESS_DOWN": "220",
                "KEYEVENT_BRIGHTNESS_UP": "221",
                "KEYEVENT_MEDIA_AUDIO_TRACK": "222",
                "KEYEVENT_SLEEP": "223",
                "KEYEVENT_WAKEUP": "224",
                "KEYEVENT_PAIRING": "225",
                "KEYEVENT_MEDIA_TOP_MENU": "226",
                "KEYEVENT_11": "227",
                "KEYEVENT_12": "228",
                "KEYEVENT_LAST_CHANNEL": "229",
                "KEYEVENT_TV_DATA_SERVICE": "230",
                "KEYEVENT_VOICE_ASSIST": "231",
                "KEYEVENT_TV_RADIO_SERVICE": "232",
                "KEYEVENT_TV_TELETEXT": "233",
                "KEYEVENT_TV_NUMBER_ENTRY": "234",
                "KEYEVENT_TV_TERRESTRIAL_ANALOG": "235",
                "KEYEVENT_TV_TERRESTRIAL_DIGITAL": "236",
                "KEYEVENT_TV_SATELLITE": "237",
                "KEYEVENT_TV_SATELLITE_BS": "238",
                "KEYEVENT_TV_SATELLITE_CS": "239",
                "KEYEVENT_TV_SATELLITE_SERVICE": "240",
                "KEYEVENT_TV_NETWORK": "241",
                "KEYEVENT_TV_ANTENNA_CABLE": "242",
                "KEYEVENT_TV_INPUT_HDMI_1": "243",
                "KEYEVENT_TV_INPUT_HDMI_2": "244",
                "KEYEVENT_TV_INPUT_HDMI_3": "245",
                "KEYEVENT_TV_INPUT_HDMI_4": "246",
                "KEYEVENT_TV_INPUT_COMPOSITE_1": "247",
                "KEYEVENT_TV_INPUT_COMPOSITE_2": "248",
                "KEYEVENT_TV_INPUT_COMPONENT_1": "249",
                "KEYEVENT_TV_INPUT_COMPONENT_2": "250",
                "KEYEVENT_TV_INPUT_VGA_1": "251",
                "KEYEVENT_TV_AUDIO_DESCRIPTION": "252",
                "KEYEVENT_TV_AUDIO_DESCRIPTION_MIX_UP": "253",
                "KEYEVENT_TV_AUDIO_DESCRIPTION_MIX_DOWN": "254",
                "KEYEVENT_TV_ZOOM_MODE": "255",
                "KEYEVENT_TV_CONTENTS_MENU": "256",
                "KEYEVENT_TV_MEDIA_CONTEXT_MENU": "257",
                "KEYEVENT_TV_TIMER_PROGRAMMING": "258",
                "KEYEVENT_HELP": "259",
                "KEYEVENT_NAVIGATE_PREVIOUS": "260",
                "KEYEVENT_NAVIGATE_NEXT": "261",
                "KEYEVENT_NAVIGATE_IN": "262",
                "KEYEVENT_NAVIGATE_OUT": "263",
                "KEYEVENT_STEM_PRIMARY": "264",
                "KEYEVENT_STEM_1": "265",
                "KEYEVENT_STEM_2": "266",
                "KEYEVENT_STEM_3": "267",
                "KEYEVENT_DPAD_UP_LEFT": "268",
                "KEYEVENT_DPAD_DOWN_LEFT": "269",
                "KEYEVENT_DPAD_UP_RIGHT": "270",
                "KEYEVENT_DPAD_DOWN_RIGHT": "271",
                "KEYEVENT_MEDIA_SKIP_FORWARD": "272",
                "KEYEVENT_MEDIA_SKIP_BACKWARD": "273",
                "KEYEVENT_MEDIA_STEP_FORWARD": "274",
                "KEYEVENT_MEDIA_STEP_BACKWARD": "275",
                "KEYEVENT_SOFT_SLEEP": "276",
                "KEYEVENT_CUT": "277",
                "KEYEVENT_COPY": "278",
                "KEYEVENT_PASTE": "279",
                "KEYEVENT_SYSTEM_NAVIGATION_UP": "280",
                "KEYEVENT_SYSTEM_NAVIGATION_DOWN": "281",
                "KEYEVENT_SYSTEM_NAVIGATION_LEFT": "282",
                "KEYEVENT_SYSTEM_NAVIGATION_RIGHT": "283",
                "KEYEVENT_KEYCODE_ALL_APPS": "284",
                "KEYEVENT_KEYCODE_REFRESH": "285",
                "KEYEVENT_KEYCODE_THUMBS_UP": "286",
                "KEYEVENT_KEYCODE_THUMBS_DOWN": "287"
        }
        if char in char_list.keys():
            return char_list[char]
        return None
    def get_array_of_char(self,string):
        ''' get_array_of_char '''
        array_of_key_event=[]
        if len(string) > 1 and self.key_event_table(string) is not None:
            array_of_key_event.append(self.key_event_table(string.upper()))
        else:
            for letter in list(string):
            #for letter in [char for char in string]:
                key_value = self.key_event_table('KEYEVENT_' + letter.upper())
                if key_value is None:
                    print ('this char: ' + letter + ' will be ignored')
                else:
                    if letter.isupper() is True:
                        array_of_key_event.append(
                            key_value + "," + self.key_event_table('KEYEVENT_META_SHIFT_ON'))
                    else:
                        array_of_key_event.append(key_value)
        return array_of_key_event
