From 08c2237a9485bb241ae6fc9beb09d6cf06be3490 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Tue, 9 Jan 2024 20:42:58 -0500 Subject: [PATCH] Update the layer names in cli/python board load of the property grid layer enum because DRC quietly uses it Fixes https://gitlab.com/kicad/code/kicad/-/issues/16555 --- .../python/scripting/pcbnew_scripting_helpers.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index e7f315c174..b2cb11e291 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -179,6 +179,21 @@ BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat ) if( brd ) { + // JEY TODO: move this global to the board + ENUM_MAP& layerEnum = ENUM_MAP::Instance(); + + layerEnum.Choices().Clear(); + layerEnum.Undefined( UNDEFINED_LAYER ); + + for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq ) + { + // Canonical name + layerEnum.Map( *seq, LSET::Name( *seq ) ); + + // User name + layerEnum.Map( *seq, brd->GetLayerName( *seq ) ); + } + brd->SetProject( project ); // Move legacy view settings to local project settings