- preferences UI is now started on preferences open
- more work/fixes in working on data structures (offset, offset_value, job_type, shape)
This commit is contained in:
@@ -512,15 +512,8 @@ class CutOut(AppTool):
|
||||
|
||||
tool_found = 0
|
||||
|
||||
offset = 'Path'
|
||||
offset_val = 0.0
|
||||
tool_type = 'V'
|
||||
# look in database tools
|
||||
for db_tool, db_tool_val in tools_db_dict.items():
|
||||
offset = db_tool_val['offset']
|
||||
offset_val = db_tool_val['offset_value']
|
||||
tool_type = db_tool_val['tool_type']
|
||||
|
||||
db_tooldia = db_tool_val['tooldia']
|
||||
low_limit = float(db_tool_val['data']['tol_min'])
|
||||
high_limit = float(db_tool_val['data']['tol_max'])
|
||||
@@ -575,9 +568,6 @@ class CutOut(AppTool):
|
||||
new_tdia = deepcopy(updated_tooldia) if updated_tooldia is not None else deepcopy(truncated_tooldia)
|
||||
self.cut_tool_dict.update({
|
||||
'tooldia': new_tdia,
|
||||
'offset': deepcopy(offset),
|
||||
'offset_value': deepcopy(offset_val),
|
||||
'tool_type': deepcopy(tool_type),
|
||||
'data': deepcopy(new_tools_dict),
|
||||
'solid_geometry': []
|
||||
})
|
||||
@@ -654,10 +644,6 @@ class CutOut(AppTool):
|
||||
|
||||
self.cut_tool_dict.update({
|
||||
'tooldia': dia,
|
||||
'offset': 'Path',
|
||||
'offset_value': 0.0,
|
||||
'type': 'Rough',
|
||||
'tool_type': 'C1',
|
||||
'data': deepcopy(self.default_data),
|
||||
'solid_geometry': []
|
||||
})
|
||||
@@ -717,9 +703,6 @@ class CutOut(AppTool):
|
||||
self.cutout_tools.update({
|
||||
1: {
|
||||
'tooldia': truncated_tooldia,
|
||||
'offset': tool['offset'],
|
||||
'offset_value': tool['offset_value'],
|
||||
'tool_type': tool['tool_type'],
|
||||
'data': deepcopy(tool['data']),
|
||||
'solid_geometry': []
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
# Tool Type
|
||||
tool_type_item = FCComboBox()
|
||||
tool_type_item.addItems(self.tool_type_item_options)
|
||||
idx = tool_type_item.findText(tooluid_value['tool_type'])
|
||||
idx = int(tooluid_value['data']['tools_mill_shape'])
|
||||
tool_type_item.setCurrentIndex(idx)
|
||||
self.ui.tools_table.setCellWidget(row_no, 2, tool_type_item)
|
||||
|
||||
@@ -1318,15 +1318,8 @@ class ToolIsolation(AppTool, Gerber):
|
||||
|
||||
tool_found = 0
|
||||
|
||||
offset = 'Path'
|
||||
offset_val = 0.0
|
||||
tool_type = 'V'
|
||||
# look in database tools
|
||||
for db_tool, db_tool_val in tools_db_dict.items():
|
||||
offset = db_tool_val['offset']
|
||||
offset_val = db_tool_val['offset_value']
|
||||
tool_type = db_tool_val['tool_type']
|
||||
|
||||
db_tooldia = db_tool_val['tooldia']
|
||||
low_limit = float(db_tool_val['data']['tol_min'])
|
||||
high_limit = float(db_tool_val['data']['tol_max'])
|
||||
@@ -1385,9 +1378,6 @@ class ToolIsolation(AppTool, Gerber):
|
||||
self.iso_tools.update({
|
||||
tooluid: {
|
||||
'tooldia': new_tdia,
|
||||
'offset': deepcopy(offset),
|
||||
'offset_value': deepcopy(offset_val),
|
||||
'tool_type': deepcopy(tool_type),
|
||||
'data': deepcopy(new_tools_dict),
|
||||
'solid_geometry': []
|
||||
}
|
||||
@@ -1444,10 +1434,6 @@ class ToolIsolation(AppTool, Gerber):
|
||||
self.iso_tools.update({
|
||||
int(self.tooluid): {
|
||||
'tooldia': truncated_tooldia,
|
||||
'offset': 'Path',
|
||||
'offset_value': 0.0,
|
||||
'type': 'Iso' if self.app.defaults["tools_iso_tool_type"] == 'V' else 'Rough',
|
||||
'tool_type': deepcopy(self.app.defaults["tools_iso_tool_type"]),
|
||||
'data': deepcopy(self.default_data),
|
||||
'solid_geometry': []
|
||||
}
|
||||
@@ -1751,7 +1737,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
|
||||
tool_dia = tools_storage[tool]['tooldia']
|
||||
for i in range(passes):
|
||||
tool_type = tools_storage[tool]['tool_type']
|
||||
tool_type = tools_storage[tool]['data']['tools_mill_shape']
|
||||
|
||||
iso_offset = tool_dia * ((2 * i + 1) / 2.0000001) - (i * overlap * tool_dia)
|
||||
if negative_dia:
|
||||
@@ -1925,7 +1911,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
if float('%.*f' % (self.decimals, tools_storage[tool]['tooldia'])) == sorted_tool:
|
||||
|
||||
tool_dia = tools_storage[tool]['tooldia']
|
||||
tool_type = tools_storage[tool]['tool_type']
|
||||
tool_type = tools_storage[tool]['data']['tools_mill_shape']
|
||||
tool_data = tools_storage[tool]['data']
|
||||
|
||||
passes = tool_data['tools_iso_passes']
|
||||
@@ -2098,9 +2084,9 @@ class ToolIsolation(AppTool, Gerber):
|
||||
|
||||
for tool in sorted_tools:
|
||||
tool_dia = tools_storage[tool]['tooldia']
|
||||
tool_has_offset = tools_storage[tool]['offset']
|
||||
tool_offset_value = tools_storage[tool]['offset_value']
|
||||
tool_type = tools_storage[tool]['tool_type']
|
||||
tool_has_offset = tools_storage[tool]['data']['tools_mill_offset_type']
|
||||
tool_offset_value = tools_storage[tool]['data']['tools_mill_offset_value']
|
||||
tool_type = tools_storage[tool]['data']['tools_mill_shape']
|
||||
tool_data = tools_storage[tool]['data']
|
||||
|
||||
work_geo = geometry
|
||||
@@ -2868,9 +2854,6 @@ class ToolIsolation(AppTool, Gerber):
|
||||
self.iso_tools.update({
|
||||
tooluid: {
|
||||
'tooldia': truncated_tooldia,
|
||||
'offset': deepcopy(tool['offset']),
|
||||
'offset_value': deepcopy(tool['offset_value']),
|
||||
'tool_type': deepcopy(tool['tool_type']),
|
||||
'data': deepcopy(tool['data']),
|
||||
'solid_geometry': []
|
||||
}
|
||||
|
||||
@@ -2077,15 +2077,8 @@ class ToolMilling(AppTool, Excellon):
|
||||
|
||||
tool_found = 0
|
||||
|
||||
offset = 'Path'
|
||||
offset_val = 0.0
|
||||
tool_type = 'C1'
|
||||
# look in database tools
|
||||
for db_tool, db_tool_val in tools_db_dict.items():
|
||||
offset = db_tool_val['offset']
|
||||
offset_val = db_tool_val['offset_value']
|
||||
tool_type = db_tool_val['tool_type']
|
||||
|
||||
db_tooldia = db_tool_val['tooldia']
|
||||
low_limit = float(db_tool_val['data']['tol_min'])
|
||||
high_limit = float(db_tool_val['data']['tol_max'])
|
||||
@@ -2138,9 +2131,6 @@ class ToolMilling(AppTool, Excellon):
|
||||
self.target_obj.tools.update({
|
||||
tooluid: {
|
||||
'tooldia': new_tdia,
|
||||
'offset': deepcopy(offset),
|
||||
'offset_value': deepcopy(offset_val),
|
||||
'tool_type': deepcopy(tool_type),
|
||||
'data': deepcopy(new_tools_dict),
|
||||
'solid_geometry': self.target_obj.solid_geometry
|
||||
}
|
||||
@@ -2187,10 +2177,6 @@ class ToolMilling(AppTool, Excellon):
|
||||
# otherwise we add a tool with data copied from last tool
|
||||
if self.target_obj.tools:
|
||||
last_data = self.target_obj.tools[max_uid]['data']
|
||||
last_offset = self.target_obj.tools[max_uid]['offset']
|
||||
last_offset_value = self.target_obj.tools[max_uid]['offset_value']
|
||||
last_tool_type = self.target_obj.tools[max_uid]['tool_type']
|
||||
|
||||
last_solid_geometry = self.target_obj.tools[max_uid]['solid_geometry'] if new_geo is None else new_geo
|
||||
|
||||
# if previous geometry was empty (it may happen for the first tool added)
|
||||
@@ -2201,9 +2187,6 @@ class ToolMilling(AppTool, Excellon):
|
||||
self.target_obj.tools.update({
|
||||
self.tooluid: {
|
||||
'tooldia': tooldia,
|
||||
'offset': last_offset,
|
||||
'offset_value': last_offset_value,
|
||||
'tool_type': last_tool_type,
|
||||
'data': deepcopy(last_data),
|
||||
'solid_geometry': deepcopy(last_solid_geometry)
|
||||
}
|
||||
@@ -2212,10 +2195,6 @@ class ToolMilling(AppTool, Excellon):
|
||||
self.target_obj.tools.update({
|
||||
self.tooluid: {
|
||||
'tooldia': tooldia,
|
||||
'offset': 'Path',
|
||||
'offset_value': 0.0,
|
||||
'type': 'Rough',
|
||||
'tool_type': 'C1',
|
||||
'data': deepcopy(self.default_data),
|
||||
'solid_geometry': self.solid_geometry
|
||||
}
|
||||
@@ -2291,9 +2270,6 @@ class ToolMilling(AppTool, Excellon):
|
||||
self.target_obj.tools.update({
|
||||
self.tooluid: {
|
||||
'tooldia': tooldia,
|
||||
'offset': tool['offset'],
|
||||
'offset_value': float(tool['offset_value']),
|
||||
'tool_type': tool['tool_type'],
|
||||
'data': deepcopy(tool['data']),
|
||||
'solid_geometry': self.target_obj.solid_geometry
|
||||
}
|
||||
@@ -3985,7 +3961,7 @@ class MillingUI:
|
||||
self.tool_shape_combo.setObjectName('mill_tool_type')
|
||||
self.tool_shape_combo.addItems(["C1", "C2", "C3", "C4", "B", "V"])
|
||||
|
||||
idx = self.tool_shape_combo.findText(self.app.defaults['tools_mill_tool_type'])
|
||||
idx = int(self.app.defaults['tools_mill_shape'])
|
||||
# protection against having this translated or loading a project with translated values
|
||||
if idx == -1:
|
||||
self.tool_shape_combo.setCurrentIndex(0)
|
||||
|
||||
@@ -851,7 +851,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
# ------------------------ Tool Shape -------------------------------------------------------------
|
||||
tool_type_item = FCComboBox()
|
||||
tool_type_item.addItems(self.tool_type_item_options)
|
||||
idx = tool_type_item.findText(tooluid_value['tool_type'])
|
||||
idx = int(tooluid_value['data']['tools_mill_shape'])
|
||||
tool_type_item.setCurrentIndex(idx)
|
||||
self.ui.tools_table.setCellWidget(row_no, 2, tool_type_item)
|
||||
|
||||
@@ -1293,15 +1293,8 @@ class NonCopperClear(AppTool, Gerber):
|
||||
|
||||
tool_found = 0
|
||||
|
||||
offset = 'Path'
|
||||
offset_val = 0.0
|
||||
tool_type = 'V'
|
||||
# look in database tools
|
||||
for db_tool, db_tool_val in tools_db_dict.items():
|
||||
offset = db_tool_val['offset']
|
||||
offset_val = db_tool_val['offset_value']
|
||||
tool_type = db_tool_val['tool_type']
|
||||
|
||||
db_tooldia = db_tool_val['tooldia']
|
||||
low_limit = float(db_tool_val['data']['tol_min'])
|
||||
high_limit = float(db_tool_val['data']['tol_max'])
|
||||
@@ -1358,9 +1351,6 @@ class NonCopperClear(AppTool, Gerber):
|
||||
self.ncc_tools.update({
|
||||
tooluid: {
|
||||
'tooldia': new_tdia,
|
||||
'offset': deepcopy(offset),
|
||||
'offset_value': deepcopy(offset_val),
|
||||
'tool_type': deepcopy(tool_type),
|
||||
'data': deepcopy(new_tools_dict),
|
||||
'solid_geometry': []
|
||||
}
|
||||
@@ -1419,10 +1409,6 @@ class NonCopperClear(AppTool, Gerber):
|
||||
self.ncc_tools.update({
|
||||
int(self.tooluid): {
|
||||
'tooldia': truncated_tooldia,
|
||||
'offset': 'Path',
|
||||
'offset_value': 0.0,
|
||||
'type': 'Iso' if self.app.defaults["tools_ncc_tool_type"] == 'V' else 'Rough',
|
||||
'tool_type': deepcopy(self.app.defaults["tools_ncc_tool_type"]),
|
||||
'data': deepcopy(self.default_data),
|
||||
'solid_geometry': []
|
||||
}
|
||||
@@ -4065,9 +4051,6 @@ class NonCopperClear(AppTool, Gerber):
|
||||
self.ncc_tools.update({
|
||||
tooluid: {
|
||||
'tooldia': truncated_tooldia,
|
||||
'offset': deepcopy(tool['offset']),
|
||||
'offset_value': deepcopy(tool['offset_value']),
|
||||
'tool_type': deepcopy(tool['tool_type']),
|
||||
'data': deepcopy(tool['data']),
|
||||
'solid_geometry': []
|
||||
}
|
||||
|
||||
@@ -776,7 +776,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
for item in self.tool_type_item_options:
|
||||
tool_type_item.addItem(item)
|
||||
# tool_type_item.setStyleSheet('background-color: rgb(255,255,255)')
|
||||
idx = tool_type_item.findText(tooluid_value['tool_type'])
|
||||
idx = int(tooluid_value['data']['tools_mill_shape'])
|
||||
tool_type_item.setCurrentIndex(idx)
|
||||
|
||||
tool_uid_item = QtWidgets.QTableWidgetItem(str(int(tooluid_key)))
|
||||
@@ -2856,9 +2856,6 @@ class ToolPaint(AppTool, Gerber):
|
||||
self.paint_tools.update({
|
||||
tooluid: {
|
||||
'tooldia': float('%.*f' % (self.decimals, tooldia)),
|
||||
'offset': tool['offset'],
|
||||
'offset_value': tool['offset_value'],
|
||||
'tool_type': tool['tool_type'],
|
||||
'data': deepcopy(tool['data']),
|
||||
'solid_geometry': []
|
||||
}
|
||||
|
||||
@@ -790,10 +790,10 @@ class SolderPaste(AppTool):
|
||||
geo_obj.tools[tooluid]['tooldia'] = tool
|
||||
geo_obj.tools[tooluid]['data'] = deepcopy(self.tooltable_tools[tooluid]['data'])
|
||||
geo_obj.tools[tooluid]['solid_geometry'] = []
|
||||
geo_obj.tools[tooluid]['offset'] = 'Path'
|
||||
geo_obj.tools[tooluid]['offset_value'] = 0.0
|
||||
geo_obj.tools[tooluid]['data']['tools_mill_offset_type']= 'Path'
|
||||
geo_obj.tools[tooluid]['data']['tools_mill_offset_value'] = 0.0
|
||||
geo_obj.tools[tooluid]['type'] = 'SolderPaste'
|
||||
geo_obj.tools[tooluid]['tool_type'] = 'DN'
|
||||
geo_obj.tools[tooluid]['data']['tools_mill_shape'] = 'DN'
|
||||
|
||||
# self.flat_geometry is a list of LinearRings produced by flatten() from the exteriors of the Polygons
|
||||
# We get possible issues if we try to directly use the Polygons, due of possible the interiors,
|
||||
|
||||
Reference in New Issue
Block a user