(edge, allocation, direction, p1, p2)
Check if the supplied allocation is in the right direction of the
    supplied edge
Check if the supplied allocation is in the right direction of the
    supplied edge
Check if the supplied allocation is in the right direction of the supplied edge
def get_nav_possible(edge, allocation, direction, p1, p2):
    """Check if the supplied allocation is in the right direction of the
    supplied edge"""
    x1, x2 = allocation.x, allocation.x + allocation.width
    y1, y2 = allocation.y, allocation.y + allocation.height
    if direction == 'left':
        return(x2 <= edge and y1 <= p2 and y2 >= p1)
    elif direction == 'right':
        return(x1 >= edge and y1 <= p2 and y2 >= p1)
    elif direction == 'up':
        return(y2 <= edge and x1 <= p2 and x2 >= p1)
    elif direction == 'down':
        return(y1 >= edge and x1 <= p2 and x2 >= p1)
    else:
        raise ValueError('Unknown direction: %s' % direction)
def get_nav_possible ( edge , allocation , direction , p1 , p2 ) : x1 , x2 = allocation . x , allocation . x + allocation . width y1 , y2 = allocation . y , allocation . y + allocation . height if direction == 'left' : return ( x2 <= edge and y1 <= p2 and y2 >= p1 ) elif direction == 'right' : return ( x1 >= edge and y1 <= p2 and y2 >= p1 ) elif direction == 'up' : return ( y2 <= edge and x1 <= p2 and x2 >= p1 ) elif direction == 'down' : return ( y1 >= edge and x1 <= p2 and x2 >= p1 ) else : raise ValueError ( 'Unknown direction: %s' % direction )