From ffdcfb0b5de44d77356d2771193ee98caba410fc Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Thu, 27 Aug 2020 00:17:14 +0300 Subject: [PATCH] - fixed crash in Properties Tool, when applied on a CNCJob object made out of an Excellon object (fixed issue #444) - in Properties Tool, for CNCJob objects made out of Excellon objects, added the information's from Tool Data - in Properties Tool made sure that the set color for the Tree parents depends on the fact if the gray icons set are used (dark theme) or not - Properties Tool - properties for a Gerber objects has the Tool Data now at the end of the information's --- CHANGELOG.md | 4 +++ appObjects/FlatCAMCNCJob.py | 2 -- appTools/ToolProperties.py | 62 ++++++++++++++++++++++++------------- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 061548e5..19253cad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,10 @@ CHANGELOG for FlatCAM beta - Isolation Tool - added ability to find the tool diameter that will guarantee total isolation of the currently selected Gerber object - NCC Tool - UI change: if the operation is Isolation then some of the tool parameters are disabled - fixed issue when plotting a CNCJob object with multiple tools and annotations on by plotting annotations after all the tools geometries are plotted +- fixed crash in Properties Tool, when applied on a CNCJob object made out of an Excellon object (fixed issue #444) +- in Properties Tool, for CNCJob objects made out of Excellon objects, added the information's from Tool Data +- in Properties Tool made sure that the set color for the Tree parents depends on the fact if the gray icons set are used (dark theme) or not +- Properties Tool - properties for a Gerber objects has the Tool Data now at the end of the information's 25.08.2020 diff --git a/appObjects/FlatCAMCNCJob.py b/appObjects/FlatCAMCNCJob.py index fd145219..5edb5ef3 100644 --- a/appObjects/FlatCAMCNCJob.py +++ b/appObjects/FlatCAMCNCJob.py @@ -2294,8 +2294,6 @@ class CNCJobObject(FlatCAMObj, CNCjob): if self.app.is_legacy is False: self.annotation.clear(update=True) - - def on_annotation_change(self): """ Handler for toggling the annotation display by clicking a checkbox. diff --git a/appTools/ToolProperties.py b/appTools/ToolProperties.py index ab860b93..8a5c212c 100644 --- a/appTools/ToolProperties.py +++ b/appTools/ToolProperties.py @@ -146,30 +146,33 @@ class Properties(AppTool): font = QtGui.QFont() font.setBold(True) + p_color = QtGui.QColor("#000000") if self.app.defaults['global_gray_icons'] is False \ + else QtGui.QColor("#FFFFFF") + # main Items categories - obj_type = self.treeWidget.addParent(parent, _('TYPE'), expanded=True, color=QtGui.QColor("#000000"), font=font) - obj_name = self.treeWidget.addParent(parent, _('NAME'), expanded=True, color=QtGui.QColor("#000000"), font=font) + obj_type = self.treeWidget.addParent(parent, _('TYPE'), expanded=True, color=p_color, font=font) + obj_name = self.treeWidget.addParent(parent, _('NAME'), expanded=True, color=p_color, font=font) dims = self.treeWidget.addParent( - parent, _('Dimensions'), expanded=True, color=QtGui.QColor("#000000"), font=font) - units = self.treeWidget.addParent(parent, _('Units'), expanded=True, color=QtGui.QColor("#000000"), font=font) - options = self.treeWidget.addParent(parent, _('Options'), color=QtGui.QColor("#000000"), font=font) + parent, _('Dimensions'), expanded=True, color=p_color, font=font) + units = self.treeWidget.addParent(parent, _('Units'), expanded=True, color=p_color, font=font) + options = self.treeWidget.addParent(parent, _('Options'), color=p_color, font=font) if obj.kind.lower() == 'gerber': apertures = self.treeWidget.addParent( - parent, _('Apertures'), expanded=True, color=QtGui.QColor("#000000"), font=font) + parent, _('Apertures'), expanded=True, color=p_color, font=font) else: tools = self.treeWidget.addParent( - parent, _('Tools'), expanded=True, color=QtGui.QColor("#000000"), font=font) + parent, _('Tools'), expanded=True, color=p_color, font=font) if obj.kind.lower() == 'excellon': drills = self.treeWidget.addParent( - parent, _('Drills'), expanded=True, color=QtGui.QColor("#000000"), font=font) + parent, _('Drills'), expanded=True, color=p_color, font=font) slots = self.treeWidget.addParent( - parent, _('Slots'), expanded=True, color=QtGui.QColor("#000000"), font=font) + parent, _('Slots'), expanded=True, color=p_color, font=font) if obj.kind.lower() == 'cncjob': others = self.treeWidget.addParent( - parent, _('Others'), expanded=True, color=QtGui.QColor("#000000"), font=font) + parent, _('Others'), expanded=True, color=p_color, font=font) separator = self.treeWidget.addParent(parent, '') @@ -193,7 +196,7 @@ class Properties(AppTool): self.treeWidget.addChild(obj_name, [obj.options['name']]) def job_thread(obj_prop): - proc = self.app.proc_container.new(_("Calculating dimensions ... Please wait.")) + self.app.proc_container.new(_("Calculating dimensions ... Please wait.")) length = 0.0 width = 0.0 @@ -382,7 +385,7 @@ class Properties(AppTool): temp_ap['Clear_Geo'] = '%s Polygons' % str(clear_nr) apid = self.treeWidget.addParent( - apertures, str(ap), expanded=False, color=QtGui.QColor("#000000"), font=font) + apertures, str(ap), expanded=False, color=p_color, font=font) for key in temp_ap: self.treeWidget.addChild(apid, [str(key), str(temp_ap[key])], True) elif obj.kind.lower() == 'excellon': @@ -391,7 +394,7 @@ class Properties(AppTool): for tool, value in obj.tools.items(): toolid = self.treeWidget.addParent( - tools, str(tool), expanded=False, color=QtGui.QColor("#000000"), font=font) + tools, str(tool), expanded=False, color=p_color, font=font) drill_cnt = 0 # variable to store the nr of drills per tool slot_cnt = 0 # variable to store the nr of slots per tool @@ -424,7 +427,7 @@ class Properties(AppTool): elif obj.kind.lower() == 'geometry': for tool, value in obj.tools.items(): geo_tool = self.treeWidget.addParent( - tools, str(tool), expanded=True, color=QtGui.QColor("#000000"), font=font) + tools, str(tool), expanded=True, color=p_color, font=font) for k, v in value.items(): if k == 'solid_geometry': # printed_value = _('Present') if v else _('None') @@ -435,7 +438,7 @@ class Properties(AppTool): self.treeWidget.addChild(geo_tool, [str(k), printed_value], True) elif k == 'data': tool_data = self.treeWidget.addParent( - geo_tool, str(k).capitalize(), color=QtGui.QColor("#000000"), font=font) + geo_tool, str(k).capitalize(), color=p_color, font=font) for data_k, data_v in v.items(): self.treeWidget.addChild(tool_data, [str(data_k), str(data_v)], True) else: @@ -444,7 +447,7 @@ class Properties(AppTool): # for cncjob objects made from gerber or geometry for tool, value in obj.cnc_tools.items(): geo_tool = self.treeWidget.addParent( - tools, str(tool), expanded=True, color=QtGui.QColor("#000000"), font=font) + tools, str(tool), expanded=True, color=p_color, font=font) for k, v in value.items(): if k == 'solid_geometry': printed_value = _('Present') if v else _('None') @@ -456,17 +459,20 @@ class Properties(AppTool): printed_value = _('Present') if v else _('None') self.treeWidget.addChild(geo_tool, [_("GCode Geometry"), printed_value], True) elif k == 'data': - tool_data = self.treeWidget.addParent( - geo_tool, _("Data"), color=QtGui.QColor("#000000"), font=font) - for data_k, data_v in v.items(): - self.treeWidget.addChild(tool_data, [str(data_k).capitalize(), str(data_v)], True) + pass else: self.treeWidget.addChild(geo_tool, [str(k), str(v)], True) + v = value['data'] + tool_data = self.treeWidget.addParent( + geo_tool, _("Tool Data"), color=p_color, font=font) + for data_k, data_v in v.items(): + self.treeWidget.addChild(tool_data, [str(data_k).capitalize(), str(data_v)], True) + # for cncjob objects made from excellon for tool_dia, value in obj.exc_cnc_tools.items(): exc_tool = self.treeWidget.addParent( - tools, str(value['tool']), expanded=False, color=QtGui.QColor("#000000"), font=font + tools, str(value['tool']), expanded=False, color=p_color, font=font ) self.treeWidget.addChild( exc_tool, @@ -484,6 +490,12 @@ class Properties(AppTool): self.treeWidget.addChild(exc_tool, [_("Drills number"), str(v)], True) elif k == 'nr_slots': self.treeWidget.addChild(exc_tool, [_("Slots number"), str(v)], True) + elif k == 'gcode': + printed_value = _('Present') if v != '' else _('None') + self.treeWidget.addChild(exc_tool, [_("GCode Text"), printed_value], True) + elif k == 'gcode_parsed': + printed_value = _('Present') if v else _('None') + self.treeWidget.addChild(exc_tool, [_("GCode Geometry"), printed_value], True) else: pass @@ -493,7 +505,7 @@ class Properties(AppTool): _("Depth of Cut"), '%.*f %s' % ( self.decimals, - (obj.z_cut - abs(obj.tool_offset[tool_dia])), + (obj.z_cut - abs(value['data']['tools_drill_offset'])), self.app.defaults['units'].lower() ) ], @@ -524,6 +536,12 @@ class Properties(AppTool): True ) + v = value['data'] + tool_data = self.treeWidget.addParent( + exc_tool, _("Tool Data"), color=p_color, font=font) + for data_k, data_v in v.items(): + self.treeWidget.addChild(tool_data, [str(data_k).capitalize(), str(data_v)], True) + r_time = obj.routing_time if r_time > 1: units_lbl = 'min'