From b429f9b0c8c9eb8b4f9a44649cf6f0b41403a688 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Thu, 12 Dec 2019 02:08:45 +0200 Subject: [PATCH] - some small changes in the Scale button handler in FlatCAMObj() class --- FlatCAMObj.py | 14 +++++++++++++- README.md | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 41c19d5a..1a3a9aa9 100644 --- a/FlatCAMObj.py +++ b/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() diff --git a/README.md b/README.md index ed79ebb8..83cbab6c 100644 --- a/README.md +++ b/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