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


Python dragndroptree.DraggableTreeWidget类代码示例

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


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

示例1: DraggableTreeDialog

class DraggableTreeDialog(qg.QDialog):
    def __init__(self, list_in, *args, **kwargs):
        super(DraggableTreeDialog, self).__init__(*args, **kwargs)
        self.listwidget = DraggableTreeWidget()

        button_ok = qg.QPushButton('Ok')
        button_cancel = qg.QPushButton('Cancel')
        
        sub_layout1 = qg.QHBoxLayout()
        sub_layout1.addWidget(button_ok)
        sub_layout1.addWidget(button_cancel)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.listwidget)
        layout.addLayout(sub_layout1)

        self.setLayout(layout)
        button_ok.clicked.connect(self.accept)
        button_cancel.clicked.connect(self.reject)

        self.listwidget.linklist(list_in)

    def set_data(self,ini):
        self.listwidget.selectIndeces(ini)

    def results(self):
        return self.listwidget.currentIndeces2()
开发者ID:nickgravish,项目名称:popupcad,代码行数:27,代码来源:table_editor_popup.py

示例2: Dialog

class Dialog(qg.QDialog):

    def __init__(self, design, operations, selectedop=None, outputref=0):
        super(Dialog, self).__init__()

        self.design = design

        self.le1 = DraggableTreeWidget()
        self.le1.linklist(operations)
        if selectedop is not None:
            self.le1.selectIndeces([(selectedop, outputref)])

        layout = qg.QVBoxLayout()
        layout.addWidget(qg.QLabel('Operation to Flatten'))
        layout.addWidget(self.le1)

        button1 = qg.QPushButton('Ok')
        button2 = qg.QPushButton('Cancel')

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout.addLayout(layout2)

        self.setLayout(layout)

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

    def acceptdata(self):
        ref, ii = self.le1.currentRefs()[0]
        generic = self.design.op_from_ref(ref).output[ii].generic_laminate()
        return ref, ii, generic
开发者ID:Skylion007,项目名称:popupcad,代码行数:34,代码来源:freeze.py

示例3: Dialog

class Dialog(qg.QDialog):
    def __init__(self,operations,index,shift=0,flip=False,rotate = False,outputref = 0):
        super(Dialog,self).__init__()

        self.operations = operations
        self.le1 = DraggableTreeWidget()
        self.le1.linklist(self.operations) 
        self.le1.selectIndeces([(index,outputref)])
#        self.le1.addItems([str(op) for op in operations])
        

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        self.flip.setChecked(flip)
        layout5.addWidget(self.flip)

        layout6 = qg.QHBoxLayout()
        layout6.addWidget(qg.QLabel('Rotate Layers'))
        self.rotate = qg.QCheckBox()
        self.rotate.setChecked(rotate)
        layout6.addWidget(self.rotate)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(-100,100)
        self.sb.setSingleStep(1)
        self.sb.setValue(shift)
        layout4.addWidget(self.sb)

        button1 = qg.QPushButton('Ok')
        button2 = qg.QPushButton('Cancel')

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)
        
        layout = qg.QVBoxLayout()
        layout.addWidget(qg.QLabel('Parent Operation'))
        layout.addWidget(self.le1)
        layout.addLayout(layout5)
        layout.addLayout(layout6)
        layout.addLayout(layout4)
        layout.addLayout(layout2)

        self.setLayout(layout)    

        button1.pressed.connect(self.accept)
        button2.pressed.connect(self.reject)
        
#        self.le1.setCurrentIndex(index)

    def acceptdata(self):
#        ii = self.le1.currentIndex()
        ref,ii = self.le1.currentRefs()[0]
        return ref,self.sb.value(),self.flip.isChecked(),self.rotate.isChecked(),ii
开发者ID:apullin,项目名称:popupcad,代码行数:57,代码来源:shiftflip2.py

示例4: __init__

    def __init__(self,operationlist,index0,operationindeces1=None,operationindeces2 = None):
        super(Dialog,self).__init__()
        
        if operationindeces1 ==None:
            operationindeces1 = []
        if operationindeces2 ==None:
            operationindeces2 = []
        
        from popupcad.widgets.operationlist import OperationList
        self.le0 = OperationList(LaminateOperation.unaryoperationtypes,LaminateOperation.pairoperationtypes,LaminateOperation.displayorder)
        self.operationlist = operationlist

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

        self.pairlistwidget = DraggableTreeWidget()
        self.pairlistwidget.linklist(self.operationlist)
        self.pairlistwidget.setSelectionMode(qg.QListWidget.SelectionMode.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.pressed.connect(self.accept)
        button2.pressed.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)
开发者ID:apullin,项目名称:popupcad,代码行数:55,代码来源:laminateoperation.py

示例5: __init__

    def __init__(self, design, operations, selectedop=None, outputref=0):
        super(Dialog, self).__init__()

        self.design = design

        self.le1 = DraggableTreeWidget()
        self.le1.linklist(operations)
        if selectedop is not None:
            self.le1.selectIndeces([(selectedop, outputref)])

        layout = qg.QVBoxLayout()
        layout.addWidget(qg.QLabel('Operation to Flatten'))
        layout.addWidget(self.le1)

        button1 = qg.QPushButton('Ok')
        button2 = qg.QPushButton('Cancel')

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout.addLayout(layout2)

        self.setLayout(layout)

        button1.clicked.connect(self.accept)
        button2.clicked.connect(self.reject)
开发者ID:Skylion007,项目名称:popupcad,代码行数:27,代码来源:freeze.py

示例6: __init__

    def __init__(self, design, operations, operation_index, sketch=None):
        super(Dialog, self).__init__()
        SketchListManager(design)
        self.optree = DraggableTreeWidget()
        self.optree.linklist(operations)
        self.sketchwidget = SketchListManager(design)

        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)
        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.optree)
        layout.addWidget(self.sketchwidget)
        layout.addLayout(layout2)

        self.setLayout(layout)

        for ii in range(self.sketchwidget.itemlist.count()):
            item = self.sketchwidget.itemlist.item(ii)
            if item.value == sketch:
                item.setSelected(True)

        try:
            self.optree.selectIndeces([operation_index])
        except NoOperation:
            pass
开发者ID:Skylion007,项目名称:popupcad,代码行数:31,代码来源:cross_section.py

示例7: Dialog

class Dialog(qg.QDialog):
    def __init__(self,design,operations,operation_index,sketch = None):
        super(Dialog,self).__init__()
        SketchListManager(design)
        self.optree = DraggableTreeWidget()
        self.optree.linklist(operations)
        self.sketchwidget = SketchListManager(design)

        button1 = qg.QPushButton('Ok')
        button1.pressed.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.pressed.connect(self.reject)
        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)


        layout=qg.QVBoxLayout()
        layout.addWidget(self.optree)        
        layout.addWidget(self.sketchwidget)        
        layout.addLayout(layout2)

        self.setLayout(layout)
        
        for ii in range(self.sketchwidget.itemlist.count()):
            item = self.sketchwidget.itemlist.item(ii)
            if item.value==sketch:
                item.setSelected(True)
                
        try:
            self.optree.selectIndeces([operation_index])
        except NoOperation:
            pass
                
        
    def acceptdata(self):
        operation_links = {}
        operation_links['source'] = [self.optree.currentRefs()[0]]
        

        sketch_links= {}
        try:
            sketch_links['cross_section'] = [self.sketchwidget.itemlist.selectedItems()[0].value.id]
        except IndexError:
            pass
        
        return operation_links,sketch_links,100
开发者ID:apullin,项目名称:popupcad,代码行数:47,代码来源:cross_section.py

示例8: __init__

    def __init__(
            self,design,
            operations,
            index,
            shift=0,
            flip=False,
            rotate=False,
            outputref=0):
        super(Dialog, self).__init__()
        self.design = design
        self.operations = operations
        self.le1 = DraggableTreeWidget()
        self.le1.linklist(self.operations)
        self.le1.selectIndeces([(index, outputref)])
#        self.le1.addItems([str(op) for op in operations])
        self.layer_widget = popupcad.widgets.listeditor.ListSelector()
        self.layer_widget.linklist(self.design.return_layer_definition().layers)
        
        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        self.flip.setChecked(flip)
        layout5.addWidget(self.flip)

        layout6 = qg.QHBoxLayout()
        layout6.addWidget(qg.QLabel('Rotate Layers'))
        self.rotate = qg.QCheckBox()
        self.rotate.setChecked(rotate)
        layout6.addWidget(self.rotate)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(-100, 100)
        self.sb.setSingleStep(1)
        self.sb.setValue(shift)
        layout4.addWidget(self.sb)

        button1 = qg.QPushButton('Ok')
        button2 = qg.QPushButton('Cancel')

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout = qg.QVBoxLayout()
        layout.addWidget(qg.QLabel('Filter'))
        layout.addWidget(self.layer_widget)
        layout.addWidget(qg.QLabel('Parent Operation'))
        layout.addWidget(self.le1)
        layout.addLayout(layout5)
        layout.addLayout(layout6)
        layout.addLayout(layout4)
        layout.addLayout(layout2)

        self.setLayout(layout)

        button1.clicked.connect(self.accept)
        button2.clicked.connect(self.reject)
开发者ID:Skylion007,项目名称:popupcad,代码行数:59,代码来源:shiftflip4.py

示例9: setupLayout

    def setupLayout(self):
        self.constraint_editor = ListEditor()
        if self.selectops:
            self.optree = DraggableTreeWidget()
        self.propertieswindow = qg.QWidget()
        
        ok_button = qg.QPushButton('&Ok',self)
        cancel_button= qg.QPushButton('&Cancel',self)
        ok_button.clicked.connect(self.accept)
        cancel_button.clicked.connect(self.reject)

        sublayout= qg.QHBoxLayout()
        sublayout.addStretch(1)
        sublayout.addWidget(ok_button)
        sublayout.addWidget(cancel_button)
        sublayout.addStretch(1)

        self.scene = GraphicsScene()
        self.graphicsview = GraphicsView(self.scene)
        
        centrallayout = qg.QVBoxLayout()
        centrallayout.addWidget(self.graphicsview)
        centrallayout.addLayout(sublayout)
        centralwidget = qg.QWidget()
        centralwidget.setLayout(centrallayout)

        if self.selectops:
            self.optreedock = qg.QDockWidget()
            self.optreedock.setWidget(self.optree)
            self.optreedock.setAllowedAreas(qc.Qt.AllDockWidgetAreas)
            self.optreedock.setWindowTitle('Operatons')

        self.constraintdock = qg.QDockWidget()
        self.constraintdock.setWidget(self.constraint_editor)
        self.constraintdock.setAllowedAreas(qc.Qt.AllDockWidgetAreas)
        self.constraintdock.setWindowTitle('Constraints')
        self.constraintdock.setMinimumHeight(200)

        self.propdock = qg.QDockWidget()
        self.propdock.setWidget(self.propertieswindow)
        self.propdock.setAllowedAreas(qc.Qt.AllDockWidgetAreas)
        self.propdock.setWindowTitle('Properties')
        self.propdock.setMinimumHeight(200)

        if self.selectops:
            self.addDockWidget(qc.Qt.LeftDockWidgetArea,self.optreedock)
        self.addDockWidget(qc.Qt.RightDockWidgetArea,self.constraintdock)
        self.addDockWidget(qc.Qt.RightDockWidgetArea,self.propdock)

        self.setCentralWidget(centralwidget)        
        self.setWindowTitle('Sketcher')

        self.set_nominal_size()
        self.move_center()

        if self.selectops:
            self.optreedock.closeEvent = lambda event: self.action_uncheck(self.act_view_ops)
        self.constraintdock.closeEvent = lambda event: self.action_uncheck(self.act_view_constraints)
        self.propdock.closeEvent = lambda event: self.action_uncheck(self.act_view_properties)
开发者ID:apullin,项目名称:popupcad,代码行数:59,代码来源:sketcher.py

示例10: __init__

    def __init__(self,keepouttypes,valuenames,defaults,operations,selectedop,
            show,values=None,keepouttype=None,outputref=0):

        super(Dialog, self).__init__()

        self.operations = operations

        self.le1 = DraggableTreeWidget()
        self.le1.linklist(self.operations)
        self.le1.selectIndeces([(selectedop, outputref)])

        if values is None:
            values = defaults[:]

        layout = qg.QVBoxLayout()
        layout.addWidget(qg.QLabel('Parent Operation'))
        layout.addWidget(self.le1)

        self.valueboxes = []
        for valuename, v in zip(valuenames, values):
            templayout = qg.QHBoxLayout()
            valueedit = qg.QLineEdit()
            valueedit.setAlignment(qc.Qt.AlignRight)
            valueedit.setText(str(v))

    #        self.valueedit.setInputMask('#009.0')
            valueedit.setValidator(StrictDoubleValidator(popupcad.gui_negative_infinity, popupcad.gui_positive_infinity, popupcad.gui_default_decimals, valueedit))
            templayout.addStretch()
            templayout.addWidget(qg.QLabel(valuename))
            templayout.addWidget(valueedit)
            self.valueboxes.append(valueedit)
            layout.addLayout(templayout)

        self.radiobuttons = []
        if 'keepout' in show:
            for key, value2 in keepouttypes.dict.items():
                b = qg.QRadioButton(key)
                b.setChecked(keepouttype == value2)
                b.uservalue = value2
                self.radiobuttons.append(b)
                layout.addWidget(b)

        button1 = qg.QPushButton('Ok')
        button2 = qg.QPushButton('Cancel')

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout.addLayout(layout2)

        self.setLayout(layout)

        button1.clicked.connect(self.accept)
        button2.clicked.connect(self.reject)
开发者ID:heiko114514,项目名称:popupcad,代码行数:55,代码来源:multivalueoperation3.py

示例11: __init__

    def __init__(self,cls,design,operations,selectedopindex=None,outputref = 0,selectedoutput = None,sketch = None,operation_type_index = 0):
        super(Dialog,self).__init__()
        self.design = design
        self.operations = [NullOp()]+operations
        self.cls = cls

        self.optree = DraggableTreeWidget()
        self.optree.linklist(self.operations)
        if selectedopindex!=None:
            selectedopindex = selectedopindex+1
        else:
            selectedopindex = 0
        
        self.optree.selectIndeces([(selectedopindex,outputref)])

        self.sketchwidget = SketchListManager(self.design)
        for ii in range(self.sketchwidget.itemlist.count()):
            item = self.sketchwidget.itemlist.item(ii)
            if item.value==sketch:
                item.setSelected(True)
        
        if selectedoutput == None:
            selectedoutput = [item.id for item in design.return_layer_definition().layers]
        self.outputlayerselector = qg.QListWidget()
        self.outputlayerselector.setSelectionBehavior(qg.QListWidget.SelectionBehavior.SelectRows)
        self.outputlayerselector.setSelectionMode(qg.QListWidget.SelectionMode.MultiSelection)
        outputitems = [popupcad.filetypes.listwidgetitem.ListWidgetItem(item,self.outputlayerselector) for item in design.return_layer_definition().layers]
        [item.setSelected(item.customdata.id in selectedoutput) for item in outputitems]        

        from popupcad.widgets.operationlist import OperationList
        self.operationtypeselector = OperationList([],cls.function_names,cls.function_names)
        self.operationtypeselector.setCurrentIndex(operation_type_index)        

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

        layout = qg.QVBoxLayout()
        layout.addWidget(self.sketchwidget)
        layout.addWidget(self.operationtypeselector)
        layout.addWidget(qg.QLabel('Parent Operation'))
        layout.addWidget(self.optree)
        layout.addWidget(qg.QLabel('Select Layers'))
        layout.addWidget(self.outputlayerselector)
        layout.addLayout(buttonlayout)
        self.setLayout(layout)        

        button1.pressed.connect(self.accept)
        button2.pressed.connect(self.reject)
开发者ID:apullin,项目名称:popupcad,代码行数:51,代码来源:sketchoperation2.py

示例12: __init__

    def __init__(self, list_in, *args, **kwargs):
        super(DraggableTreeDialog, self).__init__(*args, **kwargs)
        self.listwidget = DraggableTreeWidget()

        button_ok = qg.QPushButton('Ok')
        button_cancel = qg.QPushButton('Cancel')
        
        sub_layout1 = qg.QHBoxLayout()
        sub_layout1.addWidget(button_ok)
        sub_layout1.addWidget(button_cancel)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.listwidget)
        layout.addLayout(sub_layout1)

        self.setLayout(layout)
        button_ok.clicked.connect(self.accept)
        button_cancel.clicked.connect(self.reject)

        self.listwidget.linklist(list_in)
开发者ID:nickgravish,项目名称:popupcad,代码行数:20,代码来源:table_editor_popup.py

示例13: build_dialog

    def build_dialog(self, design, prioroperations):

        self.prioroperations = prioroperations
        self.design = design

        #       operation/part | sketch to tile in | sheet to tile into
        #                  'Number of parts', 'Scale'
        #                       'x-gap', 'y-gap'
        #                       'Support offset'

        self.part = DraggableTreeWidget()
        self.part.linklist(prioroperations)
        # self.part.setCurrentItem()
        self.part.selectIndeces([(design.operation_index(self.part_opref_tp), 0)])

        self.release = DraggableTreeWidget()
        self.release.linklist(prioroperations)
        self.release.selectIndeces([(design.operation_index(self.release_opref_tp), 0)])

        self.sketch_to_tile = SketchListManager(design,name = 'Sketch of tile area')
        self.sketch_to_tile.refresh_list(selected_item = self.sketch_id_tp)

        self.sheet = DraggableTreeWidget()
        self.sheet.linklist(prioroperations)
        self.sheet.selectIndeces([(design.operation_index(self.sheet_opref_tp), 0)])

        #       operation/part | sketch to tile in | sheet to tile into
        layout_ops_sheet_sketch = qg.QHBoxLayout()
        layout_ops_sheet_sketch.addWidget(self.part)
        layout_ops_sheet_sketch.addWidget(self.release)
        layout_ops_sheet_sketch.addWidget(self.sketch_to_tile)
        layout_ops_sheet_sketch.addWidget(self.sheet)

        # layout_ops_sheet_sketch = qg.QHBoxLayout()
        # part_vbox = qg.QVBoxLayout()
        # part_vbox.addWidget(qg.QLabel('Part to tile'))
        # part_vbox.addWidget(self.part)
        # layout_ops_sheet_sketch.addLayout(part_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # rel_vbox = qg.QVBoxLayout()
        # rel_vbox.addWidget(qg.QLabel('Release cut (optional)'))
        # rel_vbox.addWidget(self.release)
        # layout_ops_sheet_sketch.addLayout(rel_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # sktch_vbox = qg.QVBoxLayout()
        # sktch_vbox.addWidget(self.sketch_to_tile)
        # layout_ops_sheet_sketch.addLayout(sktch_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # sht_vbox = qg.QVBoxLayout()
        # sht_vbox.addWidget(qg.QLabel('Sheet to tile into'))
        # sht_vbox.addWidget(self.release)
        # layout_ops_sheet_sketch.addLayout(sht_vbox)

        #       'Number of parts', 'Scale'
        number_of_parts_and_scale = qg.QHBoxLayout()

        number_of_parts_and_scale.addStretch()
        number_of_parts_and_scale.addWidget(qg.QLabel('Number of parts'))
        self.N = qg.QLineEdit()
        number_of_parts_and_scale.addWidget(self.N)

        number_of_parts_and_scale.addWidget(qg.QLabel('Scale'))
        self.scale = qg.QLineEdit()
        number_of_parts_and_scale.addWidget(self.scale)
        number_of_parts_and_scale.addStretch()

        #                       'x-gap', 'y-gap'
        xy_gap = qg.QHBoxLayout()
        xy_gap.addStretch()

        xy_gap.addWidget(qg.QLabel('X-gap'))
        self.x_gap = qg.QLineEdit()
        xy_gap.addWidget(self.x_gap)

        xy_gap.addWidget(qg.QLabel('Y-gap'))
        self.y_gap = qg.QLineEdit()
        xy_gap.addWidget(self.y_gap)
        xy_gap.addStretch()

        s_offset = qg.QHBoxLayout()
        s_offset.addStretch()
        s_offset.addWidget(qg.QLabel('Support offset'))
        self.support_offset = qg.QLineEdit()
        s_offset.addWidget(self.support_offset)
        s_offset.addStretch()

        # Button 1 and 2
        buttons = qg.QHBoxLayout()
        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        buttons.addWidget(button1)

        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)
        buttons.addWidget(button2)

        instructions = qg.QHBoxLayout()
#.........这里部分代码省略.........
开发者ID:heiko114514,项目名称:popupcad,代码行数:101,代码来源:tilepart.py

示例14: build_editor

    def build_editor(self, parent, delegate):
        editor = DraggableTreeWidget(parent)
        editor.linklist(self.get_list())
#            editor.editingFinished.connect(delegate.commitAndCloseEditor)
        return editor
开发者ID:Skylion007,项目名称:popupcad,代码行数:5,代码来源:table_editor_delegate.py

示例15: Dialog

class Dialog(qg.QDialog):

    def __init__(self,design,prioroperations, tilepart = None):
        super(Dialog, self).__init__()

        if tilepart is not None:

            self.sheet_opref_tp = tilepart.sheet_opref
            self.release_opref_tp = tilepart.release_opref
            self.part_opref_tp = tilepart.part_opref
            self.sketch_bounding_box_tp = tilepart.sketch_bounding_box
            self.sketch_id_tp = tilepart.sketch_id
            self.sc_tp = tilepart.sc
            self.N_tp = tilepart.N
            self.x_gap_tp = tilepart.x_gap
            self.y_gap_tp = tilepart.y_gap
            self.support_offset_tp = tilepart.support_offset

        else:
            # define defaults
            self.sheet_opref_tp = None if len(design.operations) == 0 else design.operations[0].id
            self.release_opref_tp = None if len(design.operations) == 0 else design.operations[0].id
            self.part_opref_tp = None if len(design.operations) == 0 else design.operations[0].id

            sketchids = [id for key, id in enumerate(design.sketches)]
            self.sketch_id_tp = None if len(design.sketches) == 0 else design.sketches[sketchids[0]]

            self.sketch_bounding_box_tp = [(0,0),(0,0)]
            self.sc_tp = 1
            self.N_tp = 10
            self.x_gap_tp = 0
            self.y_gap_tp = 0
            self.support_offset_tp = 0

        self.build_dialog(design, prioroperations)

    def build_dialog(self, design, prioroperations):

        self.prioroperations = prioroperations
        self.design = design

        #       operation/part | sketch to tile in | sheet to tile into
        #                  'Number of parts', 'Scale'
        #                       'x-gap', 'y-gap'
        #                       'Support offset'

        self.part = DraggableTreeWidget()
        self.part.linklist(prioroperations)
        # self.part.setCurrentItem()
        self.part.selectIndeces([(design.operation_index(self.part_opref_tp), 0)])

        self.release = DraggableTreeWidget()
        self.release.linklist(prioroperations)
        self.release.selectIndeces([(design.operation_index(self.release_opref_tp), 0)])

        self.sketch_to_tile = SketchListManager(design,name = 'Sketch of tile area')
        self.sketch_to_tile.refresh_list(selected_item = self.sketch_id_tp)

        self.sheet = DraggableTreeWidget()
        self.sheet.linklist(prioroperations)
        self.sheet.selectIndeces([(design.operation_index(self.sheet_opref_tp), 0)])

        #       operation/part | sketch to tile in | sheet to tile into
        layout_ops_sheet_sketch = qg.QHBoxLayout()
        layout_ops_sheet_sketch.addWidget(self.part)
        layout_ops_sheet_sketch.addWidget(self.release)
        layout_ops_sheet_sketch.addWidget(self.sketch_to_tile)
        layout_ops_sheet_sketch.addWidget(self.sheet)

        # layout_ops_sheet_sketch = qg.QHBoxLayout()
        # part_vbox = qg.QVBoxLayout()
        # part_vbox.addWidget(qg.QLabel('Part to tile'))
        # part_vbox.addWidget(self.part)
        # layout_ops_sheet_sketch.addLayout(part_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # rel_vbox = qg.QVBoxLayout()
        # rel_vbox.addWidget(qg.QLabel('Release cut (optional)'))
        # rel_vbox.addWidget(self.release)
        # layout_ops_sheet_sketch.addLayout(rel_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # sktch_vbox = qg.QVBoxLayout()
        # sktch_vbox.addWidget(self.sketch_to_tile)
        # layout_ops_sheet_sketch.addLayout(sktch_vbox)
        # layout_ops_sheet_sketch.addStretch()
        #
        # sht_vbox = qg.QVBoxLayout()
        # sht_vbox.addWidget(qg.QLabel('Sheet to tile into'))
        # sht_vbox.addWidget(self.release)
        # layout_ops_sheet_sketch.addLayout(sht_vbox)

        #       'Number of parts', 'Scale'
        number_of_parts_and_scale = qg.QHBoxLayout()

        number_of_parts_and_scale.addStretch()
        number_of_parts_and_scale.addWidget(qg.QLabel('Number of parts'))
        self.N = qg.QLineEdit()
        number_of_parts_and_scale.addWidget(self.N)

#.........这里部分代码省略.........
开发者ID:heiko114514,项目名称:popupcad,代码行数:101,代码来源:tilepart.py


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