- fixed the Tcl commands AddCircle, AddPolygon, AddPolyline and AddRectangle to have stored bounds therefore making them movable/selectable on canvas

This commit is contained in:
Marius Stanciu
2020-08-27 02:25:07 +03:00
parent 66fcec49cc
commit 19b5e100d5
6 changed files with 115 additions and 49 deletions

View File

@@ -1,6 +1,4 @@
from camlib import Geometry
import collections
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandAddPolyline(TclCommandSignaled):
@@ -52,7 +50,7 @@ class TclCommandAddPolyline(TclCommandSignaled):
if obj is None:
self.raise_tcl_error("Object not found: %s" % name)
if not isinstance(obj, Geometry):
if obj.kind != 'geometry':
self.raise_tcl_error('Expected Geometry, got %s %s.' % (name, type(obj)))
if len(unnamed_args) % 2 != 0:
@@ -62,4 +60,3 @@ class TclCommandAddPolyline(TclCommandSignaled):
points = [[float(unnamed_args[2*i]), float(unnamed_args[2*i+1])] for i in range(nr_points)]
obj.add_polyline(points)
obj.plot()