(self, r, c)
Move the head of the selection and update feedback.
Move the head of the selection and update feedback.
Move the head of the selection and update feedback .
def move(self, r, c):
        """Move the head of the selection and update feedback."""
        self.select_stop = [r, c]
        start, stop = self.select_start, self.select_stop
        if stop[1] < 1:
            stop[0] -= 1
            stop[1] = self.width+1
        if stop[1] > self.width+1:
            stop[0] += 1
            stop[1] = 1
        if stop[0] > self.height:
            stop[:] = [self.height, self.width+1]
        if stop[0] < 1:
            stop[:] = [1, 1]
        if start[0] > stop[0] or (start[0] == stop[0] and start[1] > stop[1]):
            start, stop = stop, start
        rect_left = (start[1] - 1) * self.font_width
        rect_top = (start[0] - 1) * self.font_height
        rect_right = (stop[1] - 1) * self.font_width
        rect_bot = stop[0] * self.font_height
        if start[0] == stop[0]:
            # single row selection
            self.selection_rect = [(rect_left, rect_top, rect_right-rect_left, rect_bot-rect_top)]
        else:
            # multi-row selection
            self.selection_rect = [
                (rect_left, rect_top, self.size[0]-rect_left, self.font_height),
                (0, rect_top+self.font_height, self.size[0], rect_bot-rect_top-2*self.font_height),
                (0, rect_bot-self.font_height, rect_right, self.font_height)
            ]
def move ( self , r , c ) : self . select_stop = [ r , c ] start , stop = self . select_start , self . select_stop if stop [ 1 ] < 1 : stop [ 0 ] -= 1 stop [ 1 ] = self . width + 1 if stop [ 1 ] > self . width + 1 : stop [ 0 ] += 1 stop [ 1 ] = 1 if stop [ 0 ] > self . height : stop [ : ] = [ self . height , self . width + 1 ] if stop [ 0 ] < 1 : stop [ : ] = [ 1 , 1 ] if start [ 0 ] > stop [ 0 ] or ( start [ 0 ] == stop [ 0 ] and start [ 1 ] > stop [ 1 ] ) : start , stop = stop , start rect_left = ( start [ 1 ] - 1 ) * self . font_width rect_top = ( start [ 0 ] - 1 ) * self . font_height rect_right = ( stop [ 1 ] - 1 ) * self . font_width rect_bot = stop [ 0 ] * self . font_height if start [ 0 ] == stop [ 0 ] : # single row selection self . selection_rect = [ ( rect_left , rect_top , rect_right - rect_left , rect_bot - rect_top ) ] else : # multi-row selection self . selection_rect = [ ( rect_left , rect_top , self . size [ 0 ] - rect_left , self . font_height ) , ( 0 , rect_top + self . font_height , self . size [ 0 ] , rect_bot - rect_top - 2 * self . font_height ) , ( 0 , rect_bot - self . font_height , rect_right , self . font_height ) ]