This commit is contained in:
jpcaram 2015-01-01 23:13:07 -05:00
parent 8c082365d7
commit 9c5b6a8799
2 changed files with 8 additions and 28 deletions

View File

@ -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)

View File

@ -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):