- added a Mark All button in the Gerber aperture table.
- because adding shapes to the shapes collection (when doing Mark or Mark All) is time consuming I made the plot_apertures() threaded.
This commit is contained in:
parent
5cade2ec4e
commit
7b4ea1dfa9
@ -6070,7 +6070,6 @@ class App(QtCore.QObject):
|
|||||||
elif units == 'MM' or units == 'METIRC':
|
elif units == 'MM' or units == 'METIRC':
|
||||||
units ='METRIC'
|
units ='METRIC'
|
||||||
|
|
||||||
|
|
||||||
def make_dxf():
|
def make_dxf():
|
||||||
try:
|
try:
|
||||||
dxf_code = obj.export_dxf()
|
dxf_code = obj.export_dxf()
|
||||||
|
@ -551,9 +551,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
n = len(self.apertures) + len(self.aperture_macros)
|
|
||||||
self.ui.apertures_table.setRowCount(n)
|
|
||||||
|
|
||||||
self.apertures_row = 0
|
self.apertures_row = 0
|
||||||
aper_no = self.apertures_row + 1
|
aper_no = self.apertures_row + 1
|
||||||
sort = []
|
sort = []
|
||||||
@ -566,6 +563,9 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
sort.append(k)
|
sort.append(k)
|
||||||
sorted_macros = sorted(sort)
|
sorted_macros = sorted(sort)
|
||||||
|
|
||||||
|
n = len(sorted_apertures) + len(sorted_macros)
|
||||||
|
self.ui.apertures_table.setRowCount(n)
|
||||||
|
|
||||||
for ap_code in sorted_apertures:
|
for ap_code in sorted_apertures:
|
||||||
ap_code = str(ap_code)
|
ap_code = str(ap_code)
|
||||||
|
|
||||||
@ -670,6 +670,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
self.ui.apertures_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
self.ui.apertures_table.setSortingEnabled(False)
|
self.ui.apertures_table.setSortingEnabled(False)
|
||||||
self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight())
|
self.ui.apertures_table.setMinimumHeight(self.ui.apertures_table.getHeight())
|
||||||
|
self.ui.apertures_table.setMaximumHeight(self.ui.apertures_table.getHeight())
|
||||||
|
|
||||||
self.ui_connect()
|
self.ui_connect()
|
||||||
|
|
||||||
@ -677,6 +678,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
for row in range(self.ui.apertures_table.rowCount()):
|
for row in range(self.ui.apertures_table.rowCount()):
|
||||||
self.ui.apertures_table.cellWidget(row, 5).clicked.connect(self.on_mark_cb_click_table)
|
self.ui.apertures_table.cellWidget(row, 5).clicked.connect(self.on_mark_cb_click_table)
|
||||||
|
|
||||||
|
self.ui.mark_all_cb.clicked.connect(self.on_mark_all_click)
|
||||||
|
|
||||||
def ui_disconnect(self):
|
def ui_disconnect(self):
|
||||||
for row in range(self.ui.apertures_table.rowCount()):
|
for row in range(self.ui.apertures_table.rowCount()):
|
||||||
try:
|
try:
|
||||||
@ -684,6 +687,11 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.ui.mark_all_cb.clicked.disconnect(self.on_mark_all_click)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def on_mark_cb_click_table(self):
|
def on_mark_cb_click_table(self):
|
||||||
self.ui_disconnect()
|
self.ui_disconnect()
|
||||||
cw = self.sender()
|
cw = self.sender()
|
||||||
@ -704,6 +712,36 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
|
|
||||||
self.mark_shapes.redraw()
|
self.mark_shapes.redraw()
|
||||||
|
|
||||||
|
# make sure that the Mark All is disabled if one of the row mark's are disabled and
|
||||||
|
# if all the row mark's are enabled also enable the Mark All checkbox
|
||||||
|
cb_cnt = 0
|
||||||
|
total_row = self.ui.apertures_table.rowCount()
|
||||||
|
for row in range(total_row):
|
||||||
|
if self.ui.apertures_table.cellWidget(row, 5).isChecked():
|
||||||
|
cb_cnt += 1
|
||||||
|
else:
|
||||||
|
cb_cnt -= 1
|
||||||
|
if cb_cnt < total_row:
|
||||||
|
self.ui.mark_all_cb.setChecked(False)
|
||||||
|
else:
|
||||||
|
self.ui.mark_all_cb.setChecked(True)
|
||||||
|
self.ui_connect()
|
||||||
|
|
||||||
|
def on_mark_all_click(self, signal):
|
||||||
|
self.ui_disconnect()
|
||||||
|
mark_all = self.ui.mark_all_cb.isChecked()
|
||||||
|
for row in range(self.ui.apertures_table.rowCount()):
|
||||||
|
mark_cb = self.ui.apertures_table.cellWidget(row, 5)
|
||||||
|
if mark_all:
|
||||||
|
mark_cb.setChecked(True)
|
||||||
|
else:
|
||||||
|
mark_cb.setChecked(False)
|
||||||
|
for aperture in self.apertures:
|
||||||
|
if mark_all:
|
||||||
|
self.plot_apertures(color='#2d4606bf', marked_aperture=aperture, visible=True)
|
||||||
|
else:
|
||||||
|
self.mark_shapes.clear(update=True)
|
||||||
|
|
||||||
self.ui_connect()
|
self.ui_connect()
|
||||||
|
|
||||||
def on_generatenoncopper_button_click(self, *args):
|
def on_generatenoncopper_button_click(self, *args):
|
||||||
@ -997,7 +1035,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
|
|
||||||
self.ui.new_grb_label.setVisible(True)
|
self.ui.new_grb_label.setVisible(True)
|
||||||
self.ui.new_grb_button.setVisible(True)
|
self.ui.new_grb_button.setVisible(True)
|
||||||
|
self.ui.mark_all_cb.setVisible(True)
|
||||||
|
self.ui.mark_all_cb.setChecked(False)
|
||||||
else:
|
else:
|
||||||
self.ui.apertures_table.setVisible(False)
|
self.ui.apertures_table.setVisible(False)
|
||||||
self.ui.scale_aperture_label.setVisible(False)
|
self.ui.scale_aperture_label.setVisible(False)
|
||||||
@ -1010,6 +1049,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
|
|
||||||
self.ui.new_grb_label.setVisible(False)
|
self.ui.new_grb_label.setVisible(False)
|
||||||
self.ui.new_grb_button.setVisible(False)
|
self.ui.new_grb_button.setVisible(False)
|
||||||
|
self.ui.mark_all_cb.setVisible(False)
|
||||||
|
|
||||||
# on hide disable all mark plots
|
# on hide disable all mark plots
|
||||||
for row in range(self.ui.apertures_table.rowCount()):
|
for row in range(self.ui.apertures_table.rowCount()):
|
||||||
@ -1253,6 +1293,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
else:
|
else:
|
||||||
visibility = kwargs['visible']
|
visibility = kwargs['visible']
|
||||||
|
|
||||||
|
with self.app.proc_container.new("Plotting Apertures") as proc:
|
||||||
|
def job_thread(app_obj):
|
||||||
geometry = {}
|
geometry = {}
|
||||||
for ap in self.apertures:
|
for ap in self.apertures:
|
||||||
geometry[int(ap)] = self.apertures[ap]['solid_geometry']
|
geometry[int(ap)] = self.apertures[ap]['solid_geometry']
|
||||||
@ -1260,6 +1302,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
_ = iter(geometry[int(ap)])
|
_ = iter(geometry[int(ap)])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
geometry[int(ap)] = [geometry[int(ap)]]
|
geometry[int(ap)] = [geometry[int(ap)]]
|
||||||
|
self.app.progress.emit(10)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if aperture_to_plot_mark in self.apertures:
|
if aperture_to_plot_mark in self.apertures:
|
||||||
@ -1273,9 +1316,13 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
|
|||||||
face_color=color, visible=visibility)
|
face_color=color, visible=visibility)
|
||||||
|
|
||||||
self.mark_shapes.redraw()
|
self.mark_shapes.redraw()
|
||||||
|
self.app.progress.emit(90)
|
||||||
|
|
||||||
except (ObjectDeleted, AttributeError):
|
except (ObjectDeleted, AttributeError):
|
||||||
self.mark_shapes.clear(update=True)
|
self.mark_shapes.clear(update=True)
|
||||||
|
|
||||||
|
self.app.worker_task.emit({'fcn': job_thread, 'params': [self.app]})
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
return {
|
return {
|
||||||
"options": self.options,
|
"options": self.options,
|
||||||
|
25
ObjectUI.py
25
ObjectUI.py
@ -171,25 +171,36 @@ class GerberObjectUI(ObjectUI):
|
|||||||
#### Gerber Apertures ####
|
#### Gerber Apertures ####
|
||||||
self.apertures_table_label = QtWidgets.QLabel('<b>Apertures:</b>')
|
self.apertures_table_label = QtWidgets.QLabel('<b>Apertures:</b>')
|
||||||
self.apertures_table_label.setToolTip(
|
self.apertures_table_label.setToolTip(
|
||||||
"Apertures Table containining this Gerber object apertures."
|
"Apertures Table for the Gerber Object."
|
||||||
)
|
)
|
||||||
self.apertures_table_label.setFixedWidth(90)
|
self.apertures_table_label.setFixedWidth(90)
|
||||||
|
|
||||||
hlay_plot.addWidget(self.apertures_table_label)
|
hlay_plot.addWidget(self.apertures_table_label)
|
||||||
|
|
||||||
hlay_plot.addStretch()
|
|
||||||
|
|
||||||
# Aperture Table Visibility CB
|
# Aperture Table Visibility CB
|
||||||
self.aperture_table_visibility_cb = FCCheckBox('Show/Hide')
|
self.aperture_table_visibility_cb = FCCheckBox()
|
||||||
self.aperture_table_visibility_cb.setToolTip(
|
self.aperture_table_visibility_cb.setToolTip(
|
||||||
"Toogle the display of the Gerber Apertures Table.\n"
|
"Toggle the display of the Gerber Apertures Table.\n"
|
||||||
"Also, on hide, it will delete all mark shapes\n"
|
"When unchecked, it will delete all mark shapes\n"
|
||||||
"that are drawn on canvas."
|
"that are drawn on canvas."
|
||||||
|
|
||||||
)
|
)
|
||||||
self.aperture_table_visibility_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
|
# self.aperture_table_visibility_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||||
hlay_plot.addWidget(self.aperture_table_visibility_cb)
|
hlay_plot.addWidget(self.aperture_table_visibility_cb)
|
||||||
|
|
||||||
|
hlay_plot.addStretch()
|
||||||
|
|
||||||
|
# Aperture Mark all CB
|
||||||
|
self.mark_all_cb = FCCheckBox('Mark All')
|
||||||
|
self.mark_all_cb.setToolTip(
|
||||||
|
"When checked it will display all the apertures.\n"
|
||||||
|
"When unchecked, it will delete all mark shapes\n"
|
||||||
|
"that are drawn on canvas."
|
||||||
|
|
||||||
|
)
|
||||||
|
self.mark_all_cb.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||||
|
hlay_plot.addWidget(self.mark_all_cb)
|
||||||
|
|
||||||
self.apertures_table = FCTable()
|
self.apertures_table = FCTable()
|
||||||
self.custom_box.addWidget(self.apertures_table)
|
self.custom_box.addWidget(self.apertures_table)
|
||||||
|
|
||||||
|
@ -13,8 +13,11 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
- added a function to read the parameters from ToolChange macro Text Box (I need to move it from CNCJob to Excellon and Geometry)
|
- added a function to read the parameters from ToolChange macro Text Box (I need to move it from CNCJob to Excellon and Geometry)
|
||||||
- fixed the geometry adding to the self.apertures in the case when regions are done without declaring any aperture first (Allegro does that). Now, that geometry will be stored in the '0' aperture with type REG
|
- fixed the geometry adding to the self.apertures in the case when regions are done without declaring any aperture first (Allegro does that). Now, that geometry will be stored in the '0' aperture with type REG
|
||||||
- work in progress to Toolchange_Custom code replacememnt -> finished the parse and replace function
|
- work in progress to Toolchange_Custom code replacement -> finished the parse and replace function
|
||||||
- fixed mouse selection on canvas, mouse drag, mouse click and mouse double click
|
- fixed mouse selection on canvas, mouse drag, mouse click and mouse double click
|
||||||
|
- fixed Gerber Aperture Table dimensions
|
||||||
|
- added a Mark All button in the Gerber aperture table.
|
||||||
|
- because adding shapes to the shapes collection (when doing Mark or Mark All) is time consuming I made the plot_apertures() threaded.
|
||||||
|
|
||||||
25.02.2019
|
25.02.2019
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user