(self, term, x, y)
return pos
Get our location within the terminal
Get our location within the terminal
Get our location within the terminal
def get_location(self, term, x, y):
        """Get our location within the terminal"""
        pos = ''
        # get the diagonales function for the receiving widget
        term_alloc = term.get_allocation()
        coef1 = float(term_alloc.height)/float(term_alloc.width)
        coef2 = -float(term_alloc.height)/float(term_alloc.width)
        b1 = 0
        b2 = term_alloc.height
        #determine position in rectangle
        #--------
        #|\    /|
        #| \  / |
        #|  \/  |
        #|  /\  |
        #| /  \ |
        #|/    \|
        #--------
        if (x*coef1 + b1 > y) and (x*coef2 + b2 < y):
            pos = "right"
        if (x*coef1 + b1 > y) and (x*coef2 + b2 > y):
            pos = "top"
        if (x*coef1 + b1 < y) and (x*coef2 + b2 > y):
            pos = "left"
        if (x*coef1 + b1 < y) and (x*coef2 + b2 < y):
            pos = "bottom"
        return pos
def get_location ( self , term , x , y ) : pos = '' # get the diagonales function for the receiving widget term_alloc = term . get_allocation ( ) coef1 = float ( term_alloc . height ) / float ( term_alloc . width ) coef2 = - float ( term_alloc . height ) / float ( term_alloc . width ) b1 = 0 b2 = term_alloc . height #determine position in rectangle #-------- #|\    /| #| \  / | #|  \/  | #|  /\  | #| /  \ | #|/    \| #-------- if ( x * coef1 + b1 > y ) and ( x * coef2 + b2 < y ) : pos = "right" if ( x * coef1 + b1 > y ) and ( x * coef2 + b2 > y ) : pos = "top" if ( x * coef1 + b1 < y ) and ( x * coef2 + b2 > y ) : pos = "left" if ( x * coef1 + b1 < y ) and ( x * coef2 + b2 < y ) : pos = "bottom" return pos