Cleanup.
This commit is contained in:
parent
8c082365d7
commit
9c5b6a8799
|
@ -1,4 +1,4 @@
|
||||||
from PyQt4.QtCore import QModelIndex
|
#from PyQt4.QtCore import QModelIndex
|
||||||
from FlatCAMObj import *
|
from FlatCAMObj import *
|
||||||
import inspect # TODO: Remove
|
import inspect # TODO: Remove
|
||||||
import FlatCAMApp
|
import FlatCAMApp
|
||||||
|
@ -55,13 +55,16 @@ class ObjectCollection(QtCore.QAbstractListModel):
|
||||||
self.view.selectionModel().selectionChanged.connect(self.on_list_selection_change)
|
self.view.selectionModel().selectionChanged.connect(self.on_list_selection_change)
|
||||||
self.view.activated.connect(self.on_item_activated)
|
self.view.activated.connect(self.on_item_activated)
|
||||||
self.view.keyPressed.connect(self.on_key)
|
self.view.keyPressed.connect(self.on_key)
|
||||||
|
self.view.clicked.connect(self.on_mouse_down)
|
||||||
|
|
||||||
def on_key(self, key):
|
def on_key(self, key):
|
||||||
|
|
||||||
|
# Delete
|
||||||
if key == QtCore.Qt.Key_Delete:
|
if key == QtCore.Qt.Key_Delete:
|
||||||
self.delete_active()
|
self.delete_active()
|
||||||
|
|
||||||
def on_mouse_down(self, event):
|
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):
|
def rowCount(self, parent=QtCore.QModelIndex(), *args, **kwargs):
|
||||||
return len(self.object_list)
|
return len(self.object_list)
|
||||||
|
|
29
camlib.py
29
camlib.py
|
@ -2862,37 +2862,14 @@ def arc_angle(start, stop, direction):
|
||||||
return angle
|
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):
|
def find_polygon(poly_set, point):
|
||||||
"""
|
"""
|
||||||
Return the first polygon in the list of polygons poly_set
|
Return the first polygon in the list of polygons poly_set
|
||||||
that contains the given point.
|
that contains the given point.
|
||||||
"""
|
"""
|
||||||
|
if poly_set is None:
|
||||||
|
return None
|
||||||
|
|
||||||
p = Point(point)
|
p = Point(point)
|
||||||
for poly in poly_set:
|
for poly in poly_set:
|
||||||
if poly.contains(p):
|
if poly.contains(p):
|
||||||
|
|
Loading…
Reference in New Issue