diff --git a/kiplot/bom/csv_writer.py b/kiplot/bom/csv_writer.py index efd7fe7d..fd342f5a 100644 --- a/kiplot/bom/csv_writer.py +++ b/kiplot/bom/csv_writer.py @@ -33,21 +33,17 @@ def write_csv(filename, ext, groups, headings, head_names, cfg): if not cfg.hide_headers: writer.writerow(head_names) # Body - count = 0 - row_count = 1 for group in groups: if cfg.ignore_dnf and not group.is_fitted(): continue row = group.get_row(headings) writer.writerow(row) - count += group.get_count() - row_count += 1 # PCB info if not cfg.hide_pcb_info: # Add some blank rows for i in range(5): writer.writerow([]) - + # The info writer.writerow(["Component Groups:", cfg.n_groups]) writer.writerow(["Component Count:", cfg.n_total]) writer.writerow(["Fitted Components:", cfg.n_fitted]) diff --git a/kiplot/bom/html_writer.py b/kiplot/bom/html_writer.py index a1dd91b4..74427403 100644 --- a/kiplot/bom/html_writer.py +++ b/kiplot/bom/html_writer.py @@ -44,12 +44,10 @@ def html_table(html, groups, headings, head_names, cfg, link_datasheet, link_dig html.write('\t{h}\n'.format(h=h, bg=' bgcolor="{}"'.format(bg) if bg else '')) html.write("\n") - row_count = 0 for i, group in enumerate(groups): if (cfg.ignore_dnf and not group.is_fitted()) != dnf: continue row = group.get_row(headings) - row_count += 1 html.write("\n") for n, r in enumerate(row): # 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{val}\n'.format(bg=' bgcolor={}'.format(bg) if bg else '', val=link(r))) html.write("\n") html.write("\n") - return row_count + return def write_html(filename, groups, headings, head_names, cfg): @@ -119,11 +117,10 @@ def write_html(filename, groups, headings, head_names, cfg): html.write('

Empty Fields

\n'.format(bg=BG_EMPTY)) # 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("

\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("

Optional components (DNF=Do Not Fit)

\n") # DNF component groups html_table(html, groups, headings, head_names, cfg, link_datasheet, link_digikey, True)