- in "Punch Gerber" and "Extract" Plugins - make sure that the aperture markings are deleted on Reset Tool click and upon finishing the Plugin main function

- in Punch Gerber Plugin the object is no longer populated automatically with the generated object
- in Corner Markers Plugin fixed the position of "drills in locations" and for Checking Exceloon; the source object is no longer auto-updated to the latest one since we have to always work on the original object
This commit is contained in:
Marius Stanciu
2021-10-07 20:59:08 +03:00
committed by Marius
parent 54d4c7cb78
commit 26354e1f9e
4 changed files with 66 additions and 32 deletions

View File

@@ -507,7 +507,7 @@ class ToolCorners(AppTool):
grb_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None, local_use=grb_obj,
use_thread=False)
ret = self.app.app_obj.new_object('gerber', outname, initialize, plot=True)
ret = self.app.app_obj.new_object('gerber', outname, initialize, plot=True, autoselected=False)
return ret
@@ -552,29 +552,29 @@ class ToolCorners(AppTool):
if 'manual' not in self.points:
if tl_state:
x = xmin - margin - line_thickness / 2.0 + tooldia / 2.0
y = ymax + margin + line_thickness / 2.0 - tooldia / 2.0
x = xmin - margin - line_thickness / 2.0
y = ymax + margin + line_thickness / 2.0
drill_list.append(
Point((x, y))
)
if tr_state:
x = xmax + margin + line_thickness / 2.0 - tooldia / 2.0
y = ymax + margin + line_thickness / 2.0 - tooldia / 2.0
x = xmax + margin + line_thickness / 2.0
y = ymax + margin + line_thickness / 2.0
drill_list.append(
Point((x, y))
)
if bl_state:
x = xmin - margin - line_thickness / 2.0 + tooldia / 2.0
y = ymin - margin - line_thickness / 2.0 + tooldia / 2.0
x = xmin - margin - line_thickness / 2.0
y = ymin - margin - line_thickness / 2.0
drill_list.append(
Point((x, y))
)
if br_state:
x = xmax + margin + line_thickness / 2.0 - tooldia / 2.0
y = ymin - margin - line_thickness / 2.0 + tooldia / 2.0
x = xmax + margin + line_thickness / 2.0
y = ymin - margin - line_thickness / 2.0
drill_list.append(
Point((x, y))
)
@@ -662,29 +662,29 @@ class ToolCorners(AppTool):
if 'manual' not in self.points:
if tl_state:
x = xmin - margin - line_thickness / 2.0 + tooldia / 2.0
y = ymax + margin + line_thickness / 2.0 - tooldia / 2.0
x = xmin - margin - line_thickness / 2.0
y = ymax + margin + line_thickness / 2.0
drill_list.append(
Point((x, y))
)
if tr_state:
x = xmax + margin + line_thickness / 2.0 - tooldia / 2.0
y = ymax + margin + line_thickness / 2.0 - tooldia / 2.0
x = xmax + margin + line_thickness / 2.0
y = ymax + margin + line_thickness / 2.0
drill_list.append(
Point((x, y))
)
if bl_state:
x = xmin - margin - line_thickness / 2.0 + tooldia / 2.0
y = ymin - margin - line_thickness / 2.0 + tooldia / 2.0
x = xmin - margin - line_thickness / 2.0
y = ymin - margin - line_thickness / 2.0
drill_list.append(
Point((x, y))
)
if br_state:
x = xmax + margin + line_thickness / 2.0 - tooldia / 2.0
y = ymin - margin - line_thickness / 2.0 + tooldia / 2.0
x = xmax + margin + line_thickness / 2.0
y = ymin - margin - line_thickness / 2.0
drill_list.append(
Point((x, y))
)
@@ -891,14 +891,13 @@ class CornersUI:
# Gerber Source Object
# #############################################################################################################
# Gerber object #
self.object_label = FCLabel('<span style="color:darkorange;"><b>%s</b></span>' % _("Source Object"))
self.object_label.setToolTip(_("The Gerber object to which will be added corner markers."))
self.object_combo = FCComboBox()
self.object_combo.setModel(self.app.collection)
self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.object_combo.is_last = True
self.object_combo.is_last = False
self.object_combo.obj_type = "Gerber"
self.tools_box.addWidget(self.object_label)

View File

@@ -345,7 +345,7 @@ class ToolExtract(AppTool):
self.ui.apertures_table.cellWidget(row, 3).clicked.disconnect()
except (TypeError, AttributeError):
pass
self.ui.apertures_table.cellWidget(row, 3).clicked.connect(self.on_mark_cb_click_table)
self.ui.apertures_table.cellWidget(row, 3).stateChanged.connect(self.on_mark_cb_click_table)
def ui_disconnect(self):
try:
@@ -356,7 +356,7 @@ class ToolExtract(AppTool):
# Mark Checkboxes
for row in range(self.ui.apertures_table.rowCount()):
try:
self.ui.apertures_table.cellWidget(row, 3).clicked.disconnect()
self.ui.apertures_table.cellWidget(row, 3).stateChanged.disconnect()
except (TypeError, AttributeError):
pass
@@ -409,6 +409,8 @@ class ToolExtract(AppTool):
use_thread=False)
with self.app.proc_container.new('%s...' % _("Working")):
self.clear_aperture_marking()
try:
self.app.app_obj.new_object("excellon", outname, obj_init, autoselected=False)
except Exception as e:
@@ -931,9 +933,21 @@ class ToolExtract(AppTool):
else:
grb_obj.clear_plot_apertures(aperture=aperture)
def clear_aperture_marking(self):
"""
Will clear all aperture markings after creating an Excellon object with extracted drill holes
:return:
:rtype:
"""
for row in range(self.ui.apertures_table.rowCount()):
self.ui.apertures_table.cellWidget(row, 3).set_value(False)
def reset_fields(self):
self.ui.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.ui.gerber_object_combo.setCurrentIndex(0)
self.clear_aperture_marking()
class ExtractUI:

View File

@@ -529,6 +529,7 @@ class ToolPunchGerber(AppTool, Gerber):
self.on_ring_method(self.grb_obj, outname)
elif punch_method == 'prop':
self.on_proportional_method(self.grb_obj, outname)
self.clear_aperture_marking()
else:
if punch_method == 'exc':
# get the Excellon file whose geometry will create the punch holes
@@ -562,6 +563,7 @@ class ToolPunchGerber(AppTool, Gerber):
# disconnect flags
self.poly_sel_disconnect_flag = True
self.app.ui.notebook.setDisabled(True)
# disable the canvas mouse dragging seelction shape
self.old_selection_status = deepcopy(self.app.defaults['global_selection_shape'])
@@ -670,7 +672,7 @@ class ToolPunchGerber(AppTool, Gerber):
new_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None,
local_use=new_obj, use_thread=False)
self.app.app_obj.new_object('gerber', outname, init_func)
self.app.app_obj.new_object('gerber', outname, init_func, autoselected=False)
def on_excellon_manual_method(self, outname):
# get the Excellon file whose geometry will create the punch holes
@@ -791,7 +793,7 @@ class ToolPunchGerber(AppTool, Gerber):
new_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None,
local_use=new_obj, use_thread=False)
self.app.app_obj.new_object('gerber', outname, init_func)
self.app.app_obj.new_object('gerber', outname, init_func, autoselected=False)
def on_fixed_method(self, grb_obj, outname):
punch_size = float(self.ui.dia_entry.get_value())
@@ -924,7 +926,7 @@ class ToolPunchGerber(AppTool, Gerber):
new_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None,
local_use=new_obj, use_thread=False)
self.app.app_obj.new_object('gerber', outname, init_func)
self.app.app_obj.new_object('gerber', outname, init_func, autoselected=False)
def on_fixed_manual_method(self, outname):
punch_size = float(self.ui.dia_entry.get_value())
@@ -1019,7 +1021,7 @@ class ToolPunchGerber(AppTool, Gerber):
new_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None,
local_use=new_obj, use_thread=False)
self.app.app_obj.new_object('gerber', outname, init_func)
self.app.app_obj.new_object('gerber', outname, init_func, autoselected=False)
def on_ring_method(self, grb_obj, outname):
circ_r_val = self.ui.circular_ring_entry.get_value()
@@ -1168,7 +1170,7 @@ class ToolPunchGerber(AppTool, Gerber):
new_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None,
local_use=new_obj, use_thread=False)
self.app.app_obj.new_object('gerber', outname, init_func)
self.app.app_obj.new_object('gerber', outname, init_func, autoselected=False)
def on_ring_manual_method(self, outname):
circ_r_val = self.ui.circular_ring_entry.get_value()
@@ -1308,7 +1310,7 @@ class ToolPunchGerber(AppTool, Gerber):
new_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None,
local_use=new_obj, use_thread=False)
self.app.app_obj.new_object('gerber', outname, init_func)
self.app.app_obj.new_object('gerber', outname, init_func, autoselected=False)
def on_proportional_method(self, grb_obj, outname):
prop_factor = self.ui.factor_entry.get_value() / 100.0
@@ -1452,7 +1454,7 @@ class ToolPunchGerber(AppTool, Gerber):
new_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None,
local_use=new_obj, use_thread=False)
self.app.app_obj.new_object('gerber', outname, init_func)
self.app.app_obj.new_object('gerber', outname, init_func, autoselected=False)
def on_proportional_manual_method(self, outname):
prop_factor = self.ui.factor_entry.get_value() / 100.0
@@ -1588,7 +1590,7 @@ class ToolPunchGerber(AppTool, Gerber):
new_obj.source_file = app_obj.f_handlers.export_gerber(obj_name=outname, filename=None,
local_use=new_obj, use_thread=False)
self.app.app_obj.new_object('gerber', outname, init_func)
self.app.app_obj.new_object('gerber', outname, init_func, autoselected=False)
def find_pad(self, point):
pt = Point(point) if type(point) is tuple else point
@@ -1752,6 +1754,8 @@ class ToolPunchGerber(AppTool, Gerber):
self.app.tool_shapes.clear(update=True)
self.on_manual_punch()
self.clear_aperture_marking()
self.app.ui.notebook.setDisabled(False)
# initialize the work variables
self.manual_pads = []
@@ -1844,8 +1848,9 @@ class ToolPunchGerber(AppTool, Gerber):
if self.old_selection_status is not None:
self.app.defaults['global_selection_shape'] = self.old_selection_status
self.app.ui.notebook.setDisabled(False)
self.poly_dict.clear()
self.clear_aperture_marking()
self.delete_moving_selection_shape()
self.delete_tool_selection_shape()
@@ -1942,9 +1947,22 @@ class ToolPunchGerber(AppTool, Gerber):
self.app.tool_shapes.redraw()
self.app.inform.emit(_("Selection cleared."))
def clear_aperture_marking(self):
"""
Will clear all aperture markings after creating an Excellon object with extracted drill holes
:return:
:rtype:
"""
for row in range(self.ui.apertures_table.rowCount()):
self.ui.apertures_table.cellWidget(row, 3).set_value(False)
def reset_fields(self):
self.ui.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.ui.exc_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
self.clear_aperture_marking()
self.ui_disconnect()
@@ -2008,7 +2026,7 @@ class PunchUI:
self.gerber_object_combo = FCComboBox()
self.gerber_object_combo.setModel(self.app.collection)
self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.gerber_object_combo.is_last = True
self.gerber_object_combo.is_last = False
self.gerber_object_combo.obj_type = "Gerber"
grid0.addWidget(self.gerber_object_combo, 0, 0, 1, 2)