- refactored the imports in the Plugins, moved almost all imports in the AppTool file

- fixed a number of issues, mostly leftovers from moving the UI of a Plugin in its own class
- fixed some bugs in the Punch Gerber plugin
- fixed some bugs where the 'pool' parameter was not passed when creating shapes collections (in 3D graphic mode); I wonder how it worked until now
- added a new feature in the Isolation Plugin: now for all the isolation Geometry objects this plugin can do a supplementary simplification of the geometry using the tolerance parameter defined in the General Parameters. This should lead to a reduced number of tool lifts when doing corners
This commit is contained in:
Marius Stanciu
2022-03-31 19:28:19 +03:00
committed by Marius Stanciu
parent e1824a09f7
commit ada48269a9
43 changed files with 378 additions and 797 deletions

View File

@@ -5,33 +5,15 @@
# MIT Licence #
# ##########################################################
from PyQt6 import QtWidgets, QtCore, QtGui
from PyQt6.QtCore import Qt
from appTool import AppTool
from appGUI.GUIElements import RadioSet, FCTextArea, FCSpinner, FCEntry, FCCheckBox, FCComboBox, FCFileSaveDialog, \
VerticalScrollArea, FCGridLayout, FCLabel, FCFrame
from appTool import *
from appParsers.ParseSVG import *
from shapely.geometry.base import *
from shapely.ops import unary_union
from shapely.affinity import translate
from shapely.geometry import box
from io import StringIO, BytesIO
from collections.abc import Iterable
import logging
from copy import deepcopy
import qrcode
import qrcode.image.svg
import qrcode.image.pil
from lxml import etree as ET
import gettext
import appTranslation as fcTranslate
import builtins
fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
@@ -418,21 +400,27 @@ class QRCode(AppTool):
# I use the len of self.qrcode_geometry instead of the utility one because the complexity of the polygons is
# better seen in this (bit what if the sel.qrcode_geometry is just one geo element? len will fail ...
if len(self.qrcode_geometry) <= self.app.options["tools_qrcode_sel_limit"]:
qrcode_geometry_len = len(self.qrcode_geometry.geoms) if isinstance(self.qrcode_geometry, MultiPolygon) else \
len(self.qrcode_geometry)
if qrcode_geometry_len <= self.app.options["tools_qrcode_sel_limit"]:
qrcode_geo = self.qrcode_utility_geometry.geoms if isinstance(self.qrcode_utility_geometry, MultiPolygon) \
else self.qrcode_utility_geometry
try:
for poly in self.qrcode_utility_geometry:
for poly in qrcode_geo:
offset_geo.append(translate(poly.exterior, xoff=pos[0], yoff=pos[1]))
for geo_int in poly.interiors:
offset_geo.append(translate(geo_int, xoff=pos[0], yoff=pos[1]))
except TypeError:
assert isinstance(self.qrcode_utility_geometry, Polygon)
offset_geo.append(translate(self.qrcode_utility_geometry.exterior, xoff=pos[0], yoff=pos[1]))
for geo_int in self.qrcode_utility_geometry.interiors:
offset_geo.append(translate(geo_int, xoff=pos[0], yoff=pos[1]))
else:
offset_geo = [translate(self.box_poly, xoff=pos[0], yoff=pos[1])]
for shape in offset_geo:
self.shapes.add(shape, color=outline, update=True, layer=0, tolerance=None)
for shp in offset_geo:
self.shapes.add(shp, color=outline, update=True, layer=0, tolerance=None)
if self.app.use_3d_engine:
self.shapes.redraw()