Ejemplo n.º 1
0
    def createTool(self):
        PathLog.track()
        tool = PathToolBit.Factory.Create()

        def accept():
            self.editor.accept()
            self.dialog.done(1)
            self.updateTools(tool.Label)

        def reject():
            FreeCAD.ActiveDocument.openTransaction(translate('PathToolBit', 'Uncreate ToolBit'))
            self.editor.reject()
            self.dialog.done(0)
            FreeCAD.ActiveDocument.removeObject(tool.Name)
            FreeCAD.ActiveDocument.commitTransaction()

        self.dialog = QtGui.QDialog(self.form)
        layout = QtGui.QVBoxLayout(self.dialog)
        self.editor = PathToolBitEdit.ToolBitEditor(tool, self.dialog)
        self.editor.setupUI()
        self.buttons = QtGui.QDialogButtonBox(
                QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel,
                QtCore.Qt.Horizontal, self.dialog)
        layout.addWidget(self.buttons)
        self.buttons.accepted.connect(accept)
        self.buttons.rejected.connect(reject)
        print(self.dialog.exec_())
Ejemplo n.º 2
0
    def toolEdit(self, selected):
        PathLog.track()
        item = self.toolModel.item(selected.row(), 0)

        if self.temptool is not None:
            self.temptool.Document.removeObject(self.temptool.Name)

        if selected.column() == 0:  # editing Nr
            pass
        else:
            tbpath = item.data(_PathRole)
            self.temptool = PathToolBit.ToolBitFactory().CreateFrom(
                tbpath, "temptool")
            self.editor = PathToolBitEdit.ToolBitEditor(
                self.temptool, self.form.toolTableGroup, loadBitBody=False)

            QBtn = (PySide.QtGui.QDialogButtonBox.Ok
                    | PySide.QtGui.QDialogButtonBox.Cancel)
            buttonBox = PySide.QtGui.QDialogButtonBox(QBtn)
            buttonBox.accepted.connect(self.accept)
            buttonBox.rejected.connect(self.reject)

            layout = self.editor.form.layout()
            layout.addWidget(buttonBox)
            self.lockon()
            self.editor.setupUI()
Ejemplo n.º 3
0
 def __init__(self, vobj, deleteOnReject):
     PathLog.track(vobj.Object.Label)
     self.vobj = vobj
     self.obj = vobj.Object
     self.editor = PathToolBitEdit.ToolBitEditor(self.obj)
     self.form = self.editor.form
     self.deleteOnReject = deleteOnReject
     FreeCAD.ActiveDocument.openTransaction(translate('PathToolBit', 'Edit ToolBit'))