From c804549cfe753e5cabfac5f3879849efaeb51dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20B=C3=A4hr?= Date: Sun, 22 Jan 2023 23:29:20 +0100 Subject: [PATCH] PD: Enhance InvoluteGear's Task Panel with Tool Tips In order to not maintain the same information in two places, the property docs are reused as tool tips for their input fields. And for user convenience, the same tool tip is assigned to the respective label as well. --- src/Mod/PartDesign/InvoluteGearFeature.py | 17 +++++++++++++++++ src/Mod/PartDesign/InvoluteGearFeature.ui | 16 ++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/Mod/PartDesign/InvoluteGearFeature.py b/src/Mod/PartDesign/InvoluteGearFeature.py index 31216adea4..ec35a29fb2 100644 --- a/src/Mod/PartDesign/InvoluteGearFeature.py +++ b/src/Mod/PartDesign/InvoluteGearFeature.py @@ -166,6 +166,7 @@ class _InvoluteGearTaskPanel: self.form=FreeCADGui.PySideUic.loadUi(str(pathlib.Path(__file__).with_suffix(".ui"))) self.form.setWindowIcon(QtGui.QIcon(":/icons/PartDesign_InternalExternalGear.svg")) + self.assignToolTipsFromPropertyDocs() def assignValue(property_name, fitView=False): """Returns a function that takes a single value and assigns it to the given property""" @@ -198,6 +199,22 @@ class _InvoluteGearTaskPanel: self.obj.Proxy.execute(self.obj) # calculate once FreeCAD.Gui.SendMsgToActiveView("ViewFit") + def assignToolTipsFromPropertyDocs(self): + def assign(property_name, *widgets): + doc = self.obj.getDocumentationOfProperty(property_name) + for w in widgets: + w.setToolTip(doc) + + # we assign the tool tip to both, the label and the input field, for user convenience + assign("Modules", self.form.Quantity_Modules, self.form.label_Modules) + assign("PressureAngle", self.form.Quantity_PressureAngle, self.form.label_PressureAngle) + assign("NumberOfTeeth", self.form.spinBox_NumberOfTeeth, self.form.label_NumberOfTeeth) + assign("HighPrecision", self.form.comboBox_HighPrecision, self.form.label_HighPrecision) + assign("ExternalGear", self.form.comboBox_ExternalGear, self.form.label_ExternalGear) + assign("AddendumCoefficient", self.form.doubleSpinBox_Addendum, self.form.label_Addendum) + assign("DedendumCoefficient", self.form.doubleSpinBox_Dedendum, self.form.label_Dedendum) + assign("RootFilletCoefficient", self.form.doubleSpinBox_RootFillet, self.form.label_RootFillet) + def transferTo(self): "Transfer from the dialog to the object" self.obj.NumberOfTeeth = self.form.spinBox_NumberOfTeeth.value() diff --git a/src/Mod/PartDesign/InvoluteGearFeature.ui b/src/Mod/PartDesign/InvoluteGearFeature.ui index 5af14a1797..2e9dea93e8 100644 --- a/src/Mod/PartDesign/InvoluteGearFeature.ui +++ b/src/Mod/PartDesign/InvoluteGearFeature.ui @@ -15,7 +15,7 @@ - + Number of teeth: @@ -35,7 +35,7 @@ - + Module: @@ -79,7 +79,7 @@ - + Pressure angle: @@ -120,7 +120,7 @@ - + High precision: @@ -147,7 +147,7 @@ - + External gear: @@ -174,7 +174,7 @@ - + Addendum Coefficient @@ -194,7 +194,7 @@ - + Dedendum Coefficient @@ -214,7 +214,7 @@ - + Root Fillet Coefficient