Explorar o código

Merged marius_stanciu/flatcam_beta/Beta_8.993 into Beta

Marius Stanciu %!s(int64=5) %!d(string=hai) anos
pai
achega
64e463cd64
Modificáronse 2 ficheiros con 14 adicións e 1 borrados
  1. 2 0
      CHANGELOG.md
  2. 12 1
      appGUI/GUIElements.py

+ 2 - 0
CHANGELOG.md

@@ -123,6 +123,8 @@ CHANGELOG for FlatCAM beta
 
 
 - working on Isolation Tool: made to work the Isolation with multiple tools without rest machining
 - working on Isolation Tool: made to work the Isolation with multiple tools without rest machining
 - in Tool Calculators fixed an application crash if the user typed letters instead of numbers in the boxes. Now the boxes accept only numbers, dots, comma, spaces and arithmetic operators
 - in Tool Calculators fixed an application crash if the user typed letters instead of numbers in the boxes. Now the boxes accept only numbers, dots, comma, spaces and arithmetic operators
+- NumericalEvalEntry allow the input of commas now
+- Tool Calculators: allowed comma to be used as decimal separator
 
 
 26.05.2020
 26.05.2020
 
 

+ 12 - 1
appGUI/GUIElements.py

@@ -666,10 +666,21 @@ class NumericalEvalEntry(EvalEntry):
     def __init__(self, border_color=None):
     def __init__(self, border_color=None):
         super().__init__(border_color=border_color)
         super().__init__(border_color=border_color)
 
 
-        regex = QtCore.QRegExp("[0-9\/\*\+\-\%\.\s]*")
+        regex = QtCore.QRegExp("[0-9\/\*\+\-\%\.\,\s]*")
         validator = QtGui.QRegExpValidator(regex, self)
         validator = QtGui.QRegExpValidator(regex, self)
         self.setValidator(validator)
         self.setValidator(validator)
 
 
+    def get_value(self):
+        raw = str(self.text()).strip(' ')
+        raw = raw.replace(',', '.')
+        try:
+            evaled = eval(raw)
+        except Exception as e:
+            if raw != '':
+                log.error("Could not evaluate val: %s, error: %s" % (str(raw), str(e)))
+            return None
+        return evaled
+
 
 
 class NumericalEvalTupleEntry(FCEntry):
 class NumericalEvalTupleEntry(FCEntry):
     """
     """