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