Removed counter no longer used in HTML and CSV BoM writers.

This commit is contained in:
Salvador E. Tropea 2020-08-01 18:50:50 -03:00
parent 99eab1c2f1
commit f062eca7aa
2 changed files with 4 additions and 11 deletions

View File

@ -33,21 +33,17 @@ def write_csv(filename, ext, groups, headings, head_names, cfg):
if not cfg.hide_headers: if not cfg.hide_headers:
writer.writerow(head_names) writer.writerow(head_names)
# Body # Body
count = 0
row_count = 1
for group in groups: for group in groups:
if cfg.ignore_dnf and not group.is_fitted(): if cfg.ignore_dnf and not group.is_fitted():
continue continue
row = group.get_row(headings) row = group.get_row(headings)
writer.writerow(row) writer.writerow(row)
count += group.get_count()
row_count += 1
# PCB info # PCB info
if not cfg.hide_pcb_info: if not cfg.hide_pcb_info:
# Add some blank rows # Add some blank rows
for i in range(5): for i in range(5):
writer.writerow([]) writer.writerow([])
# The info
writer.writerow(["Component Groups:", cfg.n_groups]) writer.writerow(["Component Groups:", cfg.n_groups])
writer.writerow(["Component Count:", cfg.n_total]) writer.writerow(["Component Count:", cfg.n_total])
writer.writerow(["Fitted Components:", cfg.n_fitted]) writer.writerow(["Fitted Components:", cfg.n_fitted])

View File

@ -44,12 +44,10 @@ def html_table(html, groups, headings, head_names, cfg, link_datasheet, link_dig
html.write('\t<th align="center"{bg}>{h}</th>\n'.format(h=h, bg=' bgcolor="{}"'.format(bg) if bg else '')) html.write('\t<th align="center"{bg}>{h}</th>\n'.format(h=h, bg=' bgcolor="{}"'.format(bg) if bg else ''))
html.write("</tr>\n") html.write("</tr>\n")
row_count = 0
for i, group in enumerate(groups): for i, group in enumerate(groups):
if (cfg.ignore_dnf and not group.is_fitted()) != dnf: if (cfg.ignore_dnf and not group.is_fitted()) != dnf:
continue continue
row = group.get_row(headings) row = group.get_row(headings)
row_count += 1
html.write("<tr>\n") html.write("<tr>\n")
for n, r in enumerate(row): for n, r in enumerate(row):
# A link to Digi-Key? # A link to Digi-Key?
@ -66,7 +64,7 @@ def html_table(html, groups, headings, head_names, cfg, link_datasheet, link_dig
html.write('\t<td align="center"{bg}>{val}</td>\n'.format(bg=' bgcolor={}'.format(bg) if bg else '', val=link(r))) html.write('\t<td align="center"{bg}>{val}</td>\n'.format(bg=' bgcolor={}'.format(bg) if bg else '', val=link(r)))
html.write("</tr>\n") html.write("</tr>\n")
html.write("</table>\n") html.write("</table>\n")
return row_count return
def write_html(filename, groups, headings, head_names, cfg): def write_html(filename, groups, headings, head_names, cfg):
@ -119,11 +117,10 @@ def write_html(filename, groups, headings, head_names, cfg):
html.write('<p style="background-color: {bg}">Empty Fields</p>\n'.format(bg=BG_EMPTY)) html.write('<p style="background-color: {bg}">Empty Fields</p>\n'.format(bg=BG_EMPTY))
# Fitted groups # Fitted groups
row_count = html_table(html, groups, headings, head_names, cfg, link_datasheet, link_digikey) html_table(html, groups, headings, head_names, cfg, link_datasheet, link_digikey)
html.write("<br><br>\n") html.write("<br><br>\n")
if cfg.html_generate_dnf and row_count != len(groups): if cfg.html_generate_dnf and cfg.n_total != cfg.n_fitted:
html.write("<h2>Optional components (DNF=Do Not Fit)</h2>\n") html.write("<h2>Optional components (DNF=Do Not Fit)</h2>\n")
# DNF component groups # DNF component groups
html_table(html, groups, headings, head_names, cfg, link_datasheet, link_digikey, True) html_table(html, groups, headings, head_names, cfg, link_datasheet, link_digikey, True)