[Fixed] Avoid reloading the project is none loaded

This commit is contained in:
Salvador E. Tropea 2022-09-05 10:30:29 -03:00
parent 795e56b6d7
commit 40526ed012
1 changed files with 7 additions and 6 deletions

View File

@ -148,9 +148,10 @@ 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
if GS.board:
# 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