Skip to content

Commit 65113bf

Browse files
authored
Merge pull request #5 from sparkfun/release_candidate
v1.1.0
2 parents 1502f41 + f7d49cc commit 65113bf

File tree

5 files changed

+38
-8
lines changed

5 files changed

+38
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SparkFun PCB CAMmer plugin for KiCad 7
1+
# SparkFun PCB CAMmer plugin for KiCad 7 / 8
22

33
This plugin generates the Gerber and Drill files for a KiCad PCB.
44

SparkFunKiCadCAMmer/cammer/cammer.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,38 @@
88

99
from pcbnew import *
1010

11+
# sub folder for our resource files
12+
_RESOURCE_DIRECTORY = os.path.join("..", "resource")
13+
14+
#https://stackoverflow.com/a/50914550
15+
def resource_path(relative_path):
16+
""" Get absolute path to resource, works for dev and for PyInstaller """
17+
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
18+
return os.path.join(base_path, _RESOURCE_DIRECTORY, relative_path)
19+
20+
def get_version(rel_path: str) -> str:
21+
try:
22+
with open(resource_path(rel_path), encoding='utf-8') as fp:
23+
for line in fp.read().splitlines():
24+
if line.startswith("__version__"):
25+
delim = '"' if '"' in line else "'"
26+
return line.split(delim)[1]
27+
raise RuntimeError("Unable to find version string.")
28+
except:
29+
raise RuntimeError("Unable to find _version.py.")
30+
31+
_APP_VERSION = get_version("_version.py")
32+
1133
class CAMmer():
1234
def __init__(self):
1335
pass
1436

1537
def args_parse(self, args):
1638
# set up command-line arguments parser
1739
parser = ArgumentParser(description="A script to generate and zip PCB Gerber and drill files.")
40+
parser.add_argument(
41+
"-v", "--version", action="version", version="%(prog)s " + _APP_VERSION
42+
)
1843
parser.add_argument(
1944
"-p", "--path", help="Path to the *.kicad_pcb file"
2045
)

SparkFunKiCadCAMmer/plugin.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@ def __init__(self):
2727

2828
self._pcbnew_frame = None
2929

30+
self.supportedVersions = ['7.','8.']
31+
3032
self.kicad_build_version = pcbnew.GetBuildVersion()
3133

32-
def IsVersion(self, VersionStr):
33-
for v in VersionStr:
34-
if v in self.kicad_build_version:
34+
def IsSupported(self):
35+
for v in self.supportedVersions:
36+
if self.kicad_build_version.startswith(v):
3537
return True
3638
return False
37-
39+
3840
def Run(self):
3941
if self._pcbnew_frame is None:
4042
try:
@@ -89,7 +91,7 @@ def Run(self):
8991
def run_cammer(dlg, p_cammer):
9092
self.logger.log(logging.INFO, "Running CAMmer")
9193

92-
if self.IsVersion(['7.']):
94+
if self.IsSupported():
9395
command = []
9496

9597
layers = dlg.CurrentSettings()["Layers"]
@@ -131,6 +133,9 @@ def run_cammer(dlg, p_cammer):
131133
if sysExit > 0:
132134
wx.MessageBox("CAMmer " + ("warning" if (sysExit == 1) else "error") + ".\nPlease check cammer.log for details.",
133135
("Warning" if (sysExit == 1) else "Error"), wx.OK | (wx.ICON_WARNING if (sysExit == 1) else wx.ICON_ERROR))
136+
else:
137+
wx.MessageBox("CAMmer complete.\nPlease check cammer.log for details.",
138+
"Info", wx.OK | wx.ICON_INFORMATION)
134139
else:
135140
self.logger.log(logging.ERROR, "Could not get the board")
136141

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.2"
1+
__version__ = "1.1.0"

pcm/metadata_template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://go.kicad.org/pcm/schemas/v1",
33
"name": "SparkFun KiCad CAMmer",
4-
"description": "SparkFun's simple PCB CAMmer (Gerber generator) for KiCad 7",
4+
"description": "SparkFun's simple PCB CAMmer (Gerber generator) for KiCad 7 / 8",
55
"description_full": "Generates the Gerber and drill files for a KiCad PCB and zips them",
66
"identifier": "com.github.sparkfun.SparkFunKiCadCAMmer",
77
"type": "plugin",

0 commit comments

Comments
 (0)