DebugVariablePanel.py 文件源码

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

项目:beremiz 作者: nucleron 项目源码 文件源码
def RefreshView(self):
        self.RefreshCanvasPosition()

        width, height = self.GraphicsWindow.GetVirtualSize()
        bitmap = wx.EmptyBitmap(width, height)
        dc = wx.BufferedDC(wx.ClientDC(self.GraphicsWindow), bitmap)
        dc.Clear()
        dc.BeginDrawing()
        if self.DraggingAxesPanel is not None:
            destBBox = self.DraggingAxesBoundingBox
            srcBBox = self.DraggingAxesPanel.GetAxesBoundingBox()

            srcBmp = _convert_agg_to_wx_bitmap(self.DraggingAxesPanel.get_renderer(), None)
            srcDC = wx.MemoryDC()
            srcDC.SelectObject(srcBmp)

            dc.Blit(destBBox.x, destBBox.y,
                    int(destBBox.width), int(destBBox.height),
                    srcDC, srcBBox.x, srcBBox.y)
        dc.EndDrawing()

        if not self.Fixed or self.Force:
            self.Force = False
            refresh_graphics = True
        else:
            refresh_graphics = False

        if self.DraggingAxesPanel is not None and self.DraggingAxesPanel not in self.GraphicPanels:
            self.DraggingAxesPanel.RefreshViewer(refresh_graphics)
        for panel in self.GraphicPanels:
            if isinstance(panel, DebugVariableGraphicViewer):
                panel.RefreshViewer(refresh_graphics)
            else:
                panel.RefreshViewer()

        if self.CursorTick is not None:
            tick = self.CursorTick
        elif len(self.Ticks) > 0:
            tick = self.Ticks[-1]
        else:
            tick = None
        if tick is not None:
            self.TickLabel.SetLabel(label=_("Tick: %d") % tick)
            tick_duration = int(tick * self.Ticktime)
            not_null = False
            duration = ""
            for value, format in [(tick_duration / DAY, _("%dd")),
                                  ((tick_duration % DAY) / HOUR, _("%dh")),
                                  ((tick_duration % HOUR) / MINUTE, _("%dm")),
                                  ((tick_duration % MINUTE) / SECOND, _("%ds"))]:

                if value > 0 or not_null:
                    duration += format % value
                    not_null = True

            duration += _("%03gms") % (float(tick_duration % SECOND) / MILLISECOND)
            self.TickTimeLabel.SetLabel("t: %s" % duration)
        else:
            self.TickLabel.SetLabel("")
            self.TickTimeLabel.SetLabel("")
        self.TickSizer.Layout()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号