From bf165032a356966e6f6545a917f269cd4d645e5a Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 30 Dec 2020 05:52:35 +0200 Subject: [PATCH] - fixed error in Gerber Editor - made some more log.debug messages visible in Tcl Shell --- CHANGELOG.md | 5 +++++ appEditors/AppGerberEditor.py | 21 +++++++++++---------- appObjects/AppObject.py | 24 ++++++++++++------------ appObjects/ObjectCollection.py | 3 ++- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58a872cd..1b28e5f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta ================================================= +30.12.2020 + +- fixed error in Gerber Editor +- made some more log.debug messages visible in Tcl Shell + 28.12.2020 - Gerber Editor - Import Shape sub-tool finished (by adding selection by dragging a selection box) diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py index da4a0e68..a001eb32 100644 --- a/appEditors/AppGerberEditor.py +++ b/appEditors/AppGerberEditor.py @@ -4675,16 +4675,17 @@ class AppGerberEditor(QtCore.QObject): new_elem = {} if 'solid' in elem: solid_geo = elem['solid'] - if not global_clear_geo or global_clear_geo.is_empty: - pass - else: - for clear_geo in global_clear_geo: - # Make sure that the clear_geo is within the solid_geo otherwise we loose - # Make sure that the clear_geo is within the solid_geo otherwise we loose - # the solid_geometry. We want for clear_geometry just to cut into - # solid_geometry not to delete it - if clear_geo.within(solid_geo): - solid_geo = solid_geo.difference(clear_geo) + if not global_clear_geo: + if isinstance(global_clear_geo, Polygon) and global_clear_geo.is_empty: + pass + else: + for clear_geo in global_clear_geo: + # Make sure that the clear_geo is within the solid_geo otherwise we loose + # Make sure that the clear_geo is within the solid_geo otherwise we loose + # the solid_geometry. We want for clear_geometry just to cut into + # solid_geometry not to delete it + if clear_geo.within(solid_geo): + solid_geo = solid_geo.difference(clear_geo) new_elem['solid'] = solid_geo if 'clear' in elem: diff --git a/appObjects/AppObject.py b/appObjects/AppObject.py index 55c77992..002cf933 100644 --- a/appObjects/AppObject.py +++ b/appObjects/AppObject.py @@ -90,7 +90,7 @@ class AppObject(QtCore.QObject): if callback_params is None: callback_params = [None] - log.debug("AppObject.new_object()") + self.app.log.debug("AppObject.new_object()") obj_plot = plot obj_autoselected = autoselected @@ -106,7 +106,7 @@ class AppObject(QtCore.QObject): "document": DocumentObject } - log.debug("Calling object constructor...") + self.app.log.debug("Calling object constructor...") # Object creation/instantiation obj = classdict[kind](name) @@ -162,7 +162,7 @@ class AppObject(QtCore.QObject): # in a thread-safe way as is is likely that we # have been invoked in a separate thread. t1 = time.time() - log.debug("%f seconds before initialize()." % (t1 - t0)) + self.app.log.debug("%f seconds before initialize()." % (t1 - t0)) try: return_value = initialize(obj, self.app) @@ -175,11 +175,11 @@ class AppObject(QtCore.QObject): t2 = time.time() msg = "%s %s. %f seconds executing initialize()." % (_("New object with name:"), name, (t2 - t1)) - log.debug(msg) + self.app.log.debug(msg) self.app.inform_shell.emit(msg) if return_value == 'fail': - log.debug("Object (%s) parsing and/or geometry creation failed." % kind) + self.app.log.debug("Object (%s) parsing and/or geometry creation failed." % kind) return "fail" # ############################################################################################################ @@ -190,7 +190,7 @@ class AppObject(QtCore.QObject): self.app.inform.emit('%s: %s' % (_("Converting units to "), self.app.options["units"])) obj.convert_units(self.app.options["units"]) t3 = time.time() - log.debug("%f seconds converting units." % (t3 - t2)) + self.app.log.debug("%f seconds converting units." % (t3 - t2)) # ############################################################################################################ # Create the bounding box for the object and then add the results to the obj.options @@ -204,10 +204,10 @@ class AppObject(QtCore.QObject): obj.options['xmax'] = xmax obj.options['ymax'] = ymax except Exception as e: - log.warning("AppObject.new_object() -> The object has no bounds properties. %s" % str(e)) + self.app.log.warning("AppObject.new_object() -> The object has no bounds properties. %s" % str(e)) return "fail" - log.debug("Moving new object back to main thread.") + self.app.log.debug("Moving new object back to main thread.") # ############################################################################################################ # Move the object to the main thread and let the app know that it is available. @@ -235,7 +235,7 @@ class AppObject(QtCore.QObject): """ t0 = time.time() # DEBUG - log.debug("on_object_created()") + self.app.log.debug("on_object_created()") # ############################################################################################################# # ############################### Add the new object to the Collection ###################################### @@ -321,7 +321,7 @@ class AppObject(QtCore.QObject): obj.outline_color = self.app.defaults["gerber_plot_line"] obj.fill_color = self.app.defaults["gerber_plot_fill"] except Exception as e: - log.warning("AppObject.new_object() -> setting colors error. %s" % str(e)) + self.app.log.warning("AppObject.new_object() -> setting colors error. %s" % str(e)) # ############################################################################################################# # update the SHELL auto-completer model with the name of the new object @@ -347,7 +347,7 @@ class AppObject(QtCore.QObject): t1 = time.time() # DEBUG msg = "%f seconds adding object and plotting." % (t1 - t0) - log.debug(msg) + self.app.log.debug(msg) self.object_plotted.emit(t_obj) if t_obj.kind == 'gerber' and self.app.defaults["gerber_buffering"] != 'full' and \ @@ -382,7 +382,7 @@ class AppObject(QtCore.QObject): obj.options['xmax'] = xmax obj.options['ymax'] = ymax - log.debug("Object changed, updating the bounding box data on self.options") + self.app.log.debug("Object changed, updating the bounding box data on self.options") # delete the old selection shape self.app.delete_selection_shape() self.app.should_we_save = True diff --git a/appObjects/ObjectCollection.py b/appObjects/ObjectCollection.py index 5cbe5220..3dc98864 100644 --- a/appObjects/ObjectCollection.py +++ b/appObjects/ObjectCollection.py @@ -362,7 +362,8 @@ class ObjectCollection(QtCore.QAbstractItemModel): return len(self.plot_promises) > 0 def on_mouse_down(self, event): - self.app.log.debug("Mouse button pressed on list") + # self.app.log.debug("Mouse button pressed on list") + pass def on_menu_request(self, pos):