Patch #2864: PathHelix x10 issue on "Step in Z" inputfield and "Step in Radius"

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
Kunda1
Posts: 5913
Joined: Thu Jan 05, 2017 9:03 pm

Patch #2864: PathHelix x10 issue on "Step in Z" inputfield and "Step in Radius"

Postby Kunda1 » Sat Jan 28, 2017 1:07 pm

issue #2864: PathHelix x10 issue on "Step in Z" inputfield and "Step in Radius"
proteus wrote:Description
After i open the PathHelix UI in the input field "Step in Z" the value is multiplied by 10. In the input filed "Step in Radius" is always the diameter from the tooltable. In the attachment is a patch for this issue. With this patch now the previous_value is propper working.

Steps To Reproduce
double klick on PathHelix icon on the left side of the tree.

Additional Information
OS: "openSUSE Leap 42.1 (x86_64)"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9661 (Git)
Build type: Release
Branch: master
Hash: 5b5189a8d69378e4216062bab6932978ce303be7
Python version: 2.7.12
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.9.1.oce-0.18-dev
Patch file attached to ticket + also posted here:

Code: Select all

From a33f71c8b3a76374db2c4c8e731ab9fe3630f7c2 Mon, 16 Jan 2017 12:36:57 +0100
From: Michael Kruschinsky <mk@mysmk.de>
Date: Mon, 16 Jan 2017 12:06:38 +0100
Subject: [PATCH] 0003-Add-PathHelix_Fix_for_x10_input_field_issue_017


Signed-off-by: Michael Kruschinsky <mk@mysmk.de>
diff --git a/src/Mod/Path/PathScripts/PathHelix.py b/src/Mod/Path/PathScripts/PathHelix.py
index db8ecd7..38ac501 100644
--- a/src/Mod/Path/PathScripts/PathHelix.py
+++ b/src/Mod/Path/PathScripts/PathHelix.py
@@ -587,7 +587,9 @@
                 label = QtGui.QLabel(labelstring)
                 label.setToolTip(self.obj.getDocumentationOfProperty(property))
 
-            widget.setText(str(getattr(self.obj, property)))
+            # Fix for x10: replace dot with comma.
+            # it's the first fix, i think there was a better one, but it works.
+            widget.setText(str(getattr(self.obj, property)).replace('.', ','))
             widget.setToolTip(self.obj.getDocumentationOfProperty(property))
 
             if max:

Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
chrisb
Posts: 19505
Joined: Tue Mar 17, 2015 9:14 am

Re: Patch #2864: PathHelix x10 issue on "Step in Z" inputfield and "Step in Radius"

Postby chrisb » Sat Jan 28, 2017 4:36 pm

This error had been in the Path Workbench as well, see https://forum.freecadweb.org/viewtopic. ... 3&start=10 . The fix with replacing ',' should not be used (it was my first try as well), instead use the unit stuff as is done in PathPocket.py.
Since this error occurs here and there in different modules (it has been reported in FEM and ARCH) it should be fixed in the same way or better: The usage of input fields should be everywhere the same in FreeCAD.
User avatar
Kunda1
Posts: 5913
Joined: Thu Jan 05, 2017 9:03 pm

Re: Patch #2864: PathHelix x10 issue on "Step in Z" inputfield and "Step in Radius"

Postby Kunda1 » Sat Jan 28, 2017 5:24 pm

chrisb wrote:This error had been in the Path Workbench as well, see https://forum.freecadweb.org/viewtopic. ... 3&start=10 . The fix with replacing ',' should not be used (it was my first try as well), instead use the unit stuff as is done in PathPocket.py.
Since this error occurs here and there in different modules (it has been reported in FEM and ARCH) it should be fixed in the same way or better: The usage of input fields should be everywhere the same in FreeCAD.
I skimmed the thread but it doesn't seem that a fix has been implemented globally yet, right?
Either way, I'll need to close this ticket.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
chrisb
Posts: 19505
Joined: Tue Mar 17, 2015 9:14 am

Re: Patch #2864: PathHelix x10 issue on "Step in Z" inputfield and "Step in Radius"

Postby chrisb » Sun Jan 29, 2017 12:22 am

I only know of the changes in the Path Workbench.
lorenz
Posts: 30
Joined: Wed Mar 16, 2016 9:35 pm

Re: Patch #2864: PathHelix x10 issue on "Step in Z" inputfield and "Step in Radius"

Postby lorenz » Mon Feb 13, 2017 6:45 pm

Should be fixed by git commit 8a4952044. I just made a pull request for this.

Turns out a locale independent solution is to use the UserString attribute of Quantity as input for Gui::InputFields setText() method.