set color in individual draw*() routines
This commit is contained in:
parent
73a6e5cf92
commit
abfe98a221
@ -139,11 +139,13 @@ class SketchWidget:
|
||||
return dist * self.size[0] / self.view_width
|
||||
|
||||
def drawLine(self, shape):
|
||||
glColor(*self.line_color)
|
||||
pt0 = self.ptToScreenPt(shape.getPt(0))
|
||||
pt1 = self.ptToScreenPt(shape.getPt(1))
|
||||
self.drawFilledLine(pt0[0], pt0[1], pt1[0], pt1[1], self.line_width)
|
||||
|
||||
def drawCircle(self, shape):
|
||||
glColor(*self.line_color)
|
||||
center = self.ptToScreenPt(shape.getCenter())
|
||||
rad = self.distToScreenDist(shape.getRadius())
|
||||
if rad < 30:
|
||||
@ -197,14 +199,12 @@ class SketchWidget:
|
||||
glEnd()
|
||||
|
||||
def drawAxes(self):
|
||||
glPushAttrib(GL_CURRENT_BIT)
|
||||
glColor(*self.axis_color)
|
||||
cx, cy = self.ptToScreenPt((0, 0))
|
||||
self.drawFilledLine(cx - self.axis_length, cy,
|
||||
cx + self.axis_length, cy, self.axis_width)
|
||||
self.drawFilledLine(cx, cy - self.axis_length,
|
||||
cx, cy + self.axis_length, self.axis_width)
|
||||
glPopAttrib()
|
||||
|
||||
def button_press_event(self, widget, event, data = None):
|
||||
if event.button == 1:
|
||||
@ -263,7 +263,6 @@ class SketchWidget:
|
||||
int(self.size[0]), int(self.size[1]))
|
||||
|
||||
def drawShapes(self):
|
||||
glColor(*self.line_color)
|
||||
for shape in self.sketch:
|
||||
if isinstance(shape, Line):
|
||||
self.drawLine(shape)
|
||||
@ -271,11 +270,10 @@ class SketchWidget:
|
||||
self.drawCircle(shape)
|
||||
|
||||
def drawConstraints(self):
|
||||
glColor(*self.constraint_color)
|
||||
for c in self.sketch.constraints:
|
||||
if isinstance(c, Connect):
|
||||
# self.drawConnect(c)
|
||||
self.drawConnect(c)
|
||||
pass
|
||||
|
||||
def drawConnect(self, con):
|
||||
pass
|
||||
glColor(*self.constraint_color)
|
||||
|
Loading…
x
Reference in New Issue
Block a user