[PCB_Print] Text vars generated in the same run didn't show up

Fixes #280
This commit is contained in:
Salvador E. Tropea 2022-09-05 10:05:05 -03:00
parent 01536726a1
commit 795e56b6d7
2 changed files with 8 additions and 2 deletions

View File

@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Problems with filtered/modified PCBs
- Problems with zones on multiple layers (#226)
- Problems with `hide_excluded: true` and components not in the SCH (#258)
- Text vars generated in the same run didn't show up (#280)
- SCH Variants on KiCad 6: Problems with missing values in the title block.
- Report: Converted file wasn't stored at `dir` (#238)
- Datasheet download: Time-outs on some servers expecting modern browsers (#240)

View File

@ -8,11 +8,12 @@ Dependencies:
- from: Git
role: Find commit hash and/or date
"""
import os
import sys
import json
import os
import pcbnew
import re
from subprocess import run, PIPE
import sys
from .error import KiPlotConfigurationError
from .misc import FAILED_EXECUTE, W_EMPTREP
from .optionable import Optionable
@ -147,5 +148,9 @@ class Set_Text_Variables(BasePreFlight): # noqa: F821
GS.make_bkp(pro_name)
with open(pro_name, 'wt') as f:
f.write(json.dumps(data, sort_keys=True, indent=2))
# Force a project reload
sm = pcbnew.GetSettingsManager()
sm.UnloadProject(GS.board.GetProject(), False)
assert sm.LoadProject(pro_name)
# Force the PCB reload (will reload the project file)
GS.board = None