From 94fa64077b748fd2385a83a82e8affffe2ac06db Mon Sep 17 00:00:00 2001 From: Mark Ganson TheMarkster <39143564+mwganson@users.noreply.github.com> Date: Sat, 1 Sep 2018 18:16:48 -0500 Subject: [PATCH] Add eval() to distance line edit during scaling This adds the ability to enter things like 6 * 25.4 into the distance line edit widget during scaling operations in the image workbench. Can also enter something like math.pi * 3 or 2**3, etc. Basically, any legal python input can be used. Using eval() is not considered a secure way of doing things, but in this context the user would be entering malicious code into his own computer. Also, what can the user do in eval() that he can't already do just by entering directly into the python console? --- src/Mod/Image/ImageTools/_CommandImageScaling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Image/ImageTools/_CommandImageScaling.py b/src/Mod/Image/ImageTools/_CommandImageScaling.py index 8e9b5e08cc..d86c3ae4b8 100644 --- a/src/Mod/Image/ImageTools/_CommandImageScaling.py +++ b/src/Mod/Image/ImageTools/_CommandImageScaling.py @@ -139,7 +139,7 @@ def cmdCreateImageScaling(name): sel = FreeCADGui.Selection.getSelection() try: locale=QtCore.QLocale.system() - d, ok = locale.toFloat(self.lineEdit.text()) + d, ok = locale.toFloat(str(eval(self.lineEdit.text()))) if not ok: raise ValueError s=d/self.distance