summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2015-12-02 12:44:30 +0800
committerGarret Fick <garret@ficksworkshop.com>2015-12-02 12:44:30 +0800
commitd69f50e0f62570a4c327cb8fe4f886f439196010 (patch)
tree571d519f91f4852b283d0f7a5ce7c61be4767b75
parent8eede187f3f644c4f8a0de0dc5825dc4c00c7b8f (diff)
downloadgerbonara-d69f50e0f62570a4c327cb8fe4f886f439196010.tar.gz
gerbonara-d69f50e0f62570a4c327cb8fe4f886f439196010.tar.bz2
gerbonara-d69f50e0f62570a4c327cb8fe4f886f439196010.zip
Make the hit accessible from the drawable Hit, fix crash with cario drawing rect
-rwxr-xr-xgerber/excellon.py2
-rw-r--r--gerber/primitives.py3
-rw-r--r--gerber/render/cairo_backend.py2
3 files changed, 4 insertions, 3 deletions
diff --git a/gerber/excellon.py b/gerber/excellon.py
index 708f50b..4ff2161 100755
--- a/gerber/excellon.py
+++ b/gerber/excellon.py
@@ -126,7 +126,7 @@ class ExcellonFile(CamFile):
@property
def primitives(self):
- return [Drill(hit.position, hit.tool.diameter,units=self.settings.units) for hit in self.hits]
+ return [Drill(hit.position, hit.tool.diameter, hit, units=self.settings.units) for hit in self.hits]
@property
diff --git a/gerber/primitives.py b/gerber/primitives.py
index 0ac12af..1e26f19 100644
--- a/gerber/primitives.py
+++ b/gerber/primitives.py
@@ -741,11 +741,12 @@ class SquareRoundDonut(Primitive):
class Drill(Primitive):
""" A drill hole
"""
- def __init__(self, position, diameter, **kwargs):
+ def __init__(self, position, diameter, hit, **kwargs):
super(Drill, self).__init__('dark', **kwargs)
validate_coordinates(position)
self.position = position
self.diameter = diameter
+ self.hit = hit
self._to_convert = ['position', 'diameter']
@property
diff --git a/gerber/render/cairo_backend.py b/gerber/render/cairo_backend.py
index 81c5ce4..4a0724f 100644
--- a/gerber/render/cairo_backend.py
+++ b/gerber/render/cairo_backend.py
@@ -124,7 +124,7 @@ class GerberCairoContext(GerberContext):
self.ctx.set_source_rgba(color[0], color[1], color[2], self.alpha)
self.ctx.set_operator(cairo.OPERATOR_OVER if (rectangle.level_polarity == "dark" and not self.invert) else cairo.OPERATOR_CLEAR)
self.ctx.set_line_width(0)
- self.ctx.rectangle(*ll,width=width, height=height)
+ self.ctx.rectangle(ll[0], ll[1], width, height)
self.ctx.fill()
def _render_obround(self, obround, color):