summaryrefslogtreecommitdiff
path: root/gerber/cam.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-02 00:43:08 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-02 00:43:08 -0500
commitd98d23f8b5d61bb9d20e743a3c44bf04b6b2330a (patch)
tree8e11666ac2d36aa351d28c457165a688f73f4df9 /gerber/cam.py
parent360eddc3c421cc193716b17d33cc94d8444d64ce (diff)
downloadgerbonara-d98d23f8b5d61bb9d20e743a3c44bf04b6b2330a.tar.gz
gerbonara-d98d23f8b5d61bb9d20e743a3c44bf04b6b2330a.tar.bz2
gerbonara-d98d23f8b5d61bb9d20e743a3c44bf04b6b2330a.zip
More tests and bugfixes
Diffstat (limited to 'gerber/cam.py')
-rw-r--r--gerber/cam.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/gerber/cam.py b/gerber/cam.py
index a4057bc..9c731aa 100644
--- a/gerber/cam.py
+++ b/gerber/cam.py
@@ -62,29 +62,24 @@ class FileSettings(object):
if units not in ['inch', 'metric']:
raise ValueError('Units must be either inch or metric')
self.units = units
-
-
+
if zero_suppression is None and zeros is None:
self.zero_suppression = 'trailing'
-
+
elif zero_suppression == zeros:
raise ValueError('Zeros and Zero Suppression must be different. \
Best practice is to specify only one.')
-
+
elif zero_suppression is not None:
if zero_suppression not in ['leading', 'trailing']:
raise ValueError('Zero suppression must be either leading or \
trailling')
self.zero_suppression = zero_suppression
-
elif zeros is not None:
if zeros not in ['leading', 'trailing']:
raise ValueError('Zeros must be either leading or trailling')
self.zeros = zeros
- else:
- self.zeros = 'leading'
-
if len(format) != 2:
raise ValueError('Format must be a tuple(n=2) of integers')
@@ -150,6 +145,9 @@ class FileSettings(object):
raise ValueError('Format must be a tuple(n=2) of integers')
self.format = value
+ else:
+ raise KeyError('%s is not a valid key' % key)
+
def __eq__(self, other):
return (self.notation == other.notation and
self.units == other.units and
@@ -230,7 +228,7 @@ class CamFile(object):
def bounds(self):
""" File baundaries
"""
- pass
+ raise NotImplementedError('bounds must be implemented in a subclass')
def render(self, ctx, filename=None):
""" Generate image of layer.