Assembly fixes

This commit is contained in:
PaddleStroke
2024-01-31 16:05:32 +01:00
parent 7d1f1f2143
commit b85e672226
7 changed files with 60 additions and 40 deletions

View File

@@ -76,7 +76,7 @@ class CommandCreateJointFixed:
+ "<p>"
+ 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.",
)
+ "</p>",
"CmdType": "ForEdit",
@@ -211,7 +211,7 @@ class CommandCreateJointDistance:
"ToolTip": "<p>"
+ 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.",
)
+ "</p>",
"CmdType": "ForEdit",

View File

@@ -59,7 +59,9 @@ class CommandInsertLink:
+ "</p><p><ul><li>"
+ QT_TRANSLATE_NOOP("Assembly_InsertLink", "Insert by left clicking items in the list.")
+ "</li><li>"
+ 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."
)
+ "</li><li>"
+ QT_TRANSLATE_NOOP(
"Assembly_InsertLink",

View File

@@ -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()

View File

@@ -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))

View File

@@ -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

View File

@@ -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",

View File

@@ -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/",