PCBupdateParts.py 文件源码

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

项目:FreeCAD-PCB 作者: marmni 项目源码 文件源码
def open(self):
        ''' load all packages types to list '''
        packages = []
        for j in FreeCAD.activeDocument().Objects:
            if hasattr(j, "Proxy") and hasattr(j.Proxy, "Type") and j.Proxy.Type in ["PCBpart", "PCBpart_E"] and not j.Package in packages:
                a = QtGui.QListWidgetItem(j.Package)
                a.setData(QtCore.Qt.UserRole, j.Package)
                a.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable)
                try:
                    a.setIcon(j.ViewObject.Icon)
                except AttributeError:
                    pass

                if self.updateModel:
                    if self.updateModel == j.Package:
                        a.setCheckState(QtCore.Qt.Checked)
                    else:
                        a.setCheckState(QtCore.Qt.Unchecked)
                else:
                    a.setCheckState(QtCore.Qt.Checked)

                self.form.listaElementow.addItem(a)
                packages.append(j.Package)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号