Make the hit accessible from the drawable Hit, fix crash with cario drawing rect

This commit is contained in:
Garret Fick 2015-12-02 12:44:30 +08:00
parent 8eede187f3
commit d69f50e0f6
3 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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):