当前位置: 首页>>代码示例>>Python>>正文


Python DraggableTreeWidget.setEnabled方法代码示例

本文整理汇总了Python中popupcad.widgets.dragndroptree.DraggableTreeWidget.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python DraggableTreeWidget.setEnabled方法的具体用法?Python DraggableTreeWidget.setEnabled怎么用?Python DraggableTreeWidget.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在popupcad.widgets.dragndroptree.DraggableTreeWidget的用法示例。


在下文中一共展示了DraggableTreeWidget.setEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Dialog

# 需要导入模块: from popupcad.widgets.dragndroptree import DraggableTreeWidget [as 别名]
# 或者: from popupcad.widgets.dragndroptree.DraggableTreeWidget import setEnabled [as 别名]
class Dialog(qg.QDialog):

    def __init__(
            self,
            operationlist,
            index0,
            operationindeces1=None,
            operationindeces2=None):
        super(Dialog, self).__init__()

        if operationindeces1 is None:
            operationindeces1 = []
        if operationindeces2 is None:
            operationindeces2 = []

        from popupcad.widgets.operationlist import OperationList
        self.le0 = OperationList(
            LaminateOperation2.unaryoperationtypes,
            LaminateOperation2.pairoperationtypes,
            LaminateOperation2.displayorder)
        self.operationlist = operationlist

        self.unarylistwidget = DraggableTreeWidget()
        self.unarylistwidget.linklist(self.operationlist)
        self.unarylistwidget.setSelectionMode(qg.QListWidget.ExtendedSelection)
        self.unarylistwidget.selectIndeces(operationindeces1)

        self.pairlistwidget = DraggableTreeWidget()
        self.pairlistwidget.linklist(self.operationlist)
        self.pairlistwidget.setSelectionMode(
            qg.QListWidget.ExtendedSelection)
        self.pairlistwidget.selectIndeces(operationindeces2)

        layout3 = qg.QVBoxLayout()
        layout3.addWidget(qg.QLabel('Unary Operators'))
        layout3.addWidget(self.unarylistwidget)

        layout4 = qg.QVBoxLayout()
        layout4.addWidget(qg.QLabel('Binary Operators'))
        layout4.addWidget(self.pairlistwidget)

        layout5 = qg.QHBoxLayout()
        layout5.addLayout(layout3)
        layout5.addLayout(layout4)

        button1 = qg.QPushButton('Ok')
        button2 = qg.QPushButton('Cancel')
        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.le0)
        layout.addLayout(layout5)
#        layout.addWidget(self.unarylistwidget)
#        layout.addWidget(self.pairlistwidget)
        layout.addLayout(layout2)

        self.setLayout(layout)

        button1.clicked.connect(self.accept)
        button2.clicked.connect(self.reject)

        self.le0.unary_selected.connect(
            lambda: self.pairlistwidget.setEnabled(False))
        self.le0.binary_selected.connect(
            lambda: self.pairlistwidget.setEnabled(True))
        self.le0.setCurrentIndex(index0)

    def acceptdata(self):
        unaryparents = self.unarylistwidget.currentRefs()
        pairparents = self.pairlistwidget.currentRefs()
        function = self.le0.currentText()
        operation_links = {'unary': unaryparents, 'binary': pairparents}
        return operation_links, function
开发者ID:heiko114514,项目名称:popupcad,代码行数:77,代码来源:laminateoperation2.py


注:本文中的popupcad.widgets.dragndroptree.DraggableTreeWidget.setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。