예제 #1
0
def translate_symbol_keys(ks):
    ps = keys.keys_to_positions(ks)
    null_position = ps[0]
    number_position = ps[1]
    necessary_positions = tuple(ps[2: 4])
    choice_positions = ps[4]
    pinky_position = ps[5]
    main_positions = tuple(ps[6: 8])
    second_modifier_positions = ps[8]
    first_modifier_positions = ps[9]

    assert(necessary_positions == (NON, UPP))
    if (null_position == NON) and (number_position == NON) and (pinky_position == NON):
        main_map = choice_map[choice_positions]
        if main_map is None:
            main_symbol = ''
        else:
            main_symbol = main_map[tuple(reversed(main_positions))]
            print('main = {}'.format(main_symbol))
        first_modifier = first_modifier_map[first_modifier_positions]
        second_modifier = second_modifier_map[second_modifier_positions]
        combined = main_symbol + first_modifier + second_modifier
        if combined == '' :
            combined = '{#Tab}'
    elif (null_position == NON) and (number_position == UPP) and (pinky_position == NON):
        first_positions = (ps[4], ps[9])
        second_positions = (ps[8], ps[7])
        third_positions = (ps[6], ps[5])
        combined = number_map[first_positions] + number_map[second_positions] + number_map[third_positions] + '{^}'
    else:
        combined = ''
    print('combined is {}'.format(combined))
    return combined
예제 #2
0
def translate_edit_keys(ks):
    ps = keys.keys_to_positions(ks)
    k = (tuple(ps[0:2]), tuple(reversed(ps[5:9])))
    can_repeat_and_edit = edit_map.get(k)
    if can_repeat_and_edit is not None:
        can_repeat, edit = can_repeat_and_edit
    else:
        can_repeat = None
        edit = None
    repeat = keys.keys_to_number(ks[8:10] + ks[18:20])
    if repeat == 1:
        repeat = 16
    if edit and (repeat > 1) and can_repeat:
        edit = '{#Control_L(u)' + str(repeat) + '}' + edit
    return edit
예제 #3
0
def translate_edit_keys(ks):
    ps = keys.keys_to_positions(ks)
    k = (tuple(ps[0:2]), tuple(reversed(ps[5: 9])))
    can_repeat_and_edit = edit_map.get(k)
    if can_repeat_and_edit is not None:
        can_repeat, edit = can_repeat_and_edit
    else:
        can_repeat = None
        edit = None
    repeat = keys.keys_to_number(ks[8: 10] + ks[18: 20])
    if repeat == 1:
        repeat = 16 
    if edit and (repeat > 1) and can_repeat:
        edit = '{#Control_L(u)' + str(repeat) + '}' + edit 
    return edit
예제 #4
0
def translate_symbol_keys(ks):
    ps = keys.keys_to_positions(ks)
    null_position = ps[0]
    number_position = ps[1]
    necessary_positions = tuple(ps[2:4])
    choice_positions = ps[4]
    pinky_position = ps[5]
    main_positions = tuple(ps[6:8])
    second_modifier_positions = ps[8]
    first_modifier_positions = ps[9]

    assert (necessary_positions == (NON, UPP))
    if (null_position == NON) and (number_position == NON) and (pinky_position
                                                                == NON):
        main_map = choice_map[choice_positions]
        if main_map is None:
            main_symbol = ''
        else:
            main_symbol = main_map[tuple(reversed(main_positions))]
            print('main = {}'.format(main_symbol))
        first_modifier = first_modifier_map[first_modifier_positions]
        second_modifier = second_modifier_map[second_modifier_positions]
        combined = main_symbol + first_modifier + second_modifier
        if combined == '':
            combined = '{#Tab}'
    elif (null_position == NON) and (number_position
                                     == UPP) and (pinky_position == NON):
        first_positions = (ps[4], ps[9])
        second_positions = (ps[8], ps[7])
        third_positions = (ps[6], ps[5])
        combined = number_map[first_positions] + number_map[
            second_positions] + number_map[third_positions] + '{^}'
    else:
        combined = ''
    print('combined is {}'.format(combined))
    return combined
예제 #5
0
파일: state.py 프로젝트: benreynwar/plogram
def translate_state_keys(ks):
    assert ks[0:8] == (False, True, False, False, False, False, False, True)
    ps = keys.keys_to_positions(ks[8:20])
    state_func = state_pos_map.get(tuple(ps), None)
    if state_func is not None:
        state_func()
예제 #6
0
파일: state.py 프로젝트: benreynwar/plogram
def translate_state_keys(ks):
    assert(ks[0: 8] == (False, True, False, False, False, False, False, True))
    ps = keys.keys_to_positions(ks[8: 20])
    state_func = state_pos_map.get(tuple(ps), None)
    if state_func is not None:
        state_func()