Просмотр исходного кода

- some small changes in the Scale button handler in FlatCAMObj() class

Marius Stanciu 6 лет назад
Родитель
Сommit
b429f9b0c8
2 измененных файлов с 14 добавлено и 1 удалено
  1. 13 1
      FlatCAMObj.py
  2. 1 0
      README.md

+ 13 - 1
FlatCAMObj.py

@@ -268,9 +268,19 @@ class FlatCAMObj(QtCore.QObject):
 
     def on_scale_button_click(self):
         self.read_form()
-        factor = eval(self.ui.scale_entry.get_value())
+        try:
+            factor = float(eval(self.ui.scale_entry.get_value()))
+        except Exception as e:
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Scaling could not be executed."))
+            log.debug("FlatCAMObj.on_scale_button_click() -- %s" % str(e))
+            return
+
+        if type(factor) != float:
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Scaling could not be executed."))
+
         # if factor is 1.0 do nothing, there is no point in scaling with a factor of 1.0
         if factor == 1.0:
+            self.app.inform.emit('[success] %s' % _("Scale done."))
             return
 
         log.debug("FlatCAMObj.on_scale_button_click()")
@@ -278,6 +288,8 @@ class FlatCAMObj(QtCore.QObject):
         def worker_task():
             with self.app.proc_container.new(_("Scaling...")):
                 self.scale(factor)
+                self.app.inform.emit('[success] %s' % _("Scale done."))
+
             self.app.proc_container.update_view_text('')
             with self.app.proc_container.new('%s...' % _("Plotting")):
                 self.plot()

+ 1 - 0
README.md

@@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
 
 - finished the Calibration Tool
 - changed the Scale Entry in Object UI to FCEntry() GUI element in order to allow expressions to be entered. E.g: 1/25.4
+- some small changes in the Scale button handler in FlatCAMObj() class
 
 11.12.2019