Fixed KiCad project reload
- Otherwise KiCad SIGSEGVs when trying to plot
This commit is contained in:
parent
4c356f14aa
commit
f7dceabd0e
|
|
@ -432,6 +432,8 @@ class GS(object):
|
||||||
sm = pcbnew.GetSettingsManager()
|
sm = pcbnew.GetSettingsManager()
|
||||||
sm.UnloadProject(GS.board.GetProject(), False)
|
sm.UnloadProject(GS.board.GetProject(), False)
|
||||||
assert sm.LoadProject(pro_name)
|
assert sm.LoadProject(pro_name)
|
||||||
|
# If we use the old project KiCad SIGSEGV
|
||||||
|
GS.board = None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_resource_path(name):
|
def get_resource_path(name):
|
||||||
|
|
|
||||||
|
|
@ -725,6 +725,9 @@ class PanelizeOptions(VariantOptions):
|
||||||
board = GS.load_board_low_level(name)
|
board = GS.load_board_low_level(name)
|
||||||
logger.debug('Creating preview image ...')
|
logger.debug('Creating preview image ...')
|
||||||
out.options.create_image(img_name, board)
|
out.options.create_image(img_name, board)
|
||||||
|
# KiCad loads the project automagically, so now we have the wrong project loaded
|
||||||
|
# We need to unload the current project to load the new one
|
||||||
|
# But we also need to reload the PCB, this is ridiculous ...
|
||||||
GS.reload_project(GS.pro_file)
|
GS.reload_project(GS.pro_file)
|
||||||
|
|
||||||
def run(self, output):
|
def run(self, output):
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,5 @@ class Set_Text_Variables(BasePreFlight): # noqa: F821
|
||||||
with open(pro_name, 'wt') as f:
|
with open(pro_name, 'wt') as f:
|
||||||
f.write(json.dumps(data, sort_keys=True, indent=2))
|
f.write(json.dumps(data, sort_keys=True, indent=2))
|
||||||
if GS.board:
|
if GS.board:
|
||||||
# Force a project reload
|
# Force a project and PCB reload
|
||||||
GS.reload_project(pro_name)
|
GS.reload_project(pro_name)
|
||||||
# TODO: Do we really need to reload the PCB?
|
|
||||||
# Force the PCB reload (will reload the project file)
|
|
||||||
GS.board = None
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue