FBD_Objects.py 文件源码

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

项目:beremiz 作者: nucleron 项目源码 文件源码
def Draw(self, dc):
        Graphic_Element.Draw(self, dc)
        dc.SetPen(MiterPen(wx.BLACK))
        dc.SetBrush(wx.WHITE_BRUSH)

        if getattr(dc, "printing", False):
            name_size = dc.GetTextExtent(self.Name)
            executionorder_size = dc.GetTextExtent(str(self.ExecutionOrder))
        else:
            name_size = self.NameSize
            executionorder_size = self.ExecutionOrderSize

        text_pos = (self.Pos.x + (self.Size[0] - name_size[0]) / 2,
                    self.Pos.y + (self.Size[1] - name_size[1]) / 2)
        # Draw a rectangle with the variable size
        dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
        # Draw variable name
        dc.DrawText(self.Name, text_pos[0], text_pos[1])
        # Draw connectors
        if self.Input:
            self.Input.Draw(dc)
        if self.Output:
            self.Output.Draw(dc)
        if self.ExecutionOrder != 0:
            # Draw variable execution order
            dc.DrawText(str(self.ExecutionOrder), self.Pos.x + self.Size[0] - executionorder_size[0],
                        self.Pos.y + self.Size[1] + 2)
        if not getattr(dc, "printing", False):
            DrawHighlightedText(dc, self.Name, self.Highlights, text_pos[0], text_pos[1])


# -------------------------------------------------------------------------------
#                        Function Block Diagram Connector
# -------------------------------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号