-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/bennymeg/JLC-Plugin-for-K…
- Loading branch information
Showing
1 changed file
with
13 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
import pcbnew # type: ignore | ||
|
||
def get_version(): | ||
return float('.'.join(pcbnew.GetBuildVersion().split(".")[0:2])) #e.g GetBuildVersion(): e.g. '7.99.0-3969-gc5ac2337e4' | ||
return float('.'.join(pcbnew.GetBuildVersion().split(".")[0:2])) # e.g GetBuildVersion(): e.g. '7.99.0-3969-gc5ac2337e4' | ||
|
||
def is_v8(): | ||
version = get_version() | ||
def is_v9(version = get_version()): | ||
return version >= 8.99 and version < 9.99 | ||
|
||
def is_v8(version = get_version()): | ||
return version >= 7.99 and version < 8.99 | ||
|
||
def is_v7(): | ||
version = get_version() | ||
def is_v7(version = get_version()): | ||
return version >= 6.99 and version < 7.99 | ||
|
||
def is_v6(): | ||
version = get_version() | ||
def is_v6(version = get_version()): | ||
return version >= 5.99 and version < 6.99 | ||
|
||
def footprint_has_field(footprint, field_name): | ||
if is_v8(): | ||
version = get_version() | ||
|
||
if is_v8(version) or is_v9(version): | ||
return footprint.HasFieldByName(field_name) | ||
else: | ||
return footprint.HasProperty(field_name) | ||
|
||
def footprint_get_field(footprint, field_name): | ||
if is_v8(): | ||
version = get_version() | ||
|
||
if is_v8(version) or is_v9(version): | ||
return footprint.GetFieldByName(field_name).GetText() | ||
else: | ||
return footprint.GetProperty(field_name) |