- changes in Excellon Editor in resize section

This commit is contained in:
Marius Stanciu 2019-04-01 03:24:21 +03:00
parent 40c8ef1cf8
commit 7702eb1705
1 changed files with 40 additions and 36 deletions

View File

@ -349,53 +349,57 @@ class FCDrillResize(FCShapeTool):
sel_shapes_to_be_deleted = [] sel_shapes_to_be_deleted = []
for sel_dia in self.selected_dia_list: if self.selected_dia_list:
self.current_storage = self.draw_app.storage_dict[sel_dia] for sel_dia in self.selected_dia_list:
for select_shape in self.draw_app.get_selected(): self.current_storage = self.draw_app.storage_dict[sel_dia]
if select_shape in self.current_storage.get_objects(): for select_shape in self.draw_app.get_selected():
factor = new_dia / sel_dia if select_shape in self.current_storage.get_objects():
self.geometry.append( factor = new_dia / sel_dia
DrawToolShape(affinity.scale(select_shape.geo, xfact=factor, yfact=factor, origin='center')) self.geometry.append(
) DrawToolShape(affinity.scale(select_shape.geo, xfact=factor, yfact=factor, origin='center'))
self.current_storage.remove(select_shape) )
# a hack to make the tool_table display less drills per diameter when shape(drill) is deleted self.current_storage.remove(select_shape)
# self.points_edit it's only useful first time when we load the data into the storage # a hack to make the tool_table display less drills per diameter when shape(drill) is deleted
# but is still used as reference when building tool_table in self.build_ui() # self.points_edit it's only useful first time when we load the data into the storage
# the number of drills displayed in column 2 is just a len(self.points_edit) therefore # but is still used as reference when building tool_table in self.build_ui()
# deleting self.points_edit elements (doesn't matter who but just the number) # the number of drills displayed in column 2 is just a len(self.points_edit) therefore
# solved the display issue. # deleting self.points_edit elements (doesn't matter who but just the number)
del self.draw_app.points_edit[sel_dia][0] # solved the display issue.
del self.draw_app.points_edit[sel_dia][0]
sel_shapes_to_be_deleted.append(select_shape) sel_shapes_to_be_deleted.append(select_shape)
self.draw_app.on_exc_shape_complete(self.destination_storage) self.draw_app.on_exc_shape_complete(self.destination_storage)
# a hack to make the tool_table display more drills per diameter when shape(drill) is added # a hack to make the tool_table display more drills per diameter when shape(drill) is added
# self.points_edit it's only useful first time when we load the data into the storage # self.points_edit it's only useful first time when we load the data into the storage
# but is still used as reference when building tool_table in self.build_ui() # but is still used as reference when building tool_table in self.build_ui()
# the number of drills displayed in column 2 is just a len(self.points_edit) therefore # the number of drills displayed in column 2 is just a len(self.points_edit) therefore
# deleting self.points_edit elements (doesn't matter who but just the number) # deleting self.points_edit elements (doesn't matter who but just the number)
# solved the display issue. # solved the display issue.
if new_dia not in self.draw_app.points_edit: if new_dia not in self.draw_app.points_edit:
self.draw_app.points_edit[new_dia] = [(0, 0)] self.draw_app.points_edit[new_dia] = [(0, 0)]
else: else:
self.draw_app.points_edit[new_dia].append((0,0)) self.draw_app.points_edit[new_dia].append((0,0))
self.geometry = [] self.geometry = []
# if following the resize of the drills there will be no more drills for the selected tool then # if following the resize of the drills there will be no more drills for the selected tool then
# delete that tool # delete that tool
if not self.draw_app.points_edit[sel_dia]: if not self.draw_app.points_edit[sel_dia]:
self.draw_app.on_tool_delete(sel_dia) self.draw_app.on_tool_delete(sel_dia)
for shp in sel_shapes_to_be_deleted: for shp in sel_shapes_to_be_deleted:
self.draw_app.selected.remove(shp) self.draw_app.selected.remove(shp)
sel_shapes_to_be_deleted = [] sel_shapes_to_be_deleted = []
self.draw_app.build_ui() self.draw_app.build_ui()
self.draw_app.replot() self.draw_app.replot()
self.draw_app.app.inform.emit(_("[success] Done. Drill Resize completed."))
else:
self.draw_app.app.inform.emit(_("[WARNING_NOTCL] Cancelled. No drills selected for resize ..."))
self.draw_app.resize_frame.hide() self.draw_app.resize_frame.hide()
self.complete = True self.complete = True
self.draw_app.app.inform.emit(_("[success] Done. Drill Resize completed."))
# MS: always return to the Select Tool # MS: always return to the Select Tool
self.draw_app.select_tool("select") self.draw_app.select_tool("select")