- working on a new type of database
This commit is contained in:
parent
acc61d460b
commit
70d3895799
|
@ -54,7 +54,7 @@ from flatcamGUI.PlotCanvas import *
|
|||
from flatcamGUI.PlotCanvasLegacy import *
|
||||
from flatcamGUI.FlatCAMGUI import *
|
||||
|
||||
from FlatCAMCommon import LoudDict, BookmarkManager, ToolsDB, color_variant
|
||||
from FlatCAMCommon import LoudDict, BookmarkManager, ToolsDB, ToolsDB2, color_variant
|
||||
from FlatCAMPostProc import load_preprocessors
|
||||
|
||||
from flatcamEditors.FlatCAMGeoEditor import FlatCAMGeoEditor
|
||||
|
@ -1076,7 +1076,7 @@ class App(QtCore.QObject):
|
|||
self.current_units = self.defaults['units']
|
||||
|
||||
# store here the current self.defaults so it can be restored if Preferences changes are cancelled
|
||||
self.current_defaults = dict()
|
||||
self.current_defaults = {}
|
||||
self.current_defaults.update(self.defaults)
|
||||
|
||||
# ##########################################################################
|
||||
|
@ -1755,7 +1755,7 @@ class App(QtCore.QObject):
|
|||
|
||||
# make sure that always the 'default' preprocessor is the first item in the dictionary
|
||||
if 'default' in self.preprocessors.keys():
|
||||
new_ppp_dict = dict()
|
||||
new_ppp_dict = {}
|
||||
|
||||
# add the 'default' name first in the dict after removing from the preprocessor's dictionary
|
||||
default_pp = self.preprocessors.pop('default')
|
||||
|
@ -2673,10 +2673,10 @@ class App(QtCore.QObject):
|
|||
|
||||
# List to store the objects that are currently loaded in FlatCAM
|
||||
# This list is updated on each object creation or object delete
|
||||
self.all_objects_list = list()
|
||||
self.all_objects_list = []
|
||||
|
||||
# List to store the objects that are selected
|
||||
self.sel_objects_list = list()
|
||||
self.sel_objects_list = []
|
||||
|
||||
# holds the key modifier if pressed (CTRL, SHIFT or ALT)
|
||||
self.key_modifiers = None
|
||||
|
@ -2752,7 +2752,7 @@ class App(QtCore.QObject):
|
|||
# this holds a widget that is installed in the Plot Area when View Source option is used
|
||||
self.source_editor_tab = None
|
||||
|
||||
self.pagesize = dict()
|
||||
self.pagesize = {}
|
||||
|
||||
# Storage for shapes, storage that can be used by FlatCAm tools for utility geometry
|
||||
# VisPy visuals
|
||||
|
@ -7410,8 +7410,8 @@ class App(QtCore.QObject):
|
|||
self.inform.emit('[ERROR_NOTCL] %s' % _("Failed. No object(s) selected..."))
|
||||
return
|
||||
|
||||
xminlist = list()
|
||||
yminlist = list()
|
||||
xminlist = []
|
||||
yminlist = []
|
||||
|
||||
# first get a bounding box to fit all
|
||||
for obj in obj_list:
|
||||
|
@ -7896,7 +7896,7 @@ class App(QtCore.QObject):
|
|||
apertures[str(apid)] = {}
|
||||
apertures[str(apid)]['geometry'] = []
|
||||
for obj_orig in obj.solid_geometry:
|
||||
new_elem = dict()
|
||||
new_elem = {}
|
||||
new_elem['solid'] = obj_orig
|
||||
try:
|
||||
new_elem['follow'] = obj_orig.exterior
|
||||
|
@ -7917,7 +7917,7 @@ class App(QtCore.QObject):
|
|||
apertures[str(apid)] = {}
|
||||
apertures[str(apid)]['geometry'] = []
|
||||
for geo in obj.tools[tool]['solid_geometry']:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = geo
|
||||
new_el['follow'] = geo.exterior
|
||||
apertures[str(apid)]['geometry'].append(deepcopy(new_el))
|
||||
|
@ -8072,7 +8072,7 @@ class App(QtCore.QObject):
|
|||
# there can be only one instance of Tools Database at one time
|
||||
return
|
||||
|
||||
self.tools_db_tab = ToolsDB(
|
||||
self.tools_db_tab = ToolsDB2(
|
||||
app=self,
|
||||
parent=self.ui,
|
||||
callback_on_edited=self.on_tools_db_edited,
|
||||
|
@ -8458,7 +8458,7 @@ class App(QtCore.QObject):
|
|||
return
|
||||
|
||||
# get the name of the selected objects and add them to a list
|
||||
name_list = list()
|
||||
name_list = []
|
||||
for obj in self.collection.get_selected():
|
||||
name_list.append(obj.options['name'])
|
||||
|
||||
|
@ -8495,12 +8495,12 @@ class App(QtCore.QObject):
|
|||
pass
|
||||
self.ui.menuobjects.clear()
|
||||
|
||||
gerber_list = list()
|
||||
exc_list = list()
|
||||
cncjob_list = list()
|
||||
geo_list = list()
|
||||
script_list = list()
|
||||
doc_list = list()
|
||||
gerber_list = []
|
||||
exc_list = []
|
||||
cncjob_list = []
|
||||
geo_list = []
|
||||
script_list = []
|
||||
doc_list = []
|
||||
|
||||
for name in self.collection.get_names():
|
||||
obj_named = self.collection.get_by_name(name)
|
||||
|
@ -8780,7 +8780,7 @@ class App(QtCore.QObject):
|
|||
was clicked, the pixel coordinates and the axes coordinates.
|
||||
:return: None
|
||||
"""
|
||||
self.pos = list()
|
||||
self.pos = []
|
||||
|
||||
if self.is_legacy is False:
|
||||
event_pos = event.pos
|
||||
|
@ -10631,7 +10631,7 @@ class App(QtCore.QObject):
|
|||
color = 'black'
|
||||
transparency_level = 1.0
|
||||
|
||||
self.pagesize = dict()
|
||||
self.pagesize = {}
|
||||
self.pagesize.update(
|
||||
{
|
||||
'Bounds': None,
|
||||
|
@ -10685,7 +10685,7 @@ class App(QtCore.QObject):
|
|||
}
|
||||
)
|
||||
|
||||
exported_svg = list()
|
||||
exported_svg = []
|
||||
for obj in obj_selection:
|
||||
svg_obj = obj.export_svg(scale_stroke_factor=0.0,
|
||||
scale_factor_x=None, scale_factor_y=None,
|
||||
|
|
964
FlatCAMCommon.py
964
FlatCAMCommon.py
File diff suppressed because it is too large
Load Diff
|
@ -114,7 +114,7 @@ class FlatCAMObj(QtCore.QObject):
|
|||
else:
|
||||
self.shapes = ShapeCollectionLegacy(obj=self, app=self.app, name=name)
|
||||
|
||||
self.mark_shapes = dict()
|
||||
self.mark_shapes = {}
|
||||
|
||||
self.item = None # Link with project view item
|
||||
|
||||
|
@ -654,7 +654,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
self.mp = None
|
||||
|
||||
# dict to store the polygons selected for isolation; key is the shape added to be plotted and value is the poly
|
||||
self.poly_dict = dict()
|
||||
self.poly_dict = {}
|
||||
|
||||
# store the status of grid snapping
|
||||
self.grid_status_memory = None
|
||||
|
@ -1331,7 +1331,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
geo_obj.options["cnctooldia"] = str(self.options["isotooldia"])
|
||||
geo_obj.tool_type = self.ui.tool_type_radio.get_value().upper()
|
||||
|
||||
geo_obj.solid_geometry = list()
|
||||
geo_obj.solid_geometry = []
|
||||
|
||||
# transfer the Cut Z and Vtip and VAngle values in case that we use the V-Shape tool in Gerber UI
|
||||
if self.ui.tool_type_radio.get_value() == 'v':
|
||||
|
@ -1372,8 +1372,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
"startz": self.app.defaults['geometry_startz']
|
||||
})
|
||||
|
||||
geo_obj.tools = dict()
|
||||
geo_obj.tools['1'] = dict()
|
||||
geo_obj.tools = {}
|
||||
geo_obj.tools['1'] = {}
|
||||
geo_obj.tools.update({
|
||||
'1': {
|
||||
'tooldia': float(self.options["isotooldia"]),
|
||||
|
@ -1520,8 +1520,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||
"startz": self.app.defaults['geometry_startz']
|
||||
})
|
||||
|
||||
geo_obj.tools = dict()
|
||||
geo_obj.tools['1'] = dict()
|
||||
geo_obj.tools = {}
|
||||
geo_obj.tools['1'] = {}
|
||||
geo_obj.tools.update({
|
||||
'1': {
|
||||
'tooldia': float(self.options["isotooldia"]),
|
||||
|
@ -2416,15 +2416,15 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||
})
|
||||
|
||||
# TODO: Document this.
|
||||
self.tool_cbs = dict()
|
||||
self.tool_cbs = {}
|
||||
|
||||
# dict that holds the object names and the option name
|
||||
# the key is the object name (defines in ObjectUI) for each UI element that is a parameter
|
||||
# particular for a tool and the value is the actual name of the option that the UI element is changing
|
||||
self.name2option = dict()
|
||||
self.name2option = {}
|
||||
|
||||
# default set of data to be added to each tool in self.tools as self.tools[tool]['data'] = self.default_data
|
||||
self.default_data = dict()
|
||||
self.default_data = {}
|
||||
|
||||
# fill in self.default_data values from self.options
|
||||
for opt_key, opt_val in self.app.options.items():
|
||||
|
@ -2629,7 +2629,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||
)
|
||||
|
||||
# delete the exc_final tools, drills and slots
|
||||
exc_final.tools = dict()
|
||||
exc_final.tools = {}
|
||||
exc_final.drills[:] = []
|
||||
exc_final.slots[:] = []
|
||||
|
||||
|
@ -2669,7 +2669,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||
sorted_tools = sorted(sort, key=lambda t1: t1[1])
|
||||
tools = [i[0] for i in sorted_tools]
|
||||
|
||||
new_options = dict()
|
||||
new_options = {}
|
||||
for opt in self.options:
|
||||
new_options[opt] = self.options[opt]
|
||||
|
||||
|
@ -3046,7 +3046,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||
def on_row_selection_change(self):
|
||||
self.ui_disconnect()
|
||||
|
||||
sel_rows = list()
|
||||
sel_rows = []
|
||||
sel_items = self.ui.tools_table.selectedItems()
|
||||
for it in sel_items:
|
||||
sel_rows.append(it.row())
|
||||
|
@ -3181,7 +3181,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||
# from the columnCount we subtract a value of 1 which represent the last column (plot column)
|
||||
# which does not have text
|
||||
txt = ''
|
||||
elem = list()
|
||||
elem = []
|
||||
|
||||
for column in range(0, self.ui.tools_table.columnCount() - 1):
|
||||
try:
|
||||
|
@ -3940,7 +3940,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
|||
row = 0
|
||||
|
||||
tooluid_item = int(self.ui.tools_table.item(row, 0).text())
|
||||
temp_tool_data = dict()
|
||||
temp_tool_data = {}
|
||||
|
||||
for tooluid_key, tooluid_val in self.tools.items():
|
||||
if int(tooluid_key) == tooluid_item:
|
||||
|
@ -4220,7 +4220,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
self.ui.e_cut_entry.setDisabled(True)
|
||||
|
||||
# set the text on tool_data_label after loading the object
|
||||
sel_rows = list()
|
||||
sel_rows = []
|
||||
sel_items = self.ui.geo_tools_table.selectedItems()
|
||||
for it in sel_items:
|
||||
sel_rows.append(it.row())
|
||||
|
@ -4285,7 +4285,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
self.ui.cutz_entry.setDisabled(False)
|
||||
|
||||
# store here the default data for Geometry Data
|
||||
self.default_data = dict()
|
||||
self.default_data = {}
|
||||
self.default_data.update({
|
||||
"name": None,
|
||||
"plot": None,
|
||||
|
@ -4603,7 +4603,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
self.ui_disconnect()
|
||||
|
||||
if row is None:
|
||||
sel_rows = list()
|
||||
sel_rows = []
|
||||
sel_items = self.ui.geo_tools_table.selectedItems()
|
||||
for it in sel_items:
|
||||
sel_rows.append(it.row())
|
||||
|
@ -4684,7 +4684,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
tooldia = float(self.ui.addtool_entry.get_value())
|
||||
|
||||
# construct a list of all 'tooluid' in the self.tools
|
||||
# tool_uid_list = list()
|
||||
# tool_uid_list = []
|
||||
# for tooluid_key in self.tools:
|
||||
# tool_uid_list.append(int(tooluid_key))
|
||||
tool_uid_list = [int(tooluid_key) for tooluid_key in self.tools]
|
||||
|
@ -5329,7 +5329,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
table_tools_items = []
|
||||
if self.multigeo:
|
||||
for x in self.ui.geo_tools_table.selectedItems():
|
||||
elem = list()
|
||||
elem = []
|
||||
txt = ''
|
||||
|
||||
for column in range(0, self.ui.geo_tools_table.columnCount()):
|
||||
|
@ -5482,7 +5482,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
# this reads the values in the UI form to the self.options dictionary
|
||||
self.read_form()
|
||||
|
||||
self.sel_tools = dict()
|
||||
self.sel_tools = {}
|
||||
|
||||
try:
|
||||
if self.special_group:
|
||||
|
@ -5588,7 +5588,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
# count the tools
|
||||
tool_cnt = 0
|
||||
|
||||
dia_cnc_dict = dict()
|
||||
dia_cnc_dict = {}
|
||||
|
||||
# this turn on the FlatCAMCNCJob plot for multiple tools
|
||||
job_obj.multitool = True
|
||||
|
@ -5731,7 +5731,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
# count the tools
|
||||
tool_cnt = 0
|
||||
|
||||
dia_cnc_dict = dict()
|
||||
dia_cnc_dict = {}
|
||||
|
||||
# this turn on the FlatCAMCNCJob plot for multiple tools
|
||||
job_obj.multitool = True
|
||||
|
@ -6065,7 +6065,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
|
||||
def scale_recursion(geom):
|
||||
if type(geom) is list:
|
||||
geoms = list()
|
||||
geoms = []
|
||||
for local_geom in geom:
|
||||
geoms.append(scale_recursion(local_geom))
|
||||
return geoms
|
||||
|
@ -6142,7 +6142,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
|
||||
def translate_recursion(geom):
|
||||
if type(geom) is list:
|
||||
geoms = list()
|
||||
geoms = []
|
||||
for local_geom in geom:
|
||||
geoms.append(translate_recursion(local_geom))
|
||||
return geoms
|
||||
|
@ -6419,16 +6419,16 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
|||
"""
|
||||
|
||||
if geo_final.solid_geometry is None:
|
||||
geo_final.solid_geometry = list()
|
||||
geo_final.solid_geometry = []
|
||||
|
||||
try:
|
||||
__ = iter(geo_final.solid_geometry)
|
||||
except TypeError:
|
||||
geo_final.solid_geometry = [geo_final.solid_geometry]
|
||||
|
||||
new_solid_geometry = list()
|
||||
new_options = dict()
|
||||
new_tools = dict()
|
||||
new_solid_geometry = []
|
||||
new_options = {}
|
||||
new_tools = {}
|
||||
|
||||
for geo_obj in geo_list:
|
||||
for option in geo_obj.options:
|
||||
|
@ -6564,7 +6564,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||
It is populated in the FlatCAMGeometry.mtool_gen_cncjob()
|
||||
BEWARE: I rely on the ordered nature of the Python 3.7 dictionary. Things might change ...
|
||||
'''
|
||||
self.cnc_tools = dict()
|
||||
self.cnc_tools = {}
|
||||
|
||||
'''
|
||||
This is a dict of dictionaries. Each dict is associated with a tool present in the file. The key is the
|
||||
|
@ -6585,7 +6585,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||
it's done in camlib.CNCJob.generate_from_excellon_by_tool()
|
||||
BEWARE: I rely on the ordered nature of the Python 3.7 dictionary. Things might change ...
|
||||
'''
|
||||
self.exc_cnc_tools = dict()
|
||||
self.exc_cnc_tools = {}
|
||||
|
||||
# flag to store if the CNCJob is part of a special group of CNCJob objects that can't be processed by the
|
||||
# default engine of FlatCAM. They generated by some of tools and are special cases of CNCJob objects.
|
||||
|
|
|
@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||
|
||||
- compacted the NCC Tool UI by replacing some Radio buttons with Combo boxes due of too many elements
|
||||
- fixed error in CutOut Tool when trying to create a FreeFrom Cutout out of a Gerber object with the Convex Shape checked
|
||||
- working on a new type of database
|
||||
|
||||
28.02.2020
|
||||
|
||||
|
|
36
camlib.py
36
camlib.py
|
@ -917,7 +917,7 @@ class Geometry(object):
|
|||
# graceful abort requested by the user
|
||||
raise FlatCAMApp.GracefulException
|
||||
|
||||
geo_iso = list()
|
||||
geo_iso = []
|
||||
|
||||
if follow:
|
||||
return geometry
|
||||
|
@ -1016,7 +1016,7 @@ class Geometry(object):
|
|||
|
||||
# Add to object
|
||||
if self.solid_geometry is None:
|
||||
self.solid_geometry = list()
|
||||
self.solid_geometry = []
|
||||
|
||||
if type(self.solid_geometry) is list:
|
||||
if type(geos) is list:
|
||||
|
@ -1031,7 +1031,7 @@ class Geometry(object):
|
|||
|
||||
geos_text = getsvgtext(svg_root, object_type, units=units)
|
||||
if geos_text is not None:
|
||||
geos_text_f = list()
|
||||
geos_text_f = []
|
||||
if flip:
|
||||
# Change origin to bottom left
|
||||
for i in geos_text:
|
||||
|
@ -1100,8 +1100,8 @@ class Geometry(object):
|
|||
|
||||
scale_factor = 25.4 / dpi if units.lower() == 'mm' else 1 / dpi
|
||||
|
||||
geos = list()
|
||||
unscaled_geos = list()
|
||||
geos = []
|
||||
unscaled_geos = []
|
||||
|
||||
with rasterio.open(filename) as src:
|
||||
# if filename.lower().rpartition('.')[-1] == 'bmp':
|
||||
|
@ -1148,7 +1148,7 @@ class Geometry(object):
|
|||
|
||||
# Add to object
|
||||
if self.solid_geometry is None:
|
||||
self.solid_geometry = list()
|
||||
self.solid_geometry = []
|
||||
|
||||
if type(self.solid_geometry) is list:
|
||||
# self.solid_geometry.append(cascaded_union(geos))
|
||||
|
@ -2694,7 +2694,7 @@ class CNCjob(Geometry):
|
|||
# running this method from a Tcl Command
|
||||
build_tools_in_use_list = False
|
||||
if 'Tools_in_use' not in self.options:
|
||||
self.options['Tools_in_use'] = list()
|
||||
self.options['Tools_in_use'] = []
|
||||
|
||||
# if the list is empty (either we just added the key or it was already there but empty) signal to build it
|
||||
if not self.options['Tools_in_use']:
|
||||
|
@ -2705,7 +2705,7 @@ class CNCjob(Geometry):
|
|||
for to_ol in tools:
|
||||
if to_ol == it[0]:
|
||||
drill_no = 0
|
||||
sol_geo = list()
|
||||
sol_geo = []
|
||||
for dr in exobj.drills:
|
||||
if dr['tool'] == it[0]:
|
||||
drill_no += 1
|
||||
|
@ -2725,11 +2725,11 @@ class CNCjob(Geometry):
|
|||
except KeyError:
|
||||
z_off = 0
|
||||
|
||||
default_data = dict()
|
||||
default_data = {}
|
||||
for k, v in list(self.options.items()):
|
||||
default_data[k] = deepcopy(v)
|
||||
|
||||
self.exc_cnc_tools[it[1]] = dict()
|
||||
self.exc_cnc_tools[it[1]] = {}
|
||||
self.exc_cnc_tools[it[1]]['tool'] = it[0]
|
||||
self.exc_cnc_tools[it[1]]['nr_drills'] = drill_no
|
||||
self.exc_cnc_tools[it[1]]['nr_slots'] = slot_no
|
||||
|
@ -2747,7 +2747,7 @@ class CNCjob(Geometry):
|
|||
self.app.inform.emit(_("Creating a list of points to drill..."))
|
||||
|
||||
# Points (Group by tool)
|
||||
points = dict()
|
||||
points = {}
|
||||
for drill in exobj.drills:
|
||||
if self.app.abort_flag:
|
||||
# graceful abort requested by the user
|
||||
|
@ -2761,7 +2761,7 @@ class CNCjob(Geometry):
|
|||
|
||||
# log.debug("Found %d drills." % len(points))
|
||||
|
||||
self.gcode = list()
|
||||
self.gcode = []
|
||||
|
||||
self.f_plunge = self.app.defaults["excellon_f_plunge"]
|
||||
self.f_retract = self.app.defaults["excellon_f_retract"]
|
||||
|
@ -2786,7 +2786,7 @@ class CNCjob(Geometry):
|
|||
def __init__(self, tool):
|
||||
"""Initialize distance array."""
|
||||
locations = create_data_array(tool)
|
||||
self.matrix = dict()
|
||||
self.matrix = {}
|
||||
|
||||
if locations:
|
||||
size = len(locations)
|
||||
|
@ -2813,7 +2813,7 @@ class CNCjob(Geometry):
|
|||
|
||||
# Create the data.
|
||||
def create_data_array(tool):
|
||||
loc_list = list()
|
||||
loc_list = []
|
||||
|
||||
if tool not in points:
|
||||
return None
|
||||
|
@ -3820,7 +3820,7 @@ class CNCjob(Geometry):
|
|||
'[ERROR_NOTCL] %s' % _("Trying to generate a CNC Job from a Geometry object without solid_geometry.")
|
||||
)
|
||||
|
||||
temp_solid_geometry = list()
|
||||
temp_solid_geometry = []
|
||||
|
||||
def bounds_rec(obj):
|
||||
if type(obj) is list:
|
||||
|
@ -4725,8 +4725,8 @@ class CNCjob(Geometry):
|
|||
if geo['kind'][0] == 'C':
|
||||
obj.add_shape(shape=geo['geom'], color=color['C'][1], visible=visible)
|
||||
else:
|
||||
text = list()
|
||||
pos = list()
|
||||
text = []
|
||||
pos = []
|
||||
self.coordinates_type = self.app.defaults["cncjob_coords_type"]
|
||||
if self.coordinates_type == "G90":
|
||||
# For Absolute coordinates type G90
|
||||
|
@ -6156,7 +6156,7 @@ def dict2obj(d):
|
|||
# cells[pIdx].append((startIdx, endIdx))
|
||||
#
|
||||
# # then, form polygons by storing vertex indices in (counter-)clockwise order
|
||||
# polys = dict()
|
||||
# polys = {}
|
||||
# for pIdx, lineIndices_ in cells.items():
|
||||
# # get a directed graph which contains both directions and arbitrarily follow one of both
|
||||
# directedGraph = lineIndices_ + [(i2, i1) for (i1, i2) in lineIndices_]
|
||||
|
|
|
@ -124,7 +124,7 @@ class FCDrillAdd(FCShapeTool):
|
|||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
|
@ -359,7 +359,7 @@ class FCDrillArray(FCShapeTool):
|
|||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
|
@ -562,7 +562,7 @@ class FCSlot(FCShapeTool):
|
|||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
|
@ -888,7 +888,7 @@ class FCSlotArray(FCShapeTool):
|
|||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
|
@ -1128,7 +1128,7 @@ class FCDrillResize(FCShapeTool):
|
|||
self.draw_app.select_tool("drill_select")
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
|
@ -1268,7 +1268,7 @@ class FCDrillMove(FCShapeTool):
|
|||
return DrawToolUtilityShape(ss_el)
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
|
@ -1323,7 +1323,7 @@ class FCDrillCopy(FCDrillMove):
|
|||
self.draw_app.app.jump_signal.disconnect()
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.tools_table_exc.clearSelection()
|
||||
self.draw_app.plot_all()
|
||||
|
||||
|
@ -1371,7 +1371,7 @@ class FCDrillSelect(DrawTool):
|
|||
if mod_key == self.exc_editor_app.app.defaults["global_mselect_key"]:
|
||||
pass
|
||||
else:
|
||||
self.exc_editor_app.selected = list()
|
||||
self.exc_editor_app.selected = []
|
||||
|
||||
def click_release(self, pos):
|
||||
self.exc_editor_app.tools_table_exc.clearSelection()
|
||||
|
@ -1425,7 +1425,7 @@ class FCDrillSelect(DrawTool):
|
|||
else:
|
||||
self.exc_editor_app.selected.append(closest_shape)
|
||||
else:
|
||||
self.exc_editor_app.selected = list()
|
||||
self.exc_editor_app.selected = []
|
||||
self.exc_editor_app.selected.append(closest_shape)
|
||||
|
||||
# select the diameter of the selected shape in the tool table
|
||||
|
@ -2060,31 +2060,31 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||
|
||||
self.in_action = False
|
||||
|
||||
self.storage_dict = dict()
|
||||
self.storage_dict = {}
|
||||
|
||||
self.current_storage = list()
|
||||
self.current_storage = []
|
||||
|
||||
# build the data from the Excellon point into a dictionary
|
||||
# {tool_dia: [geometry_in_points]}
|
||||
self.points_edit = dict()
|
||||
self.slot_points_edit = dict()
|
||||
self.points_edit = {}
|
||||
self.slot_points_edit = {}
|
||||
|
||||
self.sorted_diameters = list()
|
||||
self.sorted_diameters = []
|
||||
|
||||
self.new_drills = list()
|
||||
self.new_tools = dict()
|
||||
self.new_slots = list()
|
||||
self.new_drills = []
|
||||
self.new_tools = {}
|
||||
self.new_slots = []
|
||||
|
||||
# dictionary to store the tool_row and diameters in Tool_table
|
||||
# it will be updated everytime self.build_ui() is called
|
||||
self.olddia_newdia = dict()
|
||||
self.olddia_newdia = {}
|
||||
|
||||
self.tool2tooldia = dict()
|
||||
self.tool2tooldia = {}
|
||||
|
||||
# this will store the value for the last selected tool, for use after clicking on canvas when the selection
|
||||
# is cleared but as a side effect also the selected tool is cleared
|
||||
self.last_tool_selected = None
|
||||
self.utility = list()
|
||||
self.utility = []
|
||||
|
||||
# this will flag if the Editor "tools" are launched from key shortcuts (True) or from menu toolbar (False)
|
||||
self.launched_from_shortcuts = False
|
||||
|
@ -3069,8 +3069,8 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||
self.exc_obj = exc_obj
|
||||
exc_obj.visible = False
|
||||
|
||||
self.points_edit = dict()
|
||||
self.slot_points_edit = dict()
|
||||
self.points_edit = {}
|
||||
self.slot_points_edit = {}
|
||||
|
||||
# Set selection tolerance
|
||||
# DrawToolShape.tolerance = fc_excellon.drawing_tolerance * 10
|
||||
|
@ -3353,7 +3353,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||
|
||||
# add a 'data' dict for each tool with the default values
|
||||
for tool in excellon_obj.tools:
|
||||
excellon_obj.tools[tool]['data'] = dict()
|
||||
excellon_obj.tools[tool]['data'] = {}
|
||||
excellon_obj.tools[tool]['data'].update(deepcopy(self.data_defaults))
|
||||
|
||||
try:
|
||||
|
|
|
@ -1755,7 +1755,7 @@ class DrawToolShape(object):
|
|||
|
||||
def translate_recursion(geom):
|
||||
if type(geom) == list:
|
||||
geoms = list()
|
||||
geoms = []
|
||||
for local_geom in geom:
|
||||
geoms.append(translate_recursion(local_geom))
|
||||
return geoms
|
||||
|
@ -1802,7 +1802,7 @@ class DrawToolShape(object):
|
|||
|
||||
def scale_recursion(geom):
|
||||
if type(geom) == list:
|
||||
geoms = list()
|
||||
geoms = []
|
||||
for local_geom in geom:
|
||||
geoms.append(scale_recursion(local_geom))
|
||||
return geoms
|
||||
|
@ -1972,7 +1972,7 @@ class FCCircle(FCShapeTool):
|
|||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Adding Circle completed."))
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -2212,7 +2212,7 @@ class FCArc(FCShapeTool):
|
|||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Arc completed."))
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -2285,7 +2285,7 @@ class FCRectangle(FCShapeTool):
|
|||
self.draw_app.app.inform.emit('[success] %s' % _("Done. Rectangle completed."))
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -2374,7 +2374,7 @@ class FCPolygon(FCShapeTool):
|
|||
return _("Backtracked one point ...")
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -2439,7 +2439,7 @@ class FCPath(FCPolygon):
|
|||
return _("Backtracked one point ...")
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -2573,8 +2573,8 @@ class FCExplode(FCShapeTool):
|
|||
self.make()
|
||||
|
||||
def make(self):
|
||||
to_be_deleted_list = list()
|
||||
lines = list()
|
||||
to_be_deleted_list = []
|
||||
lines = []
|
||||
|
||||
for shape in self.draw_app.get_selected():
|
||||
to_be_deleted_list.append(shape)
|
||||
|
@ -2596,7 +2596,7 @@ class FCExplode(FCShapeTool):
|
|||
if shape in self.draw_app.selected:
|
||||
self.draw_app.selected.remove(shape)
|
||||
|
||||
geo_list = list()
|
||||
geo_list = []
|
||||
for line in lines:
|
||||
geo_list.append(DrawToolShape(line))
|
||||
self.geometry = geo_list
|
||||
|
@ -2604,7 +2604,7 @@ class FCExplode(FCShapeTool):
|
|||
self.draw_app.app.inform.emit('[success] %s...' % _("Done. Polygons exploded into lines."))
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -2793,7 +2793,7 @@ class FCMove(FCShapeTool):
|
|||
raise
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -2821,7 +2821,7 @@ class FCCopy(FCMove):
|
|||
pass
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -2906,7 +2906,7 @@ class FCText(FCShapeTool):
|
|||
return
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -3043,7 +3043,7 @@ class FCBuffer(FCShapeTool):
|
|||
pass
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -3165,7 +3165,7 @@ class FCEraser(FCShapeTool):
|
|||
return DrawToolUtilityShape(geo_list)
|
||||
|
||||
def clean_up(self):
|
||||
self.draw_app.selected = list()
|
||||
self.draw_app.selected = []
|
||||
self.draw_app.plot_all()
|
||||
|
||||
try:
|
||||
|
@ -3484,7 +3484,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
|
|||
# pass
|
||||
|
||||
iterator = QtWidgets.QTreeWidgetItemIterator(self.geo_parent)
|
||||
to_delete = list()
|
||||
to_delete = []
|
||||
while iterator.value():
|
||||
item = iterator.value()
|
||||
to_delete.append(item)
|
||||
|
@ -3521,7 +3521,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
|
|||
pass
|
||||
|
||||
def on_tree_selection_change(self):
|
||||
self.selected = list()
|
||||
self.selected = []
|
||||
selected_tree_items = self.tw.selectedItems()
|
||||
for sel in selected_tree_items:
|
||||
for obj_shape in self.storage.get_objects():
|
||||
|
@ -4528,7 +4528,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
|
|||
log.debug("FlatCAMGeoEditor.on_shape_complete() Error --> %s" % str(e))
|
||||
return 'fail'
|
||||
|
||||
shape_list = list()
|
||||
shape_list = []
|
||||
try:
|
||||
for geo in geom:
|
||||
shape_list.append(DrawToolShape(geo))
|
||||
|
|
|
@ -288,14 +288,14 @@ class FCPad(FCShapeTool):
|
|||
|
||||
ap_type = self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['type']
|
||||
if ap_type == 'C':
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
center = Point([point_x, point_y])
|
||||
new_geo_el['solid'] = center.buffer(self.radius)
|
||||
new_geo_el['follow'] = center
|
||||
return new_geo_el
|
||||
elif ap_type == 'R':
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
p1 = (point_x - self.half_width, point_y - self.half_height)
|
||||
p2 = (point_x + self.half_width, point_y - self.half_height)
|
||||
|
@ -307,7 +307,7 @@ class FCPad(FCShapeTool):
|
|||
return new_geo_el
|
||||
elif ap_type == 'O':
|
||||
geo = []
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
if self.half_height > self.half_width:
|
||||
p1 = (point_x - self.half_width, point_y - self.half_height + self.half_width)
|
||||
|
@ -545,7 +545,7 @@ class FCPadArray(FCShapeTool):
|
|||
)
|
||||
|
||||
if static is None or static is False:
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
if 'solid' in geo_el:
|
||||
new_geo_el['solid'] = affinity.translate(
|
||||
|
@ -602,14 +602,14 @@ class FCPadArray(FCShapeTool):
|
|||
|
||||
ap_type = self.draw_app.storage_dict[self.draw_app.last_aperture_selected]['type']
|
||||
if ap_type == 'C':
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
center = Point([point_x, point_y])
|
||||
new_geo_el['solid'] = center.buffer(self.radius)
|
||||
new_geo_el['follow'] = center
|
||||
return new_geo_el
|
||||
elif ap_type == 'R':
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
p1 = (point_x - self.half_width, point_y - self.half_height)
|
||||
p2 = (point_x + self.half_width, point_y - self.half_height)
|
||||
|
@ -620,7 +620,7 @@ class FCPadArray(FCShapeTool):
|
|||
return new_geo_el
|
||||
elif ap_type == 'O':
|
||||
geo = []
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
if self.half_height > self.half_width:
|
||||
p1 = (point_x - self.half_width, point_y - self.half_height + self.half_width)
|
||||
|
@ -812,7 +812,7 @@ class FCPoligonize(FCShapeTool):
|
|||
except KeyError:
|
||||
self.draw_app.on_aperture_add(apid='0')
|
||||
current_storage = self.draw_app.storage_dict['0']['geometry']
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = geo
|
||||
new_el['follow'] = geo.exterior
|
||||
self.draw_app.on_grb_shape_complete(current_storage, specific_shape=DrawToolShape(deepcopy(new_el)))
|
||||
|
@ -827,7 +827,7 @@ class FCPoligonize(FCShapeTool):
|
|||
self.draw_app.on_aperture_add(apid='0')
|
||||
current_storage = self.draw_app.storage_dict['0']['geometry']
|
||||
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = fused_geo
|
||||
new_el['follow'] = fused_geo.exterior
|
||||
self.draw_app.on_grb_shape_complete(current_storage, specific_shape=DrawToolShape(deepcopy(new_el)))
|
||||
|
@ -915,7 +915,7 @@ class FCRegion(FCShapeTool):
|
|||
self.gridy_size = float(self.draw_app.app.ui.grid_gap_y_entry.get_value())
|
||||
|
||||
def utility_geometry(self, data=None):
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
x = data[0]
|
||||
y = data[1]
|
||||
|
@ -983,7 +983,7 @@ class FCRegion(FCShapeTool):
|
|||
self.inter_point = data
|
||||
|
||||
self.temp_points.append(data)
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
if len(self.temp_points) > 1:
|
||||
try:
|
||||
|
@ -1049,7 +1049,7 @@ class FCRegion(FCShapeTool):
|
|||
|
||||
self.temp_points.append(self.inter_point)
|
||||
self.temp_points.append(data)
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
new_geo_el['solid'] = LinearRing(self.temp_points).buffer(self.buf_val,
|
||||
resolution=int(self.steps_per_circle / 4),
|
||||
|
@ -1070,7 +1070,7 @@ class FCRegion(FCShapeTool):
|
|||
else:
|
||||
self.draw_app.last_aperture_selected = '0'
|
||||
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
new_geo_el['solid'] = Polygon(self.points).buffer(self.buf_val,
|
||||
resolution=int(self.steps_per_circle / 4),
|
||||
|
@ -1183,7 +1183,7 @@ class FCTrack(FCRegion):
|
|||
self.draw_app.app.inform.emit(_('Track Mode 1: 45 degrees ...'))
|
||||
|
||||
def make(self):
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if len(self.temp_points) == 1:
|
||||
new_geo_el['solid'] = Point(self.temp_points).buffer(self.buf_val,
|
||||
resolution=int(self.steps_per_circle / 4))
|
||||
|
@ -1219,7 +1219,7 @@ class FCTrack(FCRegion):
|
|||
except IndexError:
|
||||
self.points.append(point)
|
||||
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
if len(self.temp_points) == 1:
|
||||
new_geo_el['solid'] = Point(self.temp_points).buffer(self.buf_val,
|
||||
|
@ -1242,7 +1242,7 @@ class FCTrack(FCRegion):
|
|||
|
||||
def utility_geometry(self, data=None):
|
||||
self.update_grid_info()
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
if len(self.points) == 0:
|
||||
new_geo_el['solid'] = Point(data).buffer(self.buf_val,
|
||||
|
@ -1427,10 +1427,10 @@ class FCDisc(FCShapeTool):
|
|||
if '0' in self.draw_app.storage_dict:
|
||||
self.storage_obj = self.draw_app.storage_dict['0']['geometry']
|
||||
else:
|
||||
self.draw_app.storage_dict['0'] = dict()
|
||||
self.draw_app.storage_dict['0'] = {}
|
||||
self.draw_app.storage_dict['0']['type'] = 'C'
|
||||
self.draw_app.storage_dict['0']['size'] = 0.0
|
||||
self.draw_app.storage_dict['0']['geometry'] = list()
|
||||
self.draw_app.storage_dict['0']['geometry'] = []
|
||||
self.storage_obj = self.draw_app.storage_dict['0']['geometry']
|
||||
|
||||
self.draw_app.app.inform.emit(_("Click on Center point ..."))
|
||||
|
@ -1453,7 +1453,7 @@ class FCDisc(FCShapeTool):
|
|||
return ""
|
||||
|
||||
def utility_geometry(self, data=None):
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if len(self.points) == 1:
|
||||
p1 = self.points[0]
|
||||
p2 = data
|
||||
|
@ -1464,7 +1464,7 @@ class FCDisc(FCShapeTool):
|
|||
return None
|
||||
|
||||
def make(self):
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
try:
|
||||
QtGui.QGuiApplication.restoreOverrideCursor()
|
||||
|
@ -1530,10 +1530,10 @@ class FCSemiDisc(FCShapeTool):
|
|||
if '0' in self.draw_app.storage_dict:
|
||||
self.storage_obj = self.draw_app.storage_dict['0']['geometry']
|
||||
else:
|
||||
self.draw_app.storage_dict['0'] = dict()
|
||||
self.draw_app.storage_dict['0'] = {}
|
||||
self.draw_app.storage_dict['0']['type'] = 'C'
|
||||
self.draw_app.storage_dict['0']['size'] = 0.0
|
||||
self.draw_app.storage_dict['0']['geometry'] = list()
|
||||
self.draw_app.storage_dict['0']['geometry'] = []
|
||||
self.storage_obj = self.draw_app.storage_dict['0']['geometry']
|
||||
|
||||
self.steps_per_circ = self.draw_app.app.defaults["gerber_circle_steps"]
|
||||
|
@ -1592,10 +1592,10 @@ class FCSemiDisc(FCShapeTool):
|
|||
return _('Mode: Center -> Start -> Stop. Click on Center point ...')
|
||||
|
||||
def utility_geometry(self, data=None):
|
||||
new_geo_el = dict()
|
||||
new_geo_el_pt1 = dict()
|
||||
new_geo_el_pt2 = dict()
|
||||
new_geo_el_pt3 = dict()
|
||||
new_geo_el = {}
|
||||
new_geo_el_pt1 = {}
|
||||
new_geo_el_pt2 = {}
|
||||
new_geo_el_pt3 = {}
|
||||
|
||||
if len(self.points) == 1: # Show the radius
|
||||
center = self.points[0]
|
||||
|
@ -1681,7 +1681,7 @@ class FCSemiDisc(FCShapeTool):
|
|||
|
||||
def make(self):
|
||||
self.draw_app.current_storage = self.storage_obj
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
|
||||
if self.mode == 'c12':
|
||||
center = self.points[0]
|
||||
|
@ -2031,7 +2031,7 @@ class FCApertureMove(FCShapeTool):
|
|||
for select_shape in self.draw_app.get_selected():
|
||||
if select_shape in self.current_storage:
|
||||
geometric_data = select_shape.geo
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geometric_data:
|
||||
new_geo_el['solid'] = affinity.translate(geometric_data['solid'], xoff=dx, yoff=dy)
|
||||
if 'follow' in geometric_data:
|
||||
|
@ -2084,7 +2084,7 @@ class FCApertureMove(FCShapeTool):
|
|||
|
||||
if len(self.draw_app.get_selected()) <= self.sel_limit:
|
||||
for geom in self.draw_app.get_selected():
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geom.geo:
|
||||
new_geo_el['solid'] = affinity.translate(geom.geo['solid'], xoff=dx, yoff=dy)
|
||||
if 'follow' in geom.geo:
|
||||
|
@ -2094,7 +2094,7 @@ class FCApertureMove(FCShapeTool):
|
|||
geo_list.append(deepcopy(new_geo_el))
|
||||
return DrawToolUtilityShape(geo_list)
|
||||
else:
|
||||
ss_el = dict()
|
||||
ss_el = {}
|
||||
ss_el['solid'] = affinity.translate(self.selection_shape, xoff=dx, yoff=dy)
|
||||
return DrawToolUtilityShape(ss_el)
|
||||
|
||||
|
@ -2115,7 +2115,7 @@ class FCApertureCopy(FCApertureMove):
|
|||
for select_shape in self.draw_app.get_selected():
|
||||
if select_shape in self.current_storage:
|
||||
geometric_data = select_shape.geo
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geometric_data:
|
||||
new_geo_el['solid'] = affinity.translate(geometric_data['solid'], xoff=dx, yoff=dy)
|
||||
if 'follow' in geometric_data:
|
||||
|
@ -2274,7 +2274,7 @@ class FCEraser(FCShapeTool):
|
|||
dy = data[1] - self.origin[1]
|
||||
|
||||
for geom in self.draw_app.get_selected():
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geom.geo:
|
||||
new_geo_el['solid'] = affinity.translate(geom.geo['solid'], xoff=dx, yoff=dy)
|
||||
if 'follow' in geom.geo:
|
||||
|
@ -2303,7 +2303,7 @@ class FCApertureSelect(DrawTool):
|
|||
self.grb_editor_app.bend_mode = 1
|
||||
|
||||
# here store the selected apertures
|
||||
self.sel_aperture = list()
|
||||
self.sel_aperture = []
|
||||
|
||||
try:
|
||||
self.grb_editor_app.apertures_table.clearSelection()
|
||||
|
@ -2922,30 +2922,30 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
# # ## Data
|
||||
self.active_tool = None
|
||||
|
||||
self.storage_dict = dict()
|
||||
self.current_storage = list()
|
||||
self.storage_dict = {}
|
||||
self.current_storage = []
|
||||
|
||||
self.sorted_apid = list()
|
||||
self.sorted_apid = []
|
||||
|
||||
self.new_apertures = dict()
|
||||
self.new_aperture_macros = dict()
|
||||
self.new_apertures = {}
|
||||
self.new_aperture_macros = {}
|
||||
|
||||
# store here the plot promises, if empty the delayed plot will be activated
|
||||
self.grb_plot_promises = list()
|
||||
self.grb_plot_promises = []
|
||||
|
||||
# dictionary to store the tool_row and aperture codes in Tool_table
|
||||
# it will be updated everytime self.build_ui() is called
|
||||
self.olddia_newdia = dict()
|
||||
self.olddia_newdia = {}
|
||||
|
||||
self.tool2tooldia = dict()
|
||||
self.tool2tooldia = {}
|
||||
|
||||
# this will store the value for the last selected tool, for use after clicking on canvas when the selection
|
||||
# is cleared but as a side effect also the selected tool is cleared
|
||||
self.last_aperture_selected = None
|
||||
self.utility = list()
|
||||
self.utility = []
|
||||
|
||||
# this will store the polygons marked by mark are to be perhaps deleted
|
||||
self.geo_to_delete = list()
|
||||
self.geo_to_delete = []
|
||||
|
||||
# this will flag if the Editor "tools" are launched from key shortcuts (True) or from menu toolbar (False)
|
||||
self.launched_from_shortcuts = False
|
||||
|
@ -2957,7 +2957,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
self.apdim_lbl.hide()
|
||||
self.apdim_entry.hide()
|
||||
self.gerber_obj = None
|
||||
self.gerber_obj_options = dict()
|
||||
self.gerber_obj_options = {}
|
||||
|
||||
# VisPy Visuals
|
||||
if self.app.is_legacy is False:
|
||||
|
@ -3040,7 +3040,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
self.pool = self.app.pool
|
||||
|
||||
# Multiprocessing results
|
||||
self.results = list()
|
||||
self.results = []
|
||||
|
||||
# A QTimer
|
||||
self.plot_thread = None
|
||||
|
@ -3434,7 +3434,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
|
||||
# I've added this flag_del variable because dictionary don't like
|
||||
# having keys deleted while iterating through them
|
||||
flag_del = list()
|
||||
flag_del = []
|
||||
for deleted_tool in self.tool2tooldia:
|
||||
if self.tool2tooldia[deleted_tool] == deleted_aperture:
|
||||
flag_del.append(deleted_tool)
|
||||
|
@ -3504,7 +3504,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
geometry = []
|
||||
for geo_el in self.storage_dict[dia_changed]:
|
||||
geometric_data = geo_el.geo
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geometric_data:
|
||||
new_geo_el['solid'] = deepcopy(affinity.scale(geometric_data['solid'],
|
||||
xfact=factor, yfact=factor))
|
||||
|
@ -3950,7 +3950,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
# ############################################################# ##
|
||||
|
||||
# list of clear geos that are to be applied to the entire file
|
||||
global_clear_geo = list()
|
||||
global_clear_geo = []
|
||||
|
||||
# create one big geometry made out of all 'negative' (clear) polygons
|
||||
for apid in app_obj.gerber_obj.apertures:
|
||||
|
@ -3969,7 +3969,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
# we subtract the big "negative" (clear) geometry from each solid polygon but only the part of
|
||||
# clear geometry that fits inside the solid. otherwise we may loose the solid
|
||||
for apid in app_obj.gerber_obj.apertures:
|
||||
temp_solid_geometry = list()
|
||||
temp_solid_geometry = []
|
||||
if 'geometry' in app_obj.gerber_obj.apertures[apid]:
|
||||
# for elem in self.gerber_obj.apertures[apid]['geometry']:
|
||||
# if 'solid' in elem:
|
||||
|
@ -3982,7 +3982,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
# solid_geo = solid_geo.difference(clear_geo)
|
||||
# try:
|
||||
# for poly in solid_geo:
|
||||
# new_elem = dict()
|
||||
# new_elem = {}
|
||||
#
|
||||
# new_elem['solid'] = poly
|
||||
# if 'clear' in elem:
|
||||
|
@ -3991,7 +3991,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
# new_elem['follow'] = poly
|
||||
# temp_elem.append(deepcopy(new_elem))
|
||||
# except TypeError:
|
||||
# new_elem = dict()
|
||||
# new_elem = {}
|
||||
# new_elem['solid'] = solid_geo
|
||||
# if 'clear' in elem:
|
||||
# new_elem['clear'] = solid_geo
|
||||
|
@ -3999,7 +3999,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
# new_elem['follow'] = solid_geo
|
||||
# temp_elem.append(deepcopy(new_elem))
|
||||
for elem in app_obj.gerber_obj.apertures[apid]['geometry']:
|
||||
new_elem = dict()
|
||||
new_elem = {}
|
||||
if 'solid' in elem:
|
||||
solid_geo = elem['solid']
|
||||
if not global_clear_geo or global_clear_geo.is_empty:
|
||||
|
@ -4033,7 +4033,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
"FlatCAMGrbEditor.edit_fcgerber.worker_job() Adding processes to pool --> %s" % str(e))
|
||||
traceback.print_exc()
|
||||
|
||||
output = list()
|
||||
output = []
|
||||
for p in app_obj.results:
|
||||
output.append(p.get())
|
||||
|
||||
|
@ -4053,8 +4053,8 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
|
||||
@staticmethod
|
||||
def add_apertures(aperture_id, aperture_dict):
|
||||
storage_elem = list()
|
||||
storage_dict = dict()
|
||||
storage_elem = []
|
||||
storage_dict = {}
|
||||
|
||||
for k, v in list(aperture_dict.items()):
|
||||
try:
|
||||
|
@ -4113,7 +4113,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
def update_options(obj):
|
||||
try:
|
||||
if not obj.options:
|
||||
obj.options = dict()
|
||||
obj.options = {}
|
||||
obj.options['xmin'] = 0
|
||||
obj.options['ymin'] = 0
|
||||
obj.options['xmax'] = 0
|
||||
|
@ -4122,7 +4122,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
else:
|
||||
return False
|
||||
except AttributeError:
|
||||
obj.options = dict()
|
||||
obj.options = {}
|
||||
return True
|
||||
|
||||
def new_edited_gerber(self, outname, aperture_storage):
|
||||
|
@ -4141,7 +4141,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
out_name = outname
|
||||
storage_dict = aperture_storage
|
||||
|
||||
local_storage_dict = dict()
|
||||
local_storage_dict = {}
|
||||
for aperture in storage_dict:
|
||||
if 'geometry' in storage_dict[aperture]:
|
||||
# add aperture only if it has geometry
|
||||
|
@ -4162,7 +4162,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
grb_obj.apertures[storage_apid][k] = []
|
||||
for geo_el in val:
|
||||
geometric_data = geo_el.geo
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geometric_data:
|
||||
new_geo_el['solid'] = geometric_data['solid']
|
||||
poly_buffer.append(deepcopy(new_geo_el['solid']))
|
||||
|
@ -4237,12 +4237,12 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
except Exception as e:
|
||||
log.error("Error on Edited object creation: %s" % str(e))
|
||||
# make sure to clean the previous results
|
||||
self.results = list()
|
||||
self.results = []
|
||||
return
|
||||
|
||||
self.app.inform.emit('[success] %s' % _("Done. Gerber editing finished."))
|
||||
# make sure to clean the previous results
|
||||
self.results = list()
|
||||
self.results = []
|
||||
|
||||
def on_tool_select(self, tool):
|
||||
"""
|
||||
|
@ -4952,14 +4952,14 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
|
||||
def buffer_recursion(geom_el, selection):
|
||||
if type(geom_el) == list:
|
||||
geoms = list()
|
||||
geoms = []
|
||||
for local_geom in geom_el:
|
||||
geoms.append(buffer_recursion(local_geom, selection=selection))
|
||||
return geoms
|
||||
else:
|
||||
if geom_el in selection:
|
||||
geometric_data = geom_el.geo
|
||||
buffered_geom_el = dict()
|
||||
buffered_geom_el = {}
|
||||
if 'solid' in geometric_data:
|
||||
buffered_geom_el['solid'] = geometric_data['solid'].buffer(buff_value, join_style=join_style)
|
||||
if 'follow' in geometric_data:
|
||||
|
@ -5008,14 +5008,14 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||
|
||||
def scale_recursion(geom_el, selection):
|
||||
if type(geom_el) == list:
|
||||
geoms = list()
|
||||
geoms = []
|
||||
for local_geom in geom_el:
|
||||
geoms.append(scale_recursion(local_geom, selection=selection))
|
||||
return geoms
|
||||
else:
|
||||
if geom_el in selection:
|
||||
geometric_data = geom_el.geo
|
||||
scaled_geom_el = dict()
|
||||
scaled_geom_el = {}
|
||||
if 'solid' in geometric_data:
|
||||
scaled_geom_el['solid'] = affinity.scale(
|
||||
geometric_data['solid'], scale_factor, scale_factor, origin='center'
|
||||
|
|
|
@ -176,8 +176,34 @@ class FCTree(QtWidgets.QTreeWidget):
|
|||
item.setFont(0, font)
|
||||
return item
|
||||
|
||||
def addChild(self, parent, title, column1=None, font=None, font_items=None):
|
||||
def addParentEditable(self, parent, title, color=None, font=None, font_items=None, editable=False):
|
||||
item = QtWidgets.QTreeWidgetItem(parent)
|
||||
item.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.DontShowIndicator)
|
||||
if editable:
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
|
||||
|
||||
for t in range(len(title)):
|
||||
item.setText(t, title[t])
|
||||
|
||||
if color is not None:
|
||||
# item.setTextColor(0, color) # PyQt4
|
||||
item.setForeground(0, QtGui.QBrush(color))
|
||||
|
||||
if font and font_items:
|
||||
try:
|
||||
for fi in font_items:
|
||||
item.setFont(fi, font)
|
||||
except TypeError:
|
||||
item.setFont(font_items, font)
|
||||
elif font:
|
||||
item.setFont(0, font)
|
||||
return item
|
||||
|
||||
def addChild(self, parent, title, column1=None, font=None, font_items=None, editable=False):
|
||||
item = QtWidgets.QTreeWidgetItem(parent)
|
||||
if editable:
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
|
||||
|
||||
item.setText(0, str(title[0]))
|
||||
if column1 is not None:
|
||||
item.setText(1, str(title[1]))
|
||||
|
@ -2108,7 +2134,7 @@ class FCTable(QtWidgets.QTableWidget):
|
|||
self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||
self.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
|
||||
|
||||
self.rows_not_for_drag_and_drop = list()
|
||||
self.rows_not_for_drag_and_drop = []
|
||||
if protected_rows:
|
||||
try:
|
||||
for r in protected_rows:
|
||||
|
@ -2116,7 +2142,7 @@ class FCTable(QtWidgets.QTableWidget):
|
|||
except TypeError:
|
||||
self.rows_not_for_drag_and_drop = [protected_rows]
|
||||
|
||||
self.rows_to_move = list()
|
||||
self.rows_to_move = []
|
||||
|
||||
def sizeHint(self):
|
||||
default_hint_size = super(FCTable, self).sizeHint()
|
||||
|
@ -2172,7 +2198,7 @@ class FCTable(QtWidgets.QTableWidget):
|
|||
# # ]
|
||||
# self.rows_to_move[:] = []
|
||||
# for row_index in rows:
|
||||
# row_items = list()
|
||||
# row_items = []
|
||||
# for column_index in range(self.columnCount()):
|
||||
# r_item = self.item(row_index, column_index)
|
||||
# w_item = self.cellWidget(row_index, column_index)
|
||||
|
@ -2253,7 +2279,7 @@ class FCTable(QtWidgets.QTableWidget):
|
|||
for _ in range(len(rows)):
|
||||
self.insertRow(targetRow)
|
||||
|
||||
rowMapping = dict() # Src row to target row.
|
||||
rowMapping = {} # Src row to target row.
|
||||
for idx, row in enumerate(rows):
|
||||
if row < targetRow:
|
||||
rowMapping[row] = targetRow + idx
|
||||
|
|
|
@ -62,7 +62,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
|
|||
# self.b_line, self.r_line, self.t_line, self.l_line = None, None, None, None
|
||||
self.workspace_line = None
|
||||
|
||||
self.pagesize_dict = dict()
|
||||
self.pagesize_dict = {}
|
||||
self.pagesize_dict.update(
|
||||
{
|
||||
'A0': (841, 1189),
|
||||
|
|
|
@ -158,7 +158,7 @@ class PlotCanvasLegacy(QtCore.QObject):
|
|||
# self.b_line, self.r_line, self.t_line, self.l_line = None, None, None, None
|
||||
self.workspace_line = None
|
||||
|
||||
self.pagesize_dict = dict()
|
||||
self.pagesize_dict = {}
|
||||
self.pagesize_dict.update(
|
||||
{
|
||||
'A0': (841, 1189),
|
||||
|
@ -959,8 +959,8 @@ class ShapeCollectionLegacy:
|
|||
self.app = app
|
||||
self.annotation_job = annotation_job
|
||||
|
||||
self._shapes = dict()
|
||||
self.shape_dict = dict()
|
||||
self._shapes = {}
|
||||
self.shape_dict = {}
|
||||
self.shape_id = 0
|
||||
|
||||
self._color = None
|
||||
|
|
|
@ -1037,7 +1037,7 @@ class GeneralAPPSetGroupUI(OptionsGroupUI):
|
|||
grid0.addWidget(self.workspace_type_lbl, 7, 0)
|
||||
grid0.addWidget(self.wk_cb, 7, 1)
|
||||
|
||||
self.pagesize = dict()
|
||||
self.pagesize = {}
|
||||
self.pagesize.update(
|
||||
{
|
||||
'A0': (841, 1189),
|
||||
|
@ -6184,7 +6184,7 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
|
|||
|
||||
self.pagesize_combo = FCComboBox()
|
||||
|
||||
self.pagesize = dict()
|
||||
self.pagesize = {}
|
||||
self.pagesize.update(
|
||||
{
|
||||
'Bounds': None,
|
||||
|
|
|
@ -95,11 +95,11 @@ class Excellon(Geometry):
|
|||
Geometry.__init__(self, geo_steps_per_circle=int(geo_steps_per_circle))
|
||||
|
||||
# dictionary to store tools, see above for description
|
||||
self.tools = dict()
|
||||
self.tools = {}
|
||||
# list to store the drills, see above for description
|
||||
self.drills = list()
|
||||
self.drills = []
|
||||
# self.slots (list) to store the slots; each is a dictionary
|
||||
self.slots = list()
|
||||
self.slots = []
|
||||
|
||||
self.source_file = ''
|
||||
|
||||
|
@ -110,8 +110,8 @@ class Excellon(Geometry):
|
|||
self.match_routing_start = None
|
||||
self.match_routing_stop = None
|
||||
|
||||
self.num_tools = list() # List for keeping the tools sorted
|
||||
self.index_per_tool = dict() # Dictionary to store the indexed points for each tool
|
||||
self.num_tools = [] # List for keeping the tools sorted
|
||||
self.index_per_tool = {} # Dictionary to store the indexed points for each tool
|
||||
|
||||
# ## IN|MM -> Units are inherited from Geometry
|
||||
self.units = self.app.defaults['units']
|
||||
|
@ -962,8 +962,8 @@ class Excellon(Geometry):
|
|||
try:
|
||||
# clear the solid_geometry in self.tools
|
||||
for tool in self.tools:
|
||||
self.tools[tool]['solid_geometry'] = list()
|
||||
self.tools[tool]['data'] = dict()
|
||||
self.tools[tool]['solid_geometry'] = []
|
||||
self.tools[tool]['data'] = {}
|
||||
|
||||
for drill in self.drills:
|
||||
# poly = drill['point'].buffer(self.tools[drill['tool']]["C"]/2.0)
|
||||
|
|
|
@ -467,7 +467,7 @@ class Gerber(Geometry):
|
|||
# --- Buffered ----
|
||||
width = self.apertures[last_path_aperture]["size"]
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_f = LineString(path)
|
||||
if not geo_f.is_empty:
|
||||
follow_buffer.append(geo_f)
|
||||
|
@ -486,7 +486,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -677,7 +677,7 @@ class Gerber(Geometry):
|
|||
# --- Buffered ---
|
||||
try:
|
||||
# log.debug("Bare op-code %d." % current_operation_code)
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
flash = self.create_flash_geometry(
|
||||
Point(current_x, current_y), self.apertures[current_aperture],
|
||||
self.steps_per_circle)
|
||||
|
@ -695,7 +695,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = flash
|
||||
|
||||
if current_aperture not in self.apertures:
|
||||
self.apertures[current_aperture] = dict()
|
||||
self.apertures[current_aperture] = {}
|
||||
if 'geometry' not in self.apertures[current_aperture]:
|
||||
self.apertures[current_aperture]['geometry'] = []
|
||||
self.apertures[current_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -734,7 +734,7 @@ class Gerber(Geometry):
|
|||
# do nothing because 'R' type moving aperture is none at once
|
||||
pass
|
||||
else:
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_f = LineString(path)
|
||||
if not geo_f.is_empty:
|
||||
follow_buffer.append(geo_f)
|
||||
|
@ -754,7 +754,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -774,7 +774,7 @@ class Gerber(Geometry):
|
|||
if path_length > 1:
|
||||
# Take care of what is left in the path
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_f = LineString(path)
|
||||
if not geo_f.is_empty:
|
||||
follow_buffer.append(geo_f)
|
||||
|
@ -794,7 +794,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -814,7 +814,7 @@ class Gerber(Geometry):
|
|||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['size'] = 0.0
|
||||
self.apertures['0']['geometry'] = list()
|
||||
self.apertures['0']['geometry'] = []
|
||||
|
||||
# if D02 happened before G37 we now have a path with 1 element only; we have to add the current
|
||||
# geo to the poly_buffer otherwise we loose it
|
||||
|
@ -826,7 +826,7 @@ class Gerber(Geometry):
|
|||
|
||||
if path_length == 1:
|
||||
# this means that the geometry was prepared previously and we just need to add it
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
if geo_f:
|
||||
if not geo_f.is_empty:
|
||||
follow_buffer.append(geo_f)
|
||||
|
@ -863,7 +863,7 @@ class Gerber(Geometry):
|
|||
# For regions we may ignore an aperture that is None
|
||||
|
||||
# --- Buffered ---
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
if current_aperture in self.apertures:
|
||||
# the following line breaks loading of Circuit Studio Gerber files
|
||||
# buff_value = float(self.apertures[current_aperture]['size']) / 2.0
|
||||
|
@ -965,7 +965,7 @@ class Gerber(Geometry):
|
|||
maxy = max(path[0][1], path[1][1]) + height / 2
|
||||
log.debug("Coords: %s - %s - %s - %s" % (minx, miny, maxx, maxy))
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_f = Point([current_x, current_y])
|
||||
follow_buffer.append(geo_f)
|
||||
geo_dict['follow'] = geo_f
|
||||
|
@ -982,7 +982,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = geo_s
|
||||
|
||||
if current_aperture not in self.apertures:
|
||||
self.apertures[current_aperture] = dict()
|
||||
self.apertures[current_aperture] = {}
|
||||
if 'geometry' not in self.apertures[current_aperture]:
|
||||
self.apertures[current_aperture]['geometry'] = []
|
||||
self.apertures[current_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -1012,7 +1012,7 @@ class Gerber(Geometry):
|
|||
if path_length > 1:
|
||||
geo_s = None
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
# --- BUFFERED ---
|
||||
# this treats the case when we are storing geometry as paths only
|
||||
if making_region:
|
||||
|
@ -1089,7 +1089,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -1115,7 +1115,7 @@ class Gerber(Geometry):
|
|||
|
||||
if path_length > 1:
|
||||
# --- Buffered ----
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
|
||||
# this treats the case when we are storing geometry as paths
|
||||
geo_f = LineString(path)
|
||||
|
@ -1156,7 +1156,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -1167,7 +1167,7 @@ class Gerber(Geometry):
|
|||
# --- BUFFERED ---
|
||||
# Draw the flash
|
||||
# this treats the case when we are storing geometry as paths
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_flash = Point([linear_x, linear_y])
|
||||
follow_buffer.append(geo_flash)
|
||||
geo_dict['follow'] = geo_flash
|
||||
|
@ -1190,7 +1190,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = flash
|
||||
|
||||
if current_aperture not in self.apertures:
|
||||
self.apertures[current_aperture] = dict()
|
||||
self.apertures[current_aperture] = {}
|
||||
if 'geometry' not in self.apertures[current_aperture]:
|
||||
self.apertures[current_aperture]['geometry'] = []
|
||||
self.apertures[current_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -1275,7 +1275,7 @@ class Gerber(Geometry):
|
|||
path_length = 1
|
||||
|
||||
if path_length > 1:
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
|
||||
if last_path_aperture is None:
|
||||
log.warning("No aperture defined for curent path. (%d)" % line_num)
|
||||
|
@ -1303,7 +1303,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = buffered
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -1432,7 +1432,7 @@ class Gerber(Geometry):
|
|||
# EOF, create shapely LineString if something still in path
|
||||
# ## --- Buffered ---
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
# this treats the case when we are storing geometry as paths
|
||||
geo_f = LineString(path)
|
||||
if not geo_f.is_empty:
|
||||
|
@ -1454,7 +1454,7 @@ class Gerber(Geometry):
|
|||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
|
@ -1525,7 +1525,7 @@ class Gerber(Geometry):
|
|||
# it use a filled bounding box polygon to which add clear polygons (negative) to isolate the copper
|
||||
# features
|
||||
if self.app.defaults['gerber_extra_buffering']:
|
||||
candidate_geo = list()
|
||||
candidate_geo = []
|
||||
try:
|
||||
for p in self.solid_geometry:
|
||||
candidate_geo.append(p.buffer(-0.0000001))
|
||||
|
@ -1777,7 +1777,7 @@ class Gerber(Geometry):
|
|||
|
||||
# Add to object
|
||||
if self.solid_geometry is None:
|
||||
self.solid_geometry = list()
|
||||
self.solid_geometry = []
|
||||
|
||||
# if type(self.solid_geometry) == list:
|
||||
# if type(geos) == list:
|
||||
|
@ -1795,7 +1795,7 @@ class Gerber(Geometry):
|
|||
geos_length = 1
|
||||
|
||||
if geos_length == 1:
|
||||
geo_qrcode = list()
|
||||
geo_qrcode = []
|
||||
geo_qrcode.append(Polygon(geos[0].exterior))
|
||||
for i_el in geos[0].interiors:
|
||||
geo_qrcode.append(Polygon(i_el).buffer(0))
|
||||
|
@ -1822,13 +1822,13 @@ class Gerber(Geometry):
|
|||
self.solid_geometry = [self.solid_geometry]
|
||||
|
||||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = dict()
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['size'] = 0.0
|
||||
self.apertures['0']['geometry'] = list()
|
||||
self.apertures['0']['geometry'] = []
|
||||
|
||||
for pol in self.solid_geometry:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pol
|
||||
new_el['follow'] = pol.exterior
|
||||
self.apertures['0']['geometry'].append(deepcopy(new_el))
|
||||
|
@ -1917,10 +1917,10 @@ class Gerber(Geometry):
|
|||
# we need to scale the geometry stored in the Gerber apertures, too
|
||||
try:
|
||||
for apid in self.apertures:
|
||||
new_geometry = list()
|
||||
new_geometry = []
|
||||
if 'geometry' in self.apertures[apid]:
|
||||
for geo_el in self.apertures[apid]['geometry']:
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geo_el:
|
||||
new_geo_el['solid'] = scale_geom(geo_el['solid'])
|
||||
if 'follow' in geo_el:
|
||||
|
@ -2313,10 +2313,10 @@ class Gerber(Geometry):
|
|||
# we need to buffer the geometry stored in the Gerber apertures, too
|
||||
try:
|
||||
for apid in self.apertures:
|
||||
new_geometry = list()
|
||||
new_geometry = []
|
||||
if 'geometry' in self.apertures[apid]:
|
||||
for geo_el in self.apertures[apid]['geometry']:
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geo_el:
|
||||
new_geo_el['solid'] = buffer_geom(geo_el['solid'])
|
||||
if 'follow' in geo_el:
|
||||
|
@ -2364,10 +2364,10 @@ class Gerber(Geometry):
|
|||
except KeyError:
|
||||
pass
|
||||
|
||||
new_geometry = list()
|
||||
new_geometry = []
|
||||
if 'geometry' in self.apertures[apid]:
|
||||
for geo_el in self.apertures[apid]['geometry']:
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'follow' in geo_el:
|
||||
new_geo_el['follow'] = geo_el['follow']
|
||||
size = float(self.apertures[apid]['size'])
|
||||
|
@ -2405,7 +2405,7 @@ class Gerber(Geometry):
|
|||
return 'fail'
|
||||
|
||||
# make the new solid_geometry
|
||||
new_solid_geo = list()
|
||||
new_solid_geo = []
|
||||
for apid in self.apertures:
|
||||
if 'geometry' in self.apertures[apid]:
|
||||
new_solid_geo += [geo_el['solid'] for geo_el in self.apertures[apid]['geometry']]
|
||||
|
|
|
@ -49,9 +49,9 @@ class HPGL2:
|
|||
self.units = 'MM'
|
||||
|
||||
# storage for the tools
|
||||
self.tools = dict()
|
||||
self.tools = {}
|
||||
|
||||
self.default_data = dict()
|
||||
self.default_data = {}
|
||||
self.default_data.update({
|
||||
"name": '_ncc',
|
||||
"plot": self.app.defaults["geometry_plot"],
|
||||
|
@ -153,7 +153,7 @@ class HPGL2:
|
|||
"""
|
||||
|
||||
# Coordinates of the current path, each is [x, y]
|
||||
path = list()
|
||||
path = []
|
||||
|
||||
geo_buffer = []
|
||||
|
||||
|
@ -209,7 +209,7 @@ class HPGL2:
|
|||
match = self.sp_re.search(gline)
|
||||
if match:
|
||||
tool = match.group(1)
|
||||
# self.tools[tool] = dict()
|
||||
# self.tools[tool] = {}
|
||||
self.tools.update({
|
||||
tool: {
|
||||
'tooldia': float('%.*f' %
|
||||
|
|
|
@ -135,7 +135,7 @@ def path2shapely(path, object_type, res=1.0):
|
|||
try:
|
||||
geo_element = Polygon(rings[0], rings[1:])
|
||||
except Exception:
|
||||
coords = list()
|
||||
coords = []
|
||||
for line in rings:
|
||||
coords.append(line.coords[0])
|
||||
coords.append(line.coords[1])
|
||||
|
@ -305,7 +305,7 @@ def getsvggeo(node, object_type, root=None):
|
|||
root = node
|
||||
|
||||
kind = re.search('(?:\{.*\})?(.*)$', node.tag).group(1)
|
||||
geo = list()
|
||||
geo = []
|
||||
|
||||
# Recurse
|
||||
if len(node) > 0:
|
||||
|
|
|
@ -206,7 +206,7 @@ class AlignObjects(FlatCAMTool):
|
|||
self.target_obj = None
|
||||
|
||||
# here store the alignment points
|
||||
self.clicked_points = list()
|
||||
self.clicked_points = []
|
||||
|
||||
self.align_type = None
|
||||
|
||||
|
@ -249,7 +249,7 @@ class AlignObjects(FlatCAMTool):
|
|||
def set_tool_ui(self):
|
||||
self.reset_fields()
|
||||
|
||||
self.clicked_points = list()
|
||||
self.clicked_points = []
|
||||
self.target_obj = None
|
||||
self.aligned_obj = None
|
||||
self.aligner_obj = None
|
||||
|
@ -373,7 +373,7 @@ class AlignObjects(FlatCAMTool):
|
|||
|
||||
elif event.button == right_button and self.app.event_is_dragging is False:
|
||||
self.reset_color()
|
||||
self.clicked_points = list()
|
||||
self.clicked_points = []
|
||||
self.disconnect_cal_events()
|
||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled by user request."))
|
||||
|
||||
|
|
|
@ -926,7 +926,7 @@ class ToolCalibration(FlatCAMTool):
|
|||
self.disconnect_cal_events()
|
||||
|
||||
def reset_calibration_points(self):
|
||||
self.click_points = list()
|
||||
self.click_points = []
|
||||
|
||||
self.bottom_left_coordx_tgt.set_value('')
|
||||
self.bottom_left_coordy_tgt.set_value('')
|
||||
|
|
|
@ -494,11 +494,11 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
# Objects involved in Copper thieving
|
||||
self.grb_object = None
|
||||
self.ref_obj = None
|
||||
self.sel_rect = list()
|
||||
self.sel_rect = []
|
||||
self.sm_object = None
|
||||
|
||||
# store the flattened geometry here:
|
||||
self.flat_geometry = list()
|
||||
self.flat_geometry = []
|
||||
|
||||
# Events ID
|
||||
self.mr = None
|
||||
|
@ -517,7 +517,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
self.geo_steps_per_circle = 128
|
||||
|
||||
# Thieving geometry storage
|
||||
self.new_solid_geometry = list()
|
||||
self.new_solid_geometry = []
|
||||
|
||||
# Robber bar geometry storage
|
||||
self.robber_geo = None
|
||||
|
@ -681,7 +681,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
break
|
||||
|
||||
if aperture_found:
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = self.robber_geo
|
||||
geo_elem['follow'] = self.robber_line
|
||||
self.grb_object.apertures[aperture_found]['geometry'].append(deepcopy(geo_elem))
|
||||
|
@ -692,19 +692,19 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
else:
|
||||
new_apid = '10'
|
||||
|
||||
self.grb_object.apertures[new_apid] = dict()
|
||||
self.grb_object.apertures[new_apid] = {}
|
||||
self.grb_object.apertures[new_apid]['type'] = 'C'
|
||||
self.grb_object.apertures[new_apid]['size'] = self.rb_thickness
|
||||
self.grb_object.apertures[new_apid]['geometry'] = list()
|
||||
self.grb_object.apertures[new_apid]['geometry'] = []
|
||||
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = self.robber_geo
|
||||
geo_elem['follow'] = self.robber_line
|
||||
self.grb_object.apertures[new_apid]['geometry'].append(deepcopy(geo_elem))
|
||||
|
||||
geo_obj = self.grb_object.solid_geometry
|
||||
if isinstance(geo_obj, MultiPolygon):
|
||||
s_list = list()
|
||||
s_list = []
|
||||
for pol in geo_obj.geoms:
|
||||
s_list.append(pol)
|
||||
s_list.append(self.robber_geo)
|
||||
|
@ -1127,7 +1127,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
|
||||
if fill_type == 'dot' or fill_type == 'square':
|
||||
# build the MultiPolygon of dots/squares that will fill the entire bounding box
|
||||
thieving_list = list()
|
||||
thieving_list = []
|
||||
|
||||
if fill_type == 'dot':
|
||||
radius = dot_dia / 2.0
|
||||
|
@ -1169,7 +1169,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
except TypeError:
|
||||
thieving_box_geo = [thieving_box_geo]
|
||||
|
||||
thieving_geo = list()
|
||||
thieving_geo = []
|
||||
for dot_geo in thieving_box_geo:
|
||||
for geo_t in app_obj.new_solid_geometry:
|
||||
if dot_geo.within(geo_t):
|
||||
|
@ -1212,7 +1212,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
app_obj.app.proc_container.update_view_text(' %s' % _("Buffering"))
|
||||
outline_geometry = unary_union(outline_geometry)
|
||||
|
||||
outline_line = list()
|
||||
outline_line = []
|
||||
try:
|
||||
for geo_o in outline_geometry:
|
||||
outline_line.append(
|
||||
|
@ -1238,7 +1238,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
)
|
||||
|
||||
bx0, by0, bx1, by1 = box_outline_geo.bounds
|
||||
thieving_lines_geo = list()
|
||||
thieving_lines_geo = []
|
||||
new_x = bx0
|
||||
new_y = by0
|
||||
while new_x <= x1 - half_thick_line:
|
||||
|
@ -1258,7 +1258,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
new_y += line_size + line_spacing
|
||||
|
||||
# merge everything together
|
||||
diff_lines_geo = list()
|
||||
diff_lines_geo = []
|
||||
for line_poly in thieving_lines_geo:
|
||||
rest_line = line_poly.difference(clearance_geometry)
|
||||
diff_lines_geo.append(rest_line)
|
||||
|
@ -1271,8 +1271,8 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
geo_list = list(app_obj.grb_object.solid_geometry.geoms)
|
||||
|
||||
if '0' not in app_obj.grb_object.apertures:
|
||||
app_obj.grb_object.apertures['0'] = dict()
|
||||
app_obj.grb_object.apertures['0']['geometry'] = list()
|
||||
app_obj.grb_object.apertures['0'] = {}
|
||||
app_obj.grb_object.apertures['0']['geometry'] = []
|
||||
app_obj.grb_object.apertures['0']['type'] = 'REG'
|
||||
app_obj.grb_object.apertures['0']['size'] = 0.0
|
||||
|
||||
|
@ -1282,7 +1282,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
geo_list.append(poly)
|
||||
|
||||
# append into the '0' aperture
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = poly
|
||||
geo_elem['follow'] = poly.exterior
|
||||
app_obj.grb_object.apertures['0']['geometry'].append(deepcopy(geo_elem))
|
||||
|
@ -1291,7 +1291,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
geo_list.append(app_obj.new_solid_geometry)
|
||||
|
||||
# append into the '0' aperture
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = app_obj.new_solid_geometry
|
||||
geo_elem['follow'] = app_obj.new_solid_geometry.exterior
|
||||
app_obj.grb_object.apertures['0']['geometry'].append(deepcopy(geo_elem))
|
||||
|
@ -1350,7 +1350,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
|
||||
# if the clearance is negative apply it to the original soldermask too
|
||||
if ppm_clearance < 0:
|
||||
temp_geo_list = list()
|
||||
temp_geo_list = []
|
||||
for geo in geo_list:
|
||||
temp_geo_list.append(geo.buffer(ppm_clearance))
|
||||
geo_list = temp_geo_list
|
||||
|
@ -1372,11 +1372,11 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
|
||||
def obj_init(grb_obj, app_obj):
|
||||
grb_obj.multitool = False
|
||||
grb_obj.source_file = list()
|
||||
grb_obj.source_file = []
|
||||
grb_obj.multigeo = False
|
||||
grb_obj.follow = False
|
||||
grb_obj.apertures = dict()
|
||||
grb_obj.solid_geometry = list()
|
||||
grb_obj.apertures = {}
|
||||
grb_obj.solid_geometry = []
|
||||
|
||||
# try:
|
||||
# grb_obj.options['xmin'] = 0
|
||||
|
@ -1389,8 +1389,8 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
# if we have copper thieving geometry, add it
|
||||
if thieving_solid_geo:
|
||||
if '0' not in grb_obj.apertures:
|
||||
grb_obj.apertures['0'] = dict()
|
||||
grb_obj.apertures['0']['geometry'] = list()
|
||||
grb_obj.apertures['0'] = {}
|
||||
grb_obj.apertures['0']['geometry'] = []
|
||||
grb_obj.apertures['0']['type'] = 'REG'
|
||||
grb_obj.apertures['0']['size'] = 0.0
|
||||
|
||||
|
@ -1402,7 +1402,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
geo_list.append(poly_b)
|
||||
|
||||
# append into the '0' aperture
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = poly_b
|
||||
geo_elem['follow'] = poly_b.exterior
|
||||
grb_obj.apertures['0']['geometry'].append(deepcopy(geo_elem))
|
||||
|
@ -1411,7 +1411,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
geo_list.append(thieving_solid_geo.buffer(ppm_clearance))
|
||||
|
||||
# append into the '0' aperture
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = thieving_solid_geo.buffer(ppm_clearance)
|
||||
geo_elem['follow'] = thieving_solid_geo.buffer(ppm_clearance).exterior
|
||||
grb_obj.apertures['0']['geometry'].append(deepcopy(geo_elem))
|
||||
|
@ -1425,7 +1425,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
break
|
||||
|
||||
if aperture_found:
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = robber_solid_geo
|
||||
geo_elem['follow'] = robber_line
|
||||
grb_obj.apertures[aperture_found]['geometry'].append(deepcopy(geo_elem))
|
||||
|
@ -1437,12 +1437,12 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
else:
|
||||
new_apid = '10'
|
||||
|
||||
grb_obj.apertures[new_apid] = dict()
|
||||
grb_obj.apertures[new_apid] = {}
|
||||
grb_obj.apertures[new_apid]['type'] = 'C'
|
||||
grb_obj.apertures[new_apid]['size'] = rb_thickness + ppm_clearance
|
||||
grb_obj.apertures[new_apid]['geometry'] = list()
|
||||
grb_obj.apertures[new_apid]['geometry'] = []
|
||||
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = robber_solid_geo.buffer(ppm_clearance)
|
||||
geo_elem['follow'] = Polygon(robber_line).buffer(ppm_clearance / 2.0).exterior
|
||||
grb_obj.apertures[new_apid]['geometry'].append(deepcopy(geo_elem))
|
||||
|
@ -1510,7 +1510,7 @@ class ToolCopperThieving(FlatCAMTool):
|
|||
self.grb_object = None
|
||||
self.sm_object = None
|
||||
self.ref_obj = None
|
||||
self.sel_rect = list()
|
||||
self.sel_rect = []
|
||||
|
||||
# Events ID
|
||||
self.mr = None
|
||||
|
|
|
@ -521,7 +521,7 @@ class CutOut(FlatCAMTool):
|
|||
gapsize = gapsize / 2 + (dia / 2)
|
||||
|
||||
def geo_init(geo_obj, app_obj):
|
||||
solid_geo = list()
|
||||
solid_geo = []
|
||||
|
||||
if isinstance(cutout_obj, FlatCAMGerber):
|
||||
if isinstance(cutout_obj.solid_geometry, list):
|
||||
|
@ -639,7 +639,7 @@ class CutOut(FlatCAMTool):
|
|||
|
||||
cutout_obj.plot()
|
||||
self.app.inform.emit('[success] %s' % _("Any form CutOut operation finished."))
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
|
||||
# self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
|
||||
self.app.should_we_save = True
|
||||
|
||||
def on_rectangular_cutout(self):
|
||||
|
@ -798,7 +798,7 @@ class CutOut(FlatCAMTool):
|
|||
# cutout_obj.plot()
|
||||
self.app.inform.emit('[success] %s' %
|
||||
_("Any form CutOut operation finished."))
|
||||
self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
|
||||
# self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
|
||||
self.app.should_we_save = True
|
||||
|
||||
def on_manual_gap_click(self):
|
||||
|
|
|
@ -606,10 +606,10 @@ class DblSidedTool(FlatCAMTool):
|
|||
_("No value or wrong format in Drill Dia entry. Add it and retry."))
|
||||
return
|
||||
|
||||
tools = dict()
|
||||
tools["1"] = dict()
|
||||
tools = {}
|
||||
tools["1"] = {}
|
||||
tools["1"]["C"] = dia
|
||||
tools["1"]['solid_geometry'] = list()
|
||||
tools["1"]['solid_geometry'] = []
|
||||
|
||||
# holes = self.alignment_holes.get_value()
|
||||
holes = eval('[{}]'.format(self.alignment_holes.text()))
|
||||
|
@ -618,7 +618,7 @@ class DblSidedTool(FlatCAMTool):
|
|||
"Add them and retry."))
|
||||
return
|
||||
|
||||
drills = list()
|
||||
drills = []
|
||||
|
||||
for hole in holes:
|
||||
point = Point(hole)
|
||||
|
|
|
@ -433,7 +433,7 @@ class Distance(FlatCAMTool):
|
|||
pos = (center_pt.x, center_pt.y)
|
||||
|
||||
elif self.original_call_source == 'grb_editor':
|
||||
clicked_pads = list()
|
||||
clicked_pads = []
|
||||
for storage in self.app.grb_editor.storage_dict:
|
||||
try:
|
||||
for shape_stored in self.app.grb_editor.storage_dict[storage]['geometry']:
|
||||
|
|
|
@ -423,8 +423,8 @@ class ToolExtractDrills(FlatCAMTool):
|
|||
|
||||
prop_factor = self.factor_entry.get_value() / 100.0
|
||||
|
||||
drills = list()
|
||||
tools = dict()
|
||||
drills = []
|
||||
tools = {}
|
||||
|
||||
selection_index = self.gerber_object_combo.currentIndex()
|
||||
model_index = self.app.collection.index(selection_index, 0, self.gerber_object_combo.rootModelIndex())
|
||||
|
@ -469,7 +469,7 @@ class ToolExtractDrills(FlatCAMTool):
|
|||
if 'follow' in geo_el and isinstance(geo_el['follow'], Point):
|
||||
drills.append({"point": geo_el['follow'], "tool": "1"})
|
||||
if 'solid_geometry' not in tools["1"]:
|
||||
tools["1"]['solid_geometry'] = list()
|
||||
tools["1"]['solid_geometry'] = []
|
||||
else:
|
||||
tools["1"]['solid_geometry'].append(geo_el['follow'])
|
||||
|
||||
|
@ -548,7 +548,7 @@ class ToolExtractDrills(FlatCAMTool):
|
|||
drills.append({"point": geo_el['follow'], "tool": tool_in_drills})
|
||||
|
||||
if 'solid_geometry' not in tools[tool_in_drills]:
|
||||
tools[tool_in_drills]['solid_geometry'] = list()
|
||||
tools[tool_in_drills]['solid_geometry'] = []
|
||||
else:
|
||||
tools[tool_in_drills]['solid_geometry'].append(geo_el['follow'])
|
||||
|
||||
|
@ -633,7 +633,7 @@ class ToolExtractDrills(FlatCAMTool):
|
|||
drills.append({"point": geo_el['follow'], "tool": tool_in_drills})
|
||||
|
||||
if 'solid_geometry' not in tools[tool_in_drills]:
|
||||
tools[tool_in_drills]['solid_geometry'] = list()
|
||||
tools[tool_in_drills]['solid_geometry'] = []
|
||||
else:
|
||||
tools[tool_in_drills]['solid_geometry'].append(geo_el['follow'])
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
self.sm_obj_set = set()
|
||||
|
||||
# store the flattened geometry here:
|
||||
self.flat_geometry = list()
|
||||
self.flat_geometry = []
|
||||
|
||||
# Events ID
|
||||
self.mr = None
|
||||
|
@ -353,7 +353,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
self.sec_position = None
|
||||
self.geo_steps_per_circle = 128
|
||||
|
||||
self.click_points = list()
|
||||
self.click_points = []
|
||||
|
||||
# SIGNALS
|
||||
self.add_cfid_button.clicked.connect(self.add_fiducials)
|
||||
|
@ -404,7 +404,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
self.fid_type_radio.set_value(self.app.defaults["tools_fiducials_type"])
|
||||
self.line_thickness_entry.set_value(float(self.app.defaults["tools_fiducials_line_thickness"]))
|
||||
|
||||
self.click_points = list()
|
||||
self.click_points = []
|
||||
self.bottom_left_coords_entry.set_value('')
|
||||
self.top_right_coords_entry.set_value('')
|
||||
self.sec_points_coords_entry.set_value('')
|
||||
|
@ -429,7 +429,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
:return: None
|
||||
"""
|
||||
if val == 'auto':
|
||||
self.click_points = list()
|
||||
self.click_points = []
|
||||
|
||||
try:
|
||||
self.disconnect_event_handlers()
|
||||
|
@ -451,7 +451,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
self.sec_position = self.pos_radio.get_value()
|
||||
fid_type = self.fid_type_radio.get_value()
|
||||
|
||||
self.click_points = list()
|
||||
self.click_points = []
|
||||
|
||||
# get the Gerber object on which the Fiducial will be inserted
|
||||
selection_index = self.grb_object_combo.currentIndex()
|
||||
|
@ -547,7 +547,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
|
||||
if aperture_found:
|
||||
for geo in geo_list:
|
||||
dict_el = dict()
|
||||
dict_el = {}
|
||||
dict_el['follow'] = geo.centroid
|
||||
dict_el['solid'] = geo
|
||||
g_obj.apertures[aperture_found]['geometry'].append(deepcopy(dict_el))
|
||||
|
@ -558,18 +558,18 @@ class ToolFiducials(FlatCAMTool):
|
|||
else:
|
||||
new_apid = '10'
|
||||
|
||||
g_obj.apertures[new_apid] = dict()
|
||||
g_obj.apertures[new_apid] = {}
|
||||
g_obj.apertures[new_apid]['type'] = 'C'
|
||||
g_obj.apertures[new_apid]['size'] = fid_size
|
||||
g_obj.apertures[new_apid]['geometry'] = list()
|
||||
g_obj.apertures[new_apid]['geometry'] = []
|
||||
|
||||
for geo in geo_list:
|
||||
dict_el = dict()
|
||||
dict_el = {}
|
||||
dict_el['follow'] = geo.centroid
|
||||
dict_el['solid'] = geo
|
||||
g_obj.apertures[new_apid]['geometry'].append(deepcopy(dict_el))
|
||||
|
||||
s_list = list()
|
||||
s_list = []
|
||||
if g_obj.solid_geometry:
|
||||
try:
|
||||
for poly in g_obj.solid_geometry:
|
||||
|
@ -580,7 +580,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
s_list += geo_list
|
||||
g_obj.solid_geometry = MultiPolygon(s_list)
|
||||
elif fid_type == 'cross':
|
||||
geo_list = list()
|
||||
geo_list = []
|
||||
|
||||
for pt in points_list:
|
||||
x = pt[0]
|
||||
|
@ -599,7 +599,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
aperture_found = ap_id
|
||||
break
|
||||
|
||||
geo_buff_list = list()
|
||||
geo_buff_list = []
|
||||
if aperture_found:
|
||||
for geo in geo_list:
|
||||
geo_buff_h = geo[0].buffer(line_thickness / 2.0)
|
||||
|
@ -607,7 +607,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
geo_buff_list.append(geo_buff_h)
|
||||
geo_buff_list.append(geo_buff_v)
|
||||
|
||||
dict_el = dict()
|
||||
dict_el = {}
|
||||
dict_el['follow'] = geo_buff_h.centroid
|
||||
dict_el['solid'] = geo_buff_h
|
||||
g_obj.apertures[aperture_found]['geometry'].append(deepcopy(dict_el))
|
||||
|
@ -621,10 +621,10 @@ class ToolFiducials(FlatCAMTool):
|
|||
else:
|
||||
new_apid = '10'
|
||||
|
||||
g_obj.apertures[new_apid] = dict()
|
||||
g_obj.apertures[new_apid] = {}
|
||||
g_obj.apertures[new_apid]['type'] = 'C'
|
||||
g_obj.apertures[new_apid]['size'] = line_thickness
|
||||
g_obj.apertures[new_apid]['geometry'] = list()
|
||||
g_obj.apertures[new_apid]['geometry'] = []
|
||||
|
||||
for geo in geo_list:
|
||||
geo_buff_h = geo[0].buffer(line_thickness / 2.0)
|
||||
|
@ -632,7 +632,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
geo_buff_list.append(geo_buff_h)
|
||||
geo_buff_list.append(geo_buff_v)
|
||||
|
||||
dict_el = dict()
|
||||
dict_el = {}
|
||||
dict_el['follow'] = geo_buff_h.centroid
|
||||
dict_el['solid'] = geo_buff_h
|
||||
g_obj.apertures[new_apid]['geometry'].append(deepcopy(dict_el))
|
||||
|
@ -640,7 +640,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
dict_el['solid'] = geo_buff_v
|
||||
g_obj.apertures[new_apid]['geometry'].append(deepcopy(dict_el))
|
||||
|
||||
s_list = list()
|
||||
s_list = []
|
||||
if g_obj.solid_geometry:
|
||||
try:
|
||||
for poly in g_obj.solid_geometry:
|
||||
|
@ -655,7 +655,7 @@ class ToolFiducials(FlatCAMTool):
|
|||
g_obj.solid_geometry = MultiPolygon(s_list)
|
||||
else:
|
||||
# chess pattern fiducial type
|
||||
geo_list = list()
|
||||
geo_list = []
|
||||
|
||||
def make_square_poly(center_pt, side_size):
|
||||
half_s = side_size / 2
|
||||
|
@ -684,12 +684,12 @@ class ToolFiducials(FlatCAMTool):
|
|||
aperture_found = ap_id
|
||||
break
|
||||
|
||||
geo_buff_list = list()
|
||||
geo_buff_list = []
|
||||
if aperture_found:
|
||||
for geo in geo_list:
|
||||
geo_buff_list.append(geo)
|
||||
|
||||
dict_el = dict()
|
||||
dict_el = {}
|
||||
dict_el['follow'] = geo.centroid
|
||||
dict_el['solid'] = geo
|
||||
g_obj.apertures[aperture_found]['geometry'].append(deepcopy(dict_el))
|
||||
|
@ -700,22 +700,22 @@ class ToolFiducials(FlatCAMTool):
|
|||
else:
|
||||
new_apid = '10'
|
||||
|
||||
g_obj.apertures[new_apid] = dict()
|
||||
g_obj.apertures[new_apid] = {}
|
||||
g_obj.apertures[new_apid]['type'] = 'R'
|
||||
g_obj.apertures[new_apid]['size'] = new_ap_size
|
||||
g_obj.apertures[new_apid]['width'] = fid_size
|
||||
g_obj.apertures[new_apid]['height'] = fid_size
|
||||
g_obj.apertures[new_apid]['geometry'] = list()
|
||||
g_obj.apertures[new_apid]['geometry'] = []
|
||||
|
||||
for geo in geo_list:
|
||||
geo_buff_list.append(geo)
|
||||
|
||||
dict_el = dict()
|
||||
dict_el = {}
|
||||
dict_el['follow'] = geo.centroid
|
||||
dict_el['solid'] = geo
|
||||
g_obj.apertures[new_apid]['geometry'].append(deepcopy(dict_el))
|
||||
|
||||
s_list = list()
|
||||
s_list = []
|
||||
if g_obj.solid_geometry:
|
||||
try:
|
||||
for poly in g_obj.solid_geometry:
|
||||
|
|
|
@ -434,7 +434,7 @@ class Film(FlatCAMTool):
|
|||
|
||||
self.pagesize_combo = FCComboBox()
|
||||
|
||||
self.pagesize = dict()
|
||||
self.pagesize = {}
|
||||
self.pagesize.update(
|
||||
{
|
||||
'Bounds': None,
|
||||
|
@ -786,7 +786,7 @@ class Film(FlatCAMTool):
|
|||
|
||||
punch_size = float(self.punch_size_spinner.get_value())
|
||||
|
||||
punching_geo = list()
|
||||
punching_geo = []
|
||||
for apid in film_obj.apertures:
|
||||
if film_obj.apertures[apid]['type'] == 'C':
|
||||
if punch_size >= float(film_obj.apertures[apid]['size']):
|
||||
|
|
|
@ -223,7 +223,7 @@ class ToolImage(FlatCAMTool):
|
|||
:type type_of_obj: str
|
||||
:return: None
|
||||
"""
|
||||
mask = list()
|
||||
mask = []
|
||||
self.app.log.debug("on_file_importimage()")
|
||||
|
||||
_filter = "Image Files(*.BMP *.PNG *.JPG *.JPEG);;" \
|
||||
|
|
|
@ -227,19 +227,19 @@ class ToolInvertGerber(FlatCAMTool):
|
|||
for poly in grb_obj.solid_geometry:
|
||||
new_solid_geometry = new_solid_geometry.difference(poly)
|
||||
|
||||
new_options = dict()
|
||||
new_options = {}
|
||||
for opt in grb_obj.options:
|
||||
new_options[opt] = deepcopy(grb_obj.options[opt])
|
||||
|
||||
new_apertures = dict()
|
||||
new_apertures = {}
|
||||
|
||||
# for apid, val in grb_obj.apertures.items():
|
||||
# new_apertures[apid] = dict()
|
||||
# new_apertures[apid] = {}
|
||||
# for key in val:
|
||||
# if key == 'geometry':
|
||||
# new_apertures[apid]['geometry'] = list()
|
||||
# new_apertures[apid]['geometry'] = []
|
||||
# for elem in val['geometry']:
|
||||
# geo_elem = dict()
|
||||
# geo_elem = {}
|
||||
# if 'follow' in elem:
|
||||
# try:
|
||||
# geo_elem['clear'] = elem['follow'].buffer(val['size'] / 2.0).exterior
|
||||
|
@ -260,19 +260,19 @@ class ToolInvertGerber(FlatCAMTool):
|
|||
# new_apertures[apid][key] = deepcopy(val[key])
|
||||
|
||||
if '0' not in new_apertures:
|
||||
new_apertures['0'] = dict()
|
||||
new_apertures['0'] = {}
|
||||
new_apertures['0']['type'] = 'C'
|
||||
new_apertures['0']['size'] = 0.0
|
||||
new_apertures['0']['geometry'] = list()
|
||||
new_apertures['0']['geometry'] = []
|
||||
|
||||
try:
|
||||
for poly in new_solid_geometry:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
new_apertures['0']['geometry'].append(new_el)
|
||||
except TypeError:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = new_solid_geometry
|
||||
new_el['follow'] = new_solid_geometry.exterior
|
||||
new_apertures['0']['geometry'].append(new_el)
|
||||
|
|
|
@ -625,22 +625,22 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
# ########################## VARIABLES ########################################
|
||||
# #############################################################################
|
||||
self.units = ''
|
||||
self.ncc_tools = dict()
|
||||
self.ncc_tools = {}
|
||||
self.tooluid = 0
|
||||
|
||||
# store here the default data for Geometry Data
|
||||
self.default_data = dict()
|
||||
self.default_data = {}
|
||||
|
||||
self.obj_name = ""
|
||||
self.ncc_obj = None
|
||||
|
||||
self.sel_rect = list()
|
||||
self.sel_rect = []
|
||||
|
||||
self.bound_obj_name = ""
|
||||
self.bound_obj = None
|
||||
|
||||
self.ncc_dia_list = list()
|
||||
self.iso_dia_list = list()
|
||||
self.ncc_dia_list = []
|
||||
self.iso_dia_list = []
|
||||
self.has_offset = None
|
||||
self.o_name = None
|
||||
self.overlap = None
|
||||
|
@ -656,10 +656,10 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
self.mr = None
|
||||
|
||||
# store here solid_geometry when there are tool with isolation job
|
||||
self.solid_geometry = list()
|
||||
self.solid_geometry = []
|
||||
|
||||
self.select_method = None
|
||||
self.tool_type_item_options = list()
|
||||
self.tool_type_item_options = []
|
||||
|
||||
self.grb_circle_steps = int(self.app.defaults["gerber_circle_steps"])
|
||||
|
||||
|
@ -832,7 +832,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
row = 0
|
||||
|
||||
tooluid_item = int(self.tools_table.item(row, 3).text())
|
||||
temp_tool_data = dict()
|
||||
temp_tool_data = {}
|
||||
|
||||
for tooluid_key, tooluid_val in self.ncc_tools.items():
|
||||
if int(tooluid_key) == tooluid_item:
|
||||
|
@ -1143,7 +1143,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
self.ui_connect()
|
||||
|
||||
# set the text on tool_data_label after loading the object
|
||||
sel_rows = list()
|
||||
sel_rows = []
|
||||
sel_items = self.tools_table.selectedItems()
|
||||
for it in sel_items:
|
||||
sel_rows.append(it.row())
|
||||
|
@ -1550,9 +1550,9 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
return
|
||||
|
||||
# use the selected tools in the tool table; get diameters for non-copper clear
|
||||
self.iso_dia_list = list()
|
||||
self.iso_dia_list = []
|
||||
# use the selected tools in the tool table; get diameters for non-copper clear
|
||||
self.ncc_dia_list = list()
|
||||
self.ncc_dia_list = []
|
||||
if self.tools_table.selectedItems():
|
||||
for x in self.tools_table.selectedItems():
|
||||
try:
|
||||
|
@ -1834,7 +1834,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
bounding_box = cascaded_union(geo_buff_list)
|
||||
elif ncc_select == _("Reference Object"):
|
||||
if box_kind == 'geometry':
|
||||
geo_buff_list = list()
|
||||
geo_buff_list = []
|
||||
for poly in env_obj:
|
||||
if self.app.abort_flag:
|
||||
# graceful abort requested by the user
|
||||
|
@ -2223,7 +2223,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
p = p.buffer(0)
|
||||
|
||||
if p is not None and p.is_valid:
|
||||
poly_processed = list()
|
||||
poly_processed = []
|
||||
try:
|
||||
for pol in p:
|
||||
if pol is not None and isinstance(pol, Polygon):
|
||||
|
@ -2368,7 +2368,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
return
|
||||
|
||||
# create the solid_geometry
|
||||
geo_obj.solid_geometry = list()
|
||||
geo_obj.solid_geometry = []
|
||||
for tooluid in geo_obj.tools:
|
||||
if geo_obj.tools[tooluid]['solid_geometry']:
|
||||
try:
|
||||
|
@ -2653,7 +2653,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
return
|
||||
|
||||
# create the solid_geometry
|
||||
geo_obj.solid_geometry = list()
|
||||
geo_obj.solid_geometry = []
|
||||
for tooluid in geo_obj.tools:
|
||||
if geo_obj.tools[tooluid]['solid_geometry']:
|
||||
try:
|
||||
|
@ -2961,7 +2961,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
milling_type = self.app.defaults["tools_nccmilling_type"]
|
||||
|
||||
for tool_iso in isotooldia:
|
||||
new_geometry = list()
|
||||
new_geometry = []
|
||||
|
||||
if milling_type == 'cl':
|
||||
isolated_geo = self.generate_envelope(tool_iso / 2, 1)
|
||||
|
@ -3129,7 +3129,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
p = p.buffer(0)
|
||||
|
||||
if p is not None and p.is_valid:
|
||||
poly_processed = list()
|
||||
poly_processed = []
|
||||
try:
|
||||
for pol in p:
|
||||
if pol is not None and isinstance(pol, Polygon):
|
||||
|
@ -3267,7 +3267,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
return
|
||||
|
||||
# create the solid_geometry
|
||||
geo_obj.solid_geometry = list()
|
||||
geo_obj.solid_geometry = []
|
||||
for tooluid in geo_obj.tools:
|
||||
if geo_obj.tools[tooluid]['solid_geometry']:
|
||||
try:
|
||||
|
@ -3650,7 +3650,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
|||
return
|
||||
|
||||
# create the solid_geometry
|
||||
geo_obj.solid_geometry = list()
|
||||
geo_obj.solid_geometry = []
|
||||
for tooluid in geo_obj.tools:
|
||||
if geo_obj.tools[tooluid]['solid_geometry']:
|
||||
try:
|
||||
|
|
|
@ -259,7 +259,7 @@ class ToolOptimal(FlatCAMTool):
|
|||
|
||||
# dict to hold the distances between every two elements in Gerber as keys and the actual locations where that
|
||||
# distances happen as values
|
||||
self.min_dict = dict()
|
||||
self.min_dict = {}
|
||||
|
||||
# ############################################################################
|
||||
# ############################ Signals #######################################
|
||||
|
@ -354,7 +354,7 @@ class ToolOptimal(FlatCAMTool):
|
|||
old_disp_number = 0
|
||||
pol_nr = 0
|
||||
app_obj.proc_container.update_view_text(' %d%%' % 0)
|
||||
total_geo = list()
|
||||
total_geo = []
|
||||
|
||||
for ap in list(fcobj.apertures.keys()):
|
||||
if 'geometry' in fcobj.apertures[ap]:
|
||||
|
@ -388,7 +388,7 @@ class ToolOptimal(FlatCAMTool):
|
|||
'%s: %s' % (_("Optimal Tool. Finding the distances between each two elements. Iterations"),
|
||||
str(geo_len)))
|
||||
|
||||
self.min_dict = dict()
|
||||
self.min_dict = {}
|
||||
idx = 1
|
||||
for geo in total_geo:
|
||||
for s_geo in total_geo[idx:]:
|
||||
|
|
|
@ -105,7 +105,7 @@ class ToolPDF(FlatCAMTool):
|
|||
self.restore_gs_re = re.compile(r'^.*Q.*$')
|
||||
|
||||
# graphic stack where we save parameters like transformation, line_width
|
||||
self.gs = dict()
|
||||
self.gs = {}
|
||||
# each element is a list composed of sublist elements
|
||||
# (each sublist has 2 lists each having 2 elements: first is offset like:
|
||||
# offset_geo = [off_x, off_y], second element is scale list with 2 elements, like: scale_geo = [sc_x, sc_yy])
|
||||
|
@ -434,12 +434,12 @@ class ToolPDF(FlatCAMTool):
|
|||
traceback.print_exc()
|
||||
|
||||
def parse_pdf(self, pdf_content):
|
||||
path = dict()
|
||||
path = {}
|
||||
path['lines'] = [] # it's a list of lines subpaths
|
||||
path['bezier'] = [] # it's a list of bezier arcs subpaths
|
||||
path['rectangle'] = [] # it's a list of rectangle subpaths
|
||||
|
||||
subpath = dict()
|
||||
subpath = {}
|
||||
subpath['lines'] = [] # it's a list of points
|
||||
subpath['bezier'] = [] # it's a list of sublists each like this [start, c1, c2, stop]
|
||||
subpath['rectangle'] = [] # it's a list of sublists of points
|
||||
|
@ -473,9 +473,9 @@ class ToolPDF(FlatCAMTool):
|
|||
|
||||
# store the apertures with clear geometry here
|
||||
# we are interested only in the circular geometry (drill holes) therefore we target only Bezier subpaths
|
||||
clear_apertures_dict = dict()
|
||||
clear_apertures_dict = {}
|
||||
# everything will be stored in the '0' aperture since we are dealing with clear polygons not strokes
|
||||
clear_apertures_dict['0'] = dict()
|
||||
clear_apertures_dict['0'] = {}
|
||||
clear_apertures_dict['0']['size'] = 0.0
|
||||
clear_apertures_dict['0']['type'] = 'C'
|
||||
clear_apertures_dict['0']['geometry'] = []
|
||||
|
@ -515,7 +515,7 @@ class ToolPDF(FlatCAMTool):
|
|||
apertures_dict.clear()
|
||||
layer_nr += 1
|
||||
|
||||
object_dict[layer_nr] = dict()
|
||||
object_dict[layer_nr] = {}
|
||||
old_color = copy(color)
|
||||
# we make sure that the following geometry is added to the right storage
|
||||
flag_clear_geo = False
|
||||
|
@ -778,7 +778,7 @@ class ToolPDF(FlatCAMTool):
|
|||
if match:
|
||||
# scale the size here; some PDF printers apply transformation after the size is declared
|
||||
applied_size = size * scale_geo[0] * self.point_to_unit_factor
|
||||
path_geo = list()
|
||||
path_geo = []
|
||||
if current_subpath == 'lines':
|
||||
if path['lines']:
|
||||
for subp in path['lines']:
|
||||
|
@ -859,12 +859,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict[copy(found_aperture)]['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict[copy(found_aperture)]['geometry'].append(deepcopy(new_el))
|
||||
|
@ -879,12 +879,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict[str(aperture)]['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict[str(aperture)]['geometry'].append(deepcopy(new_el))
|
||||
|
@ -896,12 +896,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict[str(aperture)]['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict[str(aperture)]['geometry'].append(deepcopy(new_el))
|
||||
|
@ -913,7 +913,7 @@ class ToolPDF(FlatCAMTool):
|
|||
if match:
|
||||
# scale the size here; some PDF printers apply transformation after the size is declared
|
||||
applied_size = size * scale_geo[0] * self.point_to_unit_factor
|
||||
path_geo = list()
|
||||
path_geo = []
|
||||
|
||||
if current_subpath == 'lines':
|
||||
if path['lines']:
|
||||
|
@ -1007,11 +1007,11 @@ class ToolPDF(FlatCAMTool):
|
|||
if path_geo:
|
||||
try:
|
||||
for g in path_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = g
|
||||
clear_apertures_dict['0']['geometry'].append(new_el)
|
||||
except TypeError:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = path_geo
|
||||
clear_apertures_dict['0']['geometry'].append(new_el)
|
||||
|
||||
|
@ -1022,11 +1022,11 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = poly
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = pdf_geo
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
except KeyError:
|
||||
|
@ -1038,11 +1038,11 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = poly
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = pdf_geo
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
|
@ -1051,12 +1051,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
|
@ -1069,12 +1069,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
|
@ -1085,8 +1085,8 @@ class ToolPDF(FlatCAMTool):
|
|||
if match:
|
||||
# scale the size here; some PDF printers apply transformation after the size is declared
|
||||
applied_size = size * scale_geo[0] * self.point_to_unit_factor
|
||||
path_geo = list()
|
||||
fill_geo = list()
|
||||
path_geo = []
|
||||
fill_geo = []
|
||||
|
||||
if current_subpath == 'lines':
|
||||
if path['lines']:
|
||||
|
@ -1222,12 +1222,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict[copy(found_aperture)]['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict[copy(found_aperture)]['geometry'].append(deepcopy(new_el))
|
||||
|
@ -1242,12 +1242,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict[str(aperture)]['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict[str(aperture)]['geometry'].append(deepcopy(new_el))
|
||||
|
@ -1259,12 +1259,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict[str(aperture)]['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict[str(aperture)]['geometry'].append(deepcopy(new_el))
|
||||
|
@ -1279,11 +1279,11 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in fill_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = poly
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = pdf_geo
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
except KeyError:
|
||||
|
@ -1295,11 +1295,11 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in fill_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = poly
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['clear'] = pdf_geo
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
|
@ -1307,12 +1307,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in path_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in fill_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
|
@ -1325,12 +1325,12 @@ class ToolPDF(FlatCAMTool):
|
|||
for pdf_geo in fill_geo:
|
||||
if isinstance(pdf_geo, MultiPolygon):
|
||||
for poly in pdf_geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = poly
|
||||
new_el['follow'] = poly.exterior
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
else:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pdf_geo
|
||||
new_el['follow'] = pdf_geo.exterior
|
||||
apertures_dict['0']['geometry'].append(deepcopy(new_el))
|
||||
|
|
|
@ -561,7 +561,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
self.bound_obj_name = ""
|
||||
self.bound_obj = None
|
||||
|
||||
self.tooldia_list = list()
|
||||
self.tooldia_list = []
|
||||
self.tooldia = None
|
||||
|
||||
self.sel_rect = None
|
||||
|
@ -572,7 +572,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
self.select_method = None
|
||||
|
||||
self.units = ''
|
||||
self.paint_tools = dict()
|
||||
self.paint_tools = {}
|
||||
self.tooluid = 0
|
||||
self.first_click = False
|
||||
self.cursor_pos = None
|
||||
|
@ -582,16 +582,16 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
self.mp = None
|
||||
self.mr = None
|
||||
|
||||
self.sel_rect = list()
|
||||
self.sel_rect = []
|
||||
|
||||
# store here if the grid snapping is active
|
||||
self.grid_status_memory = False
|
||||
|
||||
# dict to store the polygons selected for painting; key is the shape added to be plotted and value is the poly
|
||||
self.poly_dict = dict()
|
||||
self.poly_dict = {}
|
||||
|
||||
# store here the default data for Geometry Data
|
||||
self.default_data = dict()
|
||||
self.default_data = {}
|
||||
|
||||
self.tool_type_item_options = ["C1", "C2", "C3", "C4", "B", "V"]
|
||||
|
||||
|
@ -794,7 +794,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
row = 0
|
||||
|
||||
tooluid_item = int(self.tools_table.item(row, 3).text())
|
||||
temp_tool_data = dict()
|
||||
temp_tool_data = {}
|
||||
|
||||
for tooluid_key, tooluid_val in self.paint_tools.items():
|
||||
if int(tooluid_key) == tooluid_item:
|
||||
|
@ -1352,7 +1352,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
self.o_name = '%s_mt_paint' % self.obj_name
|
||||
|
||||
# use the selected tools in the tool table; get diameters
|
||||
self.tooldia_list = list()
|
||||
self.tooldia_list = []
|
||||
if self.tools_table.selectedItems():
|
||||
for x in self.tools_table.selectedItems():
|
||||
try:
|
||||
|
@ -1739,7 +1739,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
|
||||
# Initializes the new geometry object
|
||||
def gen_paintarea(geo_obj, app_obj):
|
||||
geo_obj.solid_geometry = list()
|
||||
geo_obj.solid_geometry = []
|
||||
|
||||
def paint_p(polyg, tooldiameter):
|
||||
cpoly = None
|
||||
|
@ -1779,9 +1779,9 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
# aperture_size = None
|
||||
|
||||
# the key is the aperture type and the val is a list of geo elements
|
||||
flash_el_dict = dict()
|
||||
flash_el_dict = {}
|
||||
# the key is the aperture size, the val is a list of geo elements
|
||||
traces_el_dict = dict()
|
||||
traces_el_dict = {}
|
||||
|
||||
# find the flashes and the lines that are in the selected polygon and store them separately
|
||||
for apid, apval in obj.apertures.items():
|
||||
|
@ -1818,7 +1818,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
traces_el_dict[aperture_size] = [geo_el]
|
||||
|
||||
cpoly = FlatCAMRTreeStorage()
|
||||
pads_lines_list = list()
|
||||
pads_lines_list = []
|
||||
|
||||
# process the flashes found in the selected polygon with the 'lines' method for rectangular
|
||||
# flashes and with _("Seed") for oblong and circular flashes
|
||||
|
@ -1868,7 +1868,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
except TypeError:
|
||||
cpoly.insert(pads_lines_list)
|
||||
|
||||
copper_lines_list = list()
|
||||
copper_lines_list = []
|
||||
# process the traces found in the selected polygon using the 'laser_lines' method,
|
||||
# method which will follow the 'follow' line therefore use the longer path possible for the
|
||||
# laser, therefore the acceleration will play a smaller factor
|
||||
|
@ -1976,14 +1976,14 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
|
||||
try:
|
||||
poly_buf = [pol.buffer(-paint_margin) for pol in polygon_list]
|
||||
cp = list()
|
||||
cp = []
|
||||
try:
|
||||
for pp in poly_buf:
|
||||
cp.append(paint_p(pp, tooldiameter=tool_dia))
|
||||
except TypeError:
|
||||
cp = paint_p(poly_buf, tooldiameter=tool_dia)
|
||||
|
||||
total_geometry = list()
|
||||
total_geometry = []
|
||||
if cp:
|
||||
try:
|
||||
for x in cp:
|
||||
|
@ -2289,7 +2289,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
poly_buf = geo.buffer(-paint_margin)
|
||||
|
||||
if geo is not None and geo.is_valid:
|
||||
poly_processed = list()
|
||||
poly_processed = []
|
||||
try:
|
||||
for pol in poly_buf:
|
||||
if pol is not None and isinstance(pol, Polygon):
|
||||
|
@ -2326,9 +2326,9 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
# aperture_size = None
|
||||
|
||||
# the key is the aperture type and the val is a list of geo elements
|
||||
flash_el_dict = dict()
|
||||
flash_el_dict = {}
|
||||
# the key is the aperture size, the val is a list of geo elements
|
||||
traces_el_dict = dict()
|
||||
traces_el_dict = {}
|
||||
|
||||
# find the flashes and the lines that are in the selected polygon and store
|
||||
# them separately
|
||||
|
@ -2366,7 +2366,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
traces_el_dict[aperture_size] = [geo_el]
|
||||
|
||||
cp = FlatCAMRTreeStorage()
|
||||
pads_lines_list = list()
|
||||
pads_lines_list = []
|
||||
|
||||
# process the flashes found in the selected polygon with the 'lines' method
|
||||
# for rectangular flashes and with _("Seed") for oblong and circular flashes
|
||||
|
@ -2417,7 +2417,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
except TypeError:
|
||||
cp.insert(pads_lines_list)
|
||||
|
||||
copper_lines_list = list()
|
||||
copper_lines_list = []
|
||||
# process the traces found in the selected polygon using the 'laser_lines'
|
||||
# method, method which will follow the 'follow' line therefore use the longer
|
||||
# path possible for the laser, therefore the acceleration will play
|
||||
|
@ -2528,9 +2528,9 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
# aperture_size = None
|
||||
|
||||
# the key is the aperture type and the val is a list of geo elements
|
||||
flash_el_dict = dict()
|
||||
flash_el_dict = {}
|
||||
# the key is the aperture size, the val is a list of geo elements
|
||||
traces_el_dict = dict()
|
||||
traces_el_dict = {}
|
||||
|
||||
# find the flashes and the lines that are in the selected polygon and store
|
||||
# them separately
|
||||
|
@ -2568,7 +2568,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
traces_el_dict[aperture_size] = [geo_el]
|
||||
|
||||
cp = FlatCAMRTreeStorage()
|
||||
pads_lines_list = list()
|
||||
pads_lines_list = []
|
||||
|
||||
# process the flashes found in the selected polygon with the 'lines' method
|
||||
# for rectangular flashes and with _("Seed") for oblong and circular flashes
|
||||
|
@ -2619,7 +2619,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
except TypeError:
|
||||
cp.insert(pads_lines_list)
|
||||
|
||||
copper_lines_list = list()
|
||||
copper_lines_list = []
|
||||
# process the traces found in the selected polygon using the 'laser_lines'
|
||||
# method, method which will follow the 'follow' line therefore use the longer
|
||||
# path possible for the laser, therefore the acceleration will play
|
||||
|
@ -2906,9 +2906,9 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
# aperture_size = None
|
||||
|
||||
# the key is the aperture type and the val is a list of geo elements
|
||||
flash_el_dict = dict()
|
||||
flash_el_dict = {}
|
||||
# the key is the aperture size, the val is a list of geo elements
|
||||
traces_el_dict = dict()
|
||||
traces_el_dict = {}
|
||||
|
||||
# find the flashes and the lines that are in the selected polygon and store
|
||||
# them separately
|
||||
|
@ -2946,7 +2946,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
traces_el_dict[aperture_size] = [geo_el]
|
||||
|
||||
cp = FlatCAMRTreeStorage()
|
||||
pads_lines_list = list()
|
||||
pads_lines_list = []
|
||||
|
||||
# process the flashes found in the selected polygon with the 'lines' method
|
||||
# for rectangular flashes and with _("Seed") for oblong and circular flashes
|
||||
|
@ -2997,7 +2997,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
except TypeError:
|
||||
cp.insert(pads_lines_list)
|
||||
|
||||
copper_lines_list = list()
|
||||
copper_lines_list = []
|
||||
# process the traces found in the selected polygon using the 'laser_lines'
|
||||
# method, method which will follow the 'follow' line therefore use the longer
|
||||
# path possible for the laser, therefore the acceleration will play
|
||||
|
@ -3386,9 +3386,9 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
# aperture_size = None
|
||||
|
||||
# the key is the aperture type and the val is a list of geo elements
|
||||
flash_el_dict = dict()
|
||||
flash_el_dict = {}
|
||||
# the key is the aperture size, the val is a list of geo elements
|
||||
traces_el_dict = dict()
|
||||
traces_el_dict = {}
|
||||
|
||||
# find the flashes and the lines that are in the selected polygon and store
|
||||
# them separately
|
||||
|
@ -3426,7 +3426,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
traces_el_dict[aperture_size] = [geo_el]
|
||||
|
||||
cp = FlatCAMRTreeStorage()
|
||||
pads_lines_list = list()
|
||||
pads_lines_list = []
|
||||
|
||||
# process the flashes found in the selected polygon with the 'lines' method
|
||||
# for rectangular flashes and with _("Seed") for oblong and circular flashes
|
||||
|
@ -3477,7 +3477,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
except TypeError:
|
||||
cp.insert(pads_lines_list)
|
||||
|
||||
copper_lines_list = list()
|
||||
copper_lines_list = []
|
||||
# process the traces found in the selected polygon using the 'laser_lines'
|
||||
# method, method which will follow the 'follow' line therefore use the longer
|
||||
# path possible for the laser, therefore the acceleration will play
|
||||
|
@ -3706,9 +3706,9 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
# aperture_size = None
|
||||
|
||||
# the key is the aperture type and the val is a list of geo elements
|
||||
flash_el_dict = dict()
|
||||
flash_el_dict = {}
|
||||
# the key is the aperture size, the val is a list of geo elements
|
||||
copper_el_dict = dict()
|
||||
copper_el_dict = {}
|
||||
|
||||
# find the flashes and the lines that are in the selected polygon and store
|
||||
# them separately
|
||||
|
@ -3746,7 +3746,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
copper_el_dict[aperture_size] = [geo_el]
|
||||
|
||||
cp = FlatCAMRTreeStorage()
|
||||
pads_lines_list = list()
|
||||
pads_lines_list = []
|
||||
|
||||
# process the flashes found in the selected polygon with the 'lines' method
|
||||
# for rectangular flashes and with _("Seed") for oblong and circular flashes
|
||||
|
@ -3797,7 +3797,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
|||
except TypeError:
|
||||
cp.insert(pads_lines_list)
|
||||
|
||||
copper_lines_list = list()
|
||||
copper_lines_list = []
|
||||
# process the traces found in the selected polygon using the 'laser_lines'
|
||||
# method, method which will follow the 'follow' line therefore use the longer
|
||||
# path possible for the laser, therefore the acceleration will play
|
||||
|
|
|
@ -473,13 +473,13 @@ class Panelize(FlatCAMTool):
|
|||
|
||||
if isinstance(panel_obj, FlatCAMExcellon) or isinstance(panel_obj, FlatCAMGeometry):
|
||||
# make a copy of the panelized Excellon or Geometry tools
|
||||
copied_tools = dict()
|
||||
copied_tools = {}
|
||||
for tt, tt_val in list(panel_obj.tools.items()):
|
||||
copied_tools[tt] = deepcopy(tt_val)
|
||||
|
||||
if isinstance(panel_obj, FlatCAMGerber):
|
||||
# make a copy of the panelized Gerber apertures
|
||||
copied_apertures = dict()
|
||||
copied_apertures = {}
|
||||
for tt, tt_val in list(panel_obj.apertures.items()):
|
||||
copied_apertures[tt] = deepcopy(tt_val)
|
||||
|
||||
|
@ -577,7 +577,7 @@ class Panelize(FlatCAMTool):
|
|||
|
||||
def translate_recursion(geom):
|
||||
if type(geom) == list:
|
||||
geoms = list()
|
||||
geoms = []
|
||||
for local_geom in geom:
|
||||
res_geo = translate_recursion(local_geom)
|
||||
try:
|
||||
|
@ -600,7 +600,7 @@ class Panelize(FlatCAMTool):
|
|||
elif isinstance(panel_obj, FlatCAMGerber):
|
||||
obj_fin.apertures = copied_apertures
|
||||
for ap in obj_fin.apertures:
|
||||
obj_fin.apertures[ap]['geometry'] = list()
|
||||
obj_fin.apertures[ap]['geometry'] = []
|
||||
|
||||
# find the number of polygons in the source solid_geometry
|
||||
geo_len = 0
|
||||
|
@ -736,7 +736,7 @@ class Panelize(FlatCAMTool):
|
|||
# graceful abort requested by the user
|
||||
raise FlatCAMApp.GracefulException
|
||||
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
if 'solid' in el:
|
||||
geo_aper = translate_recursion(el['solid'])
|
||||
new_el['solid'] = geo_aper
|
||||
|
|
|
@ -277,7 +277,7 @@ class Properties(FlatCAMTool):
|
|||
# calculate copper area
|
||||
|
||||
# create a complete solid_geometry from the tools
|
||||
geo_tools = list()
|
||||
geo_tools = []
|
||||
for tool_k in obj_prop.tools:
|
||||
if 'solid_geometry' in obj_prop.tools[tool_k]:
|
||||
for geo_el in obj_prop.tools[tool_k]['solid_geometry']:
|
||||
|
@ -351,7 +351,7 @@ class Properties(FlatCAMTool):
|
|||
|
||||
# Items that depend on the object type
|
||||
if obj.kind.lower() == 'gerber':
|
||||
temp_ap = dict()
|
||||
temp_ap = {}
|
||||
for ap in obj.apertures:
|
||||
temp_ap.clear()
|
||||
temp_ap = deepcopy(obj.apertures[ap])
|
||||
|
|
|
@ -515,7 +515,7 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
|
||||
punch_method = self.method_punch.get_value()
|
||||
|
||||
new_options = dict()
|
||||
new_options = {}
|
||||
for opt in grb_obj.options:
|
||||
new_options[opt] = deepcopy(grb_obj.options[opt])
|
||||
|
||||
|
@ -549,7 +549,7 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
new_apid = max([int(x) for x, __ in new_apertures_items])
|
||||
|
||||
# store here the clear geometry, the key is the drill size
|
||||
holes_apertures = dict()
|
||||
holes_apertures = {}
|
||||
|
||||
for apid, val in new_apertures_items:
|
||||
for elem in val['geometry']:
|
||||
|
@ -560,14 +560,14 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
|
||||
# since there may be drills that do not drill into a pad we test only for drills in a pad
|
||||
if drill['point'].within(elem['solid']):
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['clear'] = drill['point']
|
||||
|
||||
if clear_apid_size not in holes_apertures:
|
||||
holes_apertures[clear_apid_size] = dict()
|
||||
holes_apertures[clear_apid_size] = {}
|
||||
holes_apertures[clear_apid_size]['type'] = 'C'
|
||||
holes_apertures[clear_apid_size]['size'] = clear_apid_size
|
||||
holes_apertures[clear_apid_size]['geometry'] = list()
|
||||
holes_apertures[clear_apid_size]['geometry'] = []
|
||||
|
||||
holes_apertures[clear_apid_size]['geometry'].append(deepcopy(geo_elem))
|
||||
|
||||
|
@ -597,7 +597,7 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("The value of the fixed diameter is 0.0. Aborting."))
|
||||
return 'fail'
|
||||
|
||||
punching_geo = list()
|
||||
punching_geo = []
|
||||
for apid in grb_obj.apertures:
|
||||
if grb_obj.apertures[apid]['type'] == 'C' and self.circular_cb.get_value():
|
||||
if punch_size >= float(grb_obj.apertures[apid]['size']):
|
||||
|
@ -663,7 +663,7 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
new_apid = max([int(x) for x, __ in new_apertures_items])
|
||||
|
||||
# store here the clear geometry, the key is the drill size
|
||||
holes_apertures = dict()
|
||||
holes_apertures = {}
|
||||
|
||||
for apid, val in new_apertures_items:
|
||||
for elem in val['geometry']:
|
||||
|
@ -674,14 +674,14 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
|
||||
# since there may be drills that do not drill into a pad we test only for drills in a pad
|
||||
if geo.within(elem['solid']):
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['clear'] = geo.centroid
|
||||
|
||||
if clear_apid_size not in holes_apertures:
|
||||
holes_apertures[clear_apid_size] = dict()
|
||||
holes_apertures[clear_apid_size] = {}
|
||||
holes_apertures[clear_apid_size]['type'] = 'C'
|
||||
holes_apertures[clear_apid_size]['size'] = clear_apid_size
|
||||
holes_apertures[clear_apid_size]['geometry'] = list()
|
||||
holes_apertures[clear_apid_size]['geometry'] = []
|
||||
|
||||
holes_apertures[clear_apid_size]['geometry'].append(deepcopy(geo_elem))
|
||||
|
||||
|
@ -727,11 +727,11 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
new_apid = max([int(x) for x, __ in new_apertures_items])
|
||||
|
||||
# store here the clear geometry, the key is the new aperture size
|
||||
holes_apertures = dict()
|
||||
holes_apertures = {}
|
||||
|
||||
for apid, apid_value in grb_obj.apertures.items():
|
||||
ap_type = apid_value['type']
|
||||
punching_geo = list()
|
||||
punching_geo = []
|
||||
|
||||
if ap_type == 'C' and self.circular_cb.get_value():
|
||||
dia = float(apid_value['size']) - (2 * circ_r_val)
|
||||
|
@ -816,14 +816,14 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
|
||||
# since there may be drills that do not drill into a pad we test only for geos in a pad
|
||||
if geo.within(elem['solid']):
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['clear'] = geo.centroid
|
||||
|
||||
if clear_apid_size not in holes_apertures:
|
||||
holes_apertures[clear_apid_size] = dict()
|
||||
holes_apertures[clear_apid_size] = {}
|
||||
holes_apertures[clear_apid_size]['type'] = 'C'
|
||||
holes_apertures[clear_apid_size]['size'] = clear_apid_size
|
||||
holes_apertures[clear_apid_size]['geometry'] = list()
|
||||
holes_apertures[clear_apid_size]['geometry'] = []
|
||||
|
||||
holes_apertures[clear_apid_size]['geometry'].append(deepcopy(geo_elem))
|
||||
|
||||
|
@ -866,11 +866,11 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
new_apid = max([int(x) for x, __ in new_apertures_items])
|
||||
|
||||
# store here the clear geometry, the key is the new aperture size
|
||||
holes_apertures = dict()
|
||||
holes_apertures = {}
|
||||
|
||||
for apid, apid_value in grb_obj.apertures.items():
|
||||
ap_type = apid_value['type']
|
||||
punching_geo = list()
|
||||
punching_geo = []
|
||||
|
||||
if ap_type == 'C' and self.circular_cb.get_value():
|
||||
dia = float(apid_value['size']) * prop_factor
|
||||
|
@ -955,14 +955,14 @@ class ToolPunchGerber(FlatCAMTool):
|
|||
|
||||
# since there may be drills that do not drill into a pad we test only for geos in a pad
|
||||
if geo.within(elem['solid']):
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['clear'] = geo.centroid
|
||||
|
||||
if clear_apid_size not in holes_apertures:
|
||||
holes_apertures[clear_apid_size] = dict()
|
||||
holes_apertures[clear_apid_size] = {}
|
||||
holes_apertures[clear_apid_size]['type'] = 'C'
|
||||
holes_apertures[clear_apid_size]['size'] = clear_apid_size
|
||||
holes_apertures[clear_apid_size]['geometry'] = list()
|
||||
holes_apertures[clear_apid_size]['geometry'] = []
|
||||
|
||||
holes_apertures[clear_apid_size]['geometry'].append(deepcopy(geo_elem))
|
||||
|
||||
|
|
|
@ -496,7 +496,7 @@ class QRCode(FlatCAMTool):
|
|||
mask_geo = box(a, b, c, d).buffer(buff_val, join_style=2)
|
||||
|
||||
# update the solid geometry with the cutout (if it is the case)
|
||||
new_solid_geometry = list()
|
||||
new_solid_geometry = []
|
||||
offset_mask_geo = translate(mask_geo, xoff=pos[0], yoff=pos[1])
|
||||
for poly in geo_list:
|
||||
if poly.contains(offset_mask_geo):
|
||||
|
@ -523,7 +523,7 @@ class QRCode(FlatCAMTool):
|
|||
|
||||
box_size = float(self.bsize_entry.get_value()) / 10.0
|
||||
|
||||
sort_apid = list()
|
||||
sort_apid = []
|
||||
new_apid = '10'
|
||||
if self.grb_object.apertures:
|
||||
for k, v in list(self.grb_object.apertures.items()):
|
||||
|
@ -537,8 +537,8 @@ class QRCode(FlatCAMTool):
|
|||
|
||||
# don't know if the condition is required since I already made sure above that the new_apid is a new one
|
||||
if new_apid not in self.grb_object.apertures:
|
||||
self.grb_object.apertures[new_apid] = dict()
|
||||
self.grb_object.apertures[new_apid]['geometry'] = list()
|
||||
self.grb_object.apertures[new_apid] = {}
|
||||
self.grb_object.apertures[new_apid]['geometry'] = []
|
||||
self.grb_object.apertures[new_apid]['type'] = 'R'
|
||||
# TODO: HACK
|
||||
# I've artificially added 1% to the height and width because otherwise after loading the
|
||||
|
@ -549,14 +549,14 @@ class QRCode(FlatCAMTool):
|
|||
self.grb_object.apertures[new_apid]['size'] = deepcopy(math.sqrt(box_size ** 2 + box_size ** 2))
|
||||
|
||||
if '0' not in self.grb_object.apertures:
|
||||
self.grb_object.apertures['0'] = dict()
|
||||
self.grb_object.apertures['0']['geometry'] = list()
|
||||
self.grb_object.apertures['0'] = {}
|
||||
self.grb_object.apertures['0']['geometry'] = []
|
||||
self.grb_object.apertures['0']['type'] = 'REG'
|
||||
self.grb_object.apertures['0']['size'] = 0.0
|
||||
|
||||
# in case that the QRCode geometry is dropped onto a copper region (found in the '0' aperture)
|
||||
# make sure that I place a cutout there
|
||||
zero_elem = dict()
|
||||
zero_elem = {}
|
||||
zero_elem['clear'] = offset_mask_geo
|
||||
self.grb_object.apertures['0']['geometry'].append(deepcopy(zero_elem))
|
||||
|
||||
|
@ -571,12 +571,12 @@ class QRCode(FlatCAMTool):
|
|||
|
||||
try:
|
||||
for geo in self.qrcode_geometry:
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = translate(geo, xoff=pos[0], yoff=pos[1])
|
||||
geo_elem['follow'] = translate(geo.centroid, xoff=pos[0], yoff=pos[1])
|
||||
self.grb_object.apertures[new_apid]['geometry'].append(deepcopy(geo_elem))
|
||||
except TypeError:
|
||||
geo_elem = dict()
|
||||
geo_elem = {}
|
||||
geo_elem['solid'] = self.qrcode_geometry
|
||||
self.grb_object.apertures[new_apid]['geometry'].append(deepcopy(geo_elem))
|
||||
|
||||
|
@ -592,7 +592,7 @@ class QRCode(FlatCAMTool):
|
|||
# face = '#0000FF' + str(hex(int(0.2 * 255)))[2:]
|
||||
outline = '#0000FFAF'
|
||||
|
||||
offset_geo = list()
|
||||
offset_geo = []
|
||||
|
||||
# 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 ...
|
||||
|
|
|
@ -655,8 +655,8 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
rule_title = rule
|
||||
|
||||
violations = list()
|
||||
obj_violations = dict()
|
||||
violations = []
|
||||
obj_violations = {}
|
||||
obj_violations.update({
|
||||
'name': '',
|
||||
'points': list()
|
||||
|
@ -667,8 +667,8 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
obj_violations['name'] = gerber_obj['name']
|
||||
|
||||
solid_geo = list()
|
||||
clear_geo = list()
|
||||
solid_geo = []
|
||||
clear_geo = []
|
||||
for apid in gerber_obj['apertures']:
|
||||
if 'geometry' in gerber_obj['apertures'][apid]:
|
||||
geometry = gerber_obj['apertures'][apid]['geometry']
|
||||
|
@ -679,7 +679,7 @@ class RulesCheck(FlatCAMTool):
|
|||
clear_geo.append(geo_el['clear'])
|
||||
|
||||
if clear_geo:
|
||||
total_geo = list()
|
||||
total_geo = []
|
||||
for geo_c in clear_geo:
|
||||
for geo_s in solid_geo:
|
||||
if geo_c.within(geo_s):
|
||||
|
@ -696,7 +696,7 @@ class RulesCheck(FlatCAMTool):
|
|||
iterations = (iterations * (iterations - 1)) / 2
|
||||
log.debug("RulesCheck.check_gerber_clearance(). Iterations: %s" % str(iterations))
|
||||
|
||||
min_dict = dict()
|
||||
min_dict = {}
|
||||
idx = 1
|
||||
for geo in total_geo:
|
||||
for s_geo in total_geo[idx:]:
|
||||
|
@ -729,8 +729,8 @@ class RulesCheck(FlatCAMTool):
|
|||
log.debug("RulesCheck.check_gerber_clearance()")
|
||||
rule_title = rule
|
||||
|
||||
violations = list()
|
||||
obj_violations = dict()
|
||||
violations = []
|
||||
obj_violations = {}
|
||||
obj_violations.update({
|
||||
'name': '',
|
||||
'points': list()
|
||||
|
@ -739,7 +739,7 @@ class RulesCheck(FlatCAMTool):
|
|||
if len(gerber_list) == 2:
|
||||
gerber_1 = gerber_list[0]
|
||||
# added it so I won't have errors of using before declaring
|
||||
gerber_2 = dict()
|
||||
gerber_2 = {}
|
||||
|
||||
gerber_3 = gerber_list[1]
|
||||
elif len(gerber_list) == 3:
|
||||
|
@ -749,7 +749,7 @@ class RulesCheck(FlatCAMTool):
|
|||
else:
|
||||
return 'Fail. Not enough Gerber objects to check Gerber 2 Gerber clearance'
|
||||
|
||||
total_geo_grb_1 = list()
|
||||
total_geo_grb_1 = []
|
||||
for apid in gerber_1['apertures']:
|
||||
if 'geometry' in gerber_1['apertures'][apid]:
|
||||
geometry = gerber_1['apertures'][apid]['geometry']
|
||||
|
@ -766,7 +766,7 @@ class RulesCheck(FlatCAMTool):
|
|||
if 'solid' in geo_el and geo_el['solid'] is not None:
|
||||
total_geo_grb_1.append(geo_el['solid'])
|
||||
|
||||
total_geo_grb_3 = list()
|
||||
total_geo_grb_3 = []
|
||||
for apid in gerber_3['apertures']:
|
||||
if 'geometry' in gerber_3['apertures'][apid]:
|
||||
geometry = gerber_3['apertures'][apid]['geometry']
|
||||
|
@ -795,7 +795,7 @@ class RulesCheck(FlatCAMTool):
|
|||
iterations = len_1 * len_3
|
||||
log.debug("RulesCheck.check_gerber_clearance(). Iterations: %s" % str(iterations))
|
||||
|
||||
min_dict = dict()
|
||||
min_dict = {}
|
||||
for geo in total_geo_grb_1:
|
||||
for s_geo in total_geo_grb_3:
|
||||
# minimize the number of distances by not taking into considerations those that are too small
|
||||
|
@ -817,7 +817,7 @@ class RulesCheck(FlatCAMTool):
|
|||
for location in min_dict[dist]:
|
||||
points_list.add(location)
|
||||
|
||||
name_list = list()
|
||||
name_list = []
|
||||
if gerber_1:
|
||||
name_list.append(gerber_1['name'])
|
||||
if gerber_2:
|
||||
|
@ -837,8 +837,8 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
rule = _("Hole Size")
|
||||
|
||||
violations = list()
|
||||
obj_violations = dict()
|
||||
violations = []
|
||||
obj_violations = {}
|
||||
obj_violations.update({
|
||||
'name': '',
|
||||
'dia': list()
|
||||
|
@ -863,14 +863,14 @@ class RulesCheck(FlatCAMTool):
|
|||
log.debug("RulesCheck.check_holes_clearance()")
|
||||
rule = _("Hole to Hole Clearance")
|
||||
|
||||
violations = list()
|
||||
obj_violations = dict()
|
||||
violations = []
|
||||
obj_violations = {}
|
||||
obj_violations.update({
|
||||
'name': '',
|
||||
'points': list()
|
||||
})
|
||||
|
||||
total_geo = list()
|
||||
total_geo = []
|
||||
for elem in elements:
|
||||
for tool in elem['tools']:
|
||||
if 'solid_geometry' in elem['tools'][tool]:
|
||||
|
@ -878,7 +878,7 @@ class RulesCheck(FlatCAMTool):
|
|||
for geo in geometry:
|
||||
total_geo.append(geo)
|
||||
|
||||
min_dict = dict()
|
||||
min_dict = {}
|
||||
idx = 1
|
||||
for geo in total_geo:
|
||||
for s_geo in total_geo[idx:]:
|
||||
|
@ -903,7 +903,7 @@ class RulesCheck(FlatCAMTool):
|
|||
for location in min_dict[dist]:
|
||||
points_list.add(location)
|
||||
|
||||
name_list = list()
|
||||
name_list = []
|
||||
for elem in elements:
|
||||
name_list.append(elem['name'])
|
||||
|
||||
|
@ -919,8 +919,8 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
rule = _("Trace Size")
|
||||
|
||||
violations = list()
|
||||
obj_violations = dict()
|
||||
violations = []
|
||||
obj_violations = {}
|
||||
obj_violations.update({
|
||||
'name': '',
|
||||
'size': list(),
|
||||
|
@ -957,18 +957,18 @@ class RulesCheck(FlatCAMTool):
|
|||
def check_gerber_annular_ring(obj_list, size, rule):
|
||||
rule_title = rule
|
||||
|
||||
violations = list()
|
||||
obj_violations = dict()
|
||||
violations = []
|
||||
obj_violations = {}
|
||||
obj_violations.update({
|
||||
'name': '',
|
||||
'points': list()
|
||||
})
|
||||
|
||||
# added it so I won't have errors of using before declaring
|
||||
gerber_obj = dict()
|
||||
gerber_extra_obj = dict()
|
||||
exc_obj = dict()
|
||||
exc_extra_obj = dict()
|
||||
gerber_obj = {}
|
||||
gerber_extra_obj = {}
|
||||
exc_obj = {}
|
||||
exc_extra_obj = {}
|
||||
|
||||
if len(obj_list) == 2:
|
||||
gerber_obj = obj_list[0]
|
||||
|
@ -997,7 +997,7 @@ class RulesCheck(FlatCAMTool):
|
|||
else:
|
||||
return 'Fail. Not enough objects to check Minimum Annular Ring'
|
||||
|
||||
total_geo_grb = list()
|
||||
total_geo_grb = []
|
||||
for apid in gerber_obj['apertures']:
|
||||
if 'geometry' in gerber_obj['apertures'][apid]:
|
||||
geometry = gerber_obj['apertures'][apid]['geometry']
|
||||
|
@ -1017,7 +1017,7 @@ class RulesCheck(FlatCAMTool):
|
|||
total_geo_grb = MultiPolygon(total_geo_grb)
|
||||
total_geo_grb = total_geo_grb.buffer(0)
|
||||
|
||||
total_geo_exc = list()
|
||||
total_geo_exc = []
|
||||
for tool in exc_obj['tools']:
|
||||
if 'solid_geometry' in exc_obj['tools'][tool]:
|
||||
geometry = exc_obj['tools'][tool]['solid_geometry']
|
||||
|
@ -1047,7 +1047,7 @@ class RulesCheck(FlatCAMTool):
|
|||
iterations = len_1 * len_2
|
||||
log.debug("RulesCheck.check_gerber_annular_ring(). Iterations: %s" % str(iterations))
|
||||
|
||||
min_dict = dict()
|
||||
min_dict = {}
|
||||
dist = None
|
||||
for geo in total_geo_grb:
|
||||
for s_geo in total_geo_exc:
|
||||
|
@ -1075,12 +1075,12 @@ class RulesCheck(FlatCAMTool):
|
|||
else:
|
||||
min_dict[dist] = [s_geo.representative_point()]
|
||||
|
||||
points_list = list()
|
||||
points_list = []
|
||||
for dist in min_dict.keys():
|
||||
for location in min_dict[dist]:
|
||||
points_list.append(location)
|
||||
|
||||
name_list = list()
|
||||
name_list = []
|
||||
try:
|
||||
if gerber_obj:
|
||||
name_list.append(gerber_obj['name'])
|
||||
|
@ -1110,7 +1110,7 @@ class RulesCheck(FlatCAMTool):
|
|||
return rule_title, violations
|
||||
|
||||
def execute(self):
|
||||
self.results = list()
|
||||
self.results = []
|
||||
|
||||
log.debug("RuleCheck() executing")
|
||||
|
||||
|
@ -1119,17 +1119,17 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
# RULE: Check Trace Size
|
||||
if self.trace_size_cb.get_value():
|
||||
copper_list = list()
|
||||
copper_list = []
|
||||
copper_name_1 = self.copper_t_object.currentText()
|
||||
if copper_name_1 is not '' and self.copper_t_cb.get_value():
|
||||
elem_dict = dict()
|
||||
elem_dict = {}
|
||||
elem_dict['name'] = deepcopy(copper_name_1)
|
||||
elem_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_name_1).apertures)
|
||||
copper_list.append(elem_dict)
|
||||
|
||||
copper_name_2 = self.copper_b_object.currentText()
|
||||
if copper_name_2 is not '' and self.copper_b_cb.get_value():
|
||||
elem_dict = dict()
|
||||
elem_dict = {}
|
||||
elem_dict['name'] = deepcopy(copper_name_2)
|
||||
elem_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_name_2).apertures)
|
||||
copper_list.append(elem_dict)
|
||||
|
@ -1151,7 +1151,7 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
if self.copper_t_cb.get_value():
|
||||
copper_t_obj = self.copper_t_object.currentText()
|
||||
copper_t_dict = dict()
|
||||
copper_t_dict = {}
|
||||
|
||||
if copper_t_obj is not '':
|
||||
copper_t_dict['name'] = deepcopy(copper_t_obj)
|
||||
|
@ -1163,7 +1163,7 @@ class RulesCheck(FlatCAMTool):
|
|||
_("TOP -> Copper to Copper clearance"))))
|
||||
if self.copper_b_cb.get_value():
|
||||
copper_b_obj = self.copper_b_object.currentText()
|
||||
copper_b_dict = dict()
|
||||
copper_b_dict = {}
|
||||
if copper_b_obj is not '':
|
||||
copper_b_dict['name'] = deepcopy(copper_b_obj)
|
||||
copper_b_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_b_obj).apertures)
|
||||
|
@ -1181,9 +1181,9 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
# RULE: Check Copper to Outline Clearance
|
||||
if self.clearance_copper2ol_cb.get_value() and self.out_cb.get_value():
|
||||
top_dict = dict()
|
||||
bottom_dict = dict()
|
||||
outline_dict = dict()
|
||||
top_dict = {}
|
||||
bottom_dict = {}
|
||||
outline_dict = {}
|
||||
|
||||
copper_top = self.copper_t_object.currentText()
|
||||
if copper_top is not '' and self.copper_t_cb.get_value():
|
||||
|
@ -1235,7 +1235,7 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
# RULE: Check Silk to Silk Clearance
|
||||
if self.clearance_silk2silk_cb.get_value():
|
||||
silk_dict = dict()
|
||||
silk_dict = {}
|
||||
|
||||
try:
|
||||
silk_silk_clearance = float(self.clearance_silk2silk_entry.get_value())
|
||||
|
@ -1275,10 +1275,10 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
# RULE: Check Silk to Solder Mask Clearance
|
||||
if self.clearance_silk2sm_cb.get_value():
|
||||
silk_t_dict = dict()
|
||||
sm_t_dict = dict()
|
||||
silk_b_dict = dict()
|
||||
sm_b_dict = dict()
|
||||
silk_t_dict = {}
|
||||
sm_t_dict = {}
|
||||
silk_b_dict = {}
|
||||
sm_b_dict = {}
|
||||
|
||||
top_ss = False
|
||||
bottom_ss = False
|
||||
|
@ -1344,9 +1344,9 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
# RULE: Check Silk to Outline Clearance
|
||||
if self.clearance_silk2ol_cb.get_value():
|
||||
top_dict = dict()
|
||||
bottom_dict = dict()
|
||||
outline_dict = dict()
|
||||
top_dict = {}
|
||||
bottom_dict = {}
|
||||
outline_dict = {}
|
||||
|
||||
silk_top = self.ss_t_object.currentText()
|
||||
if silk_top is not '' and self.ss_t_cb.get_value():
|
||||
|
@ -1399,7 +1399,7 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
# RULE: Check Minimum Solder Mask Sliver
|
||||
if self.clearance_silk2silk_cb.get_value():
|
||||
sm_dict = dict()
|
||||
sm_dict = {}
|
||||
|
||||
try:
|
||||
sm_sm_clearance = float(self.clearance_sm2sm_entry.get_value())
|
||||
|
@ -1439,10 +1439,10 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
# RULE: Check Minimum Annular Ring
|
||||
if self.ring_integrity_cb.get_value():
|
||||
top_dict = dict()
|
||||
bottom_dict = dict()
|
||||
exc_1_dict = dict()
|
||||
exc_2_dict = dict()
|
||||
top_dict = {}
|
||||
bottom_dict = {}
|
||||
exc_1_dict = {}
|
||||
exc_2_dict = {}
|
||||
|
||||
copper_top = self.copper_t_object.currentText()
|
||||
if copper_top is not '' and self.copper_t_cb.get_value():
|
||||
|
@ -1504,17 +1504,17 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
# RULE: Check Hole to Hole Clearance
|
||||
if self.clearance_d2d_cb.get_value():
|
||||
exc_list = list()
|
||||
exc_list = []
|
||||
exc_name_1 = self.e1_object.currentText()
|
||||
if exc_name_1 is not '' and self.e1_cb.get_value():
|
||||
elem_dict = dict()
|
||||
elem_dict = {}
|
||||
elem_dict['name'] = deepcopy(exc_name_1)
|
||||
elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_1).tools)
|
||||
exc_list.append(elem_dict)
|
||||
|
||||
exc_name_2 = self.e2_object.currentText()
|
||||
if exc_name_2 is not '' and self.e2_cb.get_value():
|
||||
elem_dict = dict()
|
||||
elem_dict = {}
|
||||
elem_dict['name'] = deepcopy(exc_name_2)
|
||||
elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_2).tools)
|
||||
exc_list.append(elem_dict)
|
||||
|
@ -1524,17 +1524,17 @@ class RulesCheck(FlatCAMTool):
|
|||
|
||||
# RULE: Check Holes Size
|
||||
if self.drill_size_cb.get_value():
|
||||
exc_list = list()
|
||||
exc_list = []
|
||||
exc_name_1 = self.e1_object.currentText()
|
||||
if exc_name_1 is not '' and self.e1_cb.get_value():
|
||||
elem_dict = dict()
|
||||
elem_dict = {}
|
||||
elem_dict['name'] = deepcopy(exc_name_1)
|
||||
elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_1).tools)
|
||||
exc_list.append(elem_dict)
|
||||
|
||||
exc_name_2 = self.e2_object.currentText()
|
||||
if exc_name_2 is not '' and self.e2_cb.get_value():
|
||||
elem_dict = dict()
|
||||
elem_dict = {}
|
||||
elem_dict['name'] = deepcopy(exc_name_2)
|
||||
elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_2).tools)
|
||||
exc_list.append(elem_dict)
|
||||
|
@ -1542,7 +1542,7 @@ class RulesCheck(FlatCAMTool):
|
|||
drill_size = float(self.drill_size_entry.get_value())
|
||||
self.results.append(self.pool.apply_async(self.check_holes_size, args=(exc_list, drill_size)))
|
||||
|
||||
output = list()
|
||||
output = []
|
||||
for p in self.results:
|
||||
output.append(p.get())
|
||||
|
||||
|
|
|
@ -303,14 +303,14 @@ class ToolSub(FlatCAMTool):
|
|||
|
||||
# crate the new_apertures dict structure
|
||||
for apid in self.target_grb_obj.apertures:
|
||||
self.new_apertures[apid] = dict()
|
||||
self.new_apertures[apid] = {}
|
||||
self.new_apertures[apid]['type'] = 'C'
|
||||
self.new_apertures[apid]['size'] = self.target_grb_obj.apertures[apid]['size']
|
||||
self.new_apertures[apid]['geometry'] = list()
|
||||
self.new_apertures[apid]['geometry'] = []
|
||||
|
||||
geo_solid_union_list = list()
|
||||
geo_follow_union_list = list()
|
||||
geo_clear_union_list = list()
|
||||
geo_solid_union_list = []
|
||||
geo_follow_union_list = []
|
||||
geo_clear_union_list = []
|
||||
|
||||
for apid1 in self.sub_grb_obj.apertures:
|
||||
if 'geometry' in self.sub_grb_obj.apertures[apid1]:
|
||||
|
@ -339,14 +339,14 @@ class ToolSub(FlatCAMTool):
|
|||
self.app.worker_task.emit({'fcn': self.aperture_intersection, 'params': [apid, geo]})
|
||||
|
||||
def aperture_intersection(self, apid, geo):
|
||||
new_geometry = list()
|
||||
new_geometry = []
|
||||
|
||||
log.debug("Working on promise: %s" % str(apid))
|
||||
|
||||
with self.app.proc_container.new('%s: %s...' % (_("Parsing geometry for aperture"), str(apid))):
|
||||
|
||||
for geo_el in geo:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
|
||||
if 'solid' in geo_el:
|
||||
work_geo = geo_el['solid']
|
||||
|
@ -513,14 +513,14 @@ class ToolSub(FlatCAMTool):
|
|||
return
|
||||
|
||||
# create the target_options obj
|
||||
# self.target_options = dict()
|
||||
# self.target_options = {}
|
||||
# for k, v in self.target_geo_obj.options.items():
|
||||
# if k != 'name':
|
||||
# self.target_options[k] = v
|
||||
|
||||
# crate the new_tools dict structure
|
||||
for tool in self.target_geo_obj.tools:
|
||||
self.new_tools[tool] = dict()
|
||||
self.new_tools[tool] = {}
|
||||
for key in self.target_geo_obj.tools[tool]:
|
||||
if key == 'solid_geometry':
|
||||
self.new_tools[tool][key] = []
|
||||
|
|
|
@ -78,7 +78,7 @@ class TclCommand(object):
|
|||
|
||||
:return: current command
|
||||
"""
|
||||
command_string = list()
|
||||
command_string = []
|
||||
command_string.append(self.aliases[0])
|
||||
|
||||
if self.original_args is not None:
|
||||
|
|
|
@ -52,7 +52,7 @@ class TclCommandBounds(TclCommand):
|
|||
:return:
|
||||
"""
|
||||
|
||||
obj_list = list()
|
||||
obj_list = []
|
||||
if 'objects' in args:
|
||||
try:
|
||||
obj_list = [str(obj_name) for obj_name in str(args['objects']).split(",") if obj_name != '']
|
||||
|
@ -68,7 +68,7 @@ class TclCommandBounds(TclCommand):
|
|||
_("Expected a list of objects names separated by comma. Got"), str(args['objects'])))
|
||||
return 'fail'
|
||||
|
||||
result_list = list()
|
||||
result_list = []
|
||||
for name in obj_list:
|
||||
obj = self.app.collection.get_by_name(name)
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ class TclCommandCopperClear(TclCommand):
|
|||
"paintcontour": self.app.defaults["tools_paintcontour"],
|
||||
"paintoverlap": self.app.defaults["tools_paintoverlap"]
|
||||
})
|
||||
ncc_tools = dict()
|
||||
ncc_tools = {}
|
||||
|
||||
tooluid = 0
|
||||
for tool in tools:
|
||||
|
|
|
@ -178,7 +178,7 @@ class TclCommandPaint(TclCommand):
|
|||
"paintcontour": self.app.defaults["tools_paintcontour"],
|
||||
"paintoverlap": self.app.defaults["tools_paintoverlap"]
|
||||
})
|
||||
paint_tools = dict()
|
||||
paint_tools = {}
|
||||
|
||||
tooluid = 0
|
||||
for tool in tools:
|
||||
|
|
|
@ -228,7 +228,7 @@ class TclCommandPanelize(TclCommand):
|
|||
|
||||
def translate_recursion(geom):
|
||||
if type(geom) == list:
|
||||
geoms = list()
|
||||
geoms = []
|
||||
for local_geom in geom:
|
||||
geoms.append(translate_recursion(local_geom))
|
||||
return geoms
|
||||
|
|
|
@ -66,7 +66,7 @@ class TclCommandSetOrigin(TclCommand):
|
|||
:return:
|
||||
"""
|
||||
|
||||
loc = list()
|
||||
loc = []
|
||||
if 'auto' in args:
|
||||
if bool(args['auto']) is True:
|
||||
objs = self.app.collection.get_list()
|
||||
|
|
Loading…
Reference in New Issue