From 9e8536ab9fc24243d3911dca7cdbc902b7a6ed86 Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 23 Dec 2019 23:32:32 +0200 Subject: [PATCH] =?UTF-8?q?-=20solved=20issue=20#355=20-=20when=20the=20to?= =?UTF-8?q?ol=20diameter=20field=20in=20the=20Edit=20=E2=86=92=20Preferenc?= =?UTF-8?q?es=20=E2=86=92=20Geometry=20=E2=86=92=20Geometry=20General=20?= =?UTF-8?q?=E2=86=92=20Tools=20=E2=86=92=20Tool=20dia=20is=20only=20one=20?= =?UTF-8?q?the=20app=20failed=20to=20read=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FlatCAMApp.py | 32 +++++++++++++++++--------------- FlatCAMObj.py | 21 ++++++++++++--------- README.md | 1 + 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 2ba31254..0e3da6c3 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -11531,26 +11531,28 @@ class App(QtCore.QObject): App.log.debug(" **************** Started PROEJCT loading... **************** ") for obj in d['objs']: - def obj_init(obj_inst, app_inst): + try: + def obj_init(obj_inst, app_inst): - obj_inst.from_dict(obj) + obj_inst.from_dict(obj) - App.log.debug("Recreating from opened project an %s object: %s" % - (obj['kind'].capitalize(), obj['options']['name'])) + App.log.debug("Recreating from opened project an %s object: %s" % + (obj['kind'].capitalize(), obj['options']['name'])) - # for some reason, setting ui_title does not work when this method is called from Tcl Shell - # it's because the TclCommand is run in another thread (it inherit TclCommandSignaled) - if cli is None: - self.set_ui_title(name="{} {}: {}".format(_("Loading Project ... restoring"), - obj['kind'].upper(), - obj['options']['name'] - ) - ) + # for some reason, setting ui_title does not work when this method is called from Tcl Shell + # it's because the TclCommand is run in another thread (it inherit TclCommandSignaled) + if cli is None: + self.set_ui_title(name="{} {}: {}".format(_("Loading Project ... restoring"), + obj['kind'].upper(), + obj['options']['name'] + ) + ) - self.new_object(obj['kind'], obj['options']['name'], obj_init, active=False, fit=False, plot=plot) + self.new_object(obj['kind'], obj['options']['name'], obj_init, active=False, fit=False, plot=plot) + except Exception as e: + print('App.open_project() --> ' + str(e)) - self.inform.emit('[success] %s: %s' % - (_("Project loaded from"), filename)) + self.inform.emit('[success] %s: %s' % (_("Project loaded from"), filename)) self.should_we_save = False self.file_opened.emit("project", filename) diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 4ac69b82..4a88160e 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -3879,15 +3879,18 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): if def_key == opt_key: self.default_data[def_key] = deepcopy(opt_val) - try: - temp_tools = self.options["cnctooldia"].split(",") - tools_list = [ - float(eval(dia)) for dia in temp_tools if dia != '' - ] - except Exception as e: - log.error("At least one tool diameter needed. Verify in Edit -> Preferences -> Geometry General -> " - "Tool dia. %s" % str(e)) - return + if type(self.options["cnctooldia"]) == float: + tools_list = [self.options["cnctooldia"]] + else: + try: + temp_tools = self.options["cnctooldia"].split(",") + tools_list = [ + float(eval(dia)) for dia in temp_tools if dia != '' + ] + except Exception as e: + log.error("FlatCAMGeometry.set_ui() -> At least one tool diameter needed. " + "Verify in Edit -> Preferences -> Geometry General -> Tool dia. %s" % str(e)) + return self.tooluid += 1 diff --git a/README.md b/README.md index b4160bec..3239e6d2 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ CAD program, and create G-Code for Isolation routing. - ~~when the selection is changed in the Project Tree the selection shape on canvas is deleted~~ - if an object is selected on Project Tree and it does not have the selection shape drawn, first click on canvas over it will draw the selection shape - in Tool Transform added a new feature named 'Buffer'. For Geometry and Gerber objects will create (and replace) a geometry at a distance from the original geometry and for Excellon will adjust the Tool diameters +- solved issue #355 - when the tool diameter field in the Edit → Preferences → Geometry → Geometry General → Tools → Tool dia is only one the app failed to read it 22.12.2019