def set_model_data(self, editor, model, index, delegate):
        value = editor.text()
        model.setData(index, value, qc.Qt.ItemDataRole.EditRole)
        model.setData(index, float(value), qc.Qt.ItemDataRole.UserRole)

    def build_editor(self, parent, delegate):
        editor = qg.QLineEdit(parent)
        val = qg.QDoubleValidator(self.bottom, self.top, self.decimals, editor)
        editor.setValidator(val)
        return editor


if __name__ =='__main__':
    import sys
    app = qg.QApplication(sys.argv)
    class JointRow(Row):
    
        def __init__(self, get_sketches, get_layers):
            elements = []
            elements.append(SingleItemListElement('joint sketch', get_sketches))
            elements.append(SingleItemListElement('joint layer', get_layers))
            elements.append(MultiItemListElement('sublaminate layers', get_layers))
            elements.append(FloatElement('hinge width'))
            elements.append(FloatElement('stiffness'))
            elements.append(FloatElement('damping'))
            elements.append(FloatElement('preload'))
            self.elements = elements
    table = Table(JointRow(lambda:range(10),lambda:range(5)),Delegate)
    tc = TableControl(table)
    tc.show()
    sys.exit(app.exec_)
Esempio n. 2
0
    def build_editor(self):
        dialog = DraggableTreeDialog(self.my_list)
        return dialog

if __name__ =='__main__':
    import sys

    class JointRow(Row):
        def __init__(self, get_sketches, get_layers):
            elements = []
            elements.append(SingleItemListElement('joint sketch', get_sketches))
            elements.append(SingleItemListElement('joint layer', get_layers))
            elements.append(MultiItemListElement('sublaminate layers', get_layers))
            elements.append(FloatElement('hinge width'))
            elements.append(FloatElement('stiffness'))
            elements.append(FloatElement('damping'))
            elements.append(FloatElement('preload'))
            self.elements = elements

    app = qg.QApplication(sys.argv)
#    dialog = Dialog1()
#    result = dialog.exec_()
#    print(result)    
# 
    table = Table(JointRow(lambda:range(5),lambda:range(10)),Delegate)
    table.row_add_empty()
    table.row_add([1], [2], [5,6,7], 5.0, 0.0, 0.3, 0.0)
    widget = TableControl(table)
    widget.show()
    
    sys.exit(app.exec_())
    def set_model_data(self, editor, model, index, delegate):
        value = editor.text()
        model.setData(index, value, qc.Qt.EditRole)
        model.setData(index, float(value), qc.Qt.UserRole)

    def build_editor(self, parent, delegate):
        editor = qg.QLineEdit(parent)
        val = StrictDoubleValidator(self.bottom, self.top, self.decimals, editor)
        editor.setValidator(val)
        return editor


if __name__ =='__main__':
    import sys
    app = qg.QApplication(sys.argv)
    class JointRow(Row):
    
        def __init__(self, get_sketches, get_layers):
            elements = []
            elements.append(SingleItemListElement('joint sketch', get_sketches))
            elements.append(SingleItemListElement('joint layer', get_layers))
            elements.append(MultiItemListElement('sublaminate layers', get_layers))
            elements.append(FloatElement('hinge width'))
            elements.append(FloatElement('stiffness'))
            elements.append(FloatElement('damping'))
            elements.append(FloatElement('preload'))
            self.elements = elements
    table = Table(JointRow(lambda:range(10),lambda:range(5)),Delegate)
    tc = TableControl(table)
    tc.show()
    sys.exit(app.exec_)
Esempio n. 4
0
    def build_editor(self):
        dialog = DraggableTreeDialog(self.my_list)
        return dialog

if __name__ =='__main__':
    import sys

    class JointRow(Row):
        def __init__(self, get_sketches, get_layers):
            elements = []
            elements.append(SingleItemListElement('joint sketch', get_sketches))
            elements.append(SingleItemListElement('joint layer', get_layers))
            elements.append(MultiItemListElement('sublaminate layers', get_layers))
            elements.append(FloatElement('hinge width'))
            elements.append(FloatElement('stiffness'))
            elements.append(FloatElement('damping'))
            elements.append(FloatElement('preload'))
            self.elements = elements

    app = qg.QApplication(sys.argv)
#    dialog = Dialog1()
#    result = dialog.exec_()
#    print(result)    
# 
    table = Table(JointRow(lambda:range(5),lambda:range(10)),Delegate)
    table.row_add_empty()
    table.row_add([1], [2], [5,6,7], 5.0, 0.0, 0.3, 0.0)
    widget = TableControl(table)
    widget.show()
    
    sys.exit(app.exec_())