From 89d587b1cd9c3a997a44119042a9757d2b541a76 Mon Sep 17 00:00:00 2001 From: Benny Megidish Date: Tue, 18 Mar 2025 09:01:17 +0200 Subject: [PATCH] chore: initial v10 support #200 --- plugins/utils.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/utils.py b/plugins/utils.py index c601c59..3f692d7 100644 --- a/plugins/utils.py +++ b/plugins/utils.py @@ -7,6 +7,9 @@ import wx def get_version(): return float('.'.join(pcbnew.GetBuildVersion().split(".")[0:2])) # e.g GetBuildVersion(): e.g. '7.99.0-3969-gc5ac2337e4' +def is_v10(version = get_version()): + return version >= 9.99 and version < 10.99 + def is_v9(version = get_version()): return version >= 8.99 and version < 9.99 @@ -22,7 +25,9 @@ def is_v6(version = get_version()): def footprint_has_field(footprint, field_name): version = get_version() - if is_v8(version) or is_v9(version): + if is_v10(version): + return footprint.HasField(field_name) + elif is_v8(version) or is_v9(version): return footprint.HasFieldByName(field_name) else: return footprint.HasProperty(field_name) @@ -30,7 +35,9 @@ def footprint_has_field(footprint, field_name): def footprint_get_field(footprint, field_name): version = get_version() - if is_v8(version) or is_v9(version): + if is_v10(version): + return footprint.GetField(field_name).GetText() + elif is_v8(version) or is_v9(version): return footprint.GetFieldByName(field_name).GetText() else: return footprint.GetProperty(field_name)