python: Return copy of netclasses not reference

Fix Board.GetAllNetClasses() so it no longer creates a duplicate of the Default netclass in the design rules net classes list.

Fixes: lp:1803623
* https://bugs.launchpad.net/kicad/+bug/1803623
This commit is contained in:
Dave Vandenbout 2019-07-06 10:17:51 -04:00 committed by Seth Hillbrand
parent 3d8d852990
commit 44734dc059
1 changed files with 3 additions and 4 deletions

View File

@ -173,11 +173,10 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints)
GetNetClasses(BOARD self) -> { wxString net_class_name : NETCLASSPTR }
Include the "Default" netclass also.
"""
netclassmap = self.GetNetClasses().NetClasses()
# Add the Default one too, but this is probably modifying the NETCLASS_MAP
# in the BOARD. If that causes trouble, could make a deepcopy() here first.
# netclassmap = deepcopy(netclassmap)
# Copy the NETCLASS_MAP so the one in the BOARD isn't modified
# when we add the Default net class.
netclassmap = {k:v for k,v in self.GetNetClasses().NetClasses().items()}
netclassmap['Default'] = self.GetNetClasses().GetDefault()
return netclassmap
%}