treehandling.py 文件源码

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

项目:dxf2gcode 作者: cnc-club 项目源码 文件源码
def AddShapeRowLayer(self, shape, parent_item):
        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/shape.png"))
        item_col_0 = QStandardItem(icon, "")
        item_col_0.setData(QVariantShape(shape), SHAPE_OBJECT)  # store a ref in our treeView element
        item_col_1 = QStandardItem(shape.type)
        item_col_2 = QStandardItem(str(shape.nr))
        item_col_3 = QStandardItem()
        parent_item.appendRow([item_col_0, item_col_1, item_col_2, item_col_3])

        # Deal with the checkboxes (shape enabled or disabled / send shape to TSP optimizer)
        item_col_0.setCheckState(QtCore.Qt.Unchecked if shape.isDisabled() else QtCore.Qt.Checked)
        item_col_3.setCheckState(QtCore.Qt.Checked if shape.isToolPathOptimized() else QtCore.Qt.Unchecked)

        flags = QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsSelectable
        if shape.allowedToChange:
            flags |= QtCore.Qt.ItemIsEnabled
        item_col_0.setFlags(flags | QtCore.Qt.ItemIsUserCheckable)
        item_col_1.setFlags(flags)
        item_col_2.setFlags(flags)
        item_col_3.setFlags(flags | QtCore.Qt.ItemIsUserCheckable)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号