Ensure Qt5 compatibility with enums
Correct LGPL headers rework bullnose Fixes #19050
This commit is contained in:
@@ -62,7 +62,7 @@ class TestPathToolBit(PathTestWithAssets):
|
||||
|
||||
# Parameters should be loaded from the shape file and set on the tool bit's object
|
||||
self.assertEqual(bullnose_bit.obj.Diameter, FreeCAD.Units.Quantity("5.0 mm"))
|
||||
self.assertEqual(bullnose_bit.obj.FlatRadius, FreeCAD.Units.Quantity("1.5 mm"))
|
||||
self.assertEqual(bullnose_bit.obj.CornerRadius, FreeCAD.Units.Quantity("1.5 mm"))
|
||||
|
||||
def testToolBitPickle(self):
|
||||
"""Test if ToolBit is picklable"""
|
||||
|
||||
@@ -153,8 +153,8 @@ class TestPathToolShapeClasses(PathTestWithAssets):
|
||||
self.assertEqual(ToolBitShape.resolve_name("ballend").asset_id, "ballend")
|
||||
self.assertEqual(ToolBitShape.resolve_name("v-bit").asset_id, "v-bit")
|
||||
self.assertEqual(ToolBitShape.resolve_name("vbit").asset_id, "vbit")
|
||||
self.assertEqual(ToolBitShape.resolve_name("torus").asset_id, "torus")
|
||||
self.assertEqual(ToolBitShape.resolve_name("torus.fcstd").asset_id, "torus")
|
||||
self.assertEqual(ToolBitShape.resolve_name("bullnose").asset_id, "bullnose")
|
||||
self.assertEqual(ToolBitShape.resolve_name("bullnose.fcstd").asset_id, "bullnose")
|
||||
self.assertEqual(ToolBitShape.resolve_name("SlittingSaw").asset_id, "SlittingSaw")
|
||||
# Test unknown name - should return the input name
|
||||
self.assertEqual(ToolBitShape.resolve_name("nonexistent").asset_id, "nonexistent")
|
||||
@@ -336,12 +336,12 @@ class TestPathToolShapeClasses(PathTestWithAssets):
|
||||
shape = self._test_shape_common("bullnose")
|
||||
self.assertEqual(shape["Diameter"].Value, 5.0)
|
||||
self.assertEqual(unit(shape["Diameter"]), "mm")
|
||||
self.assertEqual(shape["FlatRadius"].Value, 1.5)
|
||||
self.assertEqual(unit(shape["FlatRadius"]), "mm")
|
||||
self.assertEqual(shape["CornerRadius"].Value, 1.5)
|
||||
self.assertEqual(unit(shape["CornerRadius"]), "mm")
|
||||
# Need an instance to get parameter labels, get it from the asset manager
|
||||
uri = ToolBitShape.resolve_name("bullnose")
|
||||
instance = self.assets.get(uri)
|
||||
self.assertEqual(instance.get_parameter_label("FlatRadius"), "Torus radius")
|
||||
self.assertEqual(instance.get_parameter_label("CornerRadius"), "Corner radius")
|
||||
|
||||
def test_toolbitshapevbit_defaults(self):
|
||||
"""Test ToolBitShapeVBit default parameters and labels."""
|
||||
|
||||
@@ -50,19 +50,19 @@
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Shape::StyledPanel</enum>
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Shape::StyledPanel</enum>
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -92,7 +92,7 @@ Larger values (further to the right) will calculate faster; smaller values (furt
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>1</number>
|
||||
@@ -318,7 +318,7 @@ This option changes that behavior to cut each discrete area to its full depth be
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
||||
@@ -106,7 +106,7 @@ If left empty no template will be preselected.</string>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -144,7 +144,7 @@ If left empty no template will be preselected.</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow</enum>
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
@@ -257,7 +257,7 @@ See the file save policy below on how to deal with name conflicts.</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow</enum>
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
@@ -322,7 +322,7 @@ See the file save policy below on how to deal with name conflicts.</string>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -387,7 +387,7 @@ See the file save policy below on how to deal with name conflicts.</string>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -514,7 +514,7 @@ See the file save policy below on how to deal with name conflicts.</string>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -556,21 +556,21 @@ See the file save policy below on how to deal with name conflicts.</string>
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="stockAxisX">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QDoubleSpinBox" name="stockAxisY">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QDoubleSpinBox" name="stockAxisZ">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -599,7 +599,7 @@ See the file save policy below on how to deal with name conflicts.</string>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -616,7 +616,7 @@ See the file save policy below on how to deal with name conflicts.</string>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
||||
@@ -105,6 +105,7 @@ class PropertyBag(object):
|
||||
try:
|
||||
obj.removeProperty(self.CustomPropertyGroups)
|
||||
except Exception:
|
||||
# Removing the property may fail if it does not exist; safe to ignore in this context.
|
||||
pass
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
|
||||
@@ -46,7 +46,7 @@ from .cache import AssetCache, CacheKey
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.basicConfig(level=logging.ERROR)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -35,9 +35,6 @@ class FCTLSerializer(AssetSerializer):
|
||||
extensions = (".fctl",)
|
||||
mime_type = "application/x-freecad-toolbit-library"
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
@classmethod
|
||||
def get_label(cls) -> str:
|
||||
return FreeCAD.Qt.translate("CAM", "FreeCAD Tool Library")
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2025 Samuel Abels <knipknap@gmail.com> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * This file is part of FreeCAD. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
# * under the terms of the GNU Lesser General Public License as *
|
||||
# * published by the Free Software Foundation, either version 2.1 of the *
|
||||
# * License, or (at your option) any later version. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * FreeCAD is distributed in the hope that it will be useful, but *
|
||||
# * WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
# * Lesser General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Lesser General Public *
|
||||
# * License along with FreeCAD. If not, see *
|
||||
# * <https://www.gnu.org/licenses/>. *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
|
||||
from PySide import QtWidgets
|
||||
import FreeCADGui
|
||||
import FreeCAD
|
||||
|
||||
@@ -52,12 +52,12 @@ class ToolBitShapeBullnose(ToolBitShape):
|
||||
FreeCAD.Qt.translate("ToolBitShape", "Shank diameter"),
|
||||
"App::PropertyLength",
|
||||
),
|
||||
"FlatRadius": (
|
||||
FreeCAD.Qt.translate("ToolBitShape", "Torus radius"),
|
||||
"CornerRadius": (
|
||||
FreeCAD.Qt.translate("ToolBitShape", "Corner radius"),
|
||||
"App::PropertyLength",
|
||||
),
|
||||
}
|
||||
|
||||
@property
|
||||
def label(self) -> str:
|
||||
return FreeCAD.Qt.translate("ToolBitShape", "Torus")
|
||||
return FreeCAD.Qt.translate("ToolBitShape", "Bullnose")
|
||||
|
||||
@@ -39,9 +39,10 @@ class ToolBitBullnose(ToolBit, CuttingToolMixin, RotaryToolBitMixin):
|
||||
diameter = self.get_property_str("Diameter", "?", precision=3)
|
||||
flutes = self.get_property("Flutes")
|
||||
cutting_edge_height = self.get_property_str("CuttingEdgeHeight", "?", precision=3)
|
||||
flat_radius = self.get_property_str("FlatRadius", "?", precision=3)
|
||||
#flat_radius = self.get_property_str("FlatRadius", "?", precision=3)
|
||||
corner_radius = self.get_property_str("CornerRadius", "?", precision=3)
|
||||
|
||||
return FreeCAD.Qt.translate(
|
||||
"CAM",
|
||||
f"{diameter} {flutes}-flute bullnose, {cutting_edge_height} cutting edge, {flat_radius} flat radius",
|
||||
f"{diameter} {flutes}-flute bullnose, {cutting_edge_height} cutting edge, {corner_radius} corner radius",
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ from ...shape import ToolBitShape
|
||||
from ..models.base import ToolBit
|
||||
|
||||
|
||||
if True:
|
||||
if False:
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2025 Samuel Abels <knipknap@gmail.com> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * This file is part of FreeCAD. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
# * under the terms of the GNU Lesser General Public License as *
|
||||
# * published by the Free Software Foundation, either version 2.1 of the *
|
||||
# * License, or (at your option) any later version. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * FreeCAD is distributed in the hope that it will be useful, but *
|
||||
# * WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
# * Lesser General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Lesser General Public *
|
||||
# * License along with FreeCAD. If not, see *
|
||||
# * <https://www.gnu.org/licenses/>. *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import yaml
|
||||
from typing import List, Optional, Mapping, Type, cast
|
||||
from typing import List, Optional, Mapping, Type
|
||||
from ...assets.serializer import AssetSerializer
|
||||
from ...assets.uri import AssetUri
|
||||
from ...shape import ToolBitShape
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"parameter": {
|
||||
"CuttingEdgeHeight": "40.0000 mm",
|
||||
"Diameter": "6.0000 mm",
|
||||
"FlatRadius": "1.5000 mm",
|
||||
"CornerRadius": "1.5000 mm",
|
||||
"Length": "50.0000 mm",
|
||||
"ShankDiameter": "3.0000 mm"
|
||||
},
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user