From b85e672226ba5a4fa44f28314fa8c55cfb976682 Mon Sep 17 00:00:00 2001
From: PaddleStroke
Date: Wed, 31 Jan 2024 16:05:32 +0100
Subject: [PATCH] Assembly fixes
---
src/Mod/Assembly/CommandCreateJoint.py | 4 +-
src/Mod/Assembly/CommandInsertLink.py | 4 +-
src/Mod/Assembly/JointObject.py | 70 +++++++++++++++-----------
src/Mod/Assembly/Preferences.py | 8 +--
src/Mod/Assembly/UtilsAssembly.py | 4 --
src/Tools/updatecrowdin.py | 5 ++
src/Tools/updatets.py | 5 ++
7 files changed, 60 insertions(+), 40 deletions(-)
diff --git a/src/Mod/Assembly/CommandCreateJoint.py b/src/Mod/Assembly/CommandCreateJoint.py
index cb710d6aea..e5d0509d18 100644
--- a/src/Mod/Assembly/CommandCreateJoint.py
+++ b/src/Mod/Assembly/CommandCreateJoint.py
@@ -76,7 +76,7 @@ class CommandCreateJointFixed:
+ ""
+ QT_TRANSLATE_NOOP(
"Assembly_CreateJointFixed",
- "2 - If a part is active : Position sub parts by matching seleted coordinate systems. The second part selected will move.",
+ "2 - If a part is active : Position sub parts by matching selected coordinate systems. The second part selected will move.",
)
+ "
",
"CmdType": "ForEdit",
@@ -211,7 +211,7 @@ class CommandCreateJointDistance:
"ToolTip": ""
+ QT_TRANSLATE_NOOP(
"Assembly_CreateJointDistance",
- "Create a Distance Joint: Depending on your selection this tool will apply different constraints.",
+ "Create a Distance Joint: Fix the distance between the selected objects.",
)
+ "
",
"CmdType": "ForEdit",
diff --git a/src/Mod/Assembly/CommandInsertLink.py b/src/Mod/Assembly/CommandInsertLink.py
index c0793a9ae3..aeeb7776ff 100644
--- a/src/Mod/Assembly/CommandInsertLink.py
+++ b/src/Mod/Assembly/CommandInsertLink.py
@@ -59,7 +59,9 @@ class CommandInsertLink:
+ "
- "
+ QT_TRANSLATE_NOOP("Assembly_InsertLink", "Insert by left clicking items in the list.")
+ "
- "
- + QT_TRANSLATE_NOOP("Assembly_InsertLink", "Undo by right clicking items in the list.")
+ + QT_TRANSLATE_NOOP(
+ "Assembly_InsertLink", "Remove by right clicking items in the list."
+ )
+ "
- "
+ QT_TRANSLATE_NOOP(
"Assembly_InsertLink",
diff --git a/src/Mod/Assembly/JointObject.py b/src/Mod/Assembly/JointObject.py
index 5d43552914..92c998f632 100644
--- a/src/Mod/Assembly/JointObject.py
+++ b/src/Mod/Assembly/JointObject.py
@@ -42,35 +42,46 @@ from pivy import coin
import UtilsAssembly
import Preferences
+translate = App.Qt.translate
+
+TranslatedJointTypes = [
+ translate("Assembly", "Fixed"),
+ translate("Assembly", "Revolute"),
+ translate("Assembly", "Cylindrical"),
+ translate("Assembly", "Slider"),
+ translate("Assembly", "Ball"),
+ translate("Assembly", "Distance"),
+]
+
JointTypes = [
- QT_TRANSLATE_NOOP("AssemblyJoint", "Fixed"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Revolute"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Cylindrical"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Slider"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Ball"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Distance"),
+ "Fixed",
+ "Revolute",
+ "Cylindrical",
+ "Slider",
+ "Ball",
+ "Distance",
]
JointUsingDistance = [
- QT_TRANSLATE_NOOP("AssemblyJoint", "Distance"),
+ "Distance",
]
JointUsingOffset = [
- QT_TRANSLATE_NOOP("AssemblyJoint", "Fixed"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Revolute"),
+ "Fixed",
+ "Revolute",
]
JointUsingRotation = [
- QT_TRANSLATE_NOOP("AssemblyJoint", "Fixed"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Slider"),
+ "Fixed",
+ "Slider",
]
JointUsingReverse = [
- QT_TRANSLATE_NOOP("AssemblyJoint", "Fixed"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Revolute"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Cylindrical"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Slider"),
- QT_TRANSLATE_NOOP("AssemblyJoint", "Distance"),
+ "Fixed",
+ "Revolute",
+ "Cylindrical",
+ "Slider",
+ "Distance",
]
@@ -112,7 +123,7 @@ class Joint:
"App::PropertyString", # Not PropertyLink because they don't support external objects
"Object1",
"Joint Connector 1",
- QT_TRANSLATE_NOOP("App::Property", "The name of the first object of the joint"),
+ QT_TRANSLATE_NOOP("App::Property", "The first object of the joint"),
)
joint.addProperty(
@@ -142,7 +153,7 @@ class Joint:
"Joint Connector 1",
QT_TRANSLATE_NOOP(
"App::Property",
- "This is the local coordinate system within the object1 that will be used to joint.",
+ "This is the local coordinate system within object1 that will be used for the joint.",
),
)
@@ -152,7 +163,7 @@ class Joint:
"Joint Connector 1",
QT_TRANSLATE_NOOP(
"App::Property",
- "This prevent Placement1 from recomputing, enabling custom positioning of the placement.",
+ "This prevents Placement1 from recomputing, enabling custom positioning of the placement.",
),
)
@@ -161,7 +172,7 @@ class Joint:
"App::PropertyString",
"Object2",
"Joint Connector 2",
- QT_TRANSLATE_NOOP("App::Property", "The name of the second object of the joint"),
+ QT_TRANSLATE_NOOP("App::Property", "The second object of the joint"),
)
joint.addProperty(
@@ -191,7 +202,7 @@ class Joint:
"Joint Connector 2",
QT_TRANSLATE_NOOP(
"App::Property",
- "This is the local coordinate system within the object2 that will be used to joint.",
+ "This is the local coordinate system within object2 that will be used for the joint.",
),
)
@@ -201,7 +212,7 @@ class Joint:
"Joint Connector 2",
QT_TRANSLATE_NOOP(
"App::Property",
- "This prevent Placement2 from recomputing, enabling custom positioning of the placement.",
+ "This prevents Placement2 from recomputing, enabling custom positioning of the placement.",
),
)
@@ -241,7 +252,7 @@ class Joint:
"Joint",
QT_TRANSLATE_NOOP(
"App::Property",
- "This indicate if the joint is active.",
+ "This indicates if the joint is active.",
),
)
joint.Activated = True
@@ -1020,7 +1031,7 @@ class TaskAssemblyCreateJoint(QtCore.QObject):
if self.activeType == "Part":
self.form.setWindowTitle("Match parts")
self.form.jointType.hide()
- self.form.jointType.addItems(JointTypes)
+ self.form.jointType.addItems(TranslatedJointTypes)
self.form.jointType.setCurrentIndex(jointTypeIndex)
self.form.jointType.currentIndexChanged.connect(self.onJointTypeChanged)
@@ -1189,7 +1200,8 @@ class TaskAssemblyCreateJoint(QtCore.QObject):
ViewProviderJoint(self.joint.ViewObject)
def onJointTypeChanged(self, index):
- self.joint.Proxy.setJointType(self.joint, self.form.jointType.currentText())
+
+ self.joint.Proxy.setJointType(self.joint, JointTypes[self.form.jointType.currentIndex()])
self.toggleDistanceVisibility()
self.toggleOffsetVisibility()
self.toggleRotationVisibility()
@@ -1208,7 +1220,7 @@ class TaskAssemblyCreateJoint(QtCore.QObject):
self.joint.Proxy.flipOnePart(self.joint)
def toggleDistanceVisibility(self):
- if self.form.jointType.currentText() in JointUsingDistance:
+ if JointTypes[self.form.jointType.currentIndex()] in JointUsingDistance:
self.form.distanceLabel.show()
self.form.distanceSpinbox.show()
else:
@@ -1216,7 +1228,7 @@ class TaskAssemblyCreateJoint(QtCore.QObject):
self.form.distanceSpinbox.hide()
def toggleOffsetVisibility(self):
- if self.form.jointType.currentText() in JointUsingOffset:
+ if JointTypes[self.form.jointType.currentIndex()] in JointUsingOffset:
self.form.offsetLabel.show()
self.form.offsetSpinbox.show()
else:
@@ -1224,7 +1236,7 @@ class TaskAssemblyCreateJoint(QtCore.QObject):
self.form.offsetSpinbox.hide()
def toggleRotationVisibility(self):
- if self.form.jointType.currentText() in JointUsingRotation:
+ if JointTypes[self.form.jointType.currentIndex()] in JointUsingRotation:
self.form.rotationLabel.show()
self.form.rotationSpinbox.show()
else:
@@ -1232,7 +1244,7 @@ class TaskAssemblyCreateJoint(QtCore.QObject):
self.form.rotationSpinbox.hide()
def toggleReverseVisibility(self):
- if self.form.jointType.currentText() in JointUsingReverse:
+ if JointTypes[self.form.jointType.currentIndex()] in JointUsingReverse:
self.form.PushButtonReverse.show()
else:
self.form.PushButtonReverse.hide()
diff --git a/src/Mod/Assembly/Preferences.py b/src/Mod/Assembly/Preferences.py
index 8db2be359b..8f96362a4d 100644
--- a/src/Mod/Assembly/Preferences.py
+++ b/src/Mod/Assembly/Preferences.py
@@ -24,7 +24,7 @@
import FreeCAD
import FreeCADGui
-from UtilsAssembly import tr
+translate = FreeCAD.Qt.translate
def preferences():
@@ -44,7 +44,7 @@ class PreferencesPage:
pref = preferences()
self.form.checkBoxEnableEscape.setChecked(pref.GetBool("LeaveEditWithEscape", True))
self.form.groundFirstPart.clear()
- self.form.groundFirstPart.addItem(tr("Assembly", "Ask"))
- self.form.groundFirstPart.addItem(tr("Assembly", "Always"))
- self.form.groundFirstPart.addItem(tr("Assembly", "Never"))
+ self.form.groundFirstPart.addItem(translate("Assembly", "Ask"))
+ self.form.groundFirstPart.addItem(translate("Assembly", "Always"))
+ self.form.groundFirstPart.addItem(translate("Assembly", "Never"))
self.form.groundFirstPart.setCurrentIndex(pref.GetInt("GroundFirstPart", 0))
diff --git a/src/Mod/Assembly/UtilsAssembly.py b/src/Mod/Assembly/UtilsAssembly.py
index dfb2e3cb7b..9a8a39570a 100644
--- a/src/Mod/Assembly/UtilsAssembly.py
+++ b/src/Mod/Assembly/UtilsAssembly.py
@@ -38,10 +38,6 @@ __author__ = "Ondsel"
__url__ = "https://www.freecad.org"
-def tr(context, text, comment=None):
- return QtCore.QCoreApplication.translate(context, text, comment)
-
-
def activeAssembly():
doc = Gui.ActiveDocument
diff --git a/src/Tools/updatecrowdin.py b/src/Tools/updatecrowdin.py
index 9a1b728b06..e83e0fe3e8 100755
--- a/src/Tools/updatecrowdin.py
+++ b/src/Tools/updatecrowdin.py
@@ -111,6 +111,11 @@ locations = [
],
["App", "../App/Resources/translations", "../App/Resources/App.qrc"],
["Arch", "../Mod/Arch/Resources/translations", "../Mod/Arch/Resources/Arch.qrc"],
+ [
+ "Assembly",
+ "../Mod/Assembly/Gui/Resources/translations",
+ "../Mod/Assembly/Gui/Resources/Assembly.qrc",
+ ],
[
"draft",
"../Mod/Draft/Resources/translations",
diff --git a/src/Tools/updatets.py b/src/Tools/updatets.py
index e2e670aac2..d528ed8801 100755
--- a/src/Tools/updatets.py
+++ b/src/Tools/updatets.py
@@ -67,6 +67,11 @@ directories = [
"workingdir": "./src/Mod/Arch/",
"tsdir": "Resources/translations",
},
+ {
+ "tsname": "Assembly",
+ "workingdir": "./src/Mod/Assembly/",
+ "tsdir": "Gui/Resources/translations",
+ },
{
"tsname": "Draft",
"workingdir": "./src/Mod/Draft/",