Ejemplo n.º 1
0
    def initPage(self, obj):

        if self.haveStartDepth():
            self.startDepth = PathGui.QuantitySpinBox(self.form.startDepth, obj, 'StartDepth')
        else:
            self.form.startDepth.hide()
            self.form.startDepthLabel.hide()
            self.form.startDepthSet.hide()

        if self.haveFinalDepth():
            self.finalDepth = PathGui.QuantitySpinBox(self.form.finalDepth, obj, 'FinalDepth')
        else:
            if self.haveStartDepth():
                self.form.finalDepth.setEnabled(False)
                self.form.finalDepth.setToolTip(translate('PathOp', 'FinalDepth cannot be modified for this operation.\nIf it is necessary to set the FinalDepth manually please select a different operation.'))
            else:
                self.form.finalDepth.hide()
                self.form.finalDepthLabel.hide()
            self.form.finalDepthSet.hide()

        if self.haveStepDown():
            self.stepDown = PathGui.QuantitySpinBox(self.form.stepDown, obj, 'StepDown')
        else:
            self.form.stepDown.hide()
            self.form.stepDownLabel.hide()

        if self.haveFinishDepth():
            self.finishDepth = PathGui.QuantitySpinBox(self.form.finishDepth, obj, 'FinishDepth')
        else:
            self.form.finishDepth.hide()
            self.form.finishDepthLabel.hide()
Ejemplo n.º 2
0
 def initPage(self, obj):
     self.majorDia = PathGui.QuantitySpinBox(self.form.threadMajor, obj,
                                             "MajorDiameter")
     self.minorDia = PathGui.QuantitySpinBox(self.form.threadMinor, obj,
                                             "MinorDiameter")
     self.pitch = PathGui.QuantitySpinBox(self.form.threadPitch, obj,
                                          "Pitch")
Ejemplo n.º 3
0
    def __init__(self, obj, asDialog):
        self.form = FreeCADGui.PySideUic.loadUi(
            ":/panels/DlgToolControllerEdit.ui")
        if not asDialog:
            self.form.buttonBox.hide()
        self.obj = obj

        self.vertFeed = PathGui.QuantitySpinBox(self.form.vertFeed, obj,
                                                'VertFeed')
        self.horizFeed = PathGui.QuantitySpinBox(self.form.horizFeed, obj,
                                                 'HorizFeed')
        self.vertRapid = PathGui.QuantitySpinBox(self.form.vertRapid, obj,
                                                 'VertRapid')
        self.horizRapid = PathGui.QuantitySpinBox(self.form.horizRapid, obj,
                                                  'HorizRapid')

        self.toolDiameter = PathGui.QuantitySpinBox(self.form.toolDiameter,
                                                    obj, 'Tool.Diameter')
        self.toolLengthOffset = PathGui.QuantitySpinBox(
            self.form.toolLengthOffset, obj, 'Tool.LengthOffset')
        self.toolFlatRadius = PathGui.QuantitySpinBox(self.form.toolFlatRadius,
                                                      obj, 'Tool.FlatRadius')
        self.toolCornerRadius = PathGui.QuantitySpinBox(
            self.form.toolCornerRadius, obj, 'Tool.CornerRadius')
        self.toolCuttingEdgeAngle = PathGui.QuantitySpinBox(
            self.form.toolCuttingEdgeAngle, obj, 'Tool.CuttingEdgeAngle')
        self.toolCuttingEdgeHeight = PathGui.QuantitySpinBox(
            self.form.toolCuttingEdgeHeight, obj, 'Tool.CuttingEdgeHeight')
Ejemplo n.º 4
0
 def initPage(self, obj):
     self.peckDepthSpinBox = PathGui.QuantitySpinBox(
         self.form.peckDepth, obj, 'PeckDepth')
     self.peckRetractSpinBox = PathGui.QuantitySpinBox(
         self.form.peckRetractHeight, obj, 'RetractHeight')
     self.dwellTimeSpinBox = PathGui.QuantitySpinBox(
         self.form.dwellTime, obj, 'DwellTime')
Ejemplo n.º 5
0
    def __init__(self, obj, asDialog):
        self.form = FreeCADGui.PySideUic.loadUi(":/panels/DlgToolControllerEdit.ui")
        if not asDialog:
            self.form.buttonBox.hide()
        self.obj = obj

        comboToPropertyMap = [("spindleDirection", "SpindleDir")]
        enumTups = PathScripts.PathToolController.ToolController.propertyEnumerations(
            dataType="raw"
        )

        PathGui.populateCombobox(self.form, enumTups, comboToPropertyMap)
        self.vertFeed = PathGui.QuantitySpinBox(self.form.vertFeed, obj, "VertFeed")
        self.horizFeed = PathGui.QuantitySpinBox(self.form.horizFeed, obj, "HorizFeed")
        self.vertRapid = PathGui.QuantitySpinBox(self.form.vertRapid, obj, "VertRapid")
        self.horizRapid = PathGui.QuantitySpinBox(
            self.form.horizRapid, obj, "HorizRapid"
        )

        if obj.Proxy.usesLegacyTool(obj):
            self.editor = PathToolEdit.ToolEditor(obj.Tool, self.form.toolEditor)
        else:
            self.editor = None
            self.form.toolBox.widget(1).hide()
            self.form.toolBox.removeItem(1)
Ejemplo n.º 6
0
 def initPage(self, obj):
     # pylint: disable=attribute-defined-outside-init
     self.peckDepthSpinBox = PathGui.QuantitySpinBox(
         self.form.peckDepth, obj, 'PeckDepth')
     self.peckRetractSpinBox = PathGui.QuantitySpinBox(
         self.form.peckRetractHeight, obj, 'RetractHeight')
     self.dwellTimeSpinBox = PathGui.QuantitySpinBox(
         self.form.dwellTime, obj, 'DwellTime')
Ejemplo n.º 7
0
    def initPage(self, obj):
        self.majorDia = PathGui.QuantitySpinBox(self.form.threadMajor, obj, 'MajorDiameter') # pylint: disable=attribute-defined-outside-init
        self.minorDia = PathGui.QuantitySpinBox(self.form.threadMinor, obj, 'MinorDiameter') # pylint: disable=attribute-defined-outside-init
        self.pitch    = PathGui.QuantitySpinBox(self.form.threadPitch, obj, 'Pitch') # pylint: disable=attribute-defined-outside-init

        setupCombo(self.form.threadOrientation, obj.Proxy.ThreadOrientations)
        setupCombo(self.form.threadType, obj.Proxy.ThreadTypes)
        setupCombo(self.form.opDirection, obj.Proxy.Directions)
Ejemplo n.º 8
0
 def initPage(self, obj):
     self.peckDepthSpinBox = PathGui.QuantitySpinBox(
         self.form.peckDepth, obj, "PeckDepth")
     self.peckRetractSpinBox = PathGui.QuantitySpinBox(
         self.form.peckRetractHeight, obj, "RetractHeight")
     self.dwellTimeSpinBox = PathGui.QuantitySpinBox(
         self.form.dwellTime, obj, "DwellTime")
     self.form.chipBreakEnabled.setEnabled(False)
Ejemplo n.º 9
0
 def initPage(self, obj):
     self.majorDia = PathGui.QuantitySpinBox(
         self.form.threadMajor, obj, "MajorDiameter"
     )  # pylint: disable=attribute-defined-outside-init
     self.minorDia = PathGui.QuantitySpinBox(
         self.form.threadMinor, obj, "MinorDiameter"
     )  # pylint: disable=attribute-defined-outside-init
     self.pitch = PathGui.QuantitySpinBox(
         self.form.threadPitch, obj, "Pitch"
     )  # pylint: disable=attribute-defined-outside-init
Ejemplo n.º 10
0
 def setupUi(self):
     self.clearanceHeightOffs = PathGui.QuantitySpinBox(
         self.form.setupClearanceHeightOffs, self.obj,
         'ClearanceHeightOffset')
     self.safeHeightOffs = PathGui.QuantitySpinBox(
         self.form.setupSafeHeightOffs, self.obj, 'SafeHeightOffset')
     self.rapidHorizontal = PathGui.QuantitySpinBox(
         self.form.setupRapidHorizontal, self.obj, 'HorizRapid')
     self.rapidVertical = PathGui.QuantitySpinBox(
         self.form.setupRapidVertical, self.obj, 'VertRapid')
     self.setFields()
Ejemplo n.º 11
0
 def setupUi(self):
     self.clearanceHeightOffs = PathGui.QuantitySpinBox(
         self.form.setupClearanceHeightOffs, self.obj,
         "ClearanceHeightOffset")
     self.safeHeightOffs = PathGui.QuantitySpinBox(
         self.form.setupSafeHeightOffs, self.obj, "SafeHeightOffset")
     self.rapidHorizontal = PathGui.QuantitySpinBox(
         self.form.setupRapidHorizontal, self.obj, "HorizRapid")
     self.rapidVertical = PathGui.QuantitySpinBox(
         self.form.setupRapidVertical, self.obj, "VertRapid")
     self.form.setupCoolantMode.addItems(self.obj.CoolantModes)
     self.setFields()
Ejemplo n.º 12
0
 def initPage(self, obj):
     '''initPage(obj) ... Is called after getForm() to initiate the task panel.'''
     debugMsg('initPage()')
     # pylint: disable=attribute-defined-outside-init
     self.CATS = [None, None]
     self.propEnums = PathSlot.ObjectSlot.opPropertyEnumerations(False)
     self.ENUMS = dict()
     self.setTitle("Slot - " + obj.Label)
     # retrieve property enumerations
     # Requirements due to Gui::QuantitySpinBox class use in UI panel
     self.geo1Extension = PathGui.QuantitySpinBox(self.form.geo1Extension, obj, 'ExtendPathStart')
     self.geo2Extension = PathGui.QuantitySpinBox(self.form.geo2Extension, obj, 'ExtendPathEnd')
Ejemplo n.º 13
0
    def __init__(self, obj, asDialog):
        self.form = FreeCADGui.PySideUic.loadUi(":/panels/DlgToolControllerEdit.ui")
        if not asDialog:
            self.form.buttonBox.hide()
        self.obj = obj

        self.vertFeed = PathGui.QuantitySpinBox(self.form.vertFeed, obj, 'VertFeed')
        self.horizFeed = PathGui.QuantitySpinBox(self.form.horizFeed, obj, 'HorizFeed')
        self.vertRapid = PathGui.QuantitySpinBox(self.form.vertRapid, obj, 'VertRapid')
        self.horizRapid = PathGui.QuantitySpinBox(self.form.horizRapid, obj, 'HorizRapid')

        self.editor = PathToolEdit.ToolEditor(obj.Tool, self.form.toolEditor)
Ejemplo n.º 14
0
    def __init__(self, obj):
        self.obj = obj
        self.form = FreeCADGui.PySideUic.loadUi(":/panels/DragKnifeEdit.ui")
        self.filterAngle = PathGui.QuantitySpinBox(self.form.filterAngle, obj,
                                                   'filterAngle')
        self.offsetDistance = PathGui.QuantitySpinBox(self.form.offsetDistance,
                                                      obj, 'offset')
        self.pivotHeight = PathGui.QuantitySpinBox(self.form.pivotHeight, obj,
                                                   'pivotheight')

        FreeCAD.ActiveDocument.openTransaction(
            translate("Path_DressupDragKnife", "Edit Dragknife Dress-up"))
Ejemplo n.º 15
0
 def initPage(self, obj):
     """initPage(obj) ... Is called after getForm() to initiate the task panel."""
     debugMsg("initPage()")
     self.CATS = [None, None]
     self.propEnums = PathSlot.ObjectSlot.propertyEnumerations(dataType="raw")
     self.ENUMS = dict()
     self.setTitle("Slot - " + obj.Label)
     # retrieve property enumerations
     # Requirements due to Gui::QuantitySpinBox class use in UI panel
     self.geo1Extension = PathGui.QuantitySpinBox(
         self.form.geo1Extension, obj, "ExtendPathStart"
     )
     self.geo2Extension = PathGui.QuantitySpinBox(
         self.form.geo2Extension, obj, "ExtendPathEnd"
     )
Ejemplo n.º 16
0
    def initPage(self, obj):
        self.setTitle("Extensions")
        self.extensions = obj.Proxy.getExtensions(obj)  # pylint: disable=attribute-defined-outside-init

        self.defaultLength = PathGui.QuantitySpinBox(self.form.defaultLength,
                                                     obj,
                                                     'ExtensionLengthDefault')  # pylint: disable=attribute-defined-outside-init

        self.form.extensionTree.setEditTriggers(
            QtGui.QAbstractItemView.NoEditTriggers)
        self.form.extensionTree.setSelectionBehavior(
            QtGui.QAbstractItemView.SelectRows)

        self.switch = coin.SoSwitch()  # pylint: disable=attribute-defined-outside-init
        self.obj.ViewObject.RootNode.addChild(self.switch)
        self.switch.whichChild = coin.SO_SWITCH_ALL

        self.model = QtGui.QStandardItemModel(self.form.extensionTree)  # pylint: disable=attribute-defined-outside-init
        self.model.setHorizontalHeaderLabels(['Base', 'Extension'])

        if 0 < len(obj.ExtensionFeature):
            self.form.showExtensions.setCheckState(QtCore.Qt.Checked)
        else:
            self.form.showExtensions.setCheckState(QtCore.Qt.Unchecked)

        self.blockUpdateData = False  # pylint: disable=attribute-defined-outside-init
Ejemplo n.º 17
0
    def __init__(self, obj, asDialog):
        self.form = FreeCADGui.PySideUic.loadUi(":/panels/DlgToolControllerEdit.ui")
        if not asDialog:
            self.form.buttonBox.hide()
        self.obj = obj

        self.vertFeed = PathGui.QuantitySpinBox(self.form.vertFeed, obj, 'VertFeed')
        self.horizFeed = PathGui.QuantitySpinBox(self.form.horizFeed, obj, 'HorizFeed')
        self.vertRapid = PathGui.QuantitySpinBox(self.form.vertRapid, obj, 'VertRapid')
        self.horizRapid = PathGui.QuantitySpinBox(self.form.horizRapid, obj, 'HorizRapid')

        if obj.Proxy.usesLegacyTool(obj):
            self.editor = PathToolEdit.ToolEditor(obj.Tool, self.form.toolEditor)
        else:
            self.editor = None
            self.form.toolBox.widget(1).hide()
            self.form.toolBox.removeItem(1)
Ejemplo n.º 18
0
    def setupTool(self, tool):
        PathLog.track()
        # Can't delete and add fields to the form because of dangling references in case of
        # a focus change. see https://forum.freecadweb.org/viewtopic.php?f=10&t=52246#p458583
        # Instead we keep widgets once created and use them for new properties, and hide all
        # which aren't being needed anymore.

        def labelText(name):
            return re.sub("([A-Z][a-z]+)", r" \1", re.sub("([A-Z]+)", r" \1", name))

        layout = self.form.bitParams.layout()
        ui = FreeCADGui.UiLoader()

        # for all properties either assign them to existing labels and editors
        # or create additional ones for them if not enough have already been
        # created.
        usedRows = 0
        for nr, name in enumerate(tool.Proxy.toolShapeProperties(tool)):
            if nr < len(self.widgets):
                PathLog.debug("re-use row: {} [{}]".format(nr, name))
                label, qsb, editor = self.widgets[nr]
                label.setText(labelText(name))
                editor.attachTo(tool, name)
                label.show()
                qsb.show()
            else:
                qsb = ui.createWidget("Gui::QuantitySpinBox")
                editor = PathGui.QuantitySpinBox(qsb, tool, name)
                label = QtGui.QLabel(labelText(name))
                self.widgets.append((label, qsb, editor))
                PathLog.debug("create row: {} [{}]  {}".format(nr, name, type(qsb)))
                if hasattr(qsb, "editingFinished"):
                    qsb.editingFinished.connect(self.updateTool)

            if nr >= layout.rowCount():
                layout.addRow(label, qsb)
            usedRows = usedRows + 1

        # hide all rows which aren't being used
        PathLog.track(usedRows, len(self.widgets))
        for i in range(usedRows, len(self.widgets)):
            label, qsb, editor = self.widgets[i]
            label.hide()
            qsb.hide()
            editor.attachTo(None)
            PathLog.debug("  hide row: {}".format(i))

        img = tool.Proxy.getBitThumbnail(tool)
        if img:
            self.form.image.setPixmap(QtGui.QPixmap(QtGui.QImage.fromData(img)))
        else:
            self.form.image.setPixmap(QtGui.QPixmap())
Ejemplo n.º 19
0
    def setupTool(self, tool):
        PathLog.track()
        # Can't delete and add fields to the form because of dangling references in case of
        # a focus change. see https://forum.freecadweb.org/viewtopic.php?f=10&t=52246#p458583
        # Instead we keep widgets once created and use them for new properties, and hide all
        # which aren't being needed anymore.

        def labelText(name):
            return re.sub('([A-Z][a-z]+)', r' \1', re.sub('([A-Z]+)', r' \1', name))

        layout = self.form.bitParams.layout()
        ui = FreeCADGui.UiLoader()
        nr = 0

        # for all properties either assign them to existing labels and editors
        # or create additional ones for them if not enough have already been
        # created.
        for name in tool.PropertiesList:
            if tool.getGroupOfProperty(name) == PathToolBit.PropertyGroupBit:
                if nr < len(self.widgets):
                    PathLog.debug("re-use row: {} [{}]".format(nr, name))
                    label, qsb, editor = self.widgets[nr]
                    label.setText(labelText(name))
                    editor.attachTo(tool, name)
                    label.show()
                    qsb.show()
                else:
                    qsb    = ui.createWidget('Gui::QuantitySpinBox')
                    editor = PathGui.QuantitySpinBox(qsb, tool, name)
                    label  = QtGui.QLabel(labelText(name))
                    self.widgets.append((label, qsb, editor))
                    PathLog.debug("create row: {} [{}]".format(nr, name))
                if nr >= layout.rowCount():
                    layout.addRow(label, qsb)
                nr = nr + 1

        # hide all rows which aren't being used
        for i in range(nr, len(self.widgets)):
            label, qsb, editor = self.widgets[i]
            label.hide()
            qsb.hide()
            editor.attachTo(None)
            PathLog.debug("  hide row: {}".format(i))

        img = tool.Proxy.getBitThumbnail(tool)
        if img:
            self.form.image.setPixmap(QtGui.QPixmap(QtGui.QImage.fromData(img)))
        else:
            self.form.image.setPixmap(QtGui.QPixmap())
Ejemplo n.º 20
0
 def setupTool(self, tool):
     layout = self.form.bitParams.layout()
     for i in range(layout.rowCount() - 1, -1, -1):
         layout.removeRow(i)
     editor = {}
     ui = FreeCADGui.UiLoader()
     for name in tool.PropertiesList:
         if tool.getGroupOfProperty(name) == PathToolBit.PropertyGroupBit:
             qsb = ui.createWidget('Gui::QuantitySpinBox')
             editor[name] = PathGui.QuantitySpinBox(qsb, tool, name)
             label = QtGui.QLabel(re.sub('([A-Z][a-z]+)', r' \1', re.sub('([A-Z]+)', r' \1', name)))
             layout.addRow(label, qsb)
     self.bitEditor = editor
     img = tool.Proxy.getBitThumbnail(tool)
     if img:
         self.form.image.setPixmap(QtGui.QPixmap(QtGui.QImage.fromData(img)))
     else:
         self.form.image.setPixmap(QtGui.QPixmap())
    def initPage(self, obj):
        self.setTitle("Extensions")
        self.OpIcon = ":/icons/view-axonometric.svg"
        self.setIcon(self.OpIcon)
        self.initialEdgeCount = -1
        self.edgeCountThreshold = 30
        self.fieldsSet = False
        self.useOutlineCheckbox = None
        self.useOutline = -1
        self.extensionsCache = dict()
        self.extensionsReady = False
        self.enabled = True
        self.lastDefaultLength = ""

        self.extensions = list()

        self.defaultLength = PathGui.QuantitySpinBox(self.form.defaultLength,
                                                     obj,
                                                     "ExtensionLengthDefault")

        self.form.extensionTree.setEditTriggers(
            QtGui.QAbstractItemView.NoEditTriggers)
        self.form.extensionTree.setSelectionBehavior(
            QtGui.QAbstractItemView.SelectRows)

        self.switch = coin.SoSwitch()
        self.obj.ViewObject.RootNode.addChild(self.switch)
        self.switch.whichChild = coin.SO_SWITCH_ALL

        self.model = QtGui.QStandardItemModel(self.form.extensionTree)
        self.model.setHorizontalHeaderLabels(["Base", "Extension"])
        """
        # russ4262: This `if` block shows all available extensions upon edit of operation with any extension enabled.
        # This can cause the model(s) to overly obscured due to previews of extensions.
        # Would be great if only enabled extensions were shown.
        if 0 < len(obj.ExtensionFeature):
            self.form.showExtensions.setCheckState(QtCore.Qt.Checked)
        else:
            self.form.showExtensions.setCheckState(QtCore.Qt.Unchecked)
        """
        self.form.showExtensions.setCheckState(QtCore.Qt.Unchecked)

        self.blockUpdateData = False
Ejemplo n.º 22
0
 def initPage(self, obj):
     self.safeHeight = PathGui.QuantitySpinBox(self.form.safeHeight, obj,
                                               'SafeHeight')
     self.clearanceHeight = PathGui.QuantitySpinBox(
         self.form.clearanceHeight, obj, 'ClearanceHeight')
Ejemplo n.º 23
0
 def __init__(self, obj):
     self.obj = obj
     self.form = FreeCADGui.PySideUic.loadUi(":/panels/AxisMapEdit.ui")
     self.radius = PathGui.QuantitySpinBox(self.form.radius, obj, 'Radius')
     FreeCAD.ActiveDocument.openTransaction(translate("Path_DressupDragKnife", "Edit Dragknife Dress-up"))