DebugVariableGraphicViewer.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:beremiz 作者: nucleron 项目源码 文件源码
def draw(self, drawDC=None):
        """
        Render the figure.
        """
        # Render figure using agg
        FigureCanvasAgg.draw(self)

        # Get bitmap of figure rendered
        self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
        if wx.VERSION < (3, 0, 0):
            self.bitmap.UseAlpha()

        # Create DC for rendering graphics in bitmap
        destDC = wx.MemoryDC()
        destDC.SelectObject(self.bitmap)

        # Get Graphics Context for DC, for anti-aliased and transparent
        # rendering
        destGC = wx.GCDC(destDC)

        destGC.BeginDrawing()

        # Get canvas size and figure bounding box in canvas
        width, height = self.GetSize()
        bbox = self.GetAxesBoundingBox()

        # If highlight to display is resize, draw thick grey line at bottom
        # side of canvas
        if self.Highlight == HIGHLIGHT_RESIZE:
            destGC.SetPen(HIGHLIGHT_RESIZE_PEN)
            destGC.SetBrush(HIGHLIGHT_RESIZE_BRUSH)
            destGC.DrawRectangle(0, height - 5, width, 5)

        # If highlight to display is merging graph, draw 50% transparent blue
        # rectangle on left or right part of figure depending on highlight type
        elif self.Highlight in [HIGHLIGHT_LEFT, HIGHLIGHT_RIGHT]:
            destGC.SetPen(HIGHLIGHT_DROP_PEN)
            destGC.SetBrush(HIGHLIGHT_DROP_BRUSH)

            x_offset = (bbox.width / 2
                        if self.Highlight == HIGHLIGHT_RIGHT
                        else 0)
            destGC.DrawRectangle(bbox.x + x_offset, bbox.y,
                                 bbox.width / 2, bbox.height)

        # Draw other Viewer common elements
        self.DrawCommonElements(destGC, self.GetButtons())

        destGC.EndDrawing()

        self._isDrawn = True
        self.gui_repaint(drawDC=drawDC)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号