Skip to content

Commit

Permalink
Assembly: Fix limits disappearing on edit (FreeCAD#17289)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddleStroke authored Oct 18, 2024
1 parent 9c6bd61 commit f111d46
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Mod/Assembly/JointObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,13 +543,14 @@ def getAssembly(self, joint):

def setJointType(self, joint, newType):
oldType = joint.JointType
joint.JointType = newType
if newType != oldType:
joint.JointType = newType

# try to replace the joint type in the label.
tr_old_type = TranslatedJointTypes[JointTypes.index(oldType)]
tr_new_type = TranslatedJointTypes[JointTypes.index(newType)]
if tr_old_type in joint.Label:
joint.Label = joint.Label.replace(tr_old_type, tr_new_type)
# try to replace the joint type in the label.
tr_old_type = TranslatedJointTypes[JointTypes.index(oldType)]
tr_new_type = TranslatedJointTypes[JointTypes.index(newType)]
if tr_old_type in joint.Label:
joint.Label = joint.Label.replace(tr_old_type, tr_new_type)

def onChanged(self, joint, prop):
"""Do something when a property has changed"""
Expand Down Expand Up @@ -1326,6 +1327,7 @@ def __init__(self, jointTypeIndex, jointObj=None):

self.form.jointType.setCurrentIndex(jointTypeIndex)
self.jType = JointTypes[self.form.jointType.currentIndex()]
self.form.jointType.currentIndexChanged.connect(self.onJointTypeChanged)

self.form.distanceSpinbox.valueChanged.connect(self.onDistanceChanged)
self.form.distanceSpinbox2.valueChanged.connect(self.onDistance2Changed)
Expand Down Expand Up @@ -1372,8 +1374,6 @@ def __init__(self, jointTypeIndex, jointObj=None):

self.adaptUi()

self.form.jointType.currentIndexChanged.connect(self.onJointTypeChanged)

if self.creating:
# This has to be after adaptUi so that properties default values are adapted
# if needed. For instance for gears adaptUi will prevent radii from being 0
Expand Down

0 comments on commit f111d46

Please sign in to comment.