From 75499354aabba105840a0cb2a81603d8221ee403 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 19 Sep 2021 04:09:23 +0300 Subject: [PATCH] - fixed INFO in Gerber Object UI to show correctly the type of geometric element in Follow geometry --- CHANGELOG.md | 1 + appObjects/FlatCAMObj.py | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8144167e..520c4f4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta 19.09.2021 - fixed Extract Plugin not extracting soldermask for aperture macros +- fixed INFO in Gerber Object UI to show correctly the type of geometric element in Follow geometry 18.09.2021 diff --git a/appObjects/FlatCAMObj.py b/appObjects/FlatCAMObj.py index ef24a495..50c6bd39 100644 --- a/appObjects/FlatCAMObj.py +++ b/appObjects/FlatCAMObj.py @@ -10,7 +10,7 @@ # File modified by: Marius Stanciu # # ########################################################## -# import inspect # TODO: For debugging only. +# import inspect from appGUI.ObjectUI import * @@ -19,7 +19,7 @@ from appGUI.PlotCanvasLegacy import ShapeCollectionLegacy from appGUI.VisPyVisuals import ShapeCollection from shapely.ops import unary_union -from shapely.geometry import Polygon, MultiPolygon +from shapely.geometry import Polygon, MultiPolygon, Point, LineString from copy import deepcopy import sys @@ -658,7 +658,8 @@ class FlatCAMObj(QtCore.QObject): temp_ap.pop('geometry', None) solid_nr = 0 - follow_nr = 0 + follow_nr_points = 0 + follow_nr_lines = 0 clear_nr = 0 if 'geometry' in obj.tools[ap]: @@ -668,14 +669,23 @@ class FlatCAMObj(QtCore.QObject): if 'solid' in el: solid_nr += 1 if 'follow' in el: - follow_nr += 1 + if isinstance(el['follow'], Point): + follow_nr_points += 1 + else: + follow_nr_lines += 1 if 'clear' in el: clear_nr += 1 else: font.setBold(False) - temp_ap['Solid_Geo'] = '%s Polygons' % str(solid_nr) - temp_ap['Follow_Geo'] = '%s LineStrings' % str(follow_nr) - temp_ap['Clear_Geo'] = '%s Polygons' % str(clear_nr) + + temp_ap['Solid_Geo'] = '%s %s' % (str(solid_nr), _("Polygons")) + if follow_nr_lines > 0 and follow_nr_points == 0: + temp_ap['Follow_Geo'] = '%s %s' % (str(follow_nr_lines), _("LineStrings")) + elif follow_nr_lines == 0 and follow_nr_points > 0: + temp_ap['Follow_Geo'] = '%s %s' % (str(follow_nr_points), _("Points")) + else: + temp_ap['Follow_Geo'] = '%s %s' % (str(follow_nr_lines + follow_nr_points), _("Elements")) + temp_ap['Clear_Geo'] = '%s %s' % (str(clear_nr), _("Polygons")) apid = self.treeWidget.addParent( apertures, str(ap), expanded=False, color=p_color, font=font)