本文整理汇总了Python中popupcad.widgets.dragndroptree.DraggableTreeWidget.setSelectionMode方法的典型用法代码示例。如果您正苦于以下问题:Python DraggableTreeWidget.setSelectionMode方法的具体用法?Python DraggableTreeWidget.setSelectionMode怎么用?Python DraggableTreeWidget.setSelectionMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类popupcad.widgets.dragndroptree.DraggableTreeWidget
的用法示例。
在下文中一共展示了DraggableTreeWidget.setSelectionMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Dialog
# 需要导入模块: from popupcad.widgets.dragndroptree import DraggableTreeWidget [as 别名]
# 或者: from popupcad.widgets.dragndroptree.DraggableTreeWidget import setSelectionMode [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