added cancel_drawing_shape()

This commit is contained in:
Josh Holtrop 2011-07-27 22:42:36 -04:00
parent 47ac5cb3fd
commit 4a7e677bf3

View File

@ -367,8 +367,7 @@ class SketchWidget:
else:
self.widget.window.set_cursor(self.cursors['arrow'])
self.mode = mode
self.drawingShape = None
self.drawingConstraints = []
self.cancel_drawing_shape()
def do_line_left_click(self, x, y):
start = self.screenPtToPt((x, self.size[1] - y))
@ -380,8 +379,7 @@ class SketchWidget:
def do_line_right_click(self, x, y):
if self.drawingShape is not None:
# cancel line currently being drawn
self.drawingShape = None
self.cancel_drawing_shape()
self.queue_redraw()
def do_line_motion(self, x, y):
@ -421,8 +419,7 @@ class SketchWidget:
def do_circle_right_click(self, x, y):
if self.drawingShape is not None:
# cancel circle currently being drawn
self.drawingShape = None
self.cancel_drawing_shape()
self.queue_redraw()
def do_circle_motion(self, x, y):
@ -431,6 +428,10 @@ class SketchWidget:
self.drawingShape.setRadius(r)
self.queue_redraw()
def cancel_drawing_shape(self):
self.drawingShape = None
self.drawingConstraints = []
def merge_in_drawing_shape(self):
self.sketch.shapes.append(self.drawingShape)
for c in self.drawingConstraints: