diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a556525..1b2b3aa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,9 @@ CHANGELOG for FlatCAM beta - fixed issue with preamble not being inserted when used alone - modified the way that the start GCode is stored such that now the bug in GCode Editor that did not allowed selection of the first tool is now solved - in Punch Gerber Tool added a column in the apertures table that allow marking of the selected aperture so the user can see what apertures are selected +- improvements in the Punch Gerber Tool aperture markings +- improved the Geometry Object functionality in regards of Tools DB, deleting a tool and adding a tool +- when using the 'T' shortcut key with Properties Tab in focus and populated with the properties of a Geometry Object made the popped up spinner to have the value autoselected 28.10.2020 diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py index b210dd29..34776ea0 100644 --- a/appObjects/FlatCAMGeometry.py +++ b/appObjects/FlatCAMGeometry.py @@ -1015,7 +1015,7 @@ class GeometryObject(FlatCAMObj, Geometry): self.ui_connect() - def on_tool_add(self, dia=None, new_geo=None): + def on_tool_add(self, clicked_state, dia=None, new_geo=None): log.debug("GeometryObject.on_add_tool()") self.ui_disconnect() @@ -1023,6 +1023,7 @@ class GeometryObject(FlatCAMObj, Geometry): filename = self.app.tools_database_path() tool_dia = dia if dia is not None else self.ui.addtool_entry.get_value() + # construct a list of all 'tooluid' in the self.iso_tools tool_uid_list = [int(tooluid_key) for tooluid_key in self.tools] @@ -1147,6 +1148,10 @@ class GeometryObject(FlatCAMObj, Geometry): # update the UI form self.update_ui() + # if there is at least one tool left in the Tools Table, enable the parameters GUI + if self.ui.geo_tools_table.rowCount() != 0: + self.ui.geo_param_frame.setDisabled(False) + self.app.inform.emit('[success] %s' % _("New tool added to Tool Table from Tools Database.")) def on_tool_default_add(self, dia=None, new_geo=None, muted=None): @@ -1397,7 +1402,11 @@ class GeometryObject(FlatCAMObj, Geometry): self.ui_connect() self.builduiSig.emit() - def on_tool_delete(self, all_tools=None): + def on_tool_delete(self, clicked_signal, all_tools=None): + """ + It's important to keep the not clicked_signal parameter otherwise the signal will go to the all_tools + parameter and I might get all the tool deleted + """ self.ui_disconnect() if all_tools is None: diff --git a/appObjects/FlatCAMGerber.py b/appObjects/FlatCAMGerber.py index 38b49d90..9feca036 100644 --- a/appObjects/FlatCAMGerber.py +++ b/appObjects/FlatCAMGerber.py @@ -995,9 +995,8 @@ class GerberObject(FlatCAMObj, Gerber): else: visibility = kwargs['visible'] - with self.app.proc_container.new(_("Plotting Apertures")): - - def job_thread(app_obj): + def job_thread(app_obj): + with self.app.proc_container.new(_("Plotting Apertures")): try: if aperture_to_plot_mark in self.apertures: for elem in app_obj.apertures[aperture_to_plot_mark]['geometry']: @@ -1022,10 +1021,10 @@ class GerberObject(FlatCAMObj, Gerber): except Exception as e: log.debug("GerberObject.plot_aperture() --> %s" % str(e)) - if run_thread: - self.app.worker_task.emit({'fcn': job_thread, 'params': [self]}) - else: - job_thread(self) + if run_thread: + self.app.worker_task.emit({'fcn': job_thread, 'params': [self]}) + else: + job_thread(self) def clear_plot_apertures(self, aperture='all'): """ diff --git a/appTools/ToolPunchGerber.py b/appTools/ToolPunchGerber.py index c05e6f41..fa3780f4 100644 --- a/appTools/ToolPunchGerber.py +++ b/appTools/ToolPunchGerber.py @@ -35,6 +35,9 @@ class ToolPunchGerber(AppTool): self.decimals = self.app.decimals self.units = self.app.defaults['units'] + # store here the old object name + self.old_name = '' + # ############################################################################# # ######################### Tool GUI ########################################## # ############################################################################# @@ -93,6 +96,11 @@ class ToolPunchGerber(AppTool): except Exception: return + if self.old_name != '': + old_obj = self.app.collection.get_by_name(self.old_name) + old_obj.clear_plot_apertures() + old_obj.mark_shapes.enabled = False + # enable mark shapes grb_obj.mark_shapes.enabled = True @@ -100,6 +108,8 @@ class ToolPunchGerber(AppTool): for ap_code in grb_obj.apertures: grb_obj.mark_shapes_storage[ap_code] = [] + self.old_name = grb_obj.options['name'] + def run(self, toggle=True): self.app.defaults.report_usage("ToolPunchGerber()") @@ -275,7 +285,7 @@ class ToolPunchGerber(AppTool): self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.ui.apertures_table.setSortingEnabled(False) - self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight()) + # self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight()) # self.ui.apertures_table.setMaximumHeight(self.ui.apertures_table.getHeight()) self.ui_connect() @@ -294,6 +304,18 @@ class ToolPunchGerber(AppTool): self.ui.square_cb.setChecked(False) self.ui.rectangular_cb.setChecked(False) self.ui.other_cb.setChecked(False) + + # get the Gerber file who is the source of the punched Gerber + selection_index = self.ui.gerber_object_combo.currentIndex() + model_index = self.app.collection.index(selection_index, 0, self.ui.gerber_object_combo.rootModelIndex()) + + try: + grb_obj = model_index.internalPointer().obj + except Exception: + return + + grb_obj.clear_plot_apertures() + self.ui_connect() def on_method(self, val): diff --git a/app_Main.py b/app_Main.py index a4519882..e76e8ffa 100644 --- a/app_Main.py +++ b/app_Main.py @@ -4436,6 +4436,7 @@ class App(QtCore.QObject): text='%s:' % _('Enter a Tool Diameter'), min=0.0000, max=100.0000, decimals=self.decimals, step=0.1) tool_add_popup.setWindowIcon(QtGui.QIcon(self.resource_location + '/letter_t_32.png')) + tool_add_popup.wdg.selectAll() val, ok = tool_add_popup.get_value() if ok: @@ -4443,7 +4444,7 @@ class App(QtCore.QObject): self.inform.emit('[WARNING_NOTCL] %s' % _("Please enter a tool diameter with non-zero value, in Float format.")) return - self.collection.get_active().on_tool_add(dia=float(val)) + self.collection.get_active().on_tool_add(clicked_state=False, dia=float(val)) else: self.inform.emit('[WARNING_NOTCL] %s...' % _("Adding Tool cancelled")) else: