diff --git a/FlatCAMEditor.py b/FlatCAMEditor.py index 8a3d41ed..da2e556f 100644 --- a/FlatCAMEditor.py +++ b/FlatCAMEditor.py @@ -1988,6 +1988,7 @@ class FlatCAMGeoEditor(QtCore.QObject): self.tools[tool]["button"].setCheckable(True) # Checkable self.app.ui.grid_snap_btn.triggered.connect(self.on_grid_toggled) + self.app.ui.corner_snap_btn.setCheckable(True) self.app.ui.corner_snap_btn.triggered.connect(lambda: self.toolbar_tool_toggle("corner_snap")) self.options = { @@ -2045,6 +2046,9 @@ class FlatCAMGeoEditor(QtCore.QObject): self.shapes.enabled = True self.tool_shape.enabled = True self.app.app_cursor.enabled = True + + self.app.ui.snap_max_dist_entry.setEnabled(True) + self.app.ui.corner_snap_btn.setEnabled(True) self.app.ui.snap_magnet.setVisible(True) self.app.ui.corner_snap_btn.setVisible(True) @@ -2076,14 +2080,19 @@ class FlatCAMGeoEditor(QtCore.QObject): theme = settings.value('theme', type=str) if theme == 'standard': self.app.ui.geo_edit_toolbar.setVisible(False) + self.app.ui.snap_max_dist_entry.setEnabled(False) + self.app.ui.corner_snap_btn.setEnabled(False) self.app.ui.snap_magnet.setVisible(False) self.app.ui.corner_snap_btn.setVisible(False) elif theme == 'compact': - pass + self.app.ui.snap_max_dist_entry.setEnabled(False) + self.app.ui.corner_snap_btn.setEnabled(False) else: self.app.ui.geo_edit_toolbar.setVisible(False) self.app.ui.snap_magnet.setVisible(False) self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_max_dist_entry.setEnabled(False) + self.app.ui.corner_snap_btn.setEnabled(False) # Disable visuals self.shapes.enabled = False @@ -2093,8 +2102,7 @@ class FlatCAMGeoEditor(QtCore.QObject): self.app.ui.geo_editor_menu.setDisabled(True) self.app.ui.geo_editor_menu.menuAction().setVisible(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.update_obj_btn.setEnabled(False) + self.app.ui.g_editor_cmenu.setEnabled(False) self.app.ui.e_editor_cmenu.setEnabled(False) @@ -2970,7 +2978,7 @@ class FlatCAMGeoEditor(QtCore.QObject): nearest_pt, shape = self.storage.nearest((x, y)) nearest_pt_distance = distance((x, y), nearest_pt) - if nearest_pt_distance <= self.options["global_snap_max"]: + if nearest_pt_distance <= float(self.options["global_snap_max"]): snap_distance = nearest_pt_distance snap_x, snap_y = nearest_pt except (StopIteration, AssertionError): @@ -4208,6 +4216,8 @@ class FlatCAMExcEditor(QtCore.QObject): self.shapes.enabled = True self.tool_shape.enabled = True # self.app.app_cursor.enabled = True + self.app.ui.snap_max_dist_entry.setEnabled(True) + self.app.ui.corner_snap_btn.setEnabled(True) self.app.ui.snap_magnet.setVisible(True) self.app.ui.corner_snap_btn.setVisible(True) @@ -4238,12 +4248,22 @@ class FlatCAMExcEditor(QtCore.QObject): theme = settings.value('theme', type=str) if theme == 'standard': self.app.ui.exc_edit_toolbar.setVisible(False) + self.app.ui.snap_max_dist_entry.setEnabled(False) + self.app.ui.corner_snap_btn.setEnabled(False) self.app.ui.snap_magnet.setVisible(False) self.app.ui.corner_snap_btn.setVisible(False) elif theme == 'compact': - pass + self.app.ui.exc_edit_toolbar.setVisible(False) + self.app.ui.snap_max_dist_entry.setEnabled(False) + self.app.ui.corner_snap_btn.setEnabled(False) + self.app.ui.snap_magnet.setVisible(True) + self.app.ui.corner_snap_btn.setVisible(True) else: - pass + self.app.ui.exc_edit_toolbar.setVisible(False) + self.app.ui.snap_max_dist_entry.setEnabled(False) + self.app.ui.corner_snap_btn.setEnabled(False) + self.app.ui.snap_magnet.setVisible(False) + self.app.ui.corner_snap_btn.setVisible(False) # Disable visuals self.shapes.enabled = False @@ -4255,7 +4275,6 @@ class FlatCAMExcEditor(QtCore.QObject): self.app.ui.exc_editor_menu.setDisabled(True) self.app.ui.exc_editor_menu.menuAction().setVisible(False) - self.app.ui.corner_snap_btn.setEnabled(False) self.app.ui.update_obj_btn.setEnabled(False) self.app.ui.g_editor_cmenu.setEnabled(False) self.app.ui.e_editor_cmenu.setEnabled(False) @@ -4472,11 +4491,15 @@ class FlatCAMExcEditor(QtCore.QObject): self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab) def update_options(self, obj): - if not obj.options: + try: + if not obj.options: + obj.options = {} + return True + else: + return False + except AttributeError: obj.options = {} return True - else: - return False def new_edited_excellon(self, outname): """ @@ -4497,6 +4520,7 @@ class FlatCAMExcEditor(QtCore.QObject): excellon_obj.drills = self.new_drills excellon_obj.tools = self.new_tools excellon_obj.slots = self.new_slots + excellon_obj.options['name'] = outname try: excellon_obj.create_geometry() diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 2bfa74ac..a2911146 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -4163,7 +4163,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob): preamble = str(self.ui.prepend_text.get_value()) postamble = str(self.ui.append_text.get_value()) self.app.gcode_edited = self.export_gcode(preamble=preamble, postamble=postamble, to_file=True) - print(self.app.gcode_edited) + # print(self.app.gcode_edited) # first clear previous text in text editor (if any) self.app.ui.code_editor.clear() diff --git a/README.md b/README.md index 264ebcd4..68d688b4 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ CAD program, and create G-Code for Isolation routing. - added protection against entering float numbers with comma separator instead of decimal dot separator in key points of FlatCAM (not everywhere) - added a choice of plotting the kind of geometry for the CNC plot (all, travel and cut kind of geometries) in CNCJob Selected Tab - added a new postprocessor file named: 'probe_from_zmove' which allow probing to be done from z_move position on toolchange event +- fixed the snap magnet button in Geometry Editor, restored the checkable property to True +- some more changes in the Editors GUI in deactivate() function +- a fix for saving again empt an edited new and empty Excellon Object 1.02.2019