Skip to content

Commit

Permalink
[Fixed] Copy of KiCost data
Browse files Browse the repository at this point in the history
Now we use a copy of the components to allow field expansions.
So we must also copy the specs to the original components.
  • Loading branch information
set-soft committed Jul 31, 2023
1 parent 055e832 commit 22248c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions kibot/bom/xlsx_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ def copy_specs_to_components(parts, groups):
for p in parts:
for c in p.kibot_group.components:
c.kicost_part = p
if hasattr(c, 'original_copy'):
c.original_copy.kicost_part = p


def _create_kicost_sheet(workbook, groups, image_data, fmt_title, fmt_info, fmt_subtitle, fmt_head, fmt_cols, cfg):
Expand Down
2 changes: 1 addition & 1 deletion kibot/fil_spec_to_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def update_extra_info(self, res, attr, ei, dattr, pattern="{}", units=""):
ei[dattr] = pattern.format(value)

def check_coherent(self, c):
if not self.check_dist_coherence:
if not self.check_dist_coherence or not hasattr(c, 'kicost_part'):
return
extra_info = {}
for d, dd in c.kicost_part.dd.items():
Expand Down
4 changes: 3 additions & 1 deletion kibot/kiplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ def expand_comp_fields(c, env):

def expand_fields(comps, dont_copy=False):
if not dont_copy:
comps = deepcopy(comps)
new_comps = deepcopy(comps)
for n_c, c in zip(new_comps, comps):
n_c.original_copy = c
env = KiConf.kicad_env
env.update(GS.load_pro_variables())
for c in comps:
Expand Down

0 comments on commit 22248c0

Please sign in to comment.