From 9c5b6a8799957d3f63fe5f616d74b2c84c1a2467 Mon Sep 17 00:00:00 2001 From: jpcaram Date: Thu, 1 Jan 2015 23:13:07 -0500 Subject: [PATCH] Cleanup. --- ObjectCollection.py | 7 +++++-- camlib.py | 29 +++-------------------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/ObjectCollection.py b/ObjectCollection.py index e5d100de..3bbc091f 100644 --- a/ObjectCollection.py +++ b/ObjectCollection.py @@ -1,4 +1,4 @@ -from PyQt4.QtCore import QModelIndex +#from PyQt4.QtCore import QModelIndex from FlatCAMObj import * import inspect # TODO: Remove import FlatCAMApp @@ -55,13 +55,16 @@ class ObjectCollection(QtCore.QAbstractListModel): self.view.selectionModel().selectionChanged.connect(self.on_list_selection_change) self.view.activated.connect(self.on_item_activated) self.view.keyPressed.connect(self.on_key) + self.view.clicked.connect(self.on_mouse_down) def on_key(self, key): + + # Delete if key == QtCore.Qt.Key_Delete: self.delete_active() def on_mouse_down(self, event): - print "Mouse button pressed on list" + FlatCAMApp.App.log.debug("Mouse button pressed on list") def rowCount(self, parent=QtCore.QModelIndex(), *args, **kwargs): return len(self.object_list) diff --git a/camlib.py b/camlib.py index cc73dcea..5b0f0fe2 100644 --- a/camlib.py +++ b/camlib.py @@ -2862,37 +2862,14 @@ def arc_angle(start, stop, direction): return angle -# def clear_poly(poly, tooldia, overlap=0.1): -# """ -# Creates a list of Shapely geometry objects covering the inside -# of a Shapely.Polygon. Use for removing all the copper in a region -# or bed flattening. -# -# :param poly: Target polygon -# :type poly: Shapely.Polygon -# :param tooldia: Diameter of the tool -# :type tooldia: float -# :param overlap: Fraction of the tool diameter to overlap -# in each pass. -# :type overlap: float -# :return: list of Shapely.Polygon -# :rtype: list -# """ -# poly_cuts = [poly.buffer(-tooldia/2.0)] -# while True: -# poly = poly_cuts[-1].buffer(-tooldia*(1-overlap)) -# if poly.area > 0: -# poly_cuts.append(poly) -# else: -# break -# return poly_cuts - - def find_polygon(poly_set, point): """ Return the first polygon in the list of polygons poly_set that contains the given point. """ + if poly_set is None: + return None + p = Point(point) for poly in poly_set: if poly.contains(p):