[Fixed] Copy of KiCost data

Now we use a copy of the components to allow field expansions.
So we must also copy the specs to the original components.
This commit is contained in:
Salvador E. Tropea 2023-07-31 13:10:40 -03:00
parent 055e832670
commit 22248c0068
3 changed files with 6 additions and 2 deletions

View File

@ -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):

View File

@ -176,7 +176,7 @@ class Spec_to_Field(BaseFilter): # noqa: F821
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():

View File

@ -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: