- Excellon UI: added a column which will color each row/tool of that column in the color used when checking Multicolor checkbox

This commit is contained in:
Marius Stanciu 2020-07-21 06:49:49 +03:00 committed by Marius
parent e147ef1994
commit 617b483267
3 changed files with 22 additions and 5 deletions

View File

@ -15,6 +15,7 @@ CHANGELOG for FlatCAM beta
- modified the visibility change in Excellon UI to no longer do plot() when doing visibility toggle for one of the tools but only a visibility change in the shapes properties
- Excellon UI in Legacy Mode (2D): fixed the Solid checkbox functionality
- Excellon UI: fixed plot checkbox performing an extra plot function which was not required
- Excellon UI: added a column which will color each row/tool of that column in the color used when checking Multicolor checkbox
20.07.2020

View File

@ -584,7 +584,7 @@ class ExcellonObjectUI(ObjectUI):
self.tools_table.setColumnCount(6)
self.tools_table.setHorizontalHeaderLabels(['#', _('Diameter'), _('Drills'), _('Slots'),
"NOT USED", 'P'])
" ", 'P'])
self.tools_table.setSortingEnabled(False)
self.tools_table.horizontalHeaderItem(0).setToolTip(
@ -606,7 +606,7 @@ class ExcellonObjectUI(ObjectUI):
"This does not select the tools for G-code generation."))
# this column is not used; reserved for future usage
self.tools_table.setColumnHidden(4, True)
# self.tools_table.setColumnHidden(4, True)
# Excellon Tools autoload from DB

View File

@ -281,8 +281,16 @@ class ExcellonObject(FlatCAMObj, Excellon):
# Empty Plot Item
empty_plot_item = QtWidgets.QTableWidgetItem('')
empty_plot_item.setFlags(QtCore.Qt.ItemIsEnabled)
self.ui.tools_table.setItem(self.tool_row, 5, empty_plot_item)
empty_plot_item.setFlags(QtCore.Qt.NoItemFlags)
self.ui.tools_table.setItem(self.tool_row, 4, empty_plot_item)
if 'multicolor' in self.tools[tool_no]:
red = self.tools[tool_no]['multicolor'][0] * 255
green = self.tools[tool_no]['multicolor'][1] * 255
blue = self.tools[tool_no]['multicolor'][2] * 255
alpha = self.tools[tool_no]['multicolor'][3] * 255
h_color = QtGui.QColor(red, green, blue, alpha)
self.ui.tools_table.item(self.tool_row, 4).setBackground(h_color)
# Plot Item
plot_item = FCCheckBox()
@ -373,6 +381,8 @@ class ExcellonObject(FlatCAMObj, Excellon):
horizontal_header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)
horizontal_header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents)
horizontal_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed)
horizontal_header.resizeSection(4, 3)
horizontal_header.setSectionResizeMode(5, QtWidgets.QHeaderView.Fixed)
horizontal_header.resizeSection(5, 17)
self.ui.tools_table.setColumnWidth(5, 17)
@ -1087,6 +1097,8 @@ class ExcellonObject(FlatCAMObj, Excellon):
def plot(self, visible=None, kind=None):
multicolored = self.ui.multicolored_cb.get_value()
# Does all the required setup and returns False
# if the 'ptint' option is set to False.
if not FlatCAMObj.plot(self):
@ -1128,7 +1140,8 @@ class ExcellonObject(FlatCAMObj, Excellon):
for tool in self.tools:
# set the color here so we have one color for each tool
geo_color = random_color()
multicolored = self.ui.multicolored_cb.get_value()
if multicolored:
self.tools[tool]['multicolor'] = geo_color
# tool is a dict also
for geo in self.tools[tool]["solid_geometry"]:
@ -1165,6 +1178,9 @@ class ExcellonObject(FlatCAMObj, Excellon):
log.debug("ExcellonObject.plot() -> %s" % str(e))
self.shapes.clear(update=True)
if multicolored:
self.build_ui()
@staticmethod
def merge(exc_list, exc_final, decimals=None, fuse_tools=True):
"""