def panset(self, fitsimage, channel, paninfo):
        image = fitsimage.get_image()
        if image is None:
            return

        x, y = fitsimage.get_pan()
        points = fitsimage.get_pan_rect()

        # calculate pan position point radius
        p_image = paninfo.panimage.get_image()
        try:
            obj = paninfo.panimage.canvas.getObjectByTag('__image')
        except __HOLE__:
            obj = None
        #print(('panset', image, p_image, obj, obj.image, paninfo.panimage._imgobj))

        width, height = image.get_size()
        edgew = math.sqrt(width**2 + height**2)
        radius = int(0.015 * edgew)

        # Mark pan rectangle and pan position
        #p_canvas = paninfo.panimage.get_canvas()
        p_canvas = paninfo.panimage.private_canvas
        try:
            obj = p_canvas.getObjectByTag(paninfo.panrect)
            if obj.kind != 'compound':
                return False
            point, bbox = obj.objects
            self.logger.debug("starting panset")
            point.x, point.y = x, y
            point.radius = radius
            bbox.points = points
            p_canvas.update_canvas(whence=0)

        except KeyError:
            paninfo.panrect = p_canvas.add(self.dc.CompoundObject(
                self.dc.Point(x, y, radius=radius, style='plus',
                              color=self.settings.get('pan_position_color', 'yellow')),
                self.dc.Polygon(points,
                                color=self.settings.get('pan_rectangle_color', 'red'))))

        p_canvas.update_canvas(whence=0)
        return True
dataset/ETHPy150Open ejeschke/ginga/ginga/misc/plugins/Pan.py/Pan.panset