Beispiel #1
0
    def get_window_extent(self, renderer):
        'Return the bounding box of the table in window coords'
        boxes = [
            cell.get_window_extent(renderer) for cell in self._cells.values()
        ]

        return Bbox.union(boxes)
Beispiel #2
0
 def _get_grid_bbox(self, renderer):
     """Get a bbox, in axes co-ordinates for the cells.
     Only include those in the range (0,0) to (maxRow, maxCol)"""
     boxes = [
         self._cells[pos].get_window_extent(renderer) for pos in self._cells.keys() if pos[0] >= 0 and pos[1] >= 0
     ]
     bbox = Bbox.union(boxes)
     return bbox.inverse_transformed(self.get_transform())
Beispiel #3
0
    def _get_grid_bbox(self, renderer):
        """Get a bbox, in axes co-ordinates for the cells.

        Only include those in the range (0,0) to (maxRow, maxCol)"""
        boxes = [self._cells[pos].get_window_extent(renderer)
                 for pos in self._cells.keys()
                 if pos[0] >= 0 and pos[1] >= 0]

        bbox = Bbox.union(boxes)
        return bbox.inverse_transformed(self.get_transform())
Beispiel #4
0
 def get_tightbbox(self, renderer):
     """
     Return a (tight) bounding box of the figure in inches.
     It only accounts axes title, axis labels, and axis
     ticklabels. Needs improvement.
     """
     bb = []
     for ax in self.axes:
         if ax.get_visible():
             bb.append(ax.get_tightbbox(renderer))
     _bbox = Bbox.union([b for b in bb if b.width != 0 or b.height != 0])
     bbox_inches = TransformedBbox(_bbox, Affine2D().scale(1. / self.dpi))
     return bbox_inches
Beispiel #5
0
    def _get_handle_text_bbox(self, renderer):
        'Get a bbox for the text and lines in axes coords'

        bboxesText = [t.get_window_extent(renderer) for t in self.texts]
        bboxesHandles = [h.get_window_extent(renderer) for h in self.legendHandles if h is not None]

        bboxesAll = bboxesText
        bboxesAll.extend(bboxesHandles)
        bbox = Bbox.union(bboxesAll)

        self.save = bbox

        ibox = bbox.inverse_transformed(self.get_transform())
        self.ibox = ibox

        return ibox
Beispiel #6
0
    def get_tightbbox(self, renderer):
        """
        Return a (tight) bounding box of the figure in inches.

        It only accounts axes title, axis labels, and axis
        ticklabels. Needs improvement.
        """

        bb = []
        for ax in self.axes:
            if ax.get_visible():
                bb.append(ax.get_tightbbox(renderer))

        _bbox = Bbox.union([b for b in bb if b.width != 0 or b.height != 0])

        bbox_inches = TransformedBbox(_bbox, Affine2D().scale(1. / self.dpi))

        return bbox_inches
Beispiel #7
0
    def contains(self, mouseevent):
        """Test whether the mouse event occurred in the table.

        Returns T/F, {}
        """
        if callable(self._contains):
            return self._contains(self, mouseevent)

        # TODO: Return index of the cell containing the cursor so that the user
        # doesn't have to bind to each one individually.
        if self._cachedRenderer is not None:
            boxes = [self._cells[pos].get_window_extent(self._cachedRenderer)
                 for pos in self._cells.iterkeys()
                 if pos[0] >= 0 and pos[1] >= 0]
            bbox = Bbox.union(boxes)
            return bbox.contains(mouseevent.x, mouseevent.y), {}
        else:
            return False, {}
    def contains(self, mouseevent):
        """Test whether the mouse event occurred in the table.

        Returns T/F, {}
        """
        if callable(self._contains):
            return self._contains(self, mouseevent)

        # TODO: Return index of the cell containing the cursor so that the user
        # doesn't have to bind to each one individually.
        if self._cachedRenderer is not None:
            boxes = [self._cells[pos].get_window_extent(self._cachedRenderer)
                 for pos in self._cells.iterkeys()
                 if pos[0] >= 0 and pos[1] >= 0]
            bbox = Bbox.union(boxes)
            return bbox.contains(mouseevent.x, mouseevent.y), {}
        else:
            return False, {}
Beispiel #9
0
    def get_window_extent(self, renderer):
        "Return the bounding box of the table in window coords"
        boxes = [cell.get_window_extent(renderer) for cell in self._cells.values()]

        return Bbox.union(boxes)
Beispiel #10
0
 def get_window_extent(self, renderer):
     'Return the bounding box of the table in window coords'
     boxes = [c.get_window_extent(renderer) for c in self._cells]
     return Bbox.union(boxes)